#!/bin/bash ################################################################# # # # MolDynGrid CLI job submittion # # # # Written by Andrii Salnikov a.k.a Manf # # E-mail: manf@grid.org.ua # # Parallel Computing Lab, Inforamtion and Computer Center, # # Kyiv National Taras Schevchenko University # # # ################################################################# # # CHANGELOG # # 2.3.1 - ability to disable auto results upload to SE # - npme mdrun option for MD # - SAVE_INPUTS_AS_OUTPUTS for input .mdp files # - client side input files check # 2.4 - empty JOBNAME fix # - portal required files fix # - g_tune_pme intergarion for gromacs 4.5.x (MD_NPME="g_tune_pme") # 3.0 - completely new modular architecture # - modules for gromacs/oldngclients/xrsl/oldportal # 3.1 - staging data to storage before submission (MDS_JOBS_STAGING) # - staging output files to job dir # - defaults are changed to new interfaces usage # - processing of CPUs moved to jobdescription processing from software # - NAMD (with optional GPU acceleration) support # - GROMACS mdrun-only computation support # - Proxy generation parameters now in 'params' # 3.2 - Bugfixes for chekpointing # 4.0 - Staging on WN (for FedCloud and HTCondor cases) # 5.0 - PBS and HTCondor support VERSION="5.0" MDS_CONFIG_LOCATION=${MDS_CONFIG_LOCATION:-/opt/moldynsub/etc/moldynsub.conf} # source moldynsub configuration file if [ -f "$MDS_CONFIG_LOCATION" ]; then source "$MDS_CONFIG_LOCATION" else echo "ERROR: Cannot find MolDynSyb CLI configuration file $MDS_CONFIG_LOCATION" exit 1 fi # necessary defaults in case of not defined in the configuration file MDS_LIBEXEC_PATH=${MDS_LIBEXEC_PATH:-/usr/libexec/moldynsub/} MDS_DEFAULT_SOFTWARE=${MDS_DEFAULT_SOFTWARE:-gromacs-md-mdrun} MDS_DEFAULT_INFRASTRUCTURE=${MDS_DEFAULT_INFRASTRUCTURE:-arc} MDS_DEFAULT_PORTAL=${MDS_DEFAULT_PORTAL:-moldyngrid} # common modules source source "${MDS_LIBEXEC_PATH}/colors.sh" source "${MDS_LIBEXEC_PATH}/common.sh" # parse command line options and source software/infrastructure/protal modules parse_cmd_options $@ # source params file source_params # set necessary software-specific environment variables set_software_environment set_software_grid_environment # define some project filenames to be created SUBMITDATE=$( date +%Y%m%d%H%M%S ) EXECUTABLE="moldynsub.${SUBMITDATE}.script" SUBMITLOG="moldynsub.${SUBMITDATE}.submit.log" JDESCFILE="moldynsub.${SUBMITDATE}.$(get_jobdescription_type)" JOBIDFILE="moldynsub.${SUBMITDATE}.jobid" # create grid-proxy generate_proxy # contact portal before job submission [ -z "${DISABLEPORTAL}" -a -z "${DRYRUN}" ] && portal_connect_pre # create input files list for software create_input_files_list # if defined run pre-stages of exec generation [ -n "$(type -t create_pre_exec)" ] && create_pre_exec > $EXECUTABLE # generate main executable to be run on worker node create_executable >> $EXECUTABLE # opptionally apply wrapper function if defined [ -n "$(type -t job_wrap)" ] && job_wrap # create output files list for software create_output_files_list ${STAGEOUT_URL} # if defined run post-stages of exec generation [ -n "$(type -t create_post_exec)" ] && create_post_exec >> $EXECUTABLE # generate grid job-description file for choosen infrastructure gen_job_description $JDESCFILE # and optionally upload job files to storage [ -n "$MDS_JOBS_STAGING" -a -z "${DRYRUN}" ] && stage_in_files # submit job to choosen grid-infrastructure [ -z "${DRYRUN}" ] && grid_job_submit $JDESCFILE $JOBIDFILE $EXECUTABLE # connect portal after submission [ -z "${DISABLEPORTAL}" -a -z "${DRYRUN}" ] && portal_connect_post