Danielsola/artifact read value directly - #1582
Conversation
Signed-off-by: Daniel Sola <daniel.sola@union.ai>
f7b95bd to
6e0f5a0
Compare
There was a problem hiding this comment.
🟡 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.
| 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() |
There was a problem hiding this comment.
to_python() is async already. let me add flyte.init_from_config() though
GHA build & deploy previewBuilt by
Updated automatically on every push. |
486b0f5 to
ef24972
Compare
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.