Pascal Jahan Elahi (Pawsey)
02/10/2025, 12:06 PMRegistering artifact
in the prefect log, when I click on the Artifacts tab in the GUI, I see
This task run did not produce any artifacts; for more information on creating artifacts, see the [documentation](<https://docs.prefect.io/concepts/artifacts>).
What issues could arise in saving artifacts?Marvin
02/10/2025, 12:06 PMkey
, it might not be displayed correctly in the UI. It's advisable to provide a meaningful key when creating artifacts.
3. UI Display Issues: There might be a UI issue where artifacts are not displayed correctly. This could be related to a lack of a title for artifacts, causing them to appear as generic entries in the UI.
4. Prefect Version or Environment: Occasionally, certain versions or configurations might have bugs or issues that affect artifact visibility. Ensure you are using a stable Prefect version and check for any related bug reports or updates.
5. Artifact Storage: Artifacts are stored on Prefect Cloud or a Prefect server instance. Ensure that the storage setup is correctly configured and accessible.
For more detailed information, you can refer to the Prefect 2.x artifacts documentation, which explains how artifacts are managed and displayed.
If these suggestions don't resolve your issue, consider checking for any open issues or bugs reported in the Prefect repository, as similar problems might have been discussed or resolved.Pascal Jahan Elahi (Pawsey)
02/10/2025, 12:07 PMMarvin
02/10/2025, 12:07 PMcreate_link_artifact
function within your task. This function allows you to create artifacts such as links, which can be associated with the task run. Here's a basic example:
python
from prefect import flow, task
from prefect.artifacts import create_link_artifact
@task
def my_task():
create_link_artifact(
key="example-artifact",
link="<https://example.com/my-data.csv>",
description="## Example Data Artifact"
)
@flow
def my_flow():
my_task()
if __name__ == "__main__":
my_flow()
### Key Points:
- Key Argument: Use the key
argument to give your artifact a unique identifier. This helps in tracking its history over time.
- Task Context: Artifacts created within a task will be linked to that task's run context and visible in the Prefect UI under the Artifacts tab.
For more detailed information, you can refer to the Prefect 2.x artifacts documentation.Pascal Jahan Elahi (Pawsey)
02/10/2025, 12:11 PMMarvin
02/10/2025, 12:11 PMcreate_markdown_artifact
function within your task. This allows you to generate and attach Markdown content as an artifact to the task run. Here's an example:
python
from prefect import flow, task
from prefect.artifacts import create_markdown_artifact
@task
def markdown_task():
na_revenue = 500000
markdown_report = f"""# Sales Report
## Summary
In the past quarter, our company saw a significant increase in sales, with a total revenue of $1,000,000.
This represents a 20% increase over the same period last year.
## Sales by Region
| Region | Revenue |
|:--------------|-------:|
| North America | ${na_revenue:,} |
| Europe | $250,000 |
| Asia | $250,000 |
"""
create_markdown_artifact(
key="sales-report",
markdown=markdown_report
)
@flow
def my_flow():
markdown_task()
if __name__ == "__main__":
my_flow()
### Key Considerations:
- Key Argument: Use the key
argument to give your artifact a unique identifier. This helps in tracking its history over time.
- Markdown Formatting: Ensure that the Markdown content is not indented, as indentation might affect its rendering.
You can find more details in the Prefect 2.x artifacts documentation.