acoustic-carpenter-78188
06/10/2026, 8:59 AMimport flyte
from flyte.remote import Trigger
CONFIG = ".flyte/config-oss-local.yaml"
TASK_NAME = "cached_example_task.cached_task"
TRIGGER_NAME = "standalone_minutely" # distinct from the embedded trigger names
flyte.init_from_config(CONFIG)
Trigger.create(
trigger=flyte.Trigger.minutely("start_time", name=TRIGGER_NAME),
task_name=TASK_NAME,
)
print(f"Created standalone trigger '{TRIGGER_NAME}' on task '{TASK_NAME}'.")
[x] cached trigger (TaskTriggerSpec) Using this script
import flyte
env = flyte.TaskEnvironment(
name="cached_example_task",
env_vars={"_U_USE_ACTIONS": "1"},
)
@env.task(
cache=flyte.Cache(behavior="auto", ignored_inputs="start_time"),
triggers=flyte.Trigger.minutely("start_time", name="minutely_cached"),
)
def cached_task(start_time: datetime, x: int = 1) -> str:
return f"Cached task executed at {start_time.isoformat()} with x={x}"
if __name__ == "__main__":
flyte.init_from_config()
flyte.deploy(env)
And verified subsequent runs used cached output from the first run.
[x] run time always injected: Using this script
import flyte
env = flyte.TaskEnvironment(
name="hello_run_start_time",
)
@env.task()
async def hello_run_start_time() -> str:
ctx = flyte.ctx()
assert ctx is not None
# run_start_time is populated by the backend from the run's start time (for scheduled-trigger
# runs, the trigger's fire time) via the {{.runStartTime}} container arg. For ad-hoc runs it
# defaults to the run-creation time.
run_start_time = ctx.run_start_time
print(f"Run start time: {run_start_time.isoformat()}")
return run_start_time.isoformat()
if __name__ == "__main__":
flyte.init_from_config()
run = flyte.run(hello_run_start_time)
print(run.name)
print(run.url)
run.wait()
Verified individual runs output the kickoff time
ref eng26-533
flyteorg/flyte-sdkacoustic-carpenter-78188
06/10/2026, 8:59 AMacoustic-carpenter-78188
06/12/2026, 4:38 PM