#!/bin/bash # ARC gateway node if [ "$1" = "0" ]; then # evaluate environment variables passed env_idx=0 env_var="joboption_env_$env_idx" while [ -n "${!env_var}" ]; do eval ${!env_var} env_idx=$((env_idx+1)) env_var="joboption_env_$env_idx" done if [ -z "$MDS_UUID" ]; then echo "FATAL: There is no job UUID passed to MOLDYGRID/PORTAL runTimeEnvironmant." exit 1 fi # makes proxy certificate available on worker node X509_USER_PROXY=$joboption_directory/user.proxy cat ${joboption_controldir}/job.${joboption_gridid}.proxy > ${X509_USER_PROXY} # send status update to portal curl -k -s --form request=statusupdate --form userproxy=@${X509_USER_PROXY} \ --form uuid=${MDS_UUID} --form status=2 --form details="Prepared on $(hostname)" \ https://moldyngrid.org/mdsportal/core.php # Worker node before run elif [ "$1" = "1" ]; then X509_USER_PROXY=$RUNTIME_JOB_DIR/user.proxy curl -k -s --form request=statusupdate --form userproxy=@${X509_USER_PROXY} \ --form uuid=${MDS_UUID} --form status=100 \ --form details="Running on $(hostname)" \ https://moldyngrid.org/mdsportal/core.php # Worker node after run elif [ "$1" = "2" ]; then X509_USER_PROXY=$RUNTIME_JOB_DIR/user.proxy if [ $RESULT -eq 0 ]; then curl -k -s --form request=statusupdate --form userproxy=@${X509_USER_PROXY} \ --form uuid=${MDS_UUID} --form status=200 \ --form details="Finished on $(hostname)" \ https://moldyngrid.org/mdsportal/core.php else curl -k -s --form request=statusupdate --form userproxy=@${X509_USER_PROXY} \ --form uuid=${MDS_UUID} --form status=500 \ --form details="Job failed with exit code ${RESULT}" \ https://moldyngrid.org/mdsportal/core.php fi fi