reportingplugins Package

elasticsearchreporter Module

class fastr.resources.plugins.reportingplugins.elasticsearchreporter.ElasticsearchReporter[source]

Bases: fastr.plugins.reportingplugin.ReportingPlugin

__abstractmethods__ = frozenset()
__init__()[source]

The BasePlugin constructor.

Returns:the created plugin
Return type:BasePlugin
Raises:FastrPluginNotLoaded – if the plugin did not load correctly
__module__ = 'fastr.resources.plugins.reportingplugins.elasticsearchreporter'
activate()[source]

Activate the reporting plugin

configuration_fields = {'elasticsearch_debug': (<class 'bool'>, False, 'Setup elasticsearch debug mode to send stdout stderr on job succes'), 'elasticsearch_host': (<class 'str'>, '', 'The elasticsearch host to report to'), 'elasticsearch_index': (<class 'str'>, 'fastr', 'The elasticsearch index to store data in')}
elasticsearch_update_status(job)[source]
job_updated(job)[source]
classmethod test()[source]

Test the plugin, default behaviour is just to instantiate the plugin

pimreporter Module

class fastr.resources.plugins.reportingplugins.pimreporter.BasePimAPI[source]

Bases: object

Base class for PIM API classes which specifies the methods required to function

__abstractmethods__ = frozenset({'pim_log_line', 'pim_update_status', 'pim_finish_run', 'pim_register_run'})
__dict__ = mappingproxy({'__module__': 'fastr.resources.plugins.reportingplugins.pimreporter', '__doc__': '\n Base class for PIM API classes which specifies the methods required to function\n ', 'pim_update_status': <function BasePimAPI.pim_update_status>, 'pim_register_run': <function BasePimAPI.pim_register_run>, 'pim_finish_run': <function BasePimAPI.pim_finish_run>, 'pim_log_line': <function BasePimAPI.pim_log_line>, '__dict__': <attribute '__dict__' of 'BasePimAPI' objects>, '__weakref__': <attribute '__weakref__' of 'BasePimAPI' objects>, '__abstractmethods__': frozenset({'pim_log_line', 'pim_update_status', 'pim_finish_run', 'pim_register_run'}), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 55})
__module__ = 'fastr.resources.plugins.reportingplugins.pimreporter'
__weakref__

list of weak references to the object (if defined)

pim_finish_run(network)[source]

Set the PIM run to finished and clean up

Parameters:network (NetworkRun) – The network run to finish
pim_log_line(record)[source]

Send a new line of log record to PIM :type record: LogRecord :param record: the log record to send

pim_register_run(network)[source]

Send the basic Network layout to PIM and register the run.

Parameters:network (NetworkRun) – The network run to register to PIM
pim_update_status(job)[source]

Update the status of a job

Parameters:job (Job) – The job which to update
class fastr.resources.plugins.reportingplugins.pimreporter.PimAPIv2(uri=None)[source]

Bases: object

Class to publish to PIM

