Declaring artifacts#

In order to define a task or workflow that emits an artifact, you must first declare the artifact and the keys for any partitions you wish for it to have. For the Artifact class parameters and methods, see the Flytekit Artifact documentation.

Basic artifact#

In the following example, an artifact called BasicTaskData is declared, along with a task that emits that artifact. Since it is a basic artifact, it doesn’t have any partitions.

Note

To use the example code on this page, you will need to add your registry to the pandas_image ImageSpec block.

Time-partitioned artifact#

By default, time partitioning is not enabled for artifacts. To enable it, declare the artifact with time_partitioned set to True. You can optionally set the granularity for the time partition to MINUTE, HOUR, DAY, or MONTH; the default is DAY.

You must also pass a value to time_partition, which you can do at runtime or by binding time_partition to an input.

Passing a value to time_partition at runtime#

Passing a value to time_partition by input#

Artifact with custom partition keys#

You can specify up to 10 custom partition keys when declaring an artifact. Custom partition keys can be set at runtime or be passed as inputs.

Passing a value to a custom partition key at runtime#

Passing a value to a custom partition key by input#

Artifact with model card example#

You can attach a model card with additional metadata to your artifact, formatted in Markdown: