pipen.pipen
class
pipen.pipen.
Pipen
(
name=None
, desc=None
, outdir=None
, **kwargs
)
The Pipen class provides interface to assemble and run the pipeline
Attributes
PIPELINE_COUNT
— How many pipelines are loadedSETUP
— Whether the one-time setup hook is called_kwargs
— The extra configrations passed to overwrite the default onesconfig
— The configurationsdesc
— The description of the pipelinename
— The name of the pipelineoutdir
— The output directory of the resultspbar
— The progress barprocs
— The processesprofile
— The profile of the configurations to run the pipelinestarts
— The start processesworkdir
— The workdir for the pipeline
Parameters
name
(str | none, optional) — The name of the pipelinedesc
(str | none, optional) — The description of the pipelineoutdir
(str | os.pathlike, optional) — The output directory of the results**kwargs
— Other configurations
Methods
__init_subclass__
(
)
— This method is called when a class is subclassed.</>async_run
(
profile
)
(bool) — Run the processes one by one</>build_proc_relationships
(
)
— Build the proc relationships for the pipeline</>run
(
profile
)
(bool) — Run the pipeline with the given profileThis is just a sync wrapper for the asyncasync_run
function usingasyncio.run()
</>set_data
(
*indata
)
(Pipen) — Set the input_data for start processes</>set_starts
(
*procs
,clear
)
— Set the starts</>
classmethod
__init_subclass__
(
)
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
method
async_run
(
profile='default'
)
Run the processes one by one
Parameters
profile
(str, optional) — The default profile to use for the run
Returns (bool)
True if the pipeline ends successfully else False
method
run
(
profile='default'
)
Run the pipeline with the given profileThis is just a sync wrapper for the async async_run
function using
asyncio.run()
Parameters
profile
(str, optional) — The default profile to use for the run
Returns (bool)
True if the pipeline ends successfully else False
method
set_data
(
*indata
)
Set the input_data for start processes
Parameters
*indata
(Any) — The input data for the start processesThe data will set for the processes in the order determined byset_starts()
. If a process has input_data set, an error will be raised. To use that input_data, set None here in the corresponding position for the process
Raises
ProcInputDataError
— When trying to set input data toprocesses with input_data already set
Returns (Pipen)
self
to chain the operations
method
set_starts
(
*procs
, clear=True
)
Set the starts
Parameters
*procs
(Union) — The processes to set as starts of the pipeline.clear
(bool, optional) — Wether to clear previous set starts
Raises
ProcDependencyError
— When processes set as starts repeatedly
Returns
self
to chain the operations
method
build_proc_relationships
(
)
Build the proc relationships for the pipeline
function
pipen.pipen.
run
(
name
, starts
, data=None
, desc=None
, outdir=None
, profile='default'
, **kwargs
)
Shortcut to run a pipeline
Parameters
name
(str) — The name of the pipelinestarts
(Union) — The start processesdata
(Iterable, optional) — The input data for the start processesdesc
(str, optional) — The description of the pipelineoutdir
(str | os.pathlike, optional) — The output directory of the resultsprofile
(str, optional) — The profile to use**kwargs
— Other options pass to Pipen to create the pipeline
Returns (bool)
True if the pipeline ends successfully else False