Skip to content
Snippets Groups Projects

WS-1808 ingest_obs directory renaming

Merged Daniel Nemergut requested to merge ws1808-ingest_obs_dir_renaming into main
1 file
+ 60
0
Compare changes
  • Side-by-side
  • Inline
"""ingest obs workflow renaming
Revision ID: 569416c40ca8
Revises: 08090cb7acc4
Create Date: 2023-09-20 09:34:23.628834
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '569416c40ca8'
down_revision = '08090cb7acc4'
branch_labels = None
depends_on = None
old_ingest_obs_sh = """#!/bin/sh
set -o errexit
./ingest_envoy --observation $1 $2
"""
# Workflow will rename the directory to indicate the ingestion status
new_ingest_obs_sh = """#!/bin/sh
set -o errexit
running=$2.running
ingested=$2.ingested
failed=$2.failed
mv $2 $running
./ingest_envoy --observation $1 $running
status=$?
[ $status -eq 0 ] && mv $running $ingested || mv $running $failed
"""
def upgrade():
op.execute(
f"""
UPDATE workflow_templates
SET content=E'{new_ingest_obs_sh}'
WHERE filename='ingest_obs.sh'
"""
)
def downgrade():
op.execute(
f"""
UPDATE workflow_templates
SET content=E'{old_ingest_obs_sh}'
WHERE filename='ingest_obs.sh'
"""
)
Loading