pyiron_base.jobs.job.runfunction.run_job_with_runmode_executor#
- pyiron_base.jobs.job.runfunction.run_job_with_runmode_executor(job: pyiron_base.jobs.job.generic.GenericJob, executor: concurrent.futures.Executor, gpus_per_slot: int | None = None) None[source]#
Introduced in Python 3.2 the concurrent.futures interface enables the asynchronous execution of python programs. A function is submitted to the executor and a future object is returned. The future object is updated in the background once the executor finished executing the function. The job.server.run_mode.executor implements the same functionality for pyiron jobs. An executor is set as an attribute to the server object:
>>> job.server.executor = concurrent.futures.Executor() >>> job.run() >>> job.server.future.done() False >>> job.server.future.result() >>> job.server.future.done() True
When the job is executed by calling the run() function a future object is returned. The job is then executed in the background and the user can use the future object to check the status of the job.
- Parameters:
job (GenericJob) – pyiron job object
executor (concurrent.futures.Executor) – executor class which implements the executor interface defined in the python concurrent.futures.Executor class.
gpus_per_slot (int) – number of GPUs per MPI rank, typically 1