pyiron_base.jobs.master.generic module
The GenericMaster is the template class for all meta jobs
- class pyiron_base.jobs.master.generic.GenericMaster(project, job_name)
Bases:
GenericJob
The GenericMaster is the template class for all meta jobs - meaning all jobs which contain multiple other jobs. It defines the shared functionality of the different kind of job series.
- Parameters:
project (ProjectHDFio) – ProjectHDFio instance which points to the HDF5 file the job is stored in
job_name (str) – name of the job, which has to be unique within the project
- .. attribute:: job_name
name of the job, which has to be unique within the project
- .. attribute:: status
- execution status of the job, can be one of the following [initialized, appended, created, submitted,
running, aborted, collect, suspended, refresh, busy, finished]
- .. attribute:: job_id
unique id to identify the job in the pyiron database
- .. attribute:: parent_id
job id of the predecessor job - the job which was executed before the current one in the current job series
- .. attribute:: master_id
- job id of the master job - a meta job which groups a series of jobs, which are executed either in parallel
or in serial.
- .. attribute:: child_ids
list of child job ids - only meta jobs have child jobs - jobs which list the meta job as their master
- .. attribute:: project
Project instance the jobs is located in
- .. attribute:: project_hdf5
ProjectHDFio instance which points to the HDF5 file the job is stored in
- .. attribute:: job_info_str
short string to describe the job by it is job_name and job ID - mainly used for logging
- .. attribute:: working_directory
working directory of the job is executed in - outside the HDF5 file
- .. attribute:: path
path to the job as a combination of absolute file system path and path within the HDF5 file.
- .. attribute:: version
Version of the hamiltonian, which is also the version of the executable unless a custom executable is used.
- .. attribute:: executable
Executable used to run the job - usually the path to an external executable.
- .. attribute:: library_activated
For job types which offer a Python library pyiron can use the python library instead of an external executable.
- .. attribute:: server
Server object to handle the execution environment for the job.
- .. attribute:: queue_id
the ID returned from the queuing system - it is most likely not the same as the job ID.
- .. attribute:: logger
logger object to monitor the external execution and internal pyiron warnings.
- .. attribute:: restart_file_list
list of files which are used to restart the calculation from these files.
- .. attribute:: exclude_nodes_hdf
list of nodes which are excluded from storing in the hdf5 file.
- .. attribute:: exclude_groups_hdf
list of groups which are excluded from storing in the hdf5 file.
- .. attribute:: job_type
- Job type object with all the available job types: [‘ExampleJob’, ‘ParallelMaster’,
‘ScriptJob’, ‘ListMaster’]
- .. attribute:: child_names
Dictionary matching the child ID to the child job name.
- append(job)
Append a job to the GenericMaster - just like you would append an element to a list.
- Parameters:
job (GenericJob) – job to append
- child_hdf(job_name)
Find correct HDF for new children. Depending on self.server.new_hdf this creates a new hdf file or creates the group in the file of this job.
- Parameters:
job_name (str) – name of the new job
- Returns:
HDF file for new child job, can be assigned to its
project_hdf5
- Return type:
- property child_ids
list of child job ids - only meta jobs have child jobs - jobs which list the meta job as their master
- Returns:
list of child job ids
- Return type:
list
- property child_names
Dictionary matching the child ID to the child job name
- Returns:
{child_id: child job name }
- Return type:
dict
- first_child_name()
Get the name of the first child job
- Returns:
name of the first child job
- Return type:
str
- from_hdf(hdf=None, group_name=None)
Restore the GenericMaster from an HDF5 file
- Parameters:
hdf (ProjectHDFio) – HDF5 group object - optional
group_name (str) – HDF5 subgroup name - optional
- get_child_cores()
Calculate the currently active number of cores, by summarizing all childs which are neither finished nor aborted.
- Returns:
number of cores used
- Return type:
(int)
- property input
- interactive_close()
Not implemented for MetaJobs.
- interactive_fetch()
Not implemented for MetaJobs.
- interactive_flush(path='generic', include_last_step=True)
Not implemented for MetaJobs.
- property job_object_dict
internal cache of currently loaded jobs
- Returns:
Dictionary of currently loaded jobs
- Return type:
dict
- move_to(project)
Move the content of the job including the HDF5 file to a new location
- Parameters:
project (ProjectHDFio) – project to move the job to
- Returns:
JobCore object pointing to the new location.
- Return type:
- pop(i=-1)
Pop a job from the GenericMaster - just like you would pop an element from a list
- Parameters:
i (int) – position of the job. (Default is last element, -1.)
- Returns:
job
- Return type:
- run_if_interactive_non_modal()
Not implemented for MetaJobs.
- set_child_id_func(child_id_func)
Add an external function to derive a list of child IDs - experimental feature
- Parameters:
child_id_func (Function) – Python function which returns the list of child IDs
- set_input_to_read_only()
This function enforces read-only mode for the input classes, but it has to be implemented in the individual classes.
- to_hdf(hdf=None, group_name=None)
Store the GenericMaster in an HDF5 file
- Parameters:
hdf (ProjectHDFio) – HDF5 group object - optional
group_name (str) – HDF5 subgroup name - optional
- update_master(force_update=True)
After a job is finished it checks whether it is linked to any metajob - meaning the master ID is pointing to this jobs job ID. If this is the case and the master job is in status suspended - the child wakes up the master job, sets the status to refresh and execute run on the master job. During the execution the master job is set to status refresh. If another child calls update_master, while the master is in refresh the status of the master is set to busy and if the master is in status busy at the end of the update_master process another update is triggered.
- Parameters:
force_update (bool) – Whether to check run mode for updating master
- pyiron_base.jobs.master.generic.get_function_from_string(function_str)
Convert a string of source code to a function
- Parameters:
function_str – function source code
- Return type:
function