From 6bef093aa2361c20231d9c4d8ff7c1a74c13e98f Mon Sep 17 00:00:00 2001 From: Charlotte Hausman <chausman@nrao.edu> Date: Tue, 6 Jul 2021 23:02:55 +0000 Subject: [PATCH] Calibration ingestion templates --- schema/versions/758525350770_.py | 24 ++++++ ...2b4e_add_calibration_ingestion_workflow.py | 78 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 schema/versions/758525350770_.py create mode 100644 schema/versions/e99b65ee2b4e_add_calibration_ingestion_workflow.py diff --git a/schema/versions/758525350770_.py b/schema/versions/758525350770_.py new file mode 100644 index 000000000..1c112e622 --- /dev/null +++ b/schema/versions/758525350770_.py @@ -0,0 +1,24 @@ +"""empty message + +Revision ID: 758525350770 +Revises: e99b65ee2b4e, ecb4acbecbce +Create Date: 2021-07-06 16:50:02.296448 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '758525350770' +down_revision = ('e99b65ee2b4e', 'ecb4acbecbce') +branch_labels = None +depends_on = None + + +def upgrade(): + pass + + +def downgrade(): + pass diff --git a/schema/versions/e99b65ee2b4e_add_calibration_ingestion_workflow.py b/schema/versions/e99b65ee2b4e_add_calibration_ingestion_workflow.py new file mode 100644 index 000000000..bdd52ff30 --- /dev/null +++ b/schema/versions/e99b65ee2b4e_add_calibration_ingestion_workflow.py @@ -0,0 +1,78 @@ +"""add calibration ingestion workflow + +Revision ID: e99b65ee2b4e +Revises: 2ac701610fc7 +Create Date: 2021-07-06 11:44:30.072590 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "e99b65ee2b4e" +down_revision = "2ac701610fc7" +branch_labels = None +depends_on = None + + +condor_content = """executable = ingest_cal.sh +arguments = metadata.json + +output = ingest.out +error = ingest.err +log = condor.log + +SBIN_PATH = /lustre/aoc/cluster/pipeline/$ENV(CAPO_PROFILE)/workspaces/sbin +should_transfer_files = yes +transfer_input_files = $(SBIN_PATH)/conveyor, $(SBIN_PATH)/ingest_envoy, $(SBIN_PATH)/calibration-table-collector.sh, ./metadata.json + +getenv = True +environment = "CAPO_PATH=/home/casa/capo" + +queue +""" + +script_content = """#!/bin/sh +set -o errexit + +./conveyor --retrieve $1 +./ingest_envoy --ingest-cal $1 + +""" + + +def upgrade(): + op.execute( + """ + INSERT INTO workflows (workflow_name) VALUES ('ingest_cal') + """ + ) + + op.execute( + f""" + INSERT INTO workflow_templates (filename, content, workflow_name) + VALUES ('ingest_cal.condor', E'{condor_content}', 'ingest_cal') + """ + ) + + op.execute( + f""" + INSERT INTO workflow_templates (filename, content, workflow_name) + VALUES ('ingest_cal.sh', E'{script_content}', 'ingest_cal') + """ + ) + + +def downgrade(): + op.execute( + """ + DELETE FROM workflows WHERE workflow_name='ingest-cal' + """ + ) + + op.execute( + """ + DELETE FROM workflow_templates WHERE workflow_name='ingest-cal' + """ + ) -- GitLab