acoustic-carpenter-78188
04/10/2026, 5:00 PM@env.task
async def spew_logs(duration_sec: int = 300, interval_sec: int = 5) -> str:
elapsed = 0
iteration = 0
while elapsed < duration_sec:
iteration += 1
print(f"[{elapsed:>4}s] iteration {iteration} - still running...", flush=True)
await asyncio.sleep(interval_sec)
elapsed += interval_sec
print(f"Done after {elapsed}s ({iteration} iterations)", flush=True)
return f"completed {iteration} iterations"
if __name__ == "__main__":
import sys
config_path = sys.argv[1] if len(sys.argv) > 1 else None
if config_path:
from flyte.config import Config
flyte.init_from_config(Config.auto(config_path))
else:
flyte.init_from_config()
run = flyte.run(spew_logs)
print(f"Run: {run.name}")
print(f"URL: {run.url}")
print("Tailing logs...")
run.action.show_logs(raw=True)
Verified output worked fine
python examples/basics/long_running.py .flyte/config-oss-local.yaml
> Bundling code...
✓ Code bundle: 1 files, 0.009765625 MB (compressed 0.0006895065307617188 MB)
> Uploading code bundle...
Run: r8xqdw87c7l266b9j99x
URL: <http://localhost:30080/v2/domain/development/project/flytesnacks/runs/r8xqdw87c7l266b9j99x>
Tailing logs...
[flyte] Flyte runtime started for action a0 with run name r8xqdw87c7l266b9j99x [ 0s] iteration 1 - still running... [ 5s] iteration 2 - still running... [ 10s] iteration 3 - still running...
flyteorg/flyte-sdkacoustic-carpenter-78188
04/16/2026, 6:45 PM