generated from Sage-Bionetworks-Challenges/model-to-data-challenge-workflow
-
Notifications
You must be signed in to change notification settings - Fork 2
/
get_config.cwl
119 lines (100 loc) · 3 KB
/
get_config.cwl
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
#!/usr/bin/env cwl-runner
#
# Get more configuration of evaluation queues
# Converts yaml 2 json
#
cwlVersion: v1.0
class: CommandLineTool
baseCommand: [python3, get_config.py]
hints:
DockerRequirement:
dockerPull: biowdl/pyyaml:3.13-py37-slim
requirements:
InlineJavascriptRequirement: {}
InitialWorkDirRequirement:
listing:
- entryname: get_config.py
entry: |
#!/usr/bin/env python
import argparse
import json
import yaml
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config", required=True, help="Configuration file")
parser.add_argument("-q", "--queue", required=True, type=int, help="The ID of a queue")
parser.add_argument("-r", "--results", required=True, help="The ID of a queue")
args = parser.parse_args()
with open(args.config) as yaml_file:
config = yaml.load(yaml_file)
queue_config = config[str(args.queue)]
queue_config['submission_status'] = "EVALUATION_IN_PROGRESS"
with open(args.results, 'w') as json_file:
json_file.write(json.dumps(queue_config))
inputs:
- id: configuration
type: File
inputBinding:
position: 1
prefix: -c
- id: queue_id
type: string
inputBinding:
prefix: -q
- id: results
type: string
default: "config.json"
inputBinding:
prefix: -r
outputs:
- id: submit_to_queue
type: string[]?
outputBinding:
glob: $(inputs.results)
loadContents: true
outputEval: $(JSON.parse(self[0].contents)['submit_to'])
- id: dataset_name
type: string
outputBinding:
glob: $(inputs.results)
loadContents: true
outputEval: $(JSON.parse(self[0].contents)['dataset_name'])
- id: dataset_version
type: string
outputBinding:
glob: $(inputs.results)
loadContents: true
outputEval: $(JSON.parse(self[0].contents)['dataset_version'])
- id: runtime
type: int
outputBinding:
glob: $(inputs.results)
loadContents: true
outputEval: $(JSON.parse(self[0].contents)['runtime'])
- id: center
type: string
outputBinding:
glob: $(inputs.results)
loadContents: true
outputEval: $(JSON.parse(self[0].contents)['center'])
- id: config
type: File
outputBinding:
glob: $(inputs.results)
- id: dataset_id
type: string
outputBinding:
glob: $(inputs.results)
loadContents: true
outputEval: $(JSON.parse(self[0].contents)['dataset_name'])-$(JSON.parse(self[0].contents)['dataset_version'])
- id: subset_dataset_id
type: string
outputBinding:
glob: $(inputs.results)
loadContents: true
outputEval: $(JSON.parse(self[0].contents)['dataset_name'])-$(JSON.parse(self[0].contents)['dataset_version'])-subset
- id: datanode_endpoint
type: string
outputBinding:
glob: $(inputs.results)
loadContents: true
outputEval: $(JSON.parse(self[0].contents)['datanode_endpoint'])