9.2.7. API Functions#

Main API functions#

Provide imports for api sub-package.

junifer.api.collect(storage)#

Collect and store data.

Parameters:
storagedict

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.

junifer.api.queue(config, kind, jobname='junifer_job', overwrite=False, elements=None, **kwargs)#

Queue a job to be executed later.

Parameters:
configdict

The configuration to be used for queueing the job.

kind{“HTCondor”, “SLURM”}

The kind of job queue system to use.

jobnamestr, optional

The name of the job (default “junifer_job”).

overwritebool, optional

Whether to overwrite if job directory already exists (default False).

elementsstr or tuple or list of str or tuple, optional

Element(s) to process. Will be used to index the datagrabber (default None).

**kwargsdict

The keyword arguments to pass to the job queue system.

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:
workdirstr or pathlib.Path

Directory where the pipeline will be executed.

datagrabberdict

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.

markerslist of dict

List of markers to extract. Each marker is a dict with at least two keys: name and kind. The name key is used to name the output marker. The kind 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.

storagedict

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.

preprocessordict, 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).

elementsstr or tuple or list of str or tuple, optional

Element(s) to process. Will be used to index the datagrabber (default None).

Decorators#

Provide decorators for api.

junifer.api.decorators.register(step, name, klass)#

Register a function to be used in a pipeline step.

Parameters:
stepstr

Name of the step.

namestr

Name of the function.

klassclass

Class to be registered.

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.