1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
.. _checking_job_generation:
Checking Job Generation
///////////////////////
Job generation involves the following processes:
- Locating the '.ecf' files
- Locating the includes files specified in the '.ecf' file
- Removing comment and manual pre-processor statements
- Variable substitution
- Creating the job file on disk
This is what the ecflow_server does when submitting your task/job.
This process can be checked **BEFORE** loading the suite to the server,
by using the :ref:`python_api`. Since this API is used for checking, the jobs are all
generated with the extension '.job0'. The following example checks job
generation fo all tasks.
.. code-block:: python
:caption: Default
defs = ecflow.Defs("my.def") # load file 'my.def' into memory, not needed if the defs was created in python
msg = defs.check_job_creation() # job files generated to ECF_JOB
print(msg)
For brevity, the following examples do not show how the 'defs' object
was created. This can be read in from disk as shown above or created
directly in python.
.. code-block:: python
:caption: Checking of job generation for all tasks under '/suite/to_check'
job_ctrl = ecflow.JobGenCtrl()
job_ctrl.set_node_path("/suite/to_check") # hierarchical job generation under /suite/to_check
defs.check_job_generation(job_ctrl) # do the check
print(job_ctrl.get_error_msg())
This example shows the checking of job generation for all tasks, but
where the jobs are generated to a user-specified directory. i.e.
'/tmp/ECF_NAME.job0'.
.. code-block:: python
:caption: Generated jobs to a user specified directory
job_ctrl = ecflow.JobGenCtrl()
job_ctrl.set_dir_for_job_generation("/tmp") # generate jobs file under this directory
defs.check_job_generation(job_ctrl) # do the check
print(job_ctrl.get_error_msg()) # report any errors in job generation
This example show job checking to an automatically generated temporary
directory $TMPDIR/ecf_check_job_generation/ECF_NAME.job0
.. code-block:: python
:caption: Generate temporary directory
job_ctrl = ecflow.JobGenCtrl()
job_ctrl.generate_temp_dir()
defs.check_job_generation(job_ctrl)
print(job_ctrl.get_error_msg())
|