1
+ # Example job configurations
2
+ # This file collects useful examples. It should be copied to `jobConfig.yaml` and
3
+ # customized for your use case. Set JOB_CONFIGURATION_PATH=jobConfig.yaml in your
4
+ # environment. See jobConfig.recommended.yaml for a minimal working config file.
5
+
6
+ # Config version. Free-form, but should be updated when the config changes.
1
7
configVersion : v1.0 2024-03-01 6f3f38
8
+ # Main array defining job types
9
+ # jobType can be arbitrary, but 'archive', 'retrieve' and 'public' are conventional
2
10
jobs :
3
- - jobType : archive
11
+ - # jobType can be arbitrary, but 'archive', 'retrieve', and 'public' are conventional
12
+ jobType : template_job
13
+ # actions for POST requests
4
14
create :
15
+ # user, @group, #all, #authenticated, #datasetPublic, #datasetAccess, or #datasetOwner
16
+ auth : " #authenticated"
17
+ actions :
18
+ - actionType : log
19
+ # actions for PATCH requests
20
+ update :
21
+ # user, @group, #all, #jobOwnerUser, #jobOwnerGroup
22
+ auth : " #jobOwnerUser"
23
+ actions :
24
+ - actionType : log
25
+
26
+ - # Request data to be moved into the archive
27
+ jobType : archive
28
+ create :
29
+ # Authorization to create this job type
5
30
auth : " #datasetOwner"
31
+ # List of actions to run sequentially
6
32
actions :
7
- - actionType : validate
33
+ - # Validate properties of datasets listed in jobParams.datasetList
34
+ actionType : validate
8
35
datasets :
9
36
" datasetlifecycle.archivable " :
10
37
const : true
11
- - actionType : url
12
- url : http://localhost:3000/api/v3/health?jobid={{id}}
13
- headers :
14
- accept : application/json
15
- - actionType : rabbitmq
16
- exchange : jobs.write
17
- queue : client.jobs.write
18
- key : jobqueue
19
- - actionType : email
20
- auth :
21
- user : user
22
- password : password
23
- to : " {{contactEmail}}"
24
- from : from
25
- subject : " [SciCat] Your {{type}} job was submitted successfully"
26
- bodyTemplateFile : src/common/email-templates/job-template-simplified.html
27
38
update :
28
39
auth : archivemanager
29
40
actions :
30
41
- actionType : rabbitmq
31
42
exchange : jobs.write
32
43
queue : client.jobs.write
33
44
key : jobqueue
34
- - jobType : retrieve
45
+
46
+ - # Request data to be moved out of the archive
47
+ jobType : retrieve
35
48
create :
36
49
auth : " #datasetOwner"
37
50
actions :
38
- - actionType : validate
39
- datasets :
40
- " datasetlifecycle.retrievable " :
41
- const : true
51
+ - actionType : validate
52
+ datasets :
53
+ " datasetlifecycle.retrievable " :
54
+ const : true
42
55
update :
43
56
auth : " archivemanager"
44
57
actions : []
45
- - jobType : public
58
+
59
+ - # Retrieve published datasets to a public location
60
+ jobType : public
46
61
create :
47
62
auth : " #all"
48
63
actions :
@@ -58,3 +73,108 @@ jobs:
58
73
const : true
59
74
update :
60
75
auth : " archivemanager"
76
+
77
+ - jobType : email_demo
78
+ create :
79
+ auth : admin
80
+ actions :
81
+ - actionType : validate
82
+ request :
83
+ jobParams.subject :
84
+ type : string
85
+ - # Send an email. Requires email to be configured
86
+ actionType : email
87
+ to : " {{contactEmail}}"
88
+ subject : " [SciCat] {{jobParams.subject}}"
89
+ bodyTemplateFile : demo_email.html
90
+ update :
91
+ auth : " #jobOwnerUser"
92
+ actions : []
93
+
94
+ - jobType : url_demo
95
+ create :
96
+ auth : admin
97
+ actions :
98
+ - # Call a REST endpoint
99
+ actionType : url
100
+ url : http://localhost:3000/api/v3/health?jobid={{id}}
101
+ method : GET
102
+ headers :
103
+ accept : application/json
104
+ update :
105
+ auth : " #jobOwnerUser"
106
+ actions : []
107
+
108
+ - jobType : rabbitmq_demo
109
+ create :
110
+ auth : admin
111
+ actions :
112
+ - # Send a RabbitMQ message. Requires RABBITMQ_ENABLED and configured
113
+ actionType : rabbitmq
114
+ exchange : jobs.write
115
+ queue : client.jobs.write
116
+ key : jobqueue
117
+ update :
118
+ auth : " #jobOwnerUser"
119
+ actions : []
120
+
121
+ - jobType : switch_demo
122
+ create :
123
+ auth : admin
124
+ update :
125
+ auth : " #jobOwnerUser"
126
+ actions :
127
+ - # Use 'switch' for conditional actions
128
+ actionType : switch
129
+ scope : request
130
+ property : statusCode
131
+ cases :
132
+ - # Literal match
133
+ match : finishedSuccessful
134
+ actions :
135
+ - actionType : email
136
+ to : {? {contactEmail: ''} : ''}
137
+ subject : " [SciCat] Your {{type}} job was successful!"
138
+ bodyTemplateFile : retrieve-success.html
139
+ - # regex match. Requires a string property
140
+ regex : /unsuccessful|error/i
141
+ actions :
142
+ - actionType : email
143
+ to : {? {contactEmail: ''} : ''}
144
+ subject : " [SciCat] Your {{type}} job has state {{statusCode}}"
145
+ bodyTemplateFile : retrieve-failure.html
146
+ - # Apply a JSON Schema
147
+ schema :
148
+ type : " number"
149
+ actions :
150
+ - actionType : log
151
+ validate : " Error. statusCode ({{statusCode}}) should be a string!"
152
+ - # default condition
153
+ actions :
154
+ - # Raise an HTTP exception
155
+ actionType : error
156
+ message : " No matching case found for statusCode {{statusCode}}"
157
+
158
+ - jobType : validate_demo
159
+ create :
160
+ auth : ' #datasetAccess'
161
+ actions :
162
+ - actionType : validate
163
+ request : # validate properties of the request body
164
+ jobParams.requiredParam :
165
+ type : string
166
+ jobParams.arrayOfStrings :
167
+ type : array
168
+ items :
169
+ type : string
170
+ datasets : # validate properties of datasets listed in jobParams.datasetList
171
+ " datasetlifecycle.archivable " :
172
+ const : true
173
+ update :
174
+ auth : " #jobOwnerUser"
175
+ actions :
176
+ - actionType : validate
177
+ request :
178
+ jobResultObject.response :
179
+ type : string
180
+ # No `datasets` validation for the update operation
0 commit comments