Task Manager (photometry.TaskManager)

class photometry.TaskManager(todo_file, cleanup=False, overwrite=False, summary=None, summary_interval=100)[source]

A TaskManager which keeps track of which targets to process.

__init__(todo_file, cleanup=False, overwrite=False, summary=None, summary_interval=100)[source]

Initialize the TaskManager which keeps track of which targets to process.

Parameters:
  • todo_file (string) – Path to the TODO-file.
  • cleanup (boolean) – Perform cleanup/optimization of TODO-file before during initialization. Default=False.
  • overwrite (boolean) – Restart calculation from the beginning, discarding any previous results. Default=False.
  • summary (string) – Path to file where to periodically write a progress summary. The output file will be in JSON format. Default=None.
  • summary_interval (int) – Interval at which to write summary file. Setting this to 1 will mean writing the file after every tasks completes. Default=100.
Raises:

IOError – If TODO-file could not be found.

close()[source]

Close TaskManager and all associated objects.

get_number_tasks()[source]

Get number of tasks due to be processed.

Returns:Number of tasks due to be processed.
Return type:int
get_random_task()[source]

Get random task to be processed.

Returns:Dictionary of settings for task.
Return type:dict or None
get_task(starid=None)[source]

Get next task to be processed.

Returns:Dictionary of settings for task.
Return type:dict or None
save_result(result)[source]

Save results and diagnostics. This will update the TODO list.

Parameters:results (dict) – Dictionary of results and diagnostics.
start_task(taskid)[source]

Mark a task as STARTED in the TODO-list.

write_summary()[source]

Write summary of progress to file. The summary file will be in JSON format.