pyiron_base.project.decorator.job

Contents

pyiron_base.project.decorator.job#

pyiron_base.project.decorator.job(funct: callable | None = None, *, host: str | None = None, queue: str | None = None, cores: int = 1, threads: int = 1, gpus: int | None = None, run_mode: str = 'modal', new_hdf: bool = True, accept_crash: bool = False, run_time: int | None = None, memory_limit: str | None = None, qid: int | None = None, additional_arguments: dict = {}, conda_environment_name: str | None = None, conda_environment_path: str | None = None, output_file_lst: list = [], output_key_lst: list = [])[source]#

Decorator to create a pyiron job object from any python function

Parameters:
  • funct (callable) – python function to create a job object from

  • host (str) – the hostname of the current system.

  • queue (str) – the queue selected for a current simulation.

  • cores (int) – the number of cores selected for the current simulation.

  • threads (int) – the number of threads selected for the current simulation.

  • gpus (int) – the number of gpus selected for the current simulation.

  • run_mode (str) – the run mode of the job [‘modal’, ‘non_modal’, ‘queue’, ‘manual’]

  • new_hdf (bool) – defines whether a subjob should be stored in the same HDF5 file or in a new one.

  • accept_crash (bool) – ignore execution errors raised by external executables - default False

  • run_time (int) – run time limit in seconds for the job to finish - required for HPC job schedulers

  • memory_limit (str) – memory required

  • qid (int) – Queuing system ID - ID received from the HPC job scheduler

  • additional_arguments (dict) – Additional arguments for the HPC job scheduler

  • conda_environment_name (str) – Name of the conda environment

  • conda_environment_path (str) – Path to the conda environment

  • output_file_lst (list)

  • output_key_lst (list)

Returns:

The decorated functions

Return type:

callable

Example

>>> from pyiron_base import job, Project
>>>
>>> @job
>>> def my_function_a(a, b=8):
>>>     return a + b
>>>
>>> @job(cores=2)
>>> def my_function_b(a, b=8):
>>>     return a + b
>>>
>>> pr = Project("test")
>>> c = my_function_a(a=1, b=2, pyiron_project=pr)
>>> d = my_function_b(a=c, b=3, pyiron_project=pr)
>>> print(d.pull())

Output: 6