-
Notifications
You must be signed in to change notification settings - Fork 8
/
trs2wes.py
54 lines (48 loc) · 1.99 KB
/
trs2wes.py
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
from synorchestrator.config import config_path
from synorchestrator.config import queue_config
from synorchestrator.config import set_yaml
from synorchestrator.trs.wrapper import TRS
def fetch_queue_workflow(queue_id):
wf_config = queue_config()[queue_id]
trs_instance = TRS(wf_config['trs_id'])
wf_descriptor = trs_instance.get_workflow_descriptor(
id=wf_config['workflow_id'],
version_id=wf_config['version_id'],
type=wf_config['workflow_type']
)
wf_files = trs_instance.get_workflow_files(
id=wf_config['workflow_id'],
version_id=wf_config['version_id'],
type=wf_config['workflow_type']
)
wf_config['workflow_url'] = wf_descriptor['url']
attachment_paths = [wf_file['path'] for wf_file in wf_files
if wf_file['file_type'] == 'SECONDARY_DESCRIPTOR']
wf_attachments = []
for attachment in attachment_paths:
attachment_file = trs_instance.get_workflow_descriptor_relative(
id=wf_config['workflow_id'],
version_id=wf_config['version_id'],
type=wf_config['workflow_type'],
relative_path=attachment
)
wf_attachments.append(attachment_file['url'])
wf_config['workflow_attachments'] = wf_attachments
set_yaml('queues', queue_id, wf_config)
return wf_config
def store_verification(queue_id, wes_id):
"""
Record checker status for selected workflow and environment.
"""
wf_config = queue_config()[queue_id]
wf_config.setdefault('wes_verified', []).append(wes_id)
set_yaml('queues', queue_id, wf_config)
# def post_verification(self, id, version_id, type, relative_path, requests):
# """
# Annotate test JSON with information on whether it ran successfully on particular platforms plus metadata
# """
# id = _format_workflow_id(id)
# endpoint ='extended/{}/versions/{}/{}/tests/{}'.format(
# id, version_id, type, relative_path
# )
# return _post_to_endpoint(self, endpoint, requests)