File tree Expand file tree Collapse file tree 3 files changed +38
-6
lines changed Expand file tree Collapse file tree 3 files changed +38
-6
lines changed Original file line number Diff line number Diff line change 5
5
geospaas_processing = None
6
6
7
7
if geospaas_processing :
8
- from .processing_api .models import (Job ,
9
- DownloadJob ,
10
- ConvertJob ,
11
- SyntoolCleanupJob ,
12
- HarvestJob )
8
+ from geospaas_rest_api .processing_api .models import (Job ,
9
+ DownloadJob ,
10
+ ConvertJob ,
11
+ SyntoolCleanupJob ,
12
+ SyntoolCompareJob ,
13
+ HarvestJob )
Original file line number Diff line number Diff line change @@ -220,6 +220,35 @@ def make_task_parameters(parameters):
220
220
return ((parameters ['criteria' ],), {})
221
221
222
222
223
+ class SyntoolCompareJob (Job ):
224
+ """Job which generates comparison between Argo profiles and a 3D
225
+ product
226
+ """
227
+ class Meta :
228
+ proxy = True
229
+
230
+ @classmethod
231
+ def get_signature (cls , parameters ):
232
+ return celery .chain (
233
+ tasks_syntool .compare_profiles .signature (),
234
+ tasks_syntool .db_insert .signature (),
235
+ tasks_core .remove_downloaded .signature ()
236
+ )
237
+
238
+ @staticmethod
239
+ def check_parameters (parameters ):
240
+ accepted_keys = ('dataset_id' , 'profiles_lookups' )
241
+ if not set (parameters ).issubset (set (accepted_keys )):
242
+ raise ValidationError (
243
+ f"The convert action accepts only these parameters: { ', ' .join (accepted_keys )} " )
244
+ return parameters
245
+
246
+ @staticmethod
247
+ def make_task_parameters (parameters ):
248
+ return (((parameters ['dataset_id' ],),),
249
+ {'profiles_lookups' : parameters ['profiles_lookups' ]})
250
+
251
+
223
252
class HarvestJob (Job ):
224
253
"""Job which harvests metadata into the database"""
225
254
class Meta :
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class JobSerializer(rest_framework.serializers.Serializer):
14
14
'convert' : models .ConvertJob ,
15
15
'harvest' : models .HarvestJob ,
16
16
'syntool_cleanup' : models .SyntoolCleanupJob ,
17
+ 'compare_profiles' : models .SyntoolCompareJob ,
17
18
}
18
19
19
20
# Actual Job fields
@@ -27,7 +28,8 @@ class JobSerializer(rest_framework.serializers.Serializer):
27
28
'download' ,
28
29
'convert' ,
29
30
'harvest' ,
30
- 'syntool_cleanup'
31
+ 'syntool_cleanup' ,
32
+ 'compare_profiles' ,
31
33
],
32
34
required = True , write_only = True ,
33
35
help_text = "Action to perform" )
You can’t perform that action at this time.
0 commit comments