Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Commits
8cb2da11
Commit
8cb2da11
authored
1 year ago
by
Nathan Bockisch
Browse files
Options
Downloads
Patches
Plain Diff
Fixed the mustache syntax of the pims email template
parent
4bcc9ac7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!1390
Catch up with Main
,
!1308
Catchup with main 2.8.1
,
!1287
Fixed the mustache syntax of the pims email template
Checking pipeline status
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shared/workspaces/alembic/versions/0dc708eecbc6_fix_pims_split_templates.py
+181
-0
181 additions, 0 deletions
...alembic/versions/0dc708eecbc6_fix_pims_split_templates.py
with
181 additions
and
0 deletions
shared/workspaces/alembic/versions/0dc708eecbc6_fix_pims_split_templates.py
0 → 100644
+
181
−
0
View file @
8cb2da11
"""
fix pims split templates
Revision ID: 0dc708eecbc6
Revises: 7018d6a27433
Create Date: 2023-04-04 10:24:33.728436
"""
from
alembic
import
op
import
sqlalchemy
as
sa
# revision identifiers, used by Alembic.
revision
=
'
0dc708eecbc6
'
down_revision
=
'
7018d6a27433
'
branch_labels
=
None
depends_on
=
None
old_pims_notification
=
"""
Subject: PIMS Split Workflow Finished
Dear DA,
{{status}}
Calibration: {{calibration}}
CASA from: {{casa_path}}
Restore path: {{restore_path}}
Lustre processing area: {{lustre_dir}}
Cache directory: {{cache_dir}}
{{#num_products.length}}
SE Coarse Cube and Continuum images per tile in the database:
{{#num_products}}
Tile: {{tile_name}}, CC: {{num_coarse_cube}}, SE: {{num_continuum}}
{{/num_products}}
{{/num_products.length}}
Failed Splits/Total Splits: {{num_failed_splits}}/{{num_splits}}
{{#failed_splits.length}}
Failed splits:
{{#failed_splits}}
{{.}}
{{/failed_splits}}
{{/failed_splits.length}}
Best regards,
NRAO Workspaces
"""
new_pims_notification
=
b
"""
Subject: PIMS Split Workflow Finished
Dear DA,
{{status}}
Calibration: {{calibration}}
CASA from: {{casa_path}}
Restore path: {{restore_path}}
Lustre processing area: {{lustre_dir}}
Cache directory: {{cache_dir}}
SE Coarse Cube and Continuum images per tile in the database:
{{#num_products}}
- Tile: {{tile_name}}, CC: {{num_coarse_cube}}, SE: {{num_continuum}}
{{/num_products}}
Failed Splits ({{num_failed_splits}}/{{num_splits}}):
{{#failed_splits}}
- {{.}}
{{/failed_splits}}
Best regards,
NRAO Workspaces
"""
old_split_sh
=
b
"""
#!/bin/sh
export HOME=$TMPDIR
TILE=$(echo $1 | cut -d
"
/
"
-f 1)
PHCENTER=$(echo $1 | cut -d
"
/
"
-f 2)
# Get the measurement set path
{{^existing_restore}}
MS={{data_location}}/working/*.ms
{{/existing_restore}}
{{#existing_restore}}
MS={{existing_restore}}
{{/existing_restore}}
# Link it in the splits rawdata
ln -s $MS rawdata/
# Run CASA
./casa_envoy --split metadata.json PPR.xml
# Populate cache
./pimscache cp -c {{vlass_product}} -t $TILE -p $PHCENTER working/*_split.ms
touch {{data_location}}/failed_splits.txt
# If pimscache call failed, output the failed split to a file for pims_analyzer
if [[ $? -ne 0 ]] ; then
echo
"
${TILE}.${PHCENTER}
"
>> {{data_location}}/failed_splits.txt
fi
# Run quicklook if second parameter was given
if ! [[ -z
"
$2
"
]]; then
curl --request PUT --header
"
Content-Length: 0
"
$2
fi
"""
new_split_sh
=
b
"""
#!/bin/sh
export HOME=$TMPDIR
TILE=$(echo $1 | cut -d
"
/
"
-f 1)
PHCENTER=$(echo $1 | cut -d
"
/
"
-f 2)
# Get the measurement set path
{{^existing_restore}}
MS={{data_location}}/working/*.ms
{{/existing_restore}}
{{#existing_restore}}
MS={{existing_restore}}
{{/existing_restore}}
# Link it in the splits rawdata
ln -s $MS rawdata/
# failed_splits.txt needs to be present even if its empty for pims_analyzer
touch {{data_location}}/failed_splits.txt
# Run CASA
./casa_envoy --split metadata.json PPR.xml
# Populate cache
./pimscache cp -c {{vlass_product}} -t $TILE -p $PHCENTER working/*_split.ms
# If pimscache call failed, output the failed split to a file for pims_analyzer
if [[ $? -ne 0 ]] ; then
echo
"
${TILE}.${PHCENTER}
"
>> {{data_location}}/failed_splits.txt
fi
# Run quicklook if second parameter was given
if ! [[ -z
"
$2
"
]]; then
curl --request PUT --header
"
Content-Length: 0
"
$2
fi
"""
def
upgrade
():
conn
=
op
.
get_bind
()
conn
.
execute
(
f
"""
UPDATE workflow_templates
SET content=%s WHERE filename=
'
split.sh
'
"""
,
new_split_sh
)
conn
.
execute
(
f
"""
UPDATE notification_templates
SET template=%s WHERE name=
'
pims_notification
'
"""
,
new_pims_notification
)
def
downgrade
():
conn
=
op
.
get_bind
()
conn
.
execute
(
f
"""
UPDATE workflow_templates
SET content=%s WHERE filename=
'
split.sh
'
"""
,
old_split_sh
)
conn
.
execute
(
f
"""
UPDATE notification_templates
SET template=%s WHERE name=
'
pims_notification
'
"""
,
old_pims_notification
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment