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: str | Test | None = None, module: str | None = None, path: str | None = None, args: tuple | None = None, kwargs: dict | None = None, uid: str | None = None, rerun: int = 0, weight: int = 0, part: Tuple[int, int] | None = None)[source]
Bases:
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
- property aborted
Returns if task was aborted.
- property args: Tuple
Task target args.
- property executors
Executors to which the task had been assigned.
- property kwargs: Dict
Task target kwargs.
- property module: str
Task target module.
- property reassign_cnt: int
how many times the task is reassigned for rerun.
- property rerun: int
how many times the task is allowed to rerun.
- property serializable_attrs: Tuple[str, ...]
Attributes to be included in serialization.
- property weight: int
- 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: Task | None = None, result: TestResult | None = None, status: bool = False, reason: str | None = None, follow: Task | None = None)[source]
Bases:
SelectiveSerializable
Contains result of the executed task target and status/errors/reason information that happened during task execution.
May contain follow up tasks.
- property reason: str | None
Reason for failed status.
- property result: TestResult | None
Actual task target result.
- property serializable_attrs: Tuple
Attributes to be included in serialization.
- property status: bool
Result status. Should be True on correct successful execution.
- class testplan.runners.pools.tasks.base.TaskTargetInformation(target_params: Sequence[Sequence | dict], multitest_parts: int | str | NoneType, task_kwargs: Dict[str, Any])[source]
Bases:
object
- multitest_parts: int | str | None
- target_params: Sequence[Sequence | dict]
- task_kwargs: Dict[str, Any]
- 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: 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: Callable | Sequence[Sequence | dict] = None, multitest_parts: int | Literal['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 typekwargs (
dict
) – additional args to Task class, e.g rerun, weight etc.
Module contents
Serializable tasks and task results module.