MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / ConcurrentExecutorListResults

Class ConcurrentExecutorListResults

cassandra/concurrent.py:134–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132
133
134class ConcurrentExecutorListResults(_ConcurrentExecutor):
135
136 _exception = None
137
138 def execute(self, concurrency, fail_fast):
139 self._exception = None
140 return super(ConcurrentExecutorListResults, self).execute(concurrency, fail_fast)
141
142 def _put_result(self, result, idx, success):
143 self._results_queue.append((idx, ExecutionResult(success, result)))
144 with self._condition:
145 self._current += 1
146 if not success and self._fail_fast:
147 if not self._exception:
148 self._exception = result
149 self._condition.notify()
150 elif not self._execute_next() and self._current == self._exec_count:
151 self._condition.notify()
152
153 def _results(self):
154 with self._condition:
155 while self._current < self._exec_count:
156 self._condition.wait()
157 if self._exception and self._fail_fast:
158 raise self._exception
159 if self._exception and self._fail_fast: # raise the exception even if there was no wait
160 raise self._exception
161 return [r[1] for r in sorted(self._results_queue)]
162
163
164

Callers 1

execute_concurrentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected