km3pipe.core

The core of the KM3Pipe framework.

Module Contents

Classes

ServiceManager() Main service manager
Pipeline(blob=None, timeit=False, configfile=None, anybar=False) The holy pipeline which holds everything together.
Module(name=None, **parameters) The module which can be attached to the pipeline
Pump(*args, **kwargs) The pump with basic file or socket handling.
Blob(*args, **kwargs) A simple (ordered) dict with a fancy name. This should hold the data.
Run(**tables) A simple container for event info, hits, tracks and calibration.
km3pipe.core.log[source]
km3pipe.core.STAT_LIMIT = 100000[source]
km3pipe.core.MODULE_CONFIGURATION = pipeline.toml[source]
km3pipe.core.RESERVED_ARGS[source]
km3pipe.core.process_time[source]
km3pipe.core.basestring[source]
class km3pipe.core.ServiceManager[source]

Bases:object

Main service manager

register(self, name, service)[source]

Service registration

Args:
name: Name of the provided service service: Reference to the service
get_missing_services(self, services)[source]

Check if all required services are provided

Args:
services: List with the service names which are required
Returns:
List with missing services
class km3pipe.core.Pipeline(blob=None, timeit=False, configfile=None, anybar=False)[source]

Bases:object

The holy pipeline which holds everything together.

If initialised with timeit=True, all modules will be monitored, otherwise only the overall statistics and modules with timeit=True will be shown.

Parameters:
timeit: bool, optional [default=False]

Display time profiling statistics for the pipeline?

configfile: str, optional

Path to a configuration file (TOML format) which contains parameters for attached modules.

attach(self, module_factory, name=None, **kwargs)[source]

Attach a module to the pipeline system

attach_bundle(self, modules)[source]
drain(self, cycles=None)[source]

Execute _drain while trapping KeyboardInterrupt

finish(self)[source]

Call finish() on each attached module

class km3pipe.core.Module(name=None, **parameters)[source]

Bases:object

The module which can be attached to the pipeline

name[source]

The name of the module

configure(self)[source]

Configure module, like instance variables etc.

expose(self, obj, name)[source]

Expose an object as a service to the Pipeline

add(self, name, value)[source]

Add the parameter with the desired value to the dict

get(self, name, default=None)[source]

Return the value of the requested parameter or default if None.

require(self, name)[source]

Return the value of the requested parameter or raise an error.

require_service(self, name, why='')[source]
process(self, blob)[source]

Knead the blob and return it

finish(self)[source]

Clean everything up.

pre_finish(self)[source]

Do the last few things before calling finish()

class km3pipe.core.Pump(*args, **kwargs)[source]

Bases:km3pipe.core.Module

The pump with basic file or socket handling.

open_file(self, filename)[source]

Open the file with filename

process(self, blob)[source]

Create a blob

rewind_file(self)[source]

Put the file pointer to position 0

close_file(self)[source]

Close file.

finish(self)[source]
pre_finish(self)[source]

Clean up open file or socket-handlers.

close(self)[source]
next(self)[source]

Python 2 compatibility for iterators

class km3pipe.core.Blob(*args, **kwargs)[source]

Bases:collections.OrderedDict

A simple (ordered) dict with a fancy name. This should hold the data.

class km3pipe.core.Run(**tables)[source]

Bases:object

A simple container for event info, hits, tracks and calibration.