Skip to content
Snippets Groups Projects
Commit 9ad8faa5 authored by Daniel Nemergut's avatar Daniel Nemergut
Browse files

Updated the vlass_image_caching workflow to check for the existence of the...

Updated the vlass_image_caching workflow to check for the existence of the delete_pims flag before running pimscache rm
parent 6c1cac6b
No related branches found
No related tags found
2 merge requests!1607merge 2.8.3 to main,!1587WS-1574 Conditionalize PIMS deletion in vlass_image_caching
"""toggle_seci_pims_auto_deletion
Revision ID: 36591dc3f14d
Revises: 2a8ba99a1250
Create Date: 2024-02-23 15:54:54.379314
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '36591dc3f14d'
down_revision = '2a8ba99a1250'
branch_labels = None
depends_on = None
old_condor_args = "arguments = {{calibration_name}} {{phase_center}} {{vlass_relative_path}} {{qa_status}}"
new_condor_args = "arguments = {{calibration_name}} {{phase_center}} {{vlass_relative_path}} {{qa_status}} {{delete_pims}}"
old_vlass_image_caching_sh = """#!/bin/sh
export CAPO_PROFILE=vlass.{{vlass_env}}
./pimscache rm -c $1 -p $2
./cacheImagingProducts.sh -p $3 -s $4
"""
new_vlass_image_caching_sh = """#!/bin/sh
export CAPO_PROFILE=vlass.{{vlass_env}}
if [ -n $5 ]; then
./pimscache rm -c $1 -p $2
fi
./cacheImagingProducts.sh -p $3 -s $4
"""
def upgrade():
op.execute(
f"""
UPDATE workflow_templates
SET content = replace(convert_from(content, 'utf8'), E'{old_condor_args}', E'{new_condor_args}')::bytea
WHERE filename = 'vlass_image_caching.condor'
"""
)
op.execute(
f"""
UPDATE workflow_templates
SET content = E'{new_vlass_image_caching_sh}'
WHERE filename = 'vlass_image_caching.sh'
"""
)
def downgrade():
op.execute(
f"""
UPDATE workflow_templates
SET content = replace(convert_from(content, 'utf8'), E'{new_condor_args}', E'{old_condor_args}')::bytea
WHERE filename = 'vlass_image_caching.condor'
"""
)
op.execute(
f"""
UPDATE workflow_templates
SET content = E'{old_vlass_image_caching_sh}'
WHERE filename = 'vlass_image_caching.sh'
"""
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment