-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication_template.yaml
473 lines (457 loc) · 16.4 KB
/
application_template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
tosca_definitions_version: alien_dsl_3_0_0
metadata:
template_name: org.lexis.common.ServiceVisualizationTemplate
template_version: 0.1.0-SNAPSHOT
template_author: lexis
description: "Visualization Service available until the user deletes the workflow execution"
imports:
- yorc-types:1.1.0
- yorc-openstack-types:3.1.0
- tosca-normative-types:1.0.0-ALIEN20
- alien-base-types:3.0.0
- org.lexis.common.ddi-types:1.0.4
- org.lexis.common.dynamic-orchestration-types:1.0.4
- org.lexis.common.datatransfer:0.1.8-SNAPSHOT
- org.lexis.common.visualization.xpra:0.1.1
topology_template:
inputs:
token:
type: string
description: "OpenID Connect token"
required: true
project_id:
type: string
description: "LEXIS project identifier"
required: true
visualization_dataset_path_input_path:
type: string
description: Dataset path in DDI containing visualization data
required: true
visualization_decrypt_input:
type: boolean
description: Should the input dataset be decrypted
default: false
required: false
visualization_uncompress_input:
type: boolean
description: Should the input dataset be uncompressed
default: false
required: false
visualization_directory:
type: string
description: Directory where visualization data will be accesible on a cloud instance
default: "visualization"
required: false
visualization_port:
type: integer
description: "Port to use to expose the remote display (should be > 1024)"
default: 8080
required: false
node_templates:
# Validation of the token provided in input
# Exchanging this token to have an access and refresh tokens
# for any component needing it in the workflow
ValidateExchangeToken:
type: org.lexis.common.dynamic.orchestration.nodes.ValidateAndExchangeToken
properties:
token: {get_input: token}
project_id: { get_input: project_id }
# Job gathering info on the input dataset:
# - on which locations it is available
# - size
# - number of files
# to take placement decisions on computing resources using this dataset
InputDatasetInfoJob:
type: org.lexis.common.ddi.nodes.GetDDIDatasetInfoJob
properties:
token: {get_input: token}
dataset_path: {get_input: visualization_dataset_path_input_path}
# Find the best cloud location depending on the input dataset and needed cloud resources
FindCloudLocationJob:
type: org.lexis.common.dynamic.orchestration.nodes.SetLocationsJob
metadata:
task: dynamic_orchestration
properties:
token: { get_input: token }
project_id: { get_input: project_id }
requirements:
- InputDataset:
type_requirement: input_dataset
node: InputDatasetInfoJob
capability: org.lexis.common.ddi.capabilities.DatasetInfo
relationship: org.lexis.common.dynamic.orchestration.relationships.Dataset
- CloudResourceVM:
type_requirement: cloud_instance
node: VisualizationVM
capability: tosca.capabilities.OperatingSystem
relationship: org.lexis.common.dynamic.orchestration.relationships.CloudResource
# Floating IP address to allocate
PublicNet:
type: yorc.nodes.openstack.FloatingIP
# Compute instance to allocate
VisualizationVM:
type: tosca.nodes.Compute
metadata:
task: visualization
requirements:
- networkPublicNetConnection:
type_requirement: network
node: PublicNet
capability: yorc.capabilities.openstack.FIPConnectivity
relationship: tosca.relationships.Network
capabilities:
host:
properties:
num_cpus: 4
disk_size: "150 GB"
os:
properties:
type: linux
# Using ubuntu for the paraview install
distribution: ubuntu
scalable:
properties:
min_instances: 1
max_instances: 1
default_instances: 1
endpoint:
properties:
secure: true
protocol: tcp
network_name: PRIVATE
initiator: source
# At the end of the workflow, the Cloud instance token should be refreshed
# before attempting to uninstall the compute instance
RefreshVMToken:
type: org.lexis.common.dynamic.orchestration.nodes.RefreshTargetTokens
requirements:
- target:
type_requirement: target
node: VisualizationVM
capability: tosca.capabilities.Node
relationship: tosca.relationships.DependsOn
# Transfer the dataset from DDI to Cloud staging area
DDIToCloudDatasetJob:
type: org.lexis.common.ddi.nodes.DDIToCloudJob
properties:
token: { get_input: token }
decrypt: {get_input: visualization_decrypt_input}
uncompress: {get_input: visualization_uncompress_input}
ddi_dataset_path: { get_input: visualization_dataset_path_input_path }
cloud_staging_area_directory_path: "visualization"
timestamp_cloud_staging_area_directory: true
requirements:
- sameSite:
type_requirement: os
node: VisualizationVM
capability: tosca.capabilities.OperatingSystem
relationship: org.lexis.common.ddi.relationships.SameSite
# Get access details to the cloud staging area
GetDDIAccess:
type: org.lexis.common.ddi.nodes.DDIAccess
requirements:
- hostedOnComputeHost:
type_requirement: os
node: VisualizationVM
capability: tosca.capabilities.OperatingSystem
relationship: org.lexis.common.ddi.relationships.SameSite
# Mount the cloud staging area directory on the Compute instance
MountDataset:
type: org.lexis.common.ddi.nodes.SSHFSMountStagingAreaDataset
properties:
token: { get_input: token }
mount_point_directory: "/mnt/visualization"
requirements:
- ddi_access:
type_requirement: ddi_access
node: GetDDIAccess
capability: org.lexis.common.ddi.capabilities.DDIAccess
relationship: org.lexis.common.ddi.relationships.DDIAccessProvider
- data_transfer:
type_requirement: data_transfer
node: DDIToCloudDatasetJob
capability: org.lexis.common.ddi.capabilities.DataTransferCloud
relationship: org.lexis.common.ddi.relationships.CloudAreaDatasetProvider
- hostedOnComputeHost:
type_requirement: host
node: VisualizationVM
capability: tosca.capabilities.Container
relationship: tosca.relationships.HostedOn
# Create a directory where to store visualization data accessible to the user
CreateVisualizationDir:
type: org.lexis.common.datatransfer.nodes.CreateDirectories
properties:
directories: {concat: ["[\"", get_input: visualization_directory, "\"]"]}
requirements:
- hostedOnVirtualMachineHost:
type_requirement: host
node: VisualizationVM
capability: tosca.capabilities.Container
relationship: tosca.relationships.HostedOn
# Move results from the mount point as it is accessible to root only
MoveVisualizationData:
type: org.lexis.common.datatransfer.nodes.MoveFile
properties:
source_file: "/mnt/visualization/*/*"
destination: {get_input: visualization_directory}
as_user: "root"
requirements:
- hostedOnVirtualMachineHost:
type_requirement: host
node: VisualizationVM
capability: tosca.capabilities.Container
relationship: tosca.relationships.HostedOn
# Component running the remote visualization
XpraService:
metadata:
task: visualization
type: org.lexis.common.visualization.xpra.nodes.Xpra
properties:
port: { get_input: visualization_port }
requirements:
- hostedOnComputeHost:
type_requirement: host
node: VisualizationVM
capability: tosca.capabilities.Container
relationship: tosca.relationships.HostedOn
DeleteCloudDataJob:
type: org.lexis.common.ddi.nodes.DeleteCloudDataJob
properties:
token: { get_input: token }
requirements:
- cloud_area_dataset_provider:
type_requirement: cloud_area_dataset_provider
node: DDIToCloudDatasetJob
capability: org.lexis.common.ddi.capabilities.DataTransferCloud
relationship: org.lexis.common.ddi.relationships.CloudAreaDatasetProvider
outputs:
visualization_url:
description: URL of the remote visualization session
value: { get_attribute: [ XpraService, url ] }
workflows:
# At deployment time, validating the input token and exchanging it
# to get an access/refresh token for the orchestrator
install:
steps:
ValidateExchangeToken_start:
target: ValidateExchangeToken
activities:
- call_operation: Standard.start
on_success:
- ValidateExchangeToken_started
ValidateExchangeToken_started:
target: ValidateExchangeToken
activities:
- set_state: started
# Run workflow called by LEXIS Portal
Run:
steps:
# Submit DDI job to get info on dataset (DDI location where it is available, size...)
InputDatasetInfoJob_submit:
target: InputDatasetInfoJob
operation_host: ORCHESTRATOR
activities:
- call_operation: tosca.interfaces.node.lifecycle.Runnable.submit
on_success:
- InputDatasetInfoJob_run
InputDatasetInfoJob_run:
target: InputDatasetInfoJob
operation_host: ORCHESTRATOR
activities:
- call_operation: tosca.interfaces.node.lifecycle.Runnable.run
on_success:
- InputDatasetInfoJob_executed
InputDatasetInfoJob_executed:
target: InputDatasetInfoJob
activities:
- set_state: executed
on_success:
- FindCloudLocationJob_submit
# Submit the computation to find the best location from these inputs
FindCloudLocationJob_submit:
target: FindCloudLocationJob
activities:
- call_operation: tosca.interfaces.node.lifecycle.Runnable.submit
on_success:
- FindCloudLocationJob_run
FindCloudLocationJob_run:
target: FindCloudLocationJob
activities:
- call_operation: tosca.interfaces.node.lifecycle.Runnable.run
on_success:
- FindCloudLocationJob_executed
FindCloudLocationJob_executed:
target: FindCloudLocationJob
activities:
- set_state: executed
on_success:
- DDIToCloudDatasetJob_create
- PublicNet_install
# Transfer the dataset from DDI to the Cloud staging area
DDIToCloudDatasetJob_create:
target: DDIToCloudDatasetJob
operation_host: ORCHESTRATOR
activities:
- call_operation: Standard.create
on_success:
- DDIToCloudDatasetJob_submit
DDIToCloudDatasetJob_submit:
target: DDIToCloudDatasetJob
operation_host: ORCHESTRATOR
activities:
- call_operation: tosca.interfaces.node.lifecycle.Runnable.submit
on_success:
- DDIToCloudDatasetJob_run
DDIToCloudDatasetJob_run:
target: DDIToCloudDatasetJob
operation_host: ORCHESTRATOR
activities:
- call_operation: tosca.interfaces.node.lifecycle.Runnable.run
on_success:
- DDIToCloudDatasetJob_executed
DDIToCloudDatasetJob_executed:
target: DDIToCloudDatasetJob
activities:
- set_state: executed
on_success:
- MountDataset_create
# Get a floating IP address for the Cloud Compute instance
PublicNet_install:
target: PublicNet
activities:
- delegate: install
on_success:
- VisualizationVM_install
# Create the compute instance
VisualizationVM_install:
target: VisualizationVM
activities:
- delegate: install
on_success:
- GetDDIAccess_start
# Get access details for the cloud staging area
GetDDIAccess_start:
target: GetDDIAccess
activities:
- call_operation: Standard.start
on_success:
- GetDDIAccess_started
GetDDIAccess_started:
target: GetDDIAccess
activities:
- set_state: started
on_success:
- MountDataset_create
# Mount the dataset from the staging area on the compute instance
MountDataset_create:
target: MountDataset
activities:
- call_operation: Standard.create
on_success:
- MountDataset_created
MountDataset_created:
target: MountDataset
activities:
- set_state: created
on_success:
- MountDataset_refresh_token
MountDataset_refresh_token:
target: MountDataset
activities:
- call_operation: custom.refresh_token
on_success:
- MountDataset_start
MountDataset_start:
target: MountDataset
activities:
- call_operation: Standard.start
on_success:
- MountDataset_started
MountDataset_started:
target: MountDataset
activities:
- set_state: started
on_success:
- CreateVisualizationDir_start
# Create a directory where tp store visualization data
CreateVisualizationDir_start:
target: CreateVisualizationDir
activities:
- call_operation: Standard.start
on_success:
- CreateVisualizationDir_started
CreateVisualizationDir_started:
target: CreateVisualizationDir
activities:
- set_state: started
on_success:
- MoveVisualizationData_start
# Move visualization date from the mount point
MoveVisualizationData_start:
target: MoveVisualizationData
activities:
- call_operation: Standard.start
on_success:
- MoveVisualizationData_started
MoveVisualizationData_started:
target: MoveVisualizationData
activities:
- set_state: started
on_success:
- XpraService_create
# Submit the visualization job
XpraService_create:
target: XpraService
activities:
- call_operation: Standard.create
on_success:
- XpraService_start
XpraService_start:
target: XpraService
activities:
- call_operation: Standard.start
on_success:
- XpraService_started
XpraService_started:
target: XpraService
activities:
- set_state: started
# Uninstall workflow releases resources if ever the Run workflow failed before
uninstall:
steps:
DeleteCloudDataJob_create:
target: DeleteCloudDataJob
operation_host: ORCHESTRATOR
activities:
- call_operation: Standard.create
on_success:
- DeleteCloudDataJob_submit
DeleteCloudDataJob_submit:
target: DeleteCloudDataJob
operation_host: ORCHESTRATOR
activities:
- call_operation: tosca.interfaces.node.lifecycle.Runnable.submit
on_success:
- RefreshVMToken_start
RefreshVMToken_start:
target: RefreshVMToken
activities:
- call_operation: Standard.start
on_success:
- RefreshVMToken_started
RefreshVMToken_started:
target: RefreshVMToken
activities:
- set_state: started
on_success:
- Compute_uninstall
Compute_uninstall:
target: VisualizationVM
activities:
- delegate: uninstall
on_success:
- PublicNet_uninstall
PublicNet_uninstall:
target: PublicNet
activities:
- delegate: uninstall