Skip to content
Snippets Groups Projects
Commit 2ff8133c authored by Peters, Wouter's avatar Peters, Wouter
Browse files

slight changes to job running structure on maunaloa

parent 9425e3a0
No related branches found
No related tags found
No related merge requests found
......@@ -14,14 +14,63 @@ import os
import logging
import subprocess
from da.baseclasses.platform import PlatForm
from da.baseclasses.platform import PlatForm, std_joboptions
class MaunaloaPlatForm(PlatForm):
def __init__(self):
self.Identifier = 'WUR maunaloa' # the identifier gives the platform name
self.Identifier = 'WU maunaloa' # the identifier gives the platform name
self.Version = '1.0' # the platform version used
def GetJobTemplate(self,joboptions={},block=False):
"""
Returns the job template for a given computing system, and fill it with options from the dictionary provided as argument.
The job template should return the preamble of a job that can be submitted to a queue on your platform,
examples of popular queuing systems are:
- SGE
- MOAB
- XGrid
-
A list of job options can be passed through a dictionary, which are then filled in on the proper line,
an example is for instance passing the dictionary {'account':'co2'} which will be placed
after the ``-A`` flag in a ``qsub`` environment.
An extra option ``block`` has been added that allows the job template to be configured to block the current
job until the submitted job in this template has been completed fully.
"""
template = """## \n"""+ \
"""## This is a set of dummy names, to be replaced by values from the dictionary \n"""+ \
"""## Please make your own platform specific template with your own keys and place it in a subfolder of the da package.\n """+ \
"""## \n"""+ \
""" \n"""+ \
"""#$ jobname \n"""+ \
"""#$ jobaccount \n"""+ \
"""#$ jobnodes \n"""+ \
"""#$ jobtime \n"""+ \
"""#$ jobshell \n"""+ \
"""\n"""+ \
"""source /usr/local/Modules/3.2.8/init/sh\n"""+ \
"""module load python\n"""+ \
"""\n"""
if 'depends' in joboptions:
template += """#$ -hold_jid depends \n"""
# First replace from passed dictionary
for k,v in joboptions.iteritems():
while k in template:
template = template.replace(k,v)
# Fill remaining values with std_options
for k,v in std_joboptions.iteritems():
while k in template:
template = template.replace(k,v)
return template
msg1 = 'Platform initialized: %s'%self.Identifier ; logging.info(msg1)
#msg2 = '%s version: %s'%(self.Identifier,self.Version) ; logging.info(msg2)
......
......@@ -644,8 +644,8 @@ class CycleControl(dict):
# Template and commands for job
jobparams = {'jobname':sys.argv[0][2:],'jobtime':'01:30:00'}
template = DaPlatForm.GetJobTemplate(jobparams)
template += '\ncd %s\n'% self['dir.da_submit']
template += '%s rc=%s %s >& %s' % (sys.argv[0],self['da.restart.fname'],join(self.opts,''),logfile,)
execcommand = os.path.join(self['dir.da_submit'],sys.argv[0])
template += 'python %s rc=%s %s >& %s' % (execcommand,self['da.restart.fname'],join(self.opts,''),logfile,)
# write and submit
......
......@@ -3,6 +3,7 @@
#$ nserial 1
#$ 01:30:00
#$ /bin/sh
echo "All output piped to file das.out"
/opt/local/bin/python2.6 das.py rc=da.rc $1 >& das.out
module load python
python das.py rc=da.rc $1 >& das.out
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment