Skip to content

Commit

Permalink
parameterize publication on download jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
aperrin66 committed Sep 18, 2024
1 parent c9df155 commit 9ab8197
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions geospaas_rest_api/processing_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ def get_signature(cls, parameters):
tasks_core.crop.signature(
kwargs={'bounding_box': parameters.get('bounding_box', None)}),
])

tasks.extend([
tasks_core.archive.signature(),
tasks_core.publish.signature(),
])
if parameters.get('publish', False):
tasks.extend([
tasks_core.archive.signature(),
tasks_core.publish.signature(),
])
return celery.chain(tasks)

@staticmethod
Expand All @@ -100,7 +100,7 @@ def check_parameters(parameters):
- dataset_id: integer
- bounding_box: 4-elements list
"""
if not set(parameters).issubset(set(('dataset_id', 'bounding_box'))):
if not set(parameters).issubset(set(('dataset_id', 'bounding_box', 'publish'))):
raise ValidationError("The download action accepts only one parameter: 'dataset_id'")
if not isinstance(parameters['dataset_id'], int):
raise ValidationError("'dataset_id' must be an integer")
Expand All @@ -109,6 +109,8 @@ def check_parameters(parameters):
len(parameters['bounding_box']) == 4)):
raise ValidationError("'bounding_box' must be a sequence in the following format: "
"west, north, east, south")
if ('publish' in parameters and not isinstance(parameters['publish'], bool)):
raise ValidationError("'publish' must be a boolean")
return parameters

@staticmethod
Expand Down

0 comments on commit 9ab8197

Please sign in to comment.