managers Package

managers Package

executionpluginmanager Module

This module holds the ExecutionPluginManager as well as the base-class for all ExecutionPlugins.

class fastr.plugins.managers.executionpluginmanager.ExecutionPluginManager(parent)[source]

Bases: fastr.plugins.managers.pluginmanager.PluginSubManager

Container holding all the ExecutionPlugins known to the Fastr system

__abstractmethods__ = frozenset({})
__init__(parent)[source]

Initialize a ExecutionPluginManager and load plugins.

Parameters
  • path – path to search for plugins

  • recursive – flag for searching recursively

Returns

newly created ExecutionPluginManager

__module__ = 'fastr.plugins.managers.executionpluginmanager'

interfacemanager Module

This module holds the ExecutionPluginManager as well as the base-class for all ExecutionPlugins.

class fastr.plugins.managers.interfacemanager.InterfacePluginManager(parent)[source]

Bases: fastr.plugins.managers.pluginmanager.PluginSubManager

Container holding all the CollectorPlugins

__abstractmethods__ = frozenset({})
__init__(parent)[source]

Create the Coll :param path: :param recursive: :return:

__module__ = 'fastr.plugins.managers.interfacemanager'

iopluginmanager Module

class fastr.plugins.managers.iopluginmanager.IOPluginManager(parent)[source]

Bases: fastr.plugins.managers.pluginmanager.PluginSubManager

A mapping containing the IOPlugins known to this system

__abstractmethods__ = frozenset({})
__init__(parent)[source]

Create the IOPluginManager and populate it.

Returns

newly created IOPluginManager

__iter__()[source]

Get an iterator from the BaseManager. The iterator will iterate over the keys of the BaseManager.

Returns

the iterator

Return type

dictionary-keyiterator

__keytransform__(key)[source]

Identity transform for the keys. This function can be reimplemented by a subclass to implement a different key transform.

Parameters

key – key to transform

Returns

the transformed key (in this case the same key as inputted)

__module__ = 'fastr.plugins.managers.iopluginmanager'
cleanup()[source]

Cleanup all plugins, this closes files, connections and other things that could be left dangling otherwise.

static create_ioplugin_tool(tools, interfaces)[source]

Create the tools which handles sinks and sources. The command of this tool is the main of core.ioplugin.

expand_url(url)[source]

Expand the url by filling the wildcards. This function checks the url scheme and uses the expand function of the correct IOPlugin.

Parameters

url (str) – url to expand

Returns

list of urls

Return type

list of str

pull_source_data(url, outdir, sample_id, datatype=None)[source]

Retrieve data from an external source. This function checks the url scheme and selects the correct IOPlugin to retrieve the data.

Parameters
  • url – url to pull

  • outdir (str) – the directory to write the data to

  • datatype (DataType) – the datatype of the data, used for determining the total contents of the transfer

Returns

None

push_sink_data(inpath, outurl, datatype=None)[source]

Send data to an external source. This function checks the url scheme and selects the correct IOPlugin to retrieve the data.

Parameters
  • inpath (str) – the path of the data to be pushed

  • outurl (str) – the url to write the data to

  • datatype (DataType) – the datatype of the data, used for determining the total contents of the transfer

put_url(inpath, outurl)[source]

Put the files to the external data store.

Parameters
  • inpath – path to the local data

  • outurl – url to where to store the data in the external data store.

static register_url_scheme(scheme)[source]

Register a custom scheme to behave http like. This is needed to parse all things properly with urlparse.

Parameters

scheme – the scheme to register

url_to_path(url)[source]

Retrieve the path for a given url

Parameters

url (str) – the url to parse

Returns

the path corresponding to the input url

Return type

str

networkmanager Module

This module contains the tool manager class

class fastr.plugins.managers.networkmanager.NetworkManager(path)[source]

Bases: fastr.plugins.managers.objectmanager.ObjectManager

__abstractmethods__ = frozenset({})
__module__ = 'fastr.plugins.managers.networkmanager'
get_object_version(obj)[source]

Get the version of a given object

Parameters

object – the object to use

Returns

the version of the object

property object_class

The class of the objects to populate the manager with

objectmanager Module

This module contains the object manager class

class fastr.plugins.managers.objectmanager.ObjectManager(path)[source]

Bases: fastr.abc.basemanager.BaseManager

Class for managing all the objects loaded in the fastr system

__abstractmethods__ = frozenset({'get_object_version', 'object_class'})
__contains__(key)[source]

Check if an item is in the ObjectManager

Parameters

key (str or tuple) – object id or tuple (Objectid, version)

Returns

flag indicating the item is in the manager

__getitem__(key)[source]

Retrieve a Object from the ObjectManager. You can request by only an id, which results in the newest version of the Object being returned, or request using both an id and a version.

Parameters

key (str or tuple) – object id or tuple (Objectid, version)

Returns

the requested Object

Raises

FastrObjectUnknownError – if a non-existing Object was requested

__init__(path)[source]

Create a ObjectManager and scan path to search for Objects

Parameters

path (str or iterable of str) – the path(s) to scan for Objects

Returns

newly created ObjectManager

__keytransform__(key)[source]

Key transform, used for allowing indexing both by id-only and by (id, version)

Parameters

key – key to transform

Returns

key in form (id, version)

__module__ = 'fastr.plugins.managers.objectmanager'
abstract get_object_version(obj)[source]

Get the version of a given object

