Skip to content
Snippets Groups Projects
Commit 0540bd0a authored by Anne Tipka's avatar Anne Tipka :headphones:
Browse files

added option to provide event(ECMWF trigger events) information to CONTROL...

added option to provide event(ECMWF trigger events) information to CONTROL files and start the job in operational mode
parent 7d77efaf
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,9 @@
# - update default makefile to None
# August 2020 - Leopold Haimberger
# - added a class parameter for system installation path
# October 2022 - Anne Tipka (previously Philipp)
# - added class parameter for packingType (compression) of grib messages
# - added class parameter for event trigger for time critical jobs
#
# @License:
# (C) Copyright 2014-2020.
......@@ -332,6 +335,13 @@ class ControlFile(object):
Switch to select the calculation of extra ensemble members for the
ELDA stream. It doubles the amount of retrieved ensemble members.
eventid : int
Id for one of the events for time critical jobs 1 at ECMWF servers.
eventjobname : str
The name the ecaccess-job-submit command will be given.
This is how the job will be recognized in the list of jobs.
logicals : list of str
List of the names of logical switches which controls the flow
of the program. Default list is ['gauss', 'omega', 'omegadiff', 'eta',
......@@ -425,6 +435,8 @@ class ControlFile(object):
self.purefc = 0
self.rrint = 0
self.doubleelda = 0
self.eventid = None
self.eventjobname = ''
self.logicals = ['gauss', 'omega', 'omegadiff', 'eta', 'etadiff',
'dpdeta', 'cwc', 'wrf', 'ecstorage',
......
......@@ -704,7 +704,7 @@ def submit_sbatch_job(jobname):
print('SUBMITTED SBATCH JOB ',jobname)
return job_id.decode()
def submit_job_to_ecserver(target, jobname):
def submit_job_to_ecserver(target, jobfile):
'''Uses ecaccess-job-submit command to submit a job to the ECMWF server.
Note
......@@ -718,7 +718,7 @@ def submit_job_to_ecserver(target, jobname):
target : str
The target where the file should be sent to, e.g. the queue.
jobname : str
jobfile : str
The name of the jobfile to be submitted to the ECMWF server.
Return
......@@ -729,7 +729,64 @@ def submit_job_to_ecserver(target, jobname):
try:
job_id = subprocess.check_output(['ecaccess-job-submit', '-queueName',
target, jobname])
target, jobfile])
except subprocess.CalledProcessError as e:
print('... ERROR CODE: ' + str(e.returncode))
print('... ERROR MESSAGE:\n \t ' + str(e))
print('\n... Do you have a valid ecaccess certification key?')
sys.exit('... ecaccess-job-submit FAILED!')
except OSError as e:
print('... ERROR CODE: ' + str(e.errno))
print('... ERROR MESSAGE:\n \t ' + str(e.strerror))
print('\n... Most likely the ECACCESS library is not available!')
sys.exit('... ecaccess-job-submit FAILED!')
return job_id.decode()
def submit_eventjob_to_ecserver(target, jobfile, eventid, jobname, ecuid):
'''Uses ecaccess-job-submit command to submit a job to the ECMWF server.
Note
----
The return value is just for testing reasons. It does not have
to be used from the calling function since the whole error handling
is done in here.
Parameters
----------
target : str
The target where the file should be sent to, e.g. the queue.
jobfile : str
The name of the jobfile to be submitted to the ECMWF server.
eventid : int
The id number from an event listed by ECMWF through ecaccess-event-list.
jobname : str
The name of the job, helps to distingush between jobs.
Will be shown in the queue and list of jobs.
ecuid : str
The user id on ECMWF server.
Return
------
job_id : int
The id number of the job as a reference at the ECMWF server.
'''
try:
job_id = subprocess.check_output(['ecaccess-job-submit',
'-queueName', target, '-jobName', jobname,
'-onStart', '-onSuccess', '-onFailure',
'-onRetry', '-retryCount', '5',
'-mailTo', ecuid,
'-eventIds', eventid,
jobfile])
except subprocess.CalledProcessError as e:
print('... ERROR CODE: ' + str(e.returncode))
......
......@@ -201,7 +201,10 @@ def submit(jtemplate, c, queue):
mk_jobscript(jtemplate, job_file, clist)
job_id = submit_job_to_ecserver(queue, job_file)
#job_id = submit_job_to_ecserver(queue, job_file)
job_id = submit_eventjob_to_ecserver(queue, c.eventjobname,
c.eventid, c.ecuid)
print('The job id is: ' + str(job_id.strip()))
print('You should get an email per job with subject flex.hostname.pid')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment