# # DESCRIPTION moldyn-old Old MolDynGrid portal interface \(only supports gromacs-md software\) # source ${MDS_LIBEXEC_PATH}/manual-http.sh # works with "gromacs-md" software ONLY [ "$MDS_SOFTWARE" != "gromacs-md" ] && exit_error "OLD MolDynGrid Portal module works only with Gromacs MD software." portal_usage () { echo_g "MOLDYNGRID OLD PORTAL OPTIONS:" echo_y -e "\t--noautostageout" echo -e "\t\tdisable results autostageout to grid storages" } portal_parse_cmd_options () { case $1 in --noautostageout) DISABLE_SE=1 PARSED_BY_MODULE=1 ;; esac } portal_gen_params () { cat < $params_tmp http_multipart_post_body "params" "$params_tmp" "params" rm -f $params_tmp fi not_passed=$( mktemp moldynsub.XXXXXXXX ) echo "NOT PASSED" > $not_passed [ -f "${PDB}" ] && pdb_t=$PDB || pdb_t=$not_passed [ -f "${GI_MDP}" ] && gi_mdp_t=${GI_MDP} || gi_mdp_t=$not_passed [ -f "${EM_MDP}" ] && em_mdp_t=${EM_MDP} || em_mdp_t=$not_passed [ -f "${PR_MDP}" ] && pr_mdp_t=${PR_MDP} || pr_mdp_t=$not_passed [ -f "${MD_MDP}" ] && md_mdp_t=${MD_MDP} || md_mdp_t=$not_passed http_multipart_post_body "pdb" "$pdb_t" "pdb" http_multipart_post_body "gi_mdp" "$gi_mdp_t" "mdps" http_multipart_post_body "em_mdp" "$em_mdp_t" "mdps" http_multipart_post_body "pr_mdp" "$pr_mdp_t" "mdps" http_multipart_post_body "md_mdp" "$md_mdp_t" "mdps" if [ "x${EM2_MDP}" != "x" ]; then [ -f "${EM2_MDP}" ] && em2_mdp_t=${EM2_MDP} || em2_mdp_t=$not_passed http_multipart_post_body "em2_mdp" "$em2_mdp_t" "mdps" fi http_multipart_post_body "jobid" "$( cat ${JOBIDFILE} )" "var" http_multipart_post_body "portaljid" "${PortalJID}" "var" http_multipart_post_body "reqtype" "JOBPARAMS" "var" } function GetPortalJID { http_multipart_post_body "proxy" "${X509_USER_PROXY}" "pem" http_multipart_post_body "reqtype" "QUERYJID" "var" http_multipart_post_body "jobname" "$( echo ${JOBNAME} | sed 's/[^-0-9a-zA-Z_]/_/g' )" "var" } function GetOldJID { http_multipart_post_body "proxy" "${X509_USER_PROXY}" "pem" if [ -f ${MDS_PARAMS} ]; then params_tmp=$( mktemp moldynsub.XXXXXXXX ) cat ${MDS_PARAMS} | sed 's/^PortalJID=.*/PortalJID=XXXXX/' > $params_tmp http_multipart_post_body "params" "$params_tmp" "params" rm -f $params_tmp fi http_multipart_post_body "md_mdp" "${MD_MDP}" "mdps" http_multipart_post_body "reqtype" "GETOLDJID" "var" http_multipart_post_body "portaljid" "${PortalJID}" "var" } function JobChpoxHTTPReq { http_multipart_post_body "proxy" "${X509_USER_PROXY}" "pem" http_multipart_post_body "reqtype" "CHPOXJID" "var" http_multipart_post_body "jobid" "$( cat ${JOBIDFILE} )" "var" http_multipart_post_body "portaljid" "${PortalJID}" "var" } # # Connect function # function PortalConnect { local body_gen_f=$1 echo -n "Connecting to MolDynGrid VL portal server... "; SERVER_CERT_CHECK=$( https_check_server_cert $PORTAL_CONNECT ) if [ "x${SERVER_CERT_CHECK}" == "x0" ]; then echo_good "Ok." echo "Sending data..." body_f=$( mktemp moldynsub.XXXXXXXX ) $body_gen_f > $body_f https_multipart_post $PORTAL_CONNECT $PORTAL_HOST $PORTAL_URL $body_f rm -f $body_f else echo_bad -e "Failed." echo -n "MolDynGrid server certificate check failed with errno ${SERVER_CERT_CHECK}. It is posible that someone trying to capture your private data or internet connection failed. No information will be sent to server." exit_error " Halted. " fi } # # Output parsing function # function ProcessPortalOutput { # paramaters passed through ENV: NEED_RESP_VARS # tWO LINe of server certificate check output read LINE echo "echo -e \"$LINE\"; " read LINE echo "echo -e \"$LINE\"; " # HTTP responce code (must be 200) read LINE if [ "x`echo ${LINE} | cut -d ' ' -f 2`" == "x200" ]; then RET_FOR_EVAL="" while read LINE; do # Search all vars from list and add to return value (also add echo statements for some output) for resp_var in ${NEED_RESP_VARS} "echo"; do if [ "${LINE#$resp_var}" != "${LINE}" ]; then RET_FOR_EVAL="${RET_FOR_EVAL} ${LINE};" fi done done else if [ "x$LINE" != "x" ]; then echo "\$COLOR_DEF;" echo "echo -n \"Server respond: \";" echo "\$COLOR_R;" echo "echo -e \"${LINE}\nHalted.\";" echo "\$COLOR_DEF &&" fi RET_FOR_EVAL="exit 1" fi # Return string of values for eval echo "${RET_FOR_EVAL}" } add_JID_to_params () { if [ "x`cat ${MDS_PARAMS} | grep 'THIS IS AUTOMATICALY GENERATED PORTAL JOB IDENTIFIER'`" == "x" ]; then cat >> ${MDS_PARAMS} <