Difference between revisions of "ARC CE Tips"
From GridPP Wiki
(4 intermediate revisions by one user not shown) | |||
Line 3: | Line 3: | ||
== Setup for LHCb == | == Setup for LHCb == | ||
− | A default runtime environment must be setup. This can be done by adding the following line to the | + | A default runtime environment must be setup which creates up an environment variable containing the queue name. This can be done by adding the following line to the [grid-manager] section of ''/etc/arc.conf'': |
authplugin="PREPARING timeout=60,onfailure=pass,onsuccess=pass /usr/local/bin/default_rte_plugin.py %S %C %I ENV/GLITE" | authplugin="PREPARING timeout=60,onfailure=pass,onsuccess=pass /usr/local/bin/default_rte_plugin.py %S %C %I ENV/GLITE" | ||
Line 9: | Line 9: | ||
This sets ENV/GLITE as a default runtime environment. The file ''/usr/local/bin/default_rte_plugin.py'' is: | This sets ENV/GLITE as a default runtime environment. The file ''/usr/local/bin/default_rte_plugin.py'' is: | ||
− | #!/usr/bin/python | + | #!/usr/bin/python<br> |
− | + | """Usage: default_rte_plugin.py <status> <control dir> <jobid> <runtime environment><br> | |
− | """Usage: default_rte_plugin.py <status> <control dir> <jobid> <runtime environment> | + | Authplugin for PREPARING STATE<br> |
− | + | Example:<br> | |
− | Authplugin for PREPARING STATE | + | authplugin="PREPARING timeout=60,onfailure=pass,onsuccess=pass /usr/local/bin/default_rte_plugin.py %S %C %I <rte>"<br> |
− | + | """<br> | |
− | Example: | + | |
− | + | ||
− | authplugin="PREPARING timeout=60,onfailure=pass,onsuccess=pass /usr/local/bin/default_rte_plugin.py %S %C %I <rte>" | + | |
− | + | ||
− | """ | + | |
− | + | ||
def ExitError(msg,code): | def ExitError(msg,code): | ||
"""Print error message and exit""" | """Print error message and exit""" | ||
from sys import exit | from sys import exit | ||
print(msg) | print(msg) | ||
− | exit(code) | + | exit(code)<br> |
− | + | def SetDefaultRTE(control_dir, jobid, default_rte):<br> | |
− | def SetDefaultRTE(control_dir, jobid, default_rte): | + | from os.path import isfile<br> |
− | + | desc_file = '%s/job.%s.description' %(control_dir,jobid)<br> | |
− | from os.path import isfile | + | |
− | + | ||
− | desc_file = '%s/job.%s.description' %(control_dir,jobid) | + | |
− | + | ||
if not isfile(desc_file): | if not isfile(desc_file): | ||
− | ExitError("No such description file: %s"%desc_file,1) | + | ExitError("No such description file: %s"%desc_file,1)<br> |
− | + | ||
f = open(desc_file) | f = open(desc_file) | ||
desc = f.read() | desc = f.read() | ||
− | f.close() | + | f.close()<br> |
− | + | ||
if default_rte not in desc: | if default_rte not in desc: | ||
with open(desc_file, "a") as myfile: | with open(desc_file, "a") as myfile: | ||
− | myfile.write("( runtimeenvironment = \"" + default_rte + "\" )") | + | myfile.write("( runtimeenvironment = \"" + default_rte + "\" )")<br> |
− | + | return 0<br> | |
− | return 0 | + | |
− | + | ||
def main(): | def main(): | ||
− | """Main""" | + | """Main"""<br> |
− | + | import sys<br> | |
− | import sys | + | # Parse arguments<br> |
− | + | ||
− | # Parse arguments | + | |
− | + | ||
if len(sys.argv) == 5: | if len(sys.argv) == 5: | ||
(exe, status, control_dir, jobid, default_rte) = sys.argv | (exe, status, control_dir, jobid, default_rte) = sys.argv | ||
Line 63: | Line 46: | ||
if __name__ == "__main__": | if __name__ == "__main__": | ||
main() | main() | ||
+ | |||
+ | The ENV/GLITE runtime environment should then contain the following in addition to any existing contents: | ||
+ | |||
+ | if [ "x$1" = "x0" ]; then | ||
+ | # Set environment variable containing queue name | ||
+ | env_idx=0 | ||
+ | env_var="joboption_env_$env_idx" | ||
+ | while [ -n "${!env_var}" ]; do | ||
+ | env_idx=$((env_idx+1)) | ||
+ | env_var="joboption_env_$env_idx" | ||
+ | done | ||
+ | eval joboption_env_$env_idx="NORDUGRID_ARC_QUEUE=$joboption_queue" | ||
+ | fi |
Latest revision as of 12:48, 13 May 2014
Setup to allow gLite-WMS jobs to run
Create an empty file /usr/etc/globus-user-env.sh on all worker nodes.
Setup for LHCb
A default runtime environment must be setup which creates up an environment variable containing the queue name. This can be done by adding the following line to the [grid-manager] section of /etc/arc.conf:
authplugin="PREPARING timeout=60,onfailure=pass,onsuccess=pass /usr/local/bin/default_rte_plugin.py %S %C %I ENV/GLITE"
This sets ENV/GLITE as a default runtime environment. The file /usr/local/bin/default_rte_plugin.py is:
#!/usr/bin/python
"""Usage: default_rte_plugin.py <status> <control dir> <jobid> <runtime environment>
Authplugin for PREPARING STATE
Example:
authplugin="PREPARING timeout=60,onfailure=pass,onsuccess=pass /usr/local/bin/default_rte_plugin.py %S %C %I <rte>"
"""
def ExitError(msg,code): """Print error message and exit""" from sys import exit print(msg) exit(code)
def SetDefaultRTE(control_dir, jobid, default_rte):
from os.path import isfile
desc_file = '%s/job.%s.description' %(control_dir,jobid)
if not isfile(desc_file): ExitError("No such description file: %s"%desc_file,1)
f = open(desc_file) desc = f.read() f.close()
if default_rte not in desc: with open(desc_file, "a") as myfile: myfile.write("( runtimeenvironment = \"" + default_rte + "\" )")
return 0
def main(): """Main"""
import sys
# Parse arguments
if len(sys.argv) == 5: (exe, status, control_dir, jobid, default_rte) = sys.argv else: ExitError("Wrong number of arguments\n"+__doc__,1)
if status == "PREPARING": SetDefaultRTE(control_dir, jobid, default_rte) sys.exit(0)
sys.exit(1)
if __name__ == "__main__": main()
The ENV/GLITE runtime environment should then contain the following in addition to any existing contents:
if [ "x$1" = "x0" ]; then # Set environment variable containing queue name env_idx=0 env_var="joboption_env_$env_idx" while [ -n "${!env_var}" ]; do env_idx=$((env_idx+1)) env_var="joboption_env_$env_idx" done eval joboption_env_$env_idx="NORDUGRID_ARC_QUEUE=$joboption_queue" fi