pyiron_base.jobs.job.interactive module
InteractiveBase class extends the Generic Job class with all the functionality to run the job object interactivley.
- class pyiron_base.jobs.job.interactive.InteractiveBase(project, job_name)
Bases:
GenericJob
InteractiveBase class extends the Generic Job class with all the functionality to run the job object interactively. From this class all interactive Hamiltonians are derived. Therefore it should contain the properties/routines common to all interactive jobs. The functions in this module should be as generic as possible.
- 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:: job_type
- Job type object with all the available job types: [‘ExampleJob’, ‘ParallelMaster’, ‘ScriptJob’,
‘ListMaster’]
Examples
In the default ‘modal’ mode calculation jobs can only be executed ones:
>>> job.run()
Still if you want to execute multiple similar calculations, you can execute them in interactive mode:
>>> with job.interactive_open() as job_int: >>> # Do something with job_int >>> job_int.run()
- from_hdf(hdf=None, group_name=None)
Restore the InteractiveBase object in the HDF5 File
- Parameters:
hdf (ProjectHDFio) – HDF5 group object - optional
group_name (str) – HDF5 subgroup name - optional
- interactive_close()
Stop interactive execution and sync interactive output cache.
Sets the job status to
finished
,run()
cannot be called after this.
- interactive_flush(path='interactive', include_last_step=False)
- Parameters:
path
include_last_step
Returns:
- property interactive_flush_frequency
- interactive_is_activated()
Returns:
- interactive_open()
Set the run mode to interactive.
This is the same as setting
server.run_mode.interactive
.Must be called before
run()
is called.
- interactive_store_in_cache(key, value)
- Parameters:
key
value
Returns:
- property interactive_write_frequency
- run_if_interactive()
For jobs which executables are available as Python library, those can also be executed with a library call instead of calling an external executable. This is usually faster than a single core python job.
- run_if_interactive_non_modal()
For jobs which executables are available as Python library, those can also be executed with a library call instead of calling an external executable. This is usually faster than a single core python job.
- to_hdf(hdf=None, group_name=None)
Store the InteractiveBase object in the HDF5 File
- Parameters:
hdf (ProjectHDFio) – HDF5 group object - optional
group_name (str) – HDF5 subgroup name - optional
- validate_ready_to_run()
This should work but doesn’t…