Skip to content

Commit

Permalink
Fixed isssues in the #39
Browse files Browse the repository at this point in the history
  • Loading branch information
GowthamChowta committed Mar 2, 2022
1 parent aecadb5 commit 6b38018
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Kubernetes files/data-retrieval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app: dataretrieval
spec:
replicas: 1
replicas: 5
selector:
matchLabels:
app: dataretrieval
Expand Down
7 changes: 4 additions & 3 deletions Kubernetes files/kuberneter commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@ kubectl apply -f MySQLService.yaml
kubectl apply -f rabbitmq.yaml
kubectl apply -f data-retrieval.yaml
kubectl apply -f api-gateway.yaml
kubectl apply -f userinterface.yaml


kubectl apply -f weatherForecast.yaml

kubectl apply -f user-managment.yaml

kubectl apply -f userinterface.yaml

minikube service user-interface

Expand All @@ -67,7 +66,9 @@ minikube service user-interface
Go to the bin folder of the jmeter shell and run the following command:


sh jmeter.sh -n -t "/Users/chowtagowtham/Desktop/Spring 22/Jmeter Test Plans/gateway.jmx" -l "/Users/chowtagowtham/Desktop/Spring 22/Jmeter Test Plans/reports/report.csv" -e -o "/Users/chowtagowtham/Desktop/Spring 22/Jmeter Test Plans/dashboard"
# For weatherForecast
sh jmeter.sh -Jjmeter.reportgenerator.overall_granularity=5000 -n -t "/Users/chowtagowtham/Desktop/Spring 22/Jmeter Test Plans/gateway.jmx" -l "/Users/chowtagowtham/Desktop/Spring 22/Jmeter Test Plans/reports/report.csv" -e -o "/Users/chowtagowtham/Desktop/Spring 22/Jmeter Test Plans/dashboard"
sh jmeter.sh -Jjmeter.reportgenerator.overall_granularity=5000 -n -t "/Users/chowtagowtham/Desktop/Spring 22/Jmeter Test Plans/plot and download.jmx" -l "/Users/chowtagowtham/Desktop/Spring 22/Jmeter Test Plans/reports/report.csv" -e -o "/Users/chowtagowtham/Desktop/Spring 22/Jmeter Test Plans/dashboard"



Expand Down
Binary file modified data-retrieval-plotting-service/db.sqlite3
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.1.3 on 2022-03-01 05:04

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('download_data', '0001_initial'),
]

operations = [
migrations.AlterUniqueTogether(
name='imagepath',
unique_together={('filename',)},
),
]
3 changes: 3 additions & 0 deletions data-retrieval-plotting-service/download_data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ class ImagePath(models.Model):

filename = models.CharField(max_length=500)
url = models.CharField(max_length=500)

class Meta:
unique_together = ('filename',)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 18 additions & 9 deletions data-retrieval-plotting-service/download_data/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@ def download_file_from_s3(start_date,radar_station, end_date,download=1):
# Store the s3 bucket into a file_obj
print("*"*20)
print(file_path)
if file_path[:-2]!='gz':
s3.Bucket('noaa-nexrad-level2').download_file(file_path,'out')
f = Level2File('out')
else:
s3.Bucket('noaa-nexrad-level2').download_file(file_path,'out.gz')
f = Level2File('out.gz')
try:
if file_path[:-2]=='gz':
s3.Bucket('noaa-nexrad-level2').download_file(file_path,'out')
f = Level2File('out')
else:
s3.Bucket('noaa-nexrad-level2').download_file(file_path,'out.gz')
f = Level2File('out.gz')
except:
print("file not readable")
return ("No data available",)
print("*"*20)

# file_obj = s3.Object('noaa-nexrad-level2', file_path).get()['Body']
Expand Down Expand Up @@ -170,9 +174,14 @@ def do_plot(start_date,radar_station, end_date):
obj = cloudinary.uploader.upload("download_data/output_plot/test.png")

# Save data into the database, to avoid replotting the same thing again and again.
obj1 = ImagePath(filename=filename, url=obj['url'])
obj1.save()

try:
obj1 = ImagePath(filename=filename, url=obj['url'])
obj1.save()
except:
print("Object already exists")
obj = ImagePath.objects.get(filename=obj.filename)
return (obj.url,)

return obj['url']


Expand Down
2 changes: 1 addition & 1 deletion data-retrieval-plotting-service/download_data/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def list(self, request, *args, **kwargs):
out = do_plot(start_date, radar_station,end_date)
if out == 'No data available':
return Response("No scans available for the selected inputs",
status=status.HTTP_400_BAD_REQUEST)
status=status.HTTP_200_OK)

# Image is saved
print("image is saved ",out)
Expand Down
Binary file removed data-retrieval-plotting-service/out
Binary file not shown.

0 comments on commit 6b38018

Please sign in to comment.