base_task
trestle.tasks.base_task
¤
Trestle tasks base templating.
Attributes¤
logger = logging.getLogger(__name__)
module-attribute
¤
Classes¤
PassFail
¤
Bases: TaskBase
Holding pattern template for a task which does nothing and always passes.
Attributes:
Name | Type | Description |
---|---|---|
name |
Name of the task. |
Source code in trestle/tasks/base_task.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
Attributes¤
name = 'pass-fail'
class-attribute
instance-attribute
¤
Functions¤
__init__(config_object)
¤
Initialize trestle task pass-fail.
Attributes:
Name | Type | Description |
---|---|---|
config_object |
Config section associated with the task. |
Source code in trestle/tasks/base_task.py
74 75 76 77 78 79 80 81 |
|
execute()
¤
Provide a actual outcome.
Source code in trestle/tasks/base_task.py
105 106 107 108 109 110 111 |
|
print_info()
¤
Print the help string.
Source code in trestle/tasks/base_task.py
83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
simulate()
¤
Provide a simulated outcome.
Source code in trestle/tasks/base_task.py
97 98 99 100 101 102 103 |
|
TaskBase
¤
Bases: ABC
Abstract base class for tasks.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Name of the task. |
Source code in trestle/tasks/base_task.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
Attributes¤
name: str = 'base'
class-attribute
instance-attribute
¤
Functions¤
__init__(config_object)
¤
Initialize task base and store config.
Source code in trestle/tasks/base_task.py
47 48 49 |
|
execute()
abstractmethod
¤
Execute the task including potential rollback.
Source code in trestle/tasks/base_task.py
55 56 57 |
|
print_info()
abstractmethod
¤
Print the help string.
Source code in trestle/tasks/base_task.py
51 52 53 |
|
simulate()
abstractmethod
¤
Simulate the task and report task outcome.
Source code in trestle/tasks/base_task.py
59 60 61 |
|
TaskOutcome
¤
Bases: Enum
Enum describing possible task outcomes.
Source code in trestle/tasks/base_task.py
26 27 28 29 30 31 32 33 34 |
|
Attributes¤
FAILURE = 'failure'
class-attribute
instance-attribute
¤
NOT_IMPLEMENTED = 'not-implemented'
class-attribute
instance-attribute
¤
ROLLEDBACK = 'rolledback'
class-attribute
instance-attribute
¤
SIM_FAILURE = 'simulated-failure'
class-attribute
instance-attribute
¤
SIM_SUCCESS = 'simulated-success'
class-attribute
instance-attribute
¤
SUCCESS = 'success'
class-attribute
instance-attribute
¤
handler: python