ecsjobs.reporter module
- class ecsjobs.reporter.Reporter(config)[source]
Bases:
objectECSJobs Report Generator and SES Sender
Initialize the Report generator.
- Parameters:
config (ecsjobs.config.Config) – Configuration
- _div_for_job(job, exc=None, unfinished=False)[source]
Generate a div for the results email with the output or exception of a specific job.
- Parameters:
job (ecsjobs.jobs.base.Job) – the Job to generate a div for
exc (
ExceptionorNone) – Exception caught when running job, or Noneunfinished (bool) – whether or not the job was killed before being finished.
- Returns:
HTML div for the report
- Return type:
- _make_report(finished, unfinished, excs, start_dt, end_dt)[source]
Generate the HTML email report
- Parameters:
finished (list) – Finished Job instances.
unfinished (list) – Unfinished (timed-out) Job instances.
excs (dict) – Dict of Jobs that generated an exception while running; keys are Job class instances and values are 2-tuples of the caught Exception objects and string formatted tracebacks.
start_dt (datetime.datetime) – datetime instance when run was started
end_dt (datetime.datetime) – datetime instance when run was finished
- Returns:
HTML email report content
- Return type:
- _tr_for_job(job, exc=None, unfinished=False)[source]
Generate a row in the results table for a specific job.
- Parameters:
job (ecsjobs.jobs.base.Job) – the Job to generate a div for
exc (
2-tupleorNone) – None or 2-tuple of Exception caught when running job and traceback formatted as a string.unfinished (bool) – whether or not the job was killed before being finished.
- Returns:
Table row for the report
- Return type:
- run(finished, unfinished, excs, start_dt, end_dt, only_email_if_problems=False)[source]
Generate and send the report.
- Parameters:
finished (list) – Finished Job instances.
unfinished (list) – Unfinished (timed-out) Job instances.
excs (dict) – Dict of Jobs that generated an exception while running; keys are Job class instances and values are 2-tuples of the caught Exception objects and string formatted tracebacks.
start_dt (datetime.datetime) – datetime instance when run was started
end_dt (datetime.datetime) – datetime instance when run was finished
only_email_if_problems (bool) – If True, only send email report if there were failures, exceptions, or unfinished jobs. Otherwise, always send email.