etl_lib.core.ProgressReporter module
- class Neo4jProgressReporter(context, database)[source]
Bases:
ProgressReporterExtends the ProgressReporter to additionally write the status updates from the tasks to a Neo4j database.
- Parameters:
database (str)
- __init__(context, database)[source]
Creates a new Neo4j progress reporter.
- Parameters:
context –
etl_lib.core.ETLContextcontaining a Neo4jConnection instance.database (
str) – Name of the database to write the status updates to.
- finished_task(task, result)[source]
Marks the task as finished.
Stops the time recording for the tasks and performs logging. Logging will include details from the provided summery.
- Parameters:
task (
Task) – Task to be marked as finished.result (
TaskReturn) – result of the task execution, such as status and summery information.
- Return type:
- Returns:
Task to be marked as started.
- register_tasks(root, **kwargs)[source]
Registers a
etl_lib.core.Taskwith this reporter.Needs to be called once with the root task. The function will walk the tree of tasks and register them in turn.
- Parameters:
main – Root of the task tree.
root (Task)
- report_progress(task, batches, expected_batches, stats)[source]
Optionally provide updates during execution of a task, such as batches processed so far.
This is an optional call, as not all
etl_lib.core.Taskneed batching.- Parameters:
- Return type:
- class ProgressReporter(context)[source]
Bases:
objectResponsible for reporting progress of
etl_lib.core.Task.This specific implementation uses the python logging module to log progress. Non-error logging is using the INFO level.
- finished_task(task, result)[source]
Marks the task as finished.
Stops the time recording for the tasks and performs logging. Logging will include details from the provided summery.
- Parameters:
task (
Task) – Task to be marked as finished.result (
TaskReturn) – result of the task execution, such as status and summery information.
- Return type:
- Returns:
Task to be marked as started.
- register_tasks(main)[source]
Registers a
etl_lib.core.Taskwith this reporter.Needs to be called once with the root task. The function will walk the tree of tasks and register them in turn.
- Parameters:
main (
Task) – Root of the task tree.
- report_progress(task, batches, expected_batches, stats)[source]
Optionally provide updates during execution of a task, such as batches processed so far.
This is an optional call, as not all
etl_lib.core.Taskneed batching.- Parameters:
- Return type:
- get_reporter(context)[source]
Returns a ProgressReporter instance.
If the
ETLContextenv holds the key REPORTER_DATABASE then aNeo4jProgressReporterinstance is created with the given database name.Otherwise, a
ProgressReporter(no logging to database) instance will be created.- Return type: