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
kindwith 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
strortupleorlistofstrortuple, 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:
ValueErrorIf the value of
kindis invalid.
- junifer.api.run(workdir, datagrabber, markers, storage, preprocessor=None, elements=None)#
Run the pipeline on the selected element.
- Parameters:
- workdir
strorpathlib.Path Directory where the pipeline will be executed.
- datagrabber
dict DataGrabber to use. Must have a key
kindwith the kind of DataGrabber to use. All other keys are passed to the DataGrabber init function.- markers
listofdict List of markers to extract. Each marker is a dict with at least two keys:
nameandkind. Thenamekey is used to name the output marker. Thekindkey 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
kindwith 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
kindwith the kind of preprocessor to use. All other keys are passed to the preprocessor init function (default None).- elements
strortupleorlistofstrortuple, 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)#
Register DataGrabber.
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.
Notes
It should only be used as a decorator.
- junifer.api.decorators.register_datareader(klass)#
Register DataReader.
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.
Notes
It should only be used as a decorator.
- 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.