executorlib.standalone.serialize.serialize_funct

executorlib.standalone.serialize.serialize_funct#

executorlib.standalone.serialize.serialize_funct(fn: Callable, fn_args: list | None = None, fn_kwargs: dict | None = None, resource_dict: dict | None = None, cache_key: str | None = None) tuple[str, dict][source]#

Serialize a function and its arguments and keyword arguments into an HDF5 file.

Parameters:
  • fn (Callable) – The function to be serialized.

  • fn_args (list) – The arguments of the function.

  • fn_kwargs (dict) – The keyword arguments of the function.

  • resource_dict (dict) –

    A dictionary of resources required by the task. With the following keys: - cores (int): number of MPI cores to be used for each function call - threads_per_core (int): number of OpenMP threads to be used for each function call - gpus_per_core (int): number of GPUs per worker - defaults to 0 - cwd (str/None): current working directory where the parallel python task is executed - openmpi_oversubscribe (bool): adds the –oversubscribe command line flag (OpenMPI and

    SLURM only) - default False

    • slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)

    • error_log_file (str): Name of the error log file to use for storing exceptions raised

      by the Python functions submitted to the Executor.

  • cache_key (str, optional) – By default the cache_key is generated based on the function hash, this can be overwritten by setting the cache_key.

Returns:

A tuple containing the task key and the serialized data.

Return type:

Tuple[str, dict]