Newer
Older
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
"""add std_cms_imaging templates
Revision ID: a832fcb74a8c
Revises: 6ce7b4b8a9ea
Create Date: 2021-06-28 15:51:12.733523
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "a832fcb74a8c"
down_revision = "6ce7b4b8a9ea"
branch_labels = None
depends_on = None
condor_content = """executable = std_cms_imaging.sh
arguments = metadata.json PPR.xml
output = imaging.out
error = imaging.err
log = condor.log
SBIN_PATH = /lustre/aoc/cluster/pipeline/$ENV(CAPO_PROFILE)/workspaces/sbin
CMS_PATH = /lustre/aoc/cluster/pipeline/$ENV(CAPO_PROFILE)/workspaces/spool/{{relative_path}}/working
should_transfer_files = yes
transfer_input_files = $(SBIN_PATH)/.matplotlib, $(SBIN_PATH)/pycapo, $(SBIN_PATH)/framework.sh, $(SBIN_PATH)/productfetcher,
$(SBIN_PATH)/casa_envoy, $(SBIN_PATH)/vela, $(SBIN_PATH)/conveyor, ./PPR.xml, ./metadata.json, $(CMS_PATH)/{{cms_name}}
request_memory = {{ramInGb}}
getenv = True
environment = "CAPO_PATH=/home/casa/capo"
queue
"""
script_content = """#!/bin/sh
export HOME=$TMPDIR
./framework.sh -d .
chmod 770 .
mv {{cms_name}} ./rawdata
./casa_envoy --standard-cmsimage $1 $2
./conveyor --deliver-image $1
"""
metadata_content = """{
"fileSetIds": "{{sdmId}}",
"workflowName": "std_cms_imaging",
"systemId": "{{request_id}}",
"productLocator": "{{product_locator}}",
"projectMetadata": {
"projectCode": "{{projectCode}}",
"title": "{{title}}",
"startTime": "{{startTime}}",
"observer": "{{observer}}"
},
"destinationDirectory": "{{root_directory}}/{{relative_path}}"
"calibrationSourceDirectory":"{{cal_directory}}"
}
"""
ppr_content = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SciPipeRequest xmlns:ns2="Common/pipelinescience/SciPipeRequest">
<ProjectSummary>
<ProposalCode>VLA/null</ProposalCode>
<Observatory>NRAO</Observatory>
<Telescope>VLA</Telescope>
<ProcessingSite>Socorro</ProcessingSite>
<Operator>vlapipe</Operator>
<Mode>SCIENCE</Mode>
<Version>NGRH-ALMA-10_8</Version>
<CreationTime>{{created_at}}</CreationTime>
</ProjectSummary>
<ProjectStructure>TBD</ProjectStructure>
<ProcessingRequests>
<RootDirectory>{{root_directory}}</RootDirectory>
<ProcessingRequest>
<ProcessingIntents>
<Intents>
<Keyword>VLA_INTERFEROMETRY_STANDARD_OBSERVING_MODE</Keyword>
<Value>Undefined</Value>
</Intents>
</ProcessingIntents>
<ProcessingProcedure>
<ProcedureTitle>hifv_contimage</ProcedureTitle>
<ProcessingCommand>
<Command xmlns="">hifv_importdata</Command>
<ParameterSet>
</ParameterSet>
</ProcessingCommand>
<ProcessingCommand>
<Command xmlns="">hif_mstransform</Command>
<ParameterSet>
</ParameterSet>
</ProcessingCommand>
<ProcessingCommand>
<Command xmlns="">hif_checkproductsize</Command>
<ParameterSet>
<Parameter>
<Keyword xmlns="">maximsize</Keyword>
<Value xmlns="">16384</Value>
</Parameter>
</ParameterSet>
</ProcessingCommand>
<ProcessingCommand>
<Command xmlns="">hif_makeimlist</Command>
<ParameterSet>
<Parameter>
<Keyword xmlns="">specmode</Keyword>
<Value xmlns="">cont</Value>
</Parameter>
</ParameterSet>
</ProcessingCommand>
<ProcessingCommand>
<Command xmlns="">hif_makeimages</Command>
<ParameterSet>
<Parameter>
<Keyword xmlns="">hm_masking</Keyword>
<Value xmlns="">none</Value>
</Parameter>
<Parameter>
<Keyword xmlns="">hm_cyclefactor</Keyword>
<Value xmlns="">3.0</Value>
</Parameter>
</ParameterSet>
</ProcessingCommand>
<ProcessingCommand>
<Command xmlns="">hifv_exportdata</Command>
<ParameterSet>
<Parameter>
<Keyword xmlns="">imaging_products_only</Keyword>
<Value xmlns="">True</Value>
</Parameter>
</ParameterSet>
</ProcessingCommand>
</ProcessingProcedure>
<DataSet>
<RelativePath>{{relative_path}}</RelativePath>
<SdmIdentifier>{{sdmId}}.ms</SdmIdentifier>
<DataType>asdm</DataType>
</DataSet>
</ProcessingRequest>0
</ProcessingRequests>
<ResultsProcessing>
<ArchiveResults>false</ArchiveResults>
<CleanUpDisk>false</CleanUpDisk>
<UpdateProjectLifeCycle>false</UpdateProjectLifeCycle>
<NotifyOperatorWhenDone>false</NotifyOperatorWhenDone>
<SDMall>false</SDMall>
<SDMonly>false</SDMonly>
<PipelineOperatorAddress>Unknown</PipelineOperatorAddress>
</ResultsProcessing>
</ns2:SciPipeRequest>
"""
def upgrade():
op.execute(
f"""
INSERT INTO workflow_templates (filename, content, workflow_name)
VALUES('std_cms_imaging.condor', E'{condor_content}', 'std_cms_imaging')
"""
)
op.execute(
f"""
INSERT INTO workflow_templates (filename, content, workflow_name)
VALUES ('std_cms_imaging.sh', E'{script_content}', 'std_cms_imaging')
"""
)
op.execute(
f"""
INSERT INTO workflow_templates (filename, content, workflow_name)
VALUES ('metadata.json', E'{metadata_content}', 'std_cms_imaging')
"""
)
op.execute(
f"""
INSERT INTO workflow_templates (filename, content, workflow_name)
VALUES ('PPR.xml', E'{ppr_content}', 'std_cms_imaging')
"""
)
def downgrade():
op.execute(
"""
DELETE FROM workflow_templates WHERE workflow_name='std_cms_imaging'
"""
)