Skip to content

Danielsola/artifact read value directly - #1582

Merged
dansola merged 3 commits into
mainfrom
danielsola/artifact-read-value-directly
Sep 4, 2026
Merged

Danielsola/artifact read value directly#1582
dansola merged 3 commits into
mainfrom
danielsola/artifact-read-value-directly

Conversation

@dansola

@dansola dansola commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Artifact.get() was documented, but every consumption path ended at
flyte.run() or an app parameter. Add the direct path -- to_python()
with an explicit type, then download() -- and link to it from the
prefetch page.

Copilot AI lite review requested due to automatic review settings September 4, 2026 22:28
Signed-off-by: Daniel Sola <daniel.sola@union.ai>
Signed-off-by: Daniel Sola <daniel.sola@union.ai>
@dansola
dansola force-pushed the danielsola/artifact-read-value-directly branch from f7b95bd to 6e0f5a0 Compare September 4, 2026 22:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new example likely omits required initialization (flyte.init_from_config()) and appears to incorrectly await to_python(), making the documented usage potentially inaccurate.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the Union artifacts documentation to describe (and link to) a “direct read” path for consuming an artifact outside of flyte.run()/task inputs by materializing it with Artifact.to_python() and then downloading the resulting File/Dir.

Changes:

  • Adds a new “Reading an artifact’s value directly” section with an example for loading an artifact in a local script/notebook.
  • Links the prefetch guide to the new direct-read section for users who want to load prefetched weights themselves.
File summaries
File Description
content/user-guide/artifacts/task-outputs.md Adds a new section documenting direct materialization (to_python) + local download of artifact values.
content/user-guide/artifacts/prefetch-models.md Adds a cross-link to the new direct-read documentation from the prefetch workflow.
Review details

Suppressed comments (1)

content/user-guide/artifacts/task-outputs.md:109

  • Only download() is an async call in the example; to_python() should be called normally. The notebook guidance should avoid saying to await both calls.
In a notebook, `await` the two calls directly instead of wrapping them in `asyncio.run()`.
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +94 to +103
import asyncio

from flyte.io import Dir
from flyte.remote import Artifact


async def load() -> str:
artifact = Artifact.get("trained-model")
weights = await artifact.to_python(Dir) # File or DataFrame for other artifacts
return await weights.download()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to_python() is async already. let me add flyte.init_from_config() though

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

GHA build & deploy preview

Built by .github/workflows/build-pr.yml and deployed to the docs CF Pages project by .github/workflows/deploy-pr-preview.yml.

Branch alias https://pr-1582-danielsola-artifact.docs-dog.pages.dev
This commit https://221b256d.docs-dog.pages.dev
Commit SHA ef2497246578c1be0fabf0d7fdc0dab6e7cd8cf3

Updated automatically on every push.

Signed-off-by: Daniel Sola <daniel.sola@union.ai>
@dansola
dansola force-pushed the danielsola/artifact-read-value-directly branch from 486b0f5 to ef24972 Compare September 4, 2026 22:52
@dansola
dansola merged commit eadbd66 into main Sep 4, 2026
16 checks passed
@dansola
dansola deleted the danielsola/artifact-read-value-directly branch September 4, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants