Skip to main content

prefect.artifacts

Interface for creating and reading artifacts.

Functions

Create a link artifact. Args:
  • link: The link to create.
  • link_text: The link text.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The table artifact ID.
Create a link artifact. Args:
  • link: The link to create.
  • link_text: The link text.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The table artifact ID.

acreate_markdown_artifact

Create a markdown artifact. Args:
  • markdown: The markdown to create.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The table artifact ID.

create_markdown_artifact

Create a markdown artifact. Args:
  • markdown: The markdown to create.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The table artifact ID.

acreate_table_artifact

Create a table artifact asynchronously. Args:
  • table: The table to create.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The table artifact ID.

create_table_artifact

Create a table artifact. Args:
  • table: The table to create.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The table artifact ID.

acreate_progress_artifact

Create a progress artifact asynchronously. Args:
  • progress: The percentage of progress represented by a float between 0 and 100.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The progress artifact ID.

create_progress_artifact

Create a progress artifact. Args:
  • progress: The percentage of progress represented by a float between 0 and 100.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The progress artifact ID.

aupdate_progress_artifact

Update a progress artifact asynchronously. Args:
  • artifact_id: The ID of the artifact to update.
  • progress: The percentage of progress represented by a float between 0 and 100.
  • description: A user-specified description of the artifact.
Returns:
  • The progress artifact ID.

update_progress_artifact

Update a progress artifact. Args:
  • artifact_id: The ID of the artifact to update.
  • progress: The percentage of progress represented by a float between 0 and 100.
  • description: A user-specified description of the artifact.
Returns:
  • The progress artifact ID.

acreate_image_artifact

Create an image artifact asynchronously. Args:
  • image_url: The URL of the image to display.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The image artifact ID.

create_image_artifact

Create an image artifact. Args:
  • image_url: The URL of the image to display.
  • key: A user-provided string identifier. Required for the artifact to show in the Artifacts page in the UI. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
Returns:
  • The image artifact ID.

Classes

Artifact

An artifact is a piece of data that is created by a flow or task run. https://docs.prefect.io/latest/develop/artifacts Args:
  • type: A string identifying the type of artifact.
  • key: A user-provided string identifier. The key must only contain lowercase letters, numbers, and dashes.
  • description: A user-specified description of the artifact.
  • data: A JSON payload that allows for a result to be retrieved.
Methods:

acreate

An async method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

aformat

aget

A async method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

aget_or_create

A async method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

create

A method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

format

get

A method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

get_or_create

A method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

LinkArtifact

Methods:

acreate

An async method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

aformat

aformat

aget

A async method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

aget_or_create

A async method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

create

A method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

format

format

get

A method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

get_or_create

A method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

MarkdownArtifact

Methods:

acreate

An async method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

aformat

aformat

aget

A async method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

aget_or_create

A async method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

create

A method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

format

format

get

A method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

get_or_create

A method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

TableArtifact

Methods:

acreate

An async method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

aformat

aformat

aget

A async method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

aget_or_create

A async method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

create

A method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

format

format

get

A method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

get_or_create

A method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

ProgressArtifact

Methods:

acreate

An async method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

aformat

aformat

aget

A async method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

aget_or_create

A async method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

create

A method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

format

format

get

A method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

get_or_create

A method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

ImageArtifact

An artifact that will display an image from a publicly accessible URL in the UI. Args:
  • image_url: The URL of the image to display.
Methods:

acreate

An async method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

aformat

aformat

aget

A async method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

aget_or_create

A async method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.

create

A method to create an artifact. Args:
  • client: The PrefectClient
Returns:
  • The created artifact.

format

This method is used to format the artifact data so it can be properly sent to the API when the .create() method is called. Returns:
  • The image URL.

format

get

A method to get an artifact. Args:
  • key: The key of the artifact to get.
  • client: A client to use when calling the Prefect API.
Returns:
  • The artifact (if found).

get_or_create

A method to get or create an artifact. Args:
  • key: The key of the artifact to get or create.
  • description: The description of the artifact to create.
  • data: The data of the artifact to create.
  • client: The PrefectClient
  • **kwargs: Additional keyword arguments to use when creating the artifact.
Returns:
  • The artifact, either retrieved or created.