9.2.7. API Functions#
Main API functions#
Provide imports for api sub-package.
- junifer.api.collect(storage)#
Collect and store data.
- Parameters:
- storage
dict
Storage to use. Must have a key
kind
with the kind of storage to use. All other keys are passed to the storage init function.
- storage
- junifer.api.queue(config, kind, jobname='junifer_job', overwrite=False, elements=None, **kwargs)#
Queue a job to be executed later.
- Parameters:
- config
dict
The configuration to be used for queueing the job.
- kind{“HTCondor”, “SLURM”}
The kind of job queue system to use.
- jobname
str
, optional The name of the job (default “junifer_job”).
- overwritebool, optional
Whether to overwrite if job directory already exists (default False).
- elements
str
ortuple
orlist
ofstr
ortuple
, optional Element(s) to process. Will be used to index the datagrabber (default None).
- **kwargs
dict
The keyword arguments to pass to the job queue system.
- config
- Raises:
ValueError
If the value of
kind
is invalid.
- junifer.api.run(workdir, datagrabber, markers, storage, preprocessor=None, elements=None)#
Run the pipeline on the selected element.
- Parameters:
- workdir
str
orpathlib.Path
Directory where the pipeline will be executed.
- datagrabber
dict
Datagrabber to use. Must have a key
kind
with the kind of datagrabber to use. All other keys are passed to the datagrabber init function.- markers
list
ofdict
List of markers to extract. Each marker is a dict with at least two keys:
name
andkind
. Thename
key is used to name the output marker. Thekind
key is used to specify the kind of marker to extract. The rest of the keys are used to pass parameters to the marker calculation.- storage
dict
Storage to use. Must have a key
kind
with the kind of storage to use. All other keys are passed to the storage init function.- preprocessor
dict
, optional Preprocessor to use. Must have a key
kind
with the kind of preprocessor to use. All other keys are passed to the preprocessor init function (default None).- elements
str
ortuple
orlist
ofstr
ortuple
, optional Element(s) to process. Will be used to index the datagrabber (default None).
- workdir
Decorators#
Provide decorators for api.
- junifer.api.decorators.register(step, name, klass)#
Register a function to be used in a pipeline step.
- junifer.api.decorators.register_datagrabber(klass)#
Datagrabber registration decorator.
Registers the datagrabber so it can be used by name.
- Parameters:
- klass: class
The class of the datagrabber to register.
- Returns:
- klass: class
The unmodified input class.
- junifer.api.decorators.register_datareader(klass)#
Datareader registration decorator.
Registers the datareader so it can be used by name.
- Parameters:
- klass: class
The class of the datareader to register.
- Returns:
- klass: class
The unmodified input class.
- junifer.api.decorators.register_marker(klass)#
Marker registration decorator.
Registers the marker so it can be used by name.
- Parameters:
- klass: class
The class of the marker to register.
- Returns:
- klass: class
The unmodified input class.
- junifer.api.decorators.register_preprocessor(klass)#
Preprocessor registration decorator.
Registers the preprocessor so it can be used by name.
- Parameters:
- klass: class
The class of the preprocessor to register.
- Returns:
- klass: class
The unmodified input class.
- junifer.api.decorators.register_storage(klass)#
Storage registration decorator.
Registers the storage so it can be used by name.
- Parameters:
- klass: class
The class of the storage to register.
- Returns:
- klass: class
The unmodified input class.