See :meth:`.Session.execute_concurrent_async`.
(
session,
statements_and_parameters,
concurrency=100,
raise_on_first_error=False,
execution_profile=EXEC_PROFILE_DEFAULT
)
| 186 | |
| 187 | |
| 188 | def execute_concurrent_async( |
| 189 | session, |
| 190 | statements_and_parameters, |
| 191 | concurrency=100, |
| 192 | raise_on_first_error=False, |
| 193 | execution_profile=EXEC_PROFILE_DEFAULT |
| 194 | ): |
| 195 | """ |
| 196 | See :meth:`.Session.execute_concurrent_async`. |
| 197 | """ |
| 198 | # Create a Future object and initialize the custom ConcurrentExecutor with the Future |
| 199 | future = Future() |
| 200 | executor = ConcurrentExecutorFutureResults( |
| 201 | session=session, |
| 202 | statements_and_params=statements_and_parameters, |
| 203 | execution_profile=execution_profile, |
| 204 | future=future |
| 205 | ) |
| 206 | |
| 207 | # Execute concurrently |
| 208 | try: |
| 209 | executor.execute(concurrency=concurrency, fail_fast=raise_on_first_error) |
| 210 | except Exception as e: |
| 211 | future.set_exception(e) |
| 212 | |
| 213 | return future |