Parameters

object – the object to use

Returns

the version of the object

abstract property object_class

The class of the objects to populate the manager with

objectversions(obj)[source]

Return a list of available versions for the object

Parameters

object – The object to check the versions for. Can be either a Object or a str.

Returns

List of version objects. Returns None when the given object is not known.

todict()[source]

Return a dictionary version of the Manager

Returns

manager as a dict

pluginmanager Module

This module contains the Manager class for Plugins in the fastr system

class fastr.plugins.managers.pluginmanager.PluginManager(path=None)[source]

Bases: fastr.abc.basepluginmanager.BasePluginManager

__abstractmethods__ = frozenset({})
__init__(path=None)[source]

Create a BasePluginManager and scan the give path for matching plugins

Parameters
  • path (str) – path to scan

  • recursive (bool) – flag to indicate a recursive search

  • module (module) – the module to register plugins into

Returns

newly created plugin manager

Raises

FastrTypeError – if self._plugin_class is set to a class not subclassing BasePlugin

__module__ = 'fastr.plugins.managers.pluginmanager'
__setitem__(key, value)[source]

Store an item in the BaseManager, will ignore the item if the key is already present in the BaseManager.

Parameters
  • name – the key of the item to save

  • value – the value of the item to save

Returns

None

property plugin_class

The plugin manager contains any Plugin subclass

class fastr.plugins.managers.pluginmanager.PluginSubManager(parent, plugin_class)[source]

Bases: fastr.abc.basepluginmanager.BasePluginManager

A PluginManager that is a selection of a parent plugin manger. It uses the PluginsView to only exponse part of the parent PluginManager. This is used to create plugin plugins.managers for only certain types of plugins (e.g. IOPlugins) without loading them multiple times.

__abstractmethods__ = frozenset({})
__init__(parent, plugin_class)[source]

Create a BasePluginManager and scan the give path for matching plugins

Parameters
  • path (str) – path to scan

  • recursive (bool) – flag to indicate a recursive search

  • module (module) – the module to register plugins into

Returns

newly created plugin manager

Raises

FastrTypeError – if self._plugin_class is set to a class not subclassing BasePlugin

__module__ = 'fastr.plugins.managers.pluginmanager'
property data

The actual data dict underlying this Manager

property plugin_class

PluginSubManagers only expose the plugins of a certain class

class fastr.plugins.managers.pluginmanager.PluginsView(parent, plugin_class)[source]

Bases: collections.abc.MutableMapping

A collection that acts like view of the plugins of another plugin manager. This is a proxy object that only gives access the plugins of a certain plugin class. It behaves like a mapping and is used as the data object for a PluginSubManager.

__abstractmethods__ = frozenset({})
__delitem__(key)[source]
__dict__ = mappingproxy({'__module__': 'fastr.plugins.managers.pluginmanager', '__doc__': '\n A collection that acts like view of the plugins of another plugin manager.\n This is a proxy object that only gives access the plugins of a certain\n plugin class. It behaves like a mapping and is used as the data object for\n a PluginSubManager.\n ', '__init__': <function PluginsView.__init__>, 'filter_plugin': <function PluginsView.filter_plugin>, '__getitem__': <function PluginsView.__getitem__>, '__setitem__': <function PluginsView.__setitem__>, '__delitem__': <function PluginsView.__delitem__>, '__len__': <function PluginsView.__len__>, '__iter__': <function PluginsView.__iter__>, '__dict__': <attribute '__dict__' of 'PluginsView' objects>, '__weakref__': <attribute '__weakref__' of 'PluginsView' objects>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 55})
__getitem__(item)[source]
__init__(parent, plugin_class)[source]

Constructor for the plugins view

Parameters
  • parent (BasePluginManager) – the parent plugin manager

  • plugin_class (class) – the class of the plugins to expose

__iter__()[source]
__len__()[source]
__module__ = 'fastr.plugins.managers.pluginmanager'
__setitem__(key, value)[source]
__weakref__

list of weak references to the object (if defined)

filter_plugin(plugin)[source]

targetmanager Module

This module holds the ExecutionPluginManager as well as the base-class for all ExecutionPlugins.

class fastr.plugins.managers.targetmanager.TargetManager(parent)[source]

Bases: fastr.plugins.managers.pluginmanager.PluginSubManager

Container holding all the ExecutionPlugins known to the Fastr system

__abstractmethods__ = frozenset({})
__init__(parent)[source]

Initialize a ExecutionPluginManager and load plugins.

Returns

newly created ExecutionPluginManager

__module__ = 'fastr.plugins.managers.targetmanager'

toolmanager Module

This module contains the tool manager class

class fastr.plugins.managers.toolmanager.ToolManager(path)[source]

Bases: fastr.plugins.managers.objectmanager.ObjectManager

__abstractmethods__ = frozenset({})
__module__ = 'fastr.plugins.managers.toolmanager'
get_object_version(obj)[source]

Get the version of a given object

Parameters

object – the object to use

Returns

the version of the object

property object_class

The class of the objects to populate the manager with

populate()[source]

Populate the manager with the data. This is a method that will be called when the Managers data is first accessed. This way we avoid doing expensive directory scans when the data is never requested.

toolversions(tool)[source]

Return a list of available versions for the tool

Parameters

tool – The tool to check the versions for. Can be either a Tool or a str.

Returns

List of version objects. Returns None when the given tool is not known.