Changeset 2fb99de in flex_extract.git for python/submit.py
- Timestamp:
- Sep 20, 2018, 11:56:37 AM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 5d42acd
- Parents:
- 3232589
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/submit.py
r222aa11 r2fb99de 16 16 # - added documentation 17 17 # - minor changes in programming style (for consistence) 18 # - changed path names to variables from config file 19 # - added option for writing mars requests to extra file 20 # additionally,as option without submitting the mars jobs 18 21 # 19 22 # @License: … … 73 76 ''' 74 77 75 called_from_dir = os.getcwd()76 77 78 args = get_cmdline_arguments() 78 79 … … 80 81 c = ControlFile(args.controlfile) 81 82 except IOError: 82 try: 83 c = ControlFile(_config.PATH_LOCAL_PYTHON + args.controlfile) 84 except IOError: 85 print 'Could not read CONTROL file "' + args.controlfile + '"' 86 print 'Either it does not exist or its syntax is wrong.' 87 print 'Try "' + sys.argv[0].split('/')[-1] + \ 88 ' -h" to print usage information' 89 sys.exit(1) 90 91 env_parameter = read_ecenv(c.ecmwfdatadir + 'python/ECMWF_ENV') 83 print('Could not read CONTROL file "' + args.controlfile + '"') 84 print('Either it does not exist or its syntax is wrong.') 85 print('Try "' + sys.argv[0].split('/')[-1] + \ 86 ' -h" to print usage information') 87 sys.exit(1) 88 89 env_parameter = read_ecenv(_config.PATH_ECMWF_ENV) 92 90 c.assign_args_to_control(args) 93 91 c.assign_envs_to_control(env_parameter) 94 c.check_conditions( )92 c.check_conditions(args.queue) 95 93 96 94 # on local side 97 # on ECMWF server this would be the local side 95 # on ECMWF server this would also be the local side 96 called_from_dir = os.getcwd() 98 97 if args.queue is None: 99 98 if c.inputdir[0] != '/': … … 102 101 c.outputdir = os.path.join(called_from_dir, c.outputdir) 103 102 get_mars_data(c) 104 prepare_flexpart(args.ppid, c) 105 normal_exit(c.mailfail, 'Done!') 106 # on ECMWF server 103 if c.request == 0 or c.request == 2: 104 prepare_flexpart(args.ppid, c) 105 normal_exit(c.mailfail, 'FLEX_EXTRACT IS DONE!') 106 else: 107 normal_exit(c.mailfail, 'PRINTING MARS_REQUESTS DONE!') 108 # send files to ECMWF server and install there 107 109 else: 108 110 submit(args.job_template, c, args.queue) … … 117 119 @Input: 118 120 jtemplate: string 119 Job template file for submission to ECMWF. It contains all necessary 121 Job template file from sub-directory "_templates" for 122 submission to ECMWF. It contains all necessary 120 123 module and variable settings for the ECMWF environment as well as 121 124 the job call and mail report instructions. … … 143 146 144 147 # read template file and get index for CONTROL input 145 with open( jtemplate) as f:148 with open(os.path.join(_config.PATH_TEMPLATES, jtemplate)) as f: 146 149 lftext = f.read().split('\n') 147 150 insert_point = lftext.index('EOF') … … 150 153 # --------- create on demand job script ------------------------------------ 151 154 if c.maxstep > 24: 152 print '---- Pure forecast mode! ----'155 print('---- Pure forecast mode! ----') 153 156 else: 154 print '---- On-demand mode! ----' 155 job_file = jtemplate[:-4] + 'ksh' 157 print('---- On-demand mode! ----') 158 job_file = os.path.join(_config.PATH_JOBSCRIPTS, 159 jtemplate[:-4] + 'ksh') 156 160 clist = c.to_list() 157 161 … … 161 165 f.write('\n'.join(lftextondemand)) 162 166 163 result_code =submit_job_to_ecserver(queue, job_file)167 submit_job_to_ecserver(queue, job_file) 164 168 165 169 else: 166 170 # --------- create operational job script ---------------------------------- 167 print '---- Operational mode! ----'168 job_file = jtemplate[:-5] + 'oper.ksh'169 #colist = []171 print('---- Operational mode! ----') 172 job_file = os.path.join(_config.PATH_JOBSCRIPTS, 173 jtemplate[:-5] + 'oper.ksh') 170 174 171 175 if c.maxstep: … … 187 191 f.write('\n'.join(lftextoper)) 188 192 189 result_code =submit_job_to_ecserver(queue, job_file)193 submit_job_to_ecserver(queue, job_file) 190 194 191 195 # -------------------------------------------------------------------------- 192 print 'You should get an email with subject flex.hostname.pid'196 print('You should get an email with subject flex.hostname.pid') 193 197 194 198 return
Note: See TracChangeset
for help on using the changeset viewer.