<#1037 fix: accept list of triggers/links in @env....
# flyte-github
a
#1037 fix: accept list of triggers/links in @env.task decorator Pull request opened by EngHabu Summary
@env.task(triggers=[trigger, ...])
previously surfaced as
DeploymentError: ... 'list' object has no attribute 'env_vars'
at deploy time. The decorator's coercion in
_task_environment.py
only checked for
tuple
, so a list was wrapped into a 1-tuple containing the list — and the inner list leaked through to
to_task_trigger
, which tried to read
.env_vars
off it. The user-facing docstring at
_trigger.py:724
uses
triggers=[my_trigger]
(list syntax), so users routinely hit this. Changes •
src/flyte/_task_environment.py:369-370
— coerce triggers by element type (
isinstance(triggers, Trigger)
) and links by container type (
Link
is a non-runtime-checkable Protocol, so we check for list/tuple). Both now correctly handle a single object, a list, or a tuple. •
tests/user_api/test_triggers.py
— added
test_task_with_triggers_as_list
and
test_task_with_single_element_list_trigger
covering the regression. Sentry Closes the deploy-time failure tracked in FLYTE-SDK-17. Test plan •
pytest tests/user_api/test_triggers.py
— 32 passed (30 existing + 2 new) •
pytest tests/user_api/test_task_environment.py tests/user_api/test_triggers.py tests/flyte/test_trigger.py tests/flyte/internal/runtime/test_trigger_serde.py
— 93 passed • Manual: deploy a task with
triggers=[t1, t2]
against a real backend (no longer raises) 🤖 Generated with Claude Code flyteorg/flyte-sdk