testplan.runners.pools.tasks package¶
Submodules¶
testplan.runners.pools.tasks.base module¶
Tasks and task results base module.
-
class
testplan.runners.pools.tasks.base.
Task
(target: Union[str, testplan.testing.base.Test, None] = None, module: Optional[str] = None, path: Optional[str] = None, args: Optional[tuple] = None, kwargs: Optional[dict] = None, uid: Optional[str] = None, rerun: int = 0, weight: int = 0, part: Optional[Tuple[int, int]] = None)[source]¶ Bases:
testplan.common.serialization.base.SelectiveSerializable
Container of a target or path to a target that can be materialized into a runnable item. The arguments of the Task need to be serializable.
Parameters: - target – A runnable or a string path to a runnable or a callable to a runnable or a string path to a callable to a runnable.
- module – Module name that contains the task target definition.
- path – Path to module, default is current working directory.
- args – Args of target for task materialization.
- kwargs – Kwargs of target for task materialization.
- uid – Task uid.
- rerun – Rerun the task up to user specified times until it passes, by default 0 (no rerun). To enable task rerun feature, set to positive value no greater than 3.
- weight – Affects task scheduling - the larger the weight, the sooner task will be assigned to a worker. Default weight is 0, tasks with the same weight will be scheduled in the order they are added.
- part – part param that will be propagate to MultiTest
-
MAX_RERUN_LIMIT
= 3¶
-
aborted
¶ Returns if task was aborted.
-
args
¶ Task target args.
-
executors
¶ Executors to which the task had been assigned.
-
kwargs
¶ Task target kwargs.
-
materialize
(target=None) → testplan.testing.base.Test[source]¶ Create the actual task target executable/runnable object.
-
module
¶ Task target module.
-
reassign_cnt
¶ how many times the task is reassigned for rerun.
-
rerun
¶ how many times the task is allowed to rerun.
-
serializable_attrs
¶ Attributes to be included in serialization.
-
weight
¶
-
exception
testplan.runners.pools.tasks.base.
TaskMaterializationError
[source]¶ Bases:
Exception
Error materializing task target to be executed.
-
class
testplan.runners.pools.tasks.base.
TaskResult
(task: Optional[testplan.runners.pools.tasks.base.Task] = None, result: Optional[testplan.testing.base.TestResult] = None, status: bool = False, reason: Optional[str] = None, follow: Optional[testplan.runners.pools.tasks.base.Task] = None)[source]¶ Bases:
testplan.common.serialization.base.SelectiveSerializable
Contains result of the executed task target and status/errors/reason information that happened during task execution.
May contain follow up tasks.
-
follow
¶ Follow up tasks that need to be scheduled next.
-
reason
¶ Reason for failed status.
-
result
¶ Actual task target result.
-
serializable_attrs
¶ Attributes to be included in serialization.
-
status
¶ Result status. Should be True on correct successful execution.
-
task
¶ Original task.
-
-
class
testplan.runners.pools.tasks.base.
TaskTargetInformation
(target_params: Sequence[Union[Sequence, dict]], task_kwargs: Dict[str, Any], multitest_parts: Union[int, str, NoneType])[source]¶ Bases:
object
-
testplan.runners.pools.tasks.base.
get_task_target_information
(func) → testplan.runners.pools.tasks.base.TaskTargetInformation[source]¶
-
testplan.runners.pools.tasks.base.
is_task_target
(func)[source]¶ Check if a callable object is a task target.
-
testplan.runners.pools.tasks.base.
set_task_target
(func: Callable, info: testplan.runners.pools.tasks.base.TaskTargetInformation)[source]¶ Mark a callable object as a task target which can be packaged in a
Task
object.
-
testplan.runners.pools.tasks.base.
task_target
(parameters: Union[Callable, Sequence[Union[Sequence[T_co], dict]]] = None, multitest_parts: Union[int, typing_extensions.Literal['auto'][auto], None] = None, **kwargs)[source]¶ Decorator to make task target discoverable by plan.schedule_all.
Parameters: - parameters (
list
ortuple
that containslist
ortuple
ordict
) – A collection of parameters to be used to create task objects.list
ortuple
entry will be passed to target as positional arguments anddict
entry will be passed to target as keyword arguments. - multitest_parts (
int
or “auto”) – The number of multitest parts that will be generated from this task target, only applies if the task returns multitest type - kwargs (
dict
) – additional args to Task class, e.g rerun, weight etc.
- parameters (
Module contents¶
Serializable tasks and task results module.