Welcome to Pacifica Dispatcher’s documentation!¶
Pacifica Dispatcher receives and handles CloudEvents notifications.
Installation¶
The Pacifica software is available through PyPi so creating a virtual environment to install is what is shown below. Please keep in mind compatibility with the Pacifica Core services.
Installation in Virtual Environment¶
These installation instructions are intended to work on both Windows, Linux, and Mac platforms. Please keep that in mind when following the instructions.
Please install the appropriate tested version of Python for maximum chance of success.
Linux and Mac Installation¶
mkdir ~/.virtualenvs
python -m virtualenv ~/.virtualenvs/pacifica
. ~/.virtualenvs/pacifica/bin/activate
pip install pacifica-dispatcher
Windows Installation¶
This is done using PowerShell. Please do not use Batch Command.
mkdir "$Env:LOCALAPPDATA\virtualenvs"
python.exe -m virtualenv "$Env:LOCALAPPDATA\virtualenvs\pacifica"
& "$Env:LOCALAPPDATA\virtualenvs\pacifica\Scripts\activate.ps1"
pip install pacifica-dispatcher
Dispatcher Python Module¶
Downloader Runners Python Module¶
Download runner module.
This module contains two download runners. The first is for downloading from a local directory (works well for testing). The second is for downloading from a remote Pacifica Cartd service.
Additional methods for downloading could be used in the future.
-
class
pacifica.dispatcher.downloader_runners.
DownloaderRunner
[source]¶ Abstract downloader class for downloading files.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
-
class
pacifica.dispatcher.downloader_runners.
LocalDownloaderRunner
(basedir_name: str)[source]¶ Local download class.
This class is used for running the handlers on previously downloaded data relative to some base directory.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
download
(basedir_name: str, files: List[pacifica.dispatcher.models.File] = None, timeout: int = 180) → List[Callable[Dict[str, Any], TextIO]][source]¶ Download the files locally.
The download base directory may not match the class instance base directory. If that’s the case symlink the files from the instance base directory to the called base directory.
Either case return a list of methods used to open the files.
-
-
class
pacifica.dispatcher.downloader_runners.
RemoteDownloaderRunner
(downloader: pacifica.downloader.downloader.Downloader)[source]¶ Remote download runner class.
This class downloads data from a Pacifica Cartd service to a local directory.
-
__init__
(downloader: pacifica.downloader.downloader.Downloader) → None[source]¶ Initialize the remote downloader class.
The class is initialized with an instance of the
pacifica.downloader.Downloader
class.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
download
(basedir_name: str, files: List[pacifica.dispatcher.models.File] = None, timeout: int = 180) → List[Callable[Dict[str, Any], TextIO]][source]¶ Download the files using the downloader.
The downloader is used to setup a cart of data from the Cartd service. The downloader used in it’s blocking form, setting up the cart, waiting for it to complete and downloading it.
Once complete a list of methods is returned for opening files.
-
Event Handlers Python Module¶
Event handlers module.
This module contains classes for handling the events. Users of this
library should create their own instances of the abstract class
EventHandler
to process on the downloaded data.
-
class
pacifica.dispatcher.event_handlers.
EventHandler
[source]¶ Event handler abstract class.
This class defines the interface for handling a cloud event.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
-
class
pacifica.dispatcher.event_handlers.
NoopEventHandler
[source]¶ The Noop event handler class.
This class is a stub that does nothing when an event is received. This class maybe useful if the act of downloading and uploading is desired with no processing.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
-
class
pacifica.dispatcher.event_handlers.
ExceptionEventHandler
[source]¶ The exception event handler class.
This class is a stub that raises an exception when an event is received. This class is useful for testing error handling in the overall workflow.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
Exceptions Python Module¶
Exceptions module.
This module contains specific exceptions that can happen during the dispatching process.
-
exception
pacifica.dispatcher.exceptions.
EventError
(event: cloudevents.model.Event)[source]¶ Base event dispatcher error class.
This the base event class used by all other error classes.
Models Python Module¶
Models module.
This class contains the data structure models for the dispatcher.
-
class
pacifica.dispatcher.models.
PacificaModel
[source]¶ Abstract base class for all Dispatcher models.
Contains method interface definitions for all model classes.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
-
class
pacifica.dispatcher.models.
File
(**attrs)[source]¶ File model class.
This holds all information about a file from a cloud event.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
_id
= None¶
-
ctime
= None¶
-
encoding
= None¶
-
classmethod
from_cloudevents_model
(event: cloudevents.model.Event) → List[pacifica.dispatcher.models.File][source]¶ Factory creating instances of File from a cloud event.
-
hashsum
= None¶
-
hashtype
= None¶
-
mimetype
= None¶
-
mtime
= None¶
-
name
= None¶
-
path
¶ Path property accessor.
-
size
= None¶
-
subdir
= None¶
-
suspense_date
= None¶
-
-
class
pacifica.dispatcher.models.
Transaction
(**attrs)[source]¶ Transaction model clas.
This class holds all the information about a transaction from a cloud event.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
_id
= None¶
-
analytical_tool
= None¶
-
description
= None¶
-
classmethod
from_cloudevents_model
(event: cloudevents.model.Event) → pacifica.dispatcher.models.Transaction[source]¶ Factory creating a transaction class from a cloud event.
-
instrument
= None¶
-
project
= None¶
-
submitter
= None¶
-
suspense_date
= None¶
-
-
class
pacifica.dispatcher.models.
TransactionKeyValue
(**attrs)[source]¶ Transaction key value model.
This holds the transaction key value pairs from a cloud event.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 42¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
Receiver Python Module¶
Receiver module.
Contains a factory returning a receiver class that can create PeeWee models and CherryPy endpoints.
Router Python Module¶
Router module.
This module contains classes to handle routing of events to event handlers.
-
class
pacifica.dispatcher.router.
Route
(path: jsonpath2.path.Path, event_handler: pacifica.dispatcher.event_handlers.EventHandler)[source]¶ Route class.
This class routes an event to an event handler.
-
class
pacifica.dispatcher.router.
Router
[source]¶ Router handles a list of routes.
-
exception
pacifica.dispatcher.router.
RouterError
(router: pacifica.dispatcher.router.Router)[source]¶ Router base exception class.
Uploader Runners Python Module¶
Uploader runner module.
This module contains the methods for uploading data either remotely or locally.
-
class
pacifica.dispatcher.uploader_runners.
UploaderRunner
[source]¶ Abstract base class for uploading.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 48¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
-
class
pacifica.dispatcher.uploader_runners.
LocalUploaderRunner
[source]¶ Handle uploading to a local directory.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 48¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
upload
(basedir_name: str, transaction: pacifica.dispatcher.models.Transaction = None, transaction_key_values: List[pacifica.dispatcher.models.TransactionKeyValue] = None, timeout: int = 180) → Tuple[pacifica.uploader.bundler.bundler.Bundler, int, Dict[str, Any]][source]¶ Fake upload by bundling up data to output directory.
-
-
class
pacifica.dispatcher.uploader_runners.
RemoteUploaderRunner
(uploader: pacifica.uploader.uploader.Uploader)[source]¶ Handle uploading to a remote Pacifica instance.
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 48¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
upload
(basedir_name: str, transaction: pacifica.dispatcher.models.Transaction = None, transaction_key_values: List[pacifica.dispatcher.models.TransactionKeyValue] = None, timeout: int = 180) → Tuple[pacifica.uploader.bundler.bundler.Bundler, int, Dict[str, Any]][source]¶ Perform the upload to Pacifica.
-
Pacifica Dispatcher Module.