@@ -80,7 +80,10 @@ class Meta:
80
80
81
81
@classmethod
82
82
def get_signature (cls , parameters ):
83
- tasks = [tasks_core .download .signature ()]
83
+ tasks = [
84
+ tasks_core .download .signature (),
85
+ tasks_core .copy .signature (kwargs = {'copy_to' : parameters .get ('copy_to' , None )}),
86
+ ]
84
87
85
88
# only unarchive if cropping is needed
86
89
bounding_box = parameters .get ('bounding_box' , None )
@@ -104,8 +107,10 @@ def check_parameters(parameters):
104
107
- dataset_id: integer
105
108
- bounding_box: 4-elements list
106
109
"""
107
- if not set (parameters ).issubset (set (('dataset_id' , 'bounding_box' , 'publish' ))):
108
- raise ValidationError ("The download action accepts only one parameter: 'dataset_id'" )
110
+ allowed_parameters = ('dataset_id' , 'bounding_box' , 'publish' , 'copy_to' )
111
+ if not set (parameters ).issubset (set (allowed_parameters )):
112
+ raise ValidationError (
113
+ f"The download action accepts only the following parameters: { allowed_parameters } " )
109
114
if not isinstance (parameters ['dataset_id' ], int ):
110
115
raise ValidationError ("'dataset_id' must be an integer" )
111
116
if ('bounding_box' in parameters and
@@ -115,6 +120,8 @@ def check_parameters(parameters):
115
120
"west, north, east, south" )
116
121
if ('publish' in parameters and not isinstance (parameters ['publish' ], bool )):
117
122
raise ValidationError ("'publish' must be a boolean" )
123
+ if 'copy_to' in parameters and not isinstance (parameters ['copy_to' ], str ):
124
+ raise ValidationError ("'copy_to' must be a string" )
118
125
return parameters
119
126
120
127
@staticmethod
@@ -136,6 +143,7 @@ def get_signature(cls, parameters):
136
143
if conversion_format == 'idf' :
137
144
return celery .chain (
138
145
tasks_core .download .signature (),
146
+ tasks_core .copy .signature (copy_to = parameters .get ('copy_to' , None )),
139
147
tasks_core .unarchive .signature (),
140
148
tasks_core .crop .signature (
141
149
kwargs = {'bounding_box' : parameters .get ('bounding_box' , None )}),
@@ -145,6 +153,7 @@ def get_signature(cls, parameters):
145
153
elif conversion_format == 'syntool' :
146
154
syntool_tasks = [
147
155
tasks_core .download .signature (),
156
+ tasks_core .copy .signature (kwargs = {'copy_to' : parameters .get ('copy_to' , None )}),
148
157
tasks_core .unarchive .signature (),
149
158
tasks_core .crop .signature (
150
159
kwargs = {'bounding_box' : parameters .get ('bounding_box' , None )}),
@@ -181,7 +190,8 @@ def check_parameters(parameters):
181
190
'skip_check' ,
182
191
'converter_options' ,
183
192
'remove_downloaded' ,
184
- 'ttl' )
193
+ 'ttl' ,
194
+ 'copy_to' )
185
195
if not set (parameters ).issubset (set (accepted_keys )):
186
196
raise ValidationError (
187
197
f"The convert action accepts only these parameters: { ', ' .join (accepted_keys )} " )
@@ -208,6 +218,9 @@ def check_parameters(parameters):
208
218
parameters ['ttl' ] is None or isinstance (parameters ['ttl' ], dict ))):
209
219
raise ValidationError ("'ttl' should be a dictionary or None" )
210
220
221
+ if 'copy_to' in parameters and not isinstance (parameters ['copy_to' ], str ):
222
+ raise ValidationError ("'copy_to' must be a string" )
223
+
211
224
return parameters
212
225
213
226
@staticmethod
0 commit comments