reporters

class anadama2.reporters.BaseReporter[source]

The base reporter defines functionality similar amongst all reporters.

The workflow that executes the hooks defined can be accessed at self.run_context.

finished()[source]

Executed when a run finishes. This method is called whether there are task failures or not.

started(run_context)[source]

Executed when a run is started, usually when anadama2.workflow.Workflow.go() is executed.

task_command(task_no)[source]
Executed when anadama is ready to run a task. Logs the command
and version of any tracked executables.
Parameters:task – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
task_completed(task_result)[source]

Executed when a task completes with no errors.

Parameters:task_no (int) – The task number of the task that succeeded . To get the actual anadama2.Task object that succeeded, do self.run_context.tasks[task_no]. To get the task result of the task that succeeded, do``self.run_context.task_results[task_no]``
task_failed(task_result)[source]

Executed when a task fails.

Parameters:task_no (int) – The task number of the task that failed . To get the actual anadama2.Task object that failed, do self.run_context.tasks[task_no]. To get the task result of the task that failed, do``self.run_context.task_results[task_no]``
task_grid_status(task_no, grid_id, status_message)[source]

Executed when anadama has grid information for a task. These messages are reported when the status for a grid task has changed.

Parameters:
  • task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
  • grid_id – The id of the grid job.
  • status_message – The grid status message.
task_grid_status_polling(task_no, grid_id, status_message)[source]

Executed when anadama has grid information for a task at set polling intervals. Status may repeat at each interval.

Parameters:
  • task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
  • grid_id – The id of the grid job.
  • status_message – The grid status message.
task_running(task_no)[source]

Executed when anadama is ready to run a task.

Parameters:task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
task_skipped(task_no)[source]

Executed when anadama determines that a task needn’t be run.

Parameters:task_no (int) – The task number of the task that is skipped. To get the actual anadama2.Task object that’s being skipped, do self.run_context.tasks[task_no].
task_started(task_no)[source]

Executed when anadama is just about to execute a task. These tasks are in the queue and waiting for available resources.

Parameters:task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
class anadama2.reporters.ConsoleReporter(*args, **kwargs)[source]

Prints out run progress to stderr. An example readout is as follows:

(s)[  1/  6 -  16.67%] Track pre-existing dependencies

The readout is composed of five pieces of information:

  1. The task status. That’s the part in the parentheses.
  • ( ) means that the task is currently being executed
  • (+) means that the task finished successfully
  • (s) means that the task was skipped
  • (!) means that the task failed.
  1. The current task number. That’s the first number in the square brackets.
  2. The total number of tasks to be run or skipped. That’s the number after the forward slash.
  3. The percent complete of the current run. That’s the number with a percent-sign next to it
  4. The task name. That’s the text that comes after the ending square bracket. Remember that you can set the task name with the name option to anadama2.workflow.Workflow.add_task().
finished()[source]

Executed when a run finishes. This method is called whether there are task failures or not.

msg_str = u'({:.1})[{:3}/{:3} - {:6.2f}%] {:.57}'
reset()[source]
started(ctx)[source]

Executed when a run is started, usually when anadama2.workflow.Workflow.go() is executed.

class stats[source]
done = u'+'
fail = u'!'
skip = u's'
start = u' '
task_completed(task_result)[source]

Executed when a task completes with no errors.

Parameters:task_no (int) – The task number of the task that succeeded . To get the actual anadama2.Task object that succeeded, do self.run_context.tasks[task_no]. To get the task result of the task that succeeded, do``self.run_context.task_results[task_no]``
task_failed(task_result)[source]

Executed when a task fails.

Parameters:task_no (int) – The task number of the task that failed . To get the actual anadama2.Task object that failed, do self.run_context.tasks[task_no]. To get the task result of the task that failed, do``self.run_context.task_results[task_no]``
task_skipped(task_no)[source]

Executed when anadama determines that a task needn’t be run.

Parameters:task_no (int) – The task number of the task that is skipped. To get the actual anadama2.Task object that’s being skipped, do self.run_context.tasks[task_no].
task_started(task_no)[source]

