def run_script(script_name, args, env_file): '''Setup environment and run script for an arbitrary backend. Knowledge of environment is required.''' script = file(env_file, 'r').read() script += '\n' # Just in case no eof script += 'python %s ' % script_name script += ' '.join(str(a) for a in args) # As long as the python command is the final one, the exception raising should work! job_tools.execute_complex(script, os.getcwd(), True, True)
def run_script_wg(script_name, args): '''Setup environment and run script on WG worker node.''' script = 'module load application/python/2.7.3 \n' # Unsure if any of these are still required script += 'source /opt/exp_software/atlas.glite/setup_WN.sh \n' script += 'export LFC_HOST=lfc.gridpp.rl.ac.uk \n' script += 'export MYPROXY_SERVER=myproxy.westgrid.ca \n' script += 'python %s ' % script_name script += ' '.join(str(a) for a in args) # As long as the python command is the final one, the exception raising should work! job_tools.execute_complex(script, os.getcwd(), True)
def run_script_lcg(script_name, args): '''Setup environment and run script on LCG worker node.''' version = check_el_version() # Only needed if CVMFS software is being used script = 'source $VO_SNOPLUS_SNOLAB_CA_SW_DIR/sl' + str(version) + '/env_cvmfs.sh\n' # hack on next line; uncomment for sites where VO_SNOPLUS_SNOLAB_CA_SW_DIR does not point to cvmfs # script = 'source /cvmfs/snoplus.gridpp.ac.uk/sl' + str(version) + '/env_cvmfs.sh\n' script += 'python %s ' % script_name script += ' '.join(str(a) for a in args) # As long as the python command is the final one, the exception raising should work! job_tools.execute_complex(script, os.getcwd(), True)
def run_script_lcg(script_name, args): '''Setup environment and run script on LCG worker node.''' version = check_el_version() # Only needed if CVMFS software is being used script = 'source $VO_SNOPLUS_SNOLAB_CA_SW_DIR/sl' + str( version) + '/env_cvmfs.sh\n' # hack on next line; uncomment for sites where VO_SNOPLUS_SNOLAB_CA_SW_DIR does not point to cvmfs # script = 'source /cvmfs/snoplus.gridpp.ac.uk/sl' + str(version) + '/env_cvmfs.sh\n' script += 'python %s ' % script_name script += ' '.join(str(a) for a in args) # As long as the python command is the final one, the exception raising should work! job_tools.execute_complex(script, os.getcwd(), True)
def compile_rat(): '''Compile local version of RAT''' temp_file = os.path.join(os.getcwd(), 'installerTemp.sh') rat_dir = os.path.join(os.getcwd(), 'rat') command_text = "\ #!/bin/bash\n \ source %s\n \ cd %s\n \ ./configure \n \ source env.sh\n \ scons" % (temp_file, rat_dir) job_tools.execute_complex(command_text) #running locally, seems rat is not executable by default! job_tools.execute('chmod', ['u+x', 'rat/bin/rat'])