Skip to content

Commit 9ab8197

Browse files
committed
parameterize publication on download jobs
1 parent c9df155 commit 9ab8197

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

geospaas_rest_api/processing_api/models.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ def get_signature(cls, parameters):
8686
tasks_core.crop.signature(
8787
kwargs={'bounding_box': parameters.get('bounding_box', None)}),
8888
])
89-
90-
tasks.extend([
91-
tasks_core.archive.signature(),
92-
tasks_core.publish.signature(),
93-
])
89+
if parameters.get('publish', False):
90+
tasks.extend([
91+
tasks_core.archive.signature(),
92+
tasks_core.publish.signature(),
93+
])
9494
return celery.chain(tasks)
9595

9696
@staticmethod
@@ -100,7 +100,7 @@ def check_parameters(parameters):
100100
- dataset_id: integer
101101
- bounding_box: 4-elements list
102102
"""
103-
if not set(parameters).issubset(set(('dataset_id', 'bounding_box'))):
103+
if not set(parameters).issubset(set(('dataset_id', 'bounding_box', 'publish'))):
104104
raise ValidationError("The download action accepts only one parameter: 'dataset_id'")
105105
if not isinstance(parameters['dataset_id'], int):
106106
raise ValidationError("'dataset_id' must be an integer")
@@ -109,6 +109,8 @@ def check_parameters(parameters):
109109
len(parameters['bounding_box']) == 4)):
110110
raise ValidationError("'bounding_box' must be a sequence in the following format: "
111111
"west, north, east, south")
112+
if ('publish' in parameters and not isinstance(parameters['publish'], bool)):
113+
raise ValidationError("'publish' must be a boolean")
112114
return parameters
113115

114116
@staticmethod

0 commit comments

Comments
 (0)