NODE_CLASSES = {'ConstantNodeRun': 'constant', 'NodeRun': 'node', 'SinkNodeRun': 'sink', 'SourceNodeRun': 'source'}
PIM_STATUS_MAPPING = {<JobState.nonexistent: ('nonexistent', 'idle', False)>: 5, <JobState.created: ('created', 'idle', False)>: 0, <JobState.queued: ('queued', 'idle', False)>: 0, <JobState.hold: ('hold', 'idle', False)>: 0, <JobState.running: ('running', 'in_progress', False)>: 1, <JobState.execution_done: ('execution_done', 'in_progress', False)>: 1, <JobState.execution_failed: ('execution_failed', 'in_progress', True)>: 1, <JobState.processing_callback: ('processing_callback', 'in_progress', False)>: 1, <JobState.finished: ('finished', 'done', False)>: 2, <JobState.failed: ('failed', 'done', True)>: 3, <JobState.cancelled: ('cancelled', 'done', True)>: 4}
STATUS_TYPES = [{'color': '#aaccff', 'description': 'Jobs that are waiting for input', 'title': 'idle'}, {'color': '#daa520', 'description': 'Jobs that are running', 'title': 'running'}, {'color': '#23b22f', 'description': 'Jobs that finished successfully', 'title': 'success'}, {'color': '#dd3311', 'description': 'Jobs that have failed', 'title': 'failed'}, {'color': '#334477', 'description': 'Jobs which were cancelled', 'title': 'cancelled'}, {'color': '#ccaa99', 'description': 'Jobs with an undefined state', 'title': 'undefined'}]
__dict__ = mappingproxy({'__module__': 'fastr.resources.plugins.reportingplugins.pimreporter', '__doc__': '\n Class to publish to PIM\n ', 'PIM_STATUS_MAPPING': {<JobState.nonexistent: ('nonexistent', 'idle', False)>: 5, <JobState.created: ('created', 'idle', False)>: 0, <JobState.queued: ('queued', 'idle', False)>: 0, <JobState.hold: ('hold', 'idle', False)>: 0, <JobState.running: ('running', 'in_progress', False)>: 1, <JobState.execution_done: ('execution_done', 'in_progress', False)>: 1, <JobState.execution_failed: ('execution_failed', 'in_progress', True)>: 1, <JobState.processing_callback: ('processing_callback', 'in_progress', False)>: 1, <JobState.finished: ('finished', 'done', False)>: 2, <JobState.failed: ('failed', 'done', True)>: 3, <JobState.cancelled: ('cancelled', 'done', True)>: 4}, 'NODE_CLASSES': {'NodeRun': 'node', 'SourceNodeRun': 'source', 'ConstantNodeRun': 'constant', 'SinkNodeRun': 'sink'}, 'STATUS_TYPES': [{'color': '#aaccff', 'description': 'Jobs that are waiting for input', 'title': 'idle'}, {'color': '#daa520', 'description': 'Jobs that are running', 'title': 'running'}, {'color': '#23b22f', 'description': 'Jobs that finished successfully', 'title': 'success'}, {'color': '#dd3311', 'description': 'Jobs that have failed', 'title': 'failed'}, {'color': '#334477', 'description': 'Jobs which were cancelled', 'title': 'cancelled'}, {'color': '#ccaa99', 'description': 'Jobs with an undefined state', 'title': 'undefined'}], '__init__': <function PimAPIv2.__init__>, 'create_job_data': <function PimAPIv2.create_job_data>, 'pim_update_status': <function PimAPIv2.pim_update_status>, 'job_update_loop': <function PimAPIv2.job_update_loop>, 'pim_serialize_node': <function PimAPIv2.pim_serialize_node>, 'pim_serialize_macro': <function PimAPIv2.pim_serialize_macro>, 'pim_serialize_network': <function PimAPIv2.pim_serialize_network>, 'pim_serialize_link': <function PimAPIv2.pim_serialize_link>, 'pim_register_run': <function PimAPIv2.pim_register_run>, 'pim_finish_run': <function PimAPIv2.pim_finish_run>, 'pim_log_line': <function PimAPIv2.pim_log_line>, '__dict__': <attribute '__dict__' of 'PimAPIv2' objects>, '__weakref__': <attribute '__weakref__' of 'PimAPIv2' objects>})
__init__(uri=None)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'fastr.resources.plugins.reportingplugins.pimreporter'
__weakref__

list of weak references to the object (if defined)

create_job_data(job)[source]

Create a job data json part that is ready to send to PIM

Parameters:job (Job) – the job to convert
Return type:Dict[~KT, ~VT]
Returns:
job_update_loop()[source]

Loop that periodically updates job data

pim_finish_run(run)[source]
pim_log_line(record)[source]
pim_register_run(network)[source]
pim_serialize_macro(node, scope, links)[source]
pim_serialize_network(network, scope, parent, links)[source]
pim_serialize_node(node, scope, links)[source]
pim_update_status(job)[source]
class fastr.resources.plugins.reportingplugins.pimreporter.PimReporter[source]

Bases: fastr.plugins.reportingplugin.ReportingPlugin

SUPPORTED_APIS = {2: <class 'fastr.resources.plugins.reportingplugins.pimreporter.PimAPIv2'>}
__abstractmethods__ = frozenset()
__init__()[source]

The BasePlugin constructor.

Returns:the created plugin
Return type:BasePlugin
Raises:FastrPluginNotLoaded – if the plugin did not load correctly
__module__ = 'fastr.resources.plugins.reportingplugins.pimreporter'
activate()[source]

Activate the reporting plugin

configuration_fields = {'pim_batch_size': (<class 'int'>, 100, 'Maximum number of jobs that can be send to PIM in a single interval'), 'pim_debug': (<class 'bool'>, False, 'Setup PIM debug mode to send stdout stderr on job succes'), 'pim_host': (<class 'str'>, '', 'The PIM host to report to'), 'pim_update_interval': (<class 'float'>, 2.5, 'The interval in which to send jobs to PIM')}
job_updated(job)[source]
log_record_emitted(record)[source]
run_finished(run)[source]
run_started(run)[source]

simplereport Module

class fastr.resources.plugins.reportingplugins.simplereport.SimpleReport[source]

Bases: fastr.plugins.reportingplugin.ReportingPlugin

__abstractmethods__ = frozenset()
__module__ = 'fastr.resources.plugins.reportingplugins.simplereport'
run_finished(run)[source]