Define operations to be executed once at task shutdown. Useful when implementing processors, that don't have access to the Task top-level structure. This shutdown will be run only once, after all concurrent instances of the task have already finished. For in
(self)
| 387 | return setup |
| 388 | |
| 389 | def task_exit(self): |
| 390 | """ |
| 391 | Define operations to be executed once at task shutdown. |
| 392 | Useful when implementing processors, that don't have access to the Task |
| 393 | top-level structure. |
| 394 | |
| 395 | This shutdown will be run only once, after all concurrent instances of |
| 396 | the task have already finished. For instance-local shutdown, |
| 397 | use `task_instance_exit` instead. |
| 398 | |
| 399 | Example: |
| 400 | def read_queue(queue): |
| 401 | with ops.task_exit(): |
| 402 | queue.close(ops.net()) |
| 403 | return queue.read(ops.net()) |
| 404 | """ |
| 405 | setup = _SetupBuilder(_SetupBuilder.EXIT) |
| 406 | self.net().add_attribute(Task.TASK_SETUP, setup) |
| 407 | return setup |
| 408 | |
| 409 | def task_instance_init(self): |
| 410 | """ |