<#7194 Move TailLogs endpoint to dataproxy> Pull r...
# flyte-github
a
#7194 Move TailLogs endpoint to dataproxy Pull request opened by katrogan And add a
GetActionLogContext
to fetch log context from RunsService Why are the changes needed? Required to reduce dataflow in a secure environment. What changes were proposed in this pull request? See PR title How was this patch tested? Ran the demo cluster locally. Tested with flyte-sdk and this script
Copy code
@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
Copy code
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...
Labels Please add one or more of the following labels to categorize your PR: • added: For new features. • changed: For changes in existing functionality. • deprecated: For soon-to-be-removed features. • removed: For features being removed. • fixed: For any bug fixed. • security: In case of vulnerabilities This is important to improve the readability of release notes. Setup process Screenshots Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. Related PRs Docs link •
main
• #6583 • Move TailLogs endpoint to dataproxy 👈 flyteorg/flyte