sampo.api.process_runner

run

sampo.api.process_runner.run(spd=None, src=None, pstore_url=None, pstore_options=None, base_dir=None, seed=None)

Creates a process from the SPD/SRC and runs it. spd is not needed for prediction process because it is saved as a part of model process.

Parameters
spdstr, ProcessDescription or None

File path to an SPD file or ProcessDescription object.

srcstr or RunConfiguration

File path to an SRC file or RunConfiguration.

pstore_urlstr or None

ProcessStore URL.

pstore_optionsdict or None

This parameter is only for the developers of SAMPO product. ProcessStore options.

base_dirstr or None

Base directory of file paths of an SPD file, a SRC file, and data_sources in SRC files.

seedint or None

This parameter is only for the developers of SAMPO product. Random seed value to be set. Range=[0, 2147483647]. If None, a seed value within the above range will be generated.

Returns
pkeyProcessKey

ProcessKey having name and version of this process.

Raises
ValidationError
  • If spd is neither str, ProcessDescription nor None.

  • If src is neither str nor RunConfiguration object.

  • If pstore_url is neither None nor str.

  • If base_dir is neither None nor str.

Examples

>>> from sampo.api import process_runner
>>> process_key = process_runner.run(spd='fabhmerg.spd',
...                                  src=learn_rc, pstore_url='pstore')

session_run

sampo.api.process_runner.session_run(ssc, pstore_url=None, pstore_options=None, base_dir=None, max_workers=1)

Creates a session from a list of tuples of RunConfiguration and ProcessDescription, an SSC file, or a SessionConfiguration object and runs processes in the session.

Returns a list of tuples of ProcessKeys and Exceptions when all of processes have finished. If a process has no exception, Exception is None.

Parameters
ssclist, str or SessionConfiguration
  • listlist of tuples of RunConfiguration and ProcessDescription.

    [(RunConfiguration, ProcessDescription),]

  • str : File path to an SSC file

  • SessionConfiguration : SessionConfiguration object.

pstore_urlstr or None

ProcessStore URL. None is available only for the developers of SAMPO product. If None, MemoryProcessStore will be used.

pstore_optionsdict or None

This parameter is only for the developers of SAMPO product. ProcessStore options.

base_dirstr or None

Base directory of file paths of an SPD file, a SRC file, and data_sources in SRC files. If None, the relative path will be used.

max_workersint or None

The max number of asynchronous workers. If None, it is equivalent to specify the number of processors on the machine.

Returns
[(pkey, ex),]list of tuple

List of tuples of ProcessKey and exception.

pkeystr

If the process failed, ProcessKey has a process name only (has not a version).

exException

The exception of the process failure. If the process doesn’t fail, it will be None.

Raises
ValidationError
  • If ssc is neither list, str nor SessionConfiguration object.

  • If pstore_url is neither None nor str.

  • If base_dir is neither None nor str.

  • If max_workers is neither int nor None.

Examples

>>> from sampo.api import process_runner
>>> result = process_runner.session_run(ssc=session_conf, pstore_url='pstore', max_workers=3)