diff --git a/da/tools/initexit.py b/da/tools/initexit.py index 4821ed74757f9b75475724499c4daf05da087b09..8ea0e7f3220e618d86f735e7b6214292eb9d6619 100755 --- a/da/tools/initexit.py +++ b/da/tools/initexit.py @@ -489,15 +489,18 @@ class CycleControl(object): import os + DaPlatForm = self.DaPlatForm + if self.da_settings['time.start'] < self.da_settings['time.finish']: - #code = subprocess.call(['qsub',sys.argv[0],'rc=%s' % rc_da_shell['da.restart.fname']] ) - code = subprocess.Popen([os.getcwd()+'/das.py','rc=%s' % self.da_settings['da.restart.fname'],"process=all"] ) - code=0 - if code == 0: - logging.info('Submitted next cycle succesfully ') - else: - logging.error('Error in submitting next cycle, return code: %s ' % code) - raise OSError + + cd = self.da_settings['time.end'].strftime('%Y%m%d') + jobparams = {'jobname':'das.%s'%cd,'jobaccount':'co2','jobnodes':'nserial 1','jobtime':'00:30:00','jobshell':'/bin/sh'} + template = DaPlatForm.GetJobTemplate(jobparams) + template += 'cd %s\n'%os.getcwd() + template += './das.py','rc=%s' % self.da_settings['da.restart.fname'] + + jobfile = DaPlatForm.WriteJob(self,template,'cycle.%s.das'%cd) + jobid = DaPlatForm.SubmitJob(jobfile) else: logging.info('Final date reached, no new cycle started')