Skip to content

Commit 693b504

Browse files
Merge branch 'master' into SWAP-4573-remove-default-values-in-dtos-to-prevent-overwriting
2 parents c6324fa + 0d2bc2a commit 693b504

31 files changed

+1837
-288
lines changed

jobConfig.example.yaml

+144-24
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,63 @@
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.
17
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
210
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
414
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
530
auth: "#datasetOwner"
31+
# List of actions to run sequentially
632
actions:
7-
- actionType: validate
33+
- # Validate properties of datasets listed in jobParams.datasetList
34+
actionType: validate
835
datasets:
936
"datasetlifecycle.archivable":
1037
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
2738
update:
2839
auth: archivemanager
2940
actions:
3041
- actionType: rabbitmq
3142
exchange: jobs.write
3243
queue: client.jobs.write
3344
key: jobqueue
34-
- jobType: retrieve
45+
46+
- # Request data to be moved out of the archive
47+
jobType: retrieve
3548
create:
3649
auth: "#datasetOwner"
3750
actions:
38-
- actionType: validate
39-
datasets:
40-
"datasetlifecycle.retrievable":
41-
const: true
51+
- actionType: validate
52+
datasets:
53+
"datasetlifecycle.retrievable":
54+
const: true
4255
update:
4356
auth: "archivemanager"
4457
actions: []
45-
- jobType: public
58+
59+
- # Retrieve published datasets to a public location
60+
jobType: public
4661
create:
4762
auth: "#all"
4863
actions:
@@ -58,3 +73,108 @@ jobs:
5873
const: true
5974
update:
6075
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

jobConfig.recommended.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This represents the recommended job types
2+
# The configuration is similar to the hard-coded jobs from v3.
3+
configVersion: recommended
4+
jobs:
5+
- jobType: archive
6+
create:
7+
auth: "#datasetOwner"
8+
actions:
9+
- actionType: validate
10+
datasets:
11+
"datasetlifecycle.archivable":
12+
const: true
13+
update:
14+
auth: "archivemanager"
15+
- jobType: retrieve
16+
create:
17+
auth: "#datasetAccess"
18+
actions:
19+
- actionType: validate
20+
datasets:
21+
"datasetlifecycle.retrievable":
22+
const: true
23+
update:
24+
auth: "archivemanager"
25+
- jobType: public
26+
create:
27+
auth: "#datasetPublic"
28+
actions:
29+
- actionType: validate
30+
datasets:
31+
isPublished:
32+
const: true
33+
update:
34+
auth: "archivemanager"

0 commit comments

Comments
 (0)