Set up the background callback and manage jobs.
(
error_handler,
callback_ctx,
response,
kwargs,
background,
multi,
cache_key=None,
job_id=None,
)
| 484 | |
| 485 | |
| 486 | def _update_background_callback( |
| 487 | error_handler, |
| 488 | callback_ctx, |
| 489 | response, |
| 490 | kwargs, |
| 491 | background, |
| 492 | multi, |
| 493 | cache_key=None, |
| 494 | job_id=None, |
| 495 | ): |
| 496 | """Set up the background callback and manage jobs.""" |
| 497 | callback_manager = _get_callback_manager(kwargs, background) |
| 498 | |
| 499 | if cache_key is None or job_id is None: |
| 500 | adapter = get_app().backend.request_adapter() |
| 501 | cache_key = cache_key or (adapter.args.get("cacheKey") if adapter else None) |
| 502 | job_id = job_id or (adapter.args.get("job") if adapter else None) |
| 503 | |
| 504 | _progress_background_callback( |
| 505 | response, callback_manager, background, cache_key=cache_key |
| 506 | ) |
| 507 | |
| 508 | output_value = callback_manager.get_result(cache_key, job_id) |
| 509 | |
| 510 | return _handle_rest_background_callback( |
| 511 | output_value, |
| 512 | callback_manager, |
| 513 | response, |
| 514 | error_handler, |
| 515 | callback_ctx, |
| 516 | multi, |
| 517 | cache_key=cache_key, |
| 518 | job_id=job_id, |
| 519 | ) |
| 520 | |
| 521 | |
| 522 | def _handle_rest_background_callback( |
no test coverage detected
searching dependent graphs…