Changeset 0540bd0 in flex_extract.git


Ignore:
Timestamp:
Oct 25, 2022, 8:48:28 AM (17 months ago)
Author:
Anne Tipka <anne.tipka@…>
Branches:
dev
Children:
6e16c9d
Parents:
7d77efa
Message:

added option to provide event(ECMWF trigger events) information to CONTROL files and start the job in operational mode

Location:
Source/Python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Source/Python/Classes/ControlFile.py

    rb9ce98c r0540bd0  
    2323#   August 2020 - Leopold Haimberger
    2424#        - added a class parameter for system installation path
     25#   October 2022 - Anne Tipka (previously Philipp)
     26#        - added class parameter for packingType (compression) of grib messages
     27#        - added class parameter for event trigger for time critical jobs
    2528#
    2629# @License:
     
    332335        Switch to select the calculation of extra ensemble members for the
    333336        ELDA stream. It doubles the amount of retrieved ensemble members.
     337
     338    eventid : int
     339        Id for one of the events for time critical jobs 1 at ECMWF servers.
     340
     341    eventjobname : str
     342        The name the ecaccess-job-submit command will be given.
     343        This is how the job will be recognized in the list of jobs.
    334344
    335345    logicals : list of str
     
    426436        self.rrint = 0
    427437        self.doubleelda = 0
     438        self.eventid = None
     439        self.eventjobname = ''
    428440
    429441        self.logicals = ['gauss', 'omega', 'omegadiff', 'eta', 'etadiff',
  • Source/Python/Mods/tools.py

    r73d2e4e r0540bd0  
    705705    return job_id.decode()
    706706
    707 def submit_job_to_ecserver(target, jobname):
     707def submit_job_to_ecserver(target, jobfile):
    708708    '''Uses ecaccess-job-submit command to submit a job to the ECMWF server.
    709709
     
    719719        The target where the file should be sent to, e.g. the queue.
    720720
    721     jobname : str
     721    jobfile : str
    722722        The name of the jobfile to be submitted to the ECMWF server.
    723723
     
    730730    try:
    731731        job_id = subprocess.check_output(['ecaccess-job-submit', '-queueName',
    732                                           target, jobname])
     732                                          target, jobfile])
     733
     734    except subprocess.CalledProcessError as e:
     735        print('... ERROR CODE: ' + str(e.returncode))
     736        print('... ERROR MESSAGE:\n \t ' + str(e))
     737
     738        print('\n... Do you have a valid ecaccess certification key?')
     739        sys.exit('... ecaccess-job-submit FAILED!')
     740    except OSError as e:
     741        print('... ERROR CODE: ' + str(e.errno))
     742        print('... ERROR MESSAGE:\n \t ' + str(e.strerror))
     743
     744        print('\n... Most likely the ECACCESS library is not available!')
     745        sys.exit('... ecaccess-job-submit FAILED!')
     746
     747    return job_id.decode()
     748
     749def submit_eventjob_to_ecserver(target, jobfile, eventid, jobname, ecuid):
     750    '''Uses ecaccess-job-submit command to submit a job to the ECMWF server.
     751
     752    Note
     753    ----
     754    The return value is just for testing reasons. It does not have
     755    to be used from the calling function since the whole error handling
     756    is done in here.
     757
     758    Parameters
     759    ----------
     760    target : str
     761        The target where the file should be sent to, e.g. the queue.
     762
     763    jobfile : str
     764        The name of the jobfile to be submitted to the ECMWF server.
     765
     766    eventid : int
     767        The id number from an event listed by ECMWF through ecaccess-event-list.
     768
     769    jobname : str
     770        The name of the job, helps to distingush between jobs.
     771        Will be shown in the queue and list of jobs.
     772
     773    ecuid : str
     774        The user id on ECMWF server.
     775
     776    Return
     777    ------
     778    job_id : int
     779        The id number of the job as a reference at the ECMWF server.
     780    '''
     781
     782    try:
     783        job_id = subprocess.check_output(['ecaccess-job-submit',
     784                                          '-queueName', target, '-jobName', jobname,
     785                                          '-onStart', '-onSuccess', '-onFailure',
     786                                          '-onRetry', '-retryCount', '5',
     787                                          '-mailTo', ecuid,
     788                                          '-eventIds', eventid,
     789                                          jobfile])
    733790
    734791    except subprocess.CalledProcessError as e:
  • Source/Python/submit.py

    r47be2684 r0540bd0  
    202202        mk_jobscript(jtemplate, job_file, clist)
    203203
    204         job_id = submit_job_to_ecserver(queue, job_file)
     204        #job_id = submit_job_to_ecserver(queue, job_file)
     205        job_id = submit_eventjob_to_ecserver(queue, c.eventjobname,
     206                                             c.eventid, c.ecuid)
     207
    205208        print('The job id is: ' + str(job_id.strip()))
    206209
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG