The callable to use when submitting a Task to an executor
(self, ctx=None)
| 120 | return filtered_kwargs |
| 121 | |
| 122 | def __call__(self, ctx=None): |
| 123 | """The callable to use when submitting a Task to an executor""" |
| 124 | with start_as_current_context(ctx): |
| 125 | try: |
| 126 | # Wait for all of futures this task depends on. |
| 127 | self._wait_on_dependent_futures() |
| 128 | # Gather up all of the main keyword arguments for main(). |
| 129 | # This includes the immediately provided main_kwargs and |
| 130 | # the values for pending_main_kwargs that source from the return |
| 131 | # values from the task's dependent futures. |
| 132 | kwargs = self._get_all_main_kwargs() |
| 133 | # If the task is not done (really only if some other related |
| 134 | # task to the TransferFuture had failed) then execute the task's |
| 135 | # main() method. |
| 136 | if not self._transfer_coordinator.done(): |
| 137 | return self._execute_main(kwargs) |
| 138 | except Exception as e: |
| 139 | self._log_and_set_exception(e) |
| 140 | finally: |
| 141 | # Run any done callbacks associated to the task no matter what. |
| 142 | for done_callback in self._done_callbacks: |
| 143 | done_callback() |
| 144 | |
| 145 | if self._is_final: |
| 146 | # If this is the final task announce that it is done if results |
| 147 | # are waiting on its completion. |
| 148 | self._transfer_coordinator.announce_done() |
| 149 | |
| 150 | def _execute_main(self, kwargs): |
| 151 | # Do not display keyword args that should not be printed, especially |
nothing calls this directly
no test coverage detected