Executed when anadama is just about to execute a task. These tasks are in the queue and waiting for available resources.

Parameters:task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
class anadama2.reporters.LoggerReporter(loglevel_str=None, logfile=None, fmt_str=None, *args, **kwargs)[source]

A reporter that uses logging.

Parameters:
  • loglevel_str (str) – The logging level. Valid levels: subdebug, debug, info, subwarning, warning, error
  • logfile (str or file-like) – The file to log to. Defaults to stdout.
  • fmt_str (str) – The log format. See logging for more information
FORMAT = '%(asctime)s\t%(name)s\t%(funcName)s\t%(levelname)s: %(message)s'
finished()[source]

Executed when a run finishes. This method is called whether there are task failures or not.

log_event(msg, task_no, debug_msg=None)[source]
classmethod read_log(file, type, remove_paths=True)[source]

Read the data from the log file

started(ctx)[source]

Executed when a run is started, usually when anadama2.workflow.Workflow.go() is executed.

task_command(task_no)[source]
Executed when anadama is ready to run a task. Logs the command
and version of any tracked executables.
Parameters:task – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
task_completed(task_result)[source]

Executed when a task completes with no errors.

Parameters:task_no (int) – The task number of the task that succeeded . To get the actual anadama2.Task object that succeeded, do self.run_context.tasks[task_no]. To get the task result of the task that succeeded, do``self.run_context.task_results[task_no]``
task_failed(task_result)[source]

Executed when a task fails.

Parameters:task_no (int) – The task number of the task that failed . To get the actual anadama2.Task object that failed, do self.run_context.tasks[task_no]. To get the task result of the task that failed, do``self.run_context.task_results[task_no]``
task_grid_status(task_no, grid_id, status_message)[source]

Executed when anadama has grid information for a task. These messages are reported when the status for a grid task has changed.

Parameters:
  • task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
  • grid_id – The id of the grid job.
  • status_message – The grid status message.
task_grid_status_polling(task_no, grid_id, status_message)[source]

Executed when anadama has grid information for a task at set polling intervals. Status may repeat at each interval.

Parameters:
  • task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
  • grid_id – The id of the grid job.
  • status_message – The grid status message.
task_running(task_no)[source]

Executed when anadama is ready to run a task.

Parameters:task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
task_skipped(task_no)[source]

Executed when anadama determines that a task needn’t be run.

Parameters:task_no (int) – The task number of the task that is skipped. To get the actual anadama2.Task object that’s being skipped, do self.run_context.tasks[task_no].
task_started(task_no)[source]

Executed when anadama is just about to execute a task. These tasks are in the queue and waiting for available resources.

Parameters:task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
class anadama2.reporters.ReporterGroup(other_reporters)[source]

Sometimes you want to use multiple reporters. For that, there is ReporterGroup. Here’s an example usage:

from anadama2.reporters import ReporterGroup
my_grouped_reporter = ReporterGroup([custom_reporter_a, 
                                     custom_reporter_b, 
                                     custom_reporter_c])
...
ctx.go(reporter=my_grouped_reporter)
finished()[source]

Executed when a run finishes. This method is called whether there are task failures or not.

started(ctx)[source]

Executed when a run is started, usually when anadama2.workflow.Workflow.go() is executed.

task_command(task_no)[source]
Executed when anadama is ready to run a task. Logs the command
and version of any tracked executables.
Parameters:task – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
task_completed(task_result)[source]

Executed when a task completes with no errors.

Parameters:task_no (int) – The task number of the task that succeeded . To get the actual anadama2.Task object that succeeded, do self.run_context.tasks[task_no]. To get the task result of the task that succeeded, do``self.run_context.task_results[task_no]``
task_failed(task_result)[source]

Executed when a task fails.

Parameters:task_no (int) – The task number of the task that failed . To get the actual anadama2.Task object that failed, do self.run_context.tasks[task_no]. To get the task result of the task that failed, do``self.run_context.task_results[task_no]``
task_grid_status(task_no, grid_id, status_message)[source]

Executed when anadama has grid information for a task. These messages are reported when the status for a grid task has changed.

