Changeset 0540bd0 in flex_extract.git for Source/Python/Mods/tools.py
- Timestamp:
- Oct 25, 2022, 8:48:28 AM (18 months ago)
- Branches:
- dev
- Children:
- 6e16c9d
- Parents:
- 7d77efa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Source/Python/Mods/tools.py
r73d2e4e r0540bd0 705 705 return job_id.decode() 706 706 707 def submit_job_to_ecserver(target, job name):707 def submit_job_to_ecserver(target, jobfile): 708 708 '''Uses ecaccess-job-submit command to submit a job to the ECMWF server. 709 709 … … 719 719 The target where the file should be sent to, e.g. the queue. 720 720 721 job name : str721 jobfile : str 722 722 The name of the jobfile to be submitted to the ECMWF server. 723 723 … … 730 730 try: 731 731 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 749 def 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]) 733 790 734 791 except subprocess.CalledProcessError as e:
Note: See TracChangeset
for help on using the changeset viewer.