watchme.tasks package

Submodules

watchme.tasks.worker module

Copyright (C) 2019 Vanessa Sochat.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

class watchme.tasks.worker.Workers(workers=None, show_progress=False)[source]

Bases: object

end()[source]
run(funcs, tasks)[source]

run will send a list of tasks, a tuple with arguments, through a function. the arguments should be ordered correctly.

Parameters
  • funcs (the functions to run with multiprocessing.pool, a dictionary) – with lookup by the task name

  • tasks (a dict of tasks, each task name (key) with a) – tuple of arguments to process

start()[source]
watchme.tasks.worker.init_worker()[source]
watchme.tasks.worker.multi_package(func, kwargs)[source]
watchme.tasks.worker.multi_wrapper(func_args)[source]

Module contents

Copyright (C) 2019 Vanessa Sochat.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

class watchme.tasks.TaskBase(name, params=None, **kwargs)[source]

Bases: object

export_params(active='true')[source]

export parameters, meaning returning a dictionary of the task parameters plus the addition of the task type and active status.

get_type()[source]

get the watcher type.

run()[source]

run an isolated task, meaning no update or communication with the watcher. This will return the raw result.

set_params(params)[source]

iterate through parameters, set into dictionary.

Parameters

params (a list of key@value pairs to set.)

validate()[source]

validate the parameters set for the Task. Exit if there are any errors. Ensure required parameters are defined, and have correct values.

write_results(result, repo)[source]

an entrypoint function for a general task. By default, we parse results based on the result type. Any particular subclass of the TaskBase can modify or extend these functions.

Parameters
  • result (the result object to parse)

  • repo (the repo base (watcher.repo))