#!/bin/bash message=$1 echo "message: "$message cd /pipeline/output/ python /pipeline/app/run.py $message exit_code=$? echo "=====pipeline.log====" > /work/custom-out.txt cat /pipeline/output/pipeline.log >> /work/custom-out.txt echo "======module.log======" >> /work/custom-out.txt cat /pipeline/output/module.log|tail -n 100 >> /work/custom-out.txt timefile=/pipeline/output/timestamp.txt if test -f "$timefile"; then echo "$timefile exist" mv /pipeline/output/timestamp.txt /work/timestamps.txt fi rm -rf /pipeline/input/* /pipeline/output/* headers=$2 pattern='"dag_run_id":"([^"]+)"' if [[ $headers =~ $pattern ]]; then dag_run_id="${BASH_REMATCH[1]}" echo "dag_run_id: $dag_run_id" else # no dag_run_id in json dag_run_id="" fi echo "dag_run_id:$dag_run_id" >> /work/extra-attributes.txt if [ $exit_code -eq 0 ]; then scalebox task add --header dag_run_id=${dag_run_id} --header repeatable=yes --upsert ${message} echo "finish qc0, start sink-job." else echo "finish qc0, exit_code: $exit_code" fi exit $exit_code