Execute the task. Call's the task spec's `TaskSpec.run` method and checks the return value. If the return value is - `True`: mark the task COMPLETE - `False`: mark the task in ERROR - `None`: mark the task STARTED Returns: bool: the valu
(self)
| 333 | self.task_spec._on_ready(self) |
| 334 | |
| 335 | def run(self): |
| 336 | """Execute the task. |
| 337 | |
| 338 | Call's the task spec's `TaskSpec.run` method and checks the return value. |
| 339 | |
| 340 | If the return value is |
| 341 | - `True`: mark the task COMPLETE |
| 342 | - `False`: mark the task in ERROR |
| 343 | - `None`: mark the task STARTED |
| 344 | |
| 345 | Returns: |
| 346 | bool: the value returned by the `TaskSpec`'s run method |
| 347 | |
| 348 | See `TaskState` for more information about states. |
| 349 | """ |
| 350 | start = time.time() |
| 351 | retval = self.task_spec._run(self) |
| 352 | if retval is None: |
| 353 | self._set_state(TaskState.STARTED) |
| 354 | elif retval is False: |
| 355 | self.error() |
| 356 | else: |
| 357 | self.complete() |
| 358 | return retval |
| 359 | |
| 360 | def cancel(self): |
| 361 | """Cancels the item if it was not yet completed; recursively cancels its children.""" |