<#925 add custom_context to Trigger> Pull request ...
# flyte-github
a
#925 add custom_context to Trigger Pull request opened by cosmicBboy This pull request introduces support for propagating custom context metadata through Flyte triggers, allowing users to attach arbitrary key-value pairs to triggered runs. These context values are now serializable and accessible throughout the task hierarchy, and the changes are thoroughly tested for various usage patterns and serialization scenarios. The most important changes include: Custom Context Support in Triggers • Added a new
custom_context
field to the
Trigger
class and all trigger convenience methods (e.g.,
daily
,
hourly
,
weekly
,
monthly
,
minutely
), allowing users to specify metadata that will be propagated to all triggered runs. (
src/flyte/_trigger.py
) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] Serialization Enhancements • Modified the trigger serialization logic to include the
custom_context
as key-value pairs in the
Inputs.context
field when present, ensuring the context is properly transmitted to the backend. (
src/flyte/_internal/runtime/trigger_serde.py
) [1] [2] Testing and Validation • Added comprehensive tests for triggers using
custom_context
, including direct usage, merging with other configs, and ensuring correct serialization and deserialization. These tests cover both the Flyte/W&B integration and the core Flyte trigger serialization. (
plugins/wandb/tests/test_context.py
,
tests/flyte/internal/runtime/test_trigger_serde.py
) [1] [2] Documentation Improvements • Updated docstrings for the
Trigger
class and its convenience methods to document the new
custom_context
parameter and its intended use. (
src/flyte/_trigger.py
) [1] [2] [3] [4] [5] Test Setup • Added missing import of the
flyte
module to the test file to ensure tests run correctly. (
plugins/wandb/tests/test_context.py
) flyteorg/flyte-sdk