Helper for performing a single push operation. NOTE: - Feast providers **do not currently support async offline writes**. - Therefore: * ONLINE and ONLINE_AND_OFFLINE → may be async, depending on provider.async_sup
(push_to: PushMode)
| 535 | assert_permissions(resource=feature_view, actions=actions) |
| 536 | |
| 537 | async def _push_with_to(push_to: PushMode) -> None: |
| 538 | """ |
| 539 | Helper for performing a single push operation. |
| 540 | |
| 541 | NOTE: |
| 542 | - Feast providers **do not currently support async offline writes**. |
| 543 | - Therefore: |
| 544 | * ONLINE and ONLINE_AND_OFFLINE → may be async, depending on provider.async_supported.online.write |
| 545 | * OFFLINE → always synchronous, but executed via run_in_threadpool when called from HTTP handlers. |
| 546 | - The OfflineWriteBatcher handles offline writes directly in its own background thread, but the offline store writes are currently synchronous only. |
| 547 | """ |
| 548 | push_source_name = request.push_source_name |
| 549 | allow_registry_cache = request.allow_registry_cache |
| 550 | transform_on_write = request.transform_on_write |
| 551 | |
| 552 | # Async currently only applies to online store writes (ONLINE / ONLINE_AND_OFFLINE paths) as theres no async for offline store |
| 553 | if push_to in (PushMode.ONLINE, PushMode.ONLINE_AND_OFFLINE) and ( |
| 554 | store._get_provider().async_supported.online.write |
| 555 | ): |
| 556 | await store.push_async( |
| 557 | push_source_name=push_source_name, |
| 558 | df=df, |
| 559 | allow_registry_cache=allow_registry_cache, |
| 560 | to=push_to, |
| 561 | transform_on_write=transform_on_write, |
| 562 | ) |
| 563 | else: |
| 564 | await run_in_threadpool( |
| 565 | lambda: store.push( |
| 566 | push_source_name=push_source_name, |
| 567 | df=df, |
| 568 | allow_registry_cache=allow_registry_cache, |
| 569 | to=push_to, |
| 570 | transform_on_write=transform_on_write, |
| 571 | ) |
| 572 | ) |
| 573 | |
| 574 | needs_online = to in (PushMode.ONLINE, PushMode.ONLINE_AND_OFFLINE) |
| 575 | needs_offline = to in (PushMode.OFFLINE, PushMode.ONLINE_AND_OFFLINE) |
no test coverage detected