diff --git a/shared/workspaces/alembic/versions/08090cb7acc4_add_mark4_observation_ingestion_workflow.py b/shared/workspaces/alembic/versions/08090cb7acc4_add_mark4_observation_ingestion_workflow.py index c9caac7fcfbe3f55aadc2e1ddc2bf96cf677c8ec..a4cca7049e9a4b9d5d62d55aed2d714d2980f0a6 100644 --- a/shared/workspaces/alembic/versions/08090cb7acc4_add_mark4_observation_ingestion_workflow.py +++ b/shared/workspaces/alembic/versions/08090cb7acc4_add_mark4_observation_ingestion_workflow.py @@ -48,7 +48,13 @@ NGASHOSTSTR=$(./pycapo -q archive-ingestion.NGASHosts) NGASHOSTARR=(`/bin/echo ${NGASHOSTSTR}`) # Put the space-delimited host list into an array NGASHOSTLEN=${#NGASHOSTARR[@]} -cd $1 +# Copy from the difx area to the Workspaces staging area +WSSTAGINGDIR=$(./pycapo -q edu.nrao.workspaces.IngestionSettings.stagingDirectory) +/bin/cp -r $1 $WSSTAGINGDIR + +OBSDIR=$(/bin/basename $1) +/bin/chmod -R 750 $WSSTAGINGDIR/$OBSDIR # Make sure NGAS has permissions to ingest the files +cd $WSSTAGINGDIR/$OBSDIR for FILE in *; do # Pick random NGAS host to distribute the ingestion load @@ -57,7 +63,12 @@ for FILE in *; do FULLPATH=$(/bin/readlink -f $FILE) NGASCMD="${NGASHOST}ARCHIVE?filename=file://${FULLPATH}" - /bin/curl $NGASCMD + + INGESTOUT=$(/bin/curl $NGASCMD) + if echo $INGESTOUT | grep -i "error"; then + echo "Failed to ingest ${FILE}" + exit 1 + fi done""" def upgrade():