Skip to content

Commit

Permalink
Added exception raising for HTTP Error Status codes when downloading …
Browse files Browse the repository at this point in the history
…image files. On 5xx or 4xx status codes, the job will fail. Added default video file overwriting to ffmpeg in videoMaker
  • Loading branch information
johncanthony committed Sep 12, 2024
1 parent c834b04 commit 7cd5835
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ cover/

# Django stuff:
*.log
*.log.*
local_settings.py
db.sqlite3
db.sqlite3-journal
Expand Down
8 changes: 7 additions & 1 deletion ImageGrabber/imageGrabber/grabber.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def download_image(image_name):

try:
response = requests.get(url, timeout=request_timeout)
response.raise_for_status()
except requests.exceptions.ConnectionError as err:
log.error(f'[HTTP Connection] Unable to fetch image: [{job.job_id}] {image_name} - {err}')
job.job_status = "error"
Expand All @@ -41,7 +42,12 @@ def download_image(image_name):
job.job_status = "error"
job.job_error += f'Timed out fetching image: {image_name} - {err} ,'
return

except requests.exceptions.HTTPError as err:
log.error(f'[HTTP Response] Request failed with status code {response.status_code} - [{job.job_id} {image_name} - {url}]')
job.job_status = "error"
job.job_error += f'HTTP Error while fetching image: {image_name} - {err} ,'
return

with open(filename, 'wb') as f:
f.write(response.content)

Expand Down
2 changes: 1 addition & 1 deletion JobHandler/managers/RegionURLManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class RegionURLManager:
great_lakes: str = "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/cgl/GEOCOLOR/"
northeast: str = "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/ne/GEOCOLOR/"
#Link Template for hurricanes/tropical storms
# $id is replaced by the STORM ID (example : stormid=AL062024)
# {} is replaced by the STORM ID (example : stormid=AL062024)
storm: str = "https://cdn.star.nesdis.noaa.gov/FLOATER/{}/GEOCOLOR/"

def __getitem__(self, item):
Expand Down
4 changes: 2 additions & 2 deletions VideoMaker/videoMaker/managers/video_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def build(self):
audio_bitrate=self.audio_bitrate,
video_bitrate=self.video_bitrate,
shortest=None)
.run()
.run(overwrite_output=True)
)


Expand All @@ -93,5 +93,5 @@ def build(self):
.input(self.input_glob, pattern_type='glob', framerate=self.framerate)
.filter("scale", 1920, 1080)
.output(self.output_file, vcodec=self.vcodec, video_bitrate=self.video_bitrate)
.run()
.run(overwrite_output=True)
)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='RootsWeatherProject',
version='1.0.31',
version='1.0.32',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
packages=find_packages(),
Expand Down

0 comments on commit 7cd5835

Please sign in to comment.