Parameters:
  • task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
  • grid_id – The id of the grid job.
  • status_message – The grid status message.
task_grid_status_polling(task_no, grid_id, status_message)[source]

Executed when anadama has grid information for a task at set polling intervals. Status may repeat at each interval.

Parameters:
  • task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
  • grid_id – The id of the grid job.
  • status_message – The grid status message.
task_running(task_no)[source]

Executed when anadama is ready to run a task.

Parameters:task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
task_skipped(task_no)[source]

Executed when anadama determines that a task needn’t be run.

Parameters:task_no (int) – The task number of the task that is skipped. To get the actual anadama2.Task object that’s being skipped, do self.run_context.tasks[task_no].
task_started(task_no)[source]

Executed when anadama is just about to execute a task. These tasks are in the queue and waiting for available resources.

Parameters:task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
class anadama2.reporters.VerboseConsoleReporter(*args, **kwargs)[source]

Prints out verbose run progress to stdout. An example readout is as follows:

DATE/TIME [ 0/18 - 0.00%] Started ** Task 2: kneaddata DATE/TIME [ 0/18 - 0.00%] **Started ** Task 0: kneaddata DATE/TIME [ 1/18 - 5.56%] **Completed Task 0: kneaddata DATE/TIME [ 1/18 - 5.56%] Started ** Task 4: metaphlan2.py DATE/TIME [ 2/18 - 11.11%] **Completed Task 2: kneaddata

The readout is composed of five pieces of information:

  1. The date/time for the status message.
  2. The status of all tasks. For example, [1/4 - 25%] indicates that
    one task of the four total tasks have finished running. The workflow is 25% complete.
  3. The step the task has completed. Examples are “Started” and “Completed”.
  4. The task number.
  5. The task description. This is the task name if set. If the task name is
    the default then it is the first task action. This is the first command and it is limited to the executable name. If it is a function, it will be the name of the function.
finished()[source]

Executed when a run finishes. This method is called whether there are task failures or not.

reset()[source]
started(ctx)[source]

Executed when a run is started, usually when anadama2.workflow.Workflow.go() is executed.

class stats[source]
done = u'Completed'
fail = u'Failed'
grid_run = u'GridJob'
max_message_length = 9
ready = u'Ready'
skip = u'Skipped'
start = u'Started'
task_completed(task_result)[source]

Executed when a task completes with no errors.

Parameters:task_no (int) – The task number of the task that succeeded . To get the actual anadama2.Task object that succeeded, do self.run_context.tasks[task_no]. To get the task result of the task that succeeded, do``self.run_context.task_results[task_no]``
task_failed(task_result)[source]

Executed when a task fails.

Parameters:task_no (int) – The task number of the task that failed . To get the actual anadama2.Task object that failed, do self.run_context.tasks[task_no]. To get the task result of the task that failed, do``self.run_context.task_results[task_no]``
task_grid_status(task_no, grid_id, status_message)[source]

Executed when anadama has grid information for a task. These messages are reported when the status for a grid task has changed.

Parameters:
  • task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
  • grid_id – The id of the grid job.
  • status_message – The grid status message.
task_grid_status_polling(task_no, grid_id, status_message)[source]

Executed when anadama has grid information for a task at set polling intervals. Status may repeat at each interval.

Parameters:
  • task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
  • grid_id – The id of the grid job.
  • status_message – The grid status message.
task_running(task_no)[source]

Executed when anadama is ready to run a task.

Parameters:task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
task_skipped(task_no)[source]

Executed when anadama determines that a task needn’t be run.

Parameters:task_no (int) – The task number of the task that is skipped. To get the actual anadama2.Task object that’s being skipped, do self.run_context.tasks[task_no].
task_started(task_no)[source]

Executed when anadama is just about to execute a task. These tasks are in the queue and waiting for available resources.

Parameters:task_no (int) – The task number of the task that is being started. To get the actual anadama2.Task object that’s being executed, do self.run_context.tasks[task_no].
class anadama2.reporters.WebhookReporter[source]

TODO

anadama2.reporters.default(output_dir=None, log_level=None)[source]