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

Changing ingest_obs workflow to rename directories when starting the workflow...

Changing ingest_obs workflow to rename directories when starting the workflow and to indicate success/fail status
parent 44511616
No related branches found
No related tags found
1 merge request!1454WS-1808 ingest_obs directory renaming
This commit is part of merge request !1454. Comments created here will be created in the context of that merge request.
"""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//ready/running}
ingested=${2//ready/ingested}
failed=${2//ready/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'
"""
)
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