Skip to content

Commit

Permalink
Merge pull request #171 from wri/fix-cog-job-order
Browse files Browse the repository at this point in the history
wait for cog creation to complete before setting version to latest
  • Loading branch information
solomon-negusse authored Jan 14, 2025
2 parents b33ad85 + 7b1f8ca commit 2254b98
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN pip install . -t python
# to change the hash of the file and get TF to realize it needs to be
# redeployed. Ticket for a better solution:
# https://gfw.atlassian.net/browse/GTC-1250
# change 18
# change 19

RUN yum install -y zip geos-devel

Expand Down
31 changes: 19 additions & 12 deletions src/datapump/jobs/version_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,33 @@ def next_step(self):
elif self.step == RasterVersionUpdateJobStep.creating_tile_cache:
status = self._check_tile_cache_status()
if status == JobStatus.complete:
self.step = RasterVersionUpdateJobStep.mark_latest
self._mark_latest()
if self.aux_tile_set_parameters:
self.step = RasterVersionUpdateJobStep.creating_aux_assets
for tile_set_params in self.aux_tile_set_parameters:
self._create_aux_tile_set(tile_set_params)
else:
self.step = RasterVersionUpdateJobStep.mark_latest
self._mark_latest()
elif status == JobStatus.failed:
self.status = JobStatus.failed

elif self.step == RasterVersionUpdateJobStep.creating_aggregated_tile_set:
status = self._check_aux_assets_status()
if status == JobStatus.complete:
self.step = RasterVersionUpdateJobStep.mark_latest
self._mark_latest()
if self.aux_tile_set_parameters:
self.step = RasterVersionUpdateJobStep.creating_aux_assets
for tile_set_params in self.aux_tile_set_parameters:
self._create_aux_tile_set(tile_set_params)
else:
self.step = RasterVersionUpdateJobStep.mark_latest
self._mark_latest()
elif status == JobStatus.failed:
self.status = JobStatus.failed

elif self.step == RasterVersionUpdateJobStep.mark_latest:
status = self._check_latest_status()
if status == JobStatus.complete:
if self.aux_tile_set_parameters:
self.step = RasterVersionUpdateJobStep.creating_aux_assets
for tile_set_params in self.aux_tile_set_parameters:
self._create_aux_tile_set(tile_set_params)
else:
self.status = JobStatus.complete
self.status = JobStatus.complete
elif status == JobStatus.failed:
self.status = JobStatus.failed

Expand All @@ -110,14 +115,16 @@ def next_step(self):
self.status = JobStatus.failed
break
else:
self.status = JobStatus.complete
self.step = RasterVersionUpdateJobStep.mark_latest
self._mark_latest()
elif status == JobStatus.failed:
self.status = JobStatus.failed

elif self.step == RasterVersionUpdateJobStep.creating_cog_assets:
status = self._check_aux_assets_status()
if status == JobStatus.complete:
self.status = JobStatus.complete
self.step = RasterVersionUpdateJobStep.mark_latest
self._mark_latest()
elif status == JobStatus.failed:
self.status = JobStatus.failed

Expand Down

0 comments on commit 2254b98

Please sign in to comment.