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
Merge requests
!1287
Fixed the mustache syntax of the pims email template
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fixed the mustache syntax of the pims email template
fix-pims-templates
into
main
Overview
0
Commits
1
Pipelines
2
Changes
1
Merged
Nathan Bockisch
requested to merge
fix-pims-templates
into
main
1 year ago
Overview
0
Commits
1
Pipelines
2
Changes
1
Expand
Also fixed an issue where the touch command in split.sh was in the wrong place
0
0
Merge request reports
Compare
main
version 1
b396d95f
1 year ago
main (base)
and
latest version
latest version
8c6278a0
1 commit,
1 year ago
version 1
b396d95f
1 commit,
1 year ago
1 file
+
181
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
shared/workspaces/alembic/versions/0dc708eecbc6_fix_pims_split_templates.py
0 → 100644
+
181
−
0
Options
"""
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
)
Loading