Overview
A project can have one or more artifact versions, each version:
- Can lock a specific run to track lineage.
- Can be deployed as an internal app.
- Can be deployed in production.
CLI Reference
You can check the complete artifacts CLI reference here or by using polyaxon artifacts --help
.
Client Reference
Polyaxon’s ProjectClient library exposes all methods to:
- list_artifact_versions
- get_artifact_version
- create_artifact_version
- patch_artifact_version
- register_artifact_version
- copy_artifact_version
- transfer_artifact_version
- delete_artifact_version
- stage_artifact_version
- pull_artifact_version
Since v1.18
, Polyaxon’s RunClient library exposes a method to automatically promote the run to an artifact version:
Artifact version creation
You can create your artifact versions using the CLI, API, or the UI.
CLI
polyaxon artifacts register -p OWNER_NAME/PROJECT_NAME --version VERSION_NAME --description ... --tags tag1,tag2,... --artifacts artifact-name,env,summary
Client
from polyaxon.client import ProjectClient
project_client = ProjectClient(project="ORGANIZATION/data-generation")
version = project_client.register_artifact_version(
version="v1",
description="description for this version...",
tags=["prod", "images"],
content={"key": "val", "env": ["package1", "package2"]},
run="f27c0580dcdf4ed7b2f36726c5257ade",
artifacts=["dataset", "summary"],
)
Note: You can use
force=True
to override a previous version registered with the same name.
UI
Artifact version creation from a run
When a user create a run that tracks an artifact, users can promote that artifact version directly from a run:
Once an artifact version is registered, the run will be marked as promoted:
Artifact version overview and definition
CLI
polyaxon artifacts get [-p] -ver VERSION_NAME
Client
from polyaxon.client import ProjectClient
project_client = ProjectClient(project="ORGANIZATION/bot-detection")
version = project_client.get_artifact_version(version="v1")
print(version)
UI
Artifact version stage changes
You can update the stage of the artifact version to reflect the production-readiness
CLI
polyaxon artifacts stage -ver VERSION_NAME -to staging --reason CISystem --message "Drift tests passed, move to staging" ...
Client
from polyaxon.client import V1Stages
from polyaxon.client import ProjectClient
project_client = ProjectClient(project="ORGANIZATION/bot-detection")
project_client.stage_artifact_version(
version="v1",
stage=V1Stages.STAGING,
reason="AirflowPipelineStageUpdate",
message="Tests passed and the artifact was automatically moved to staging",
)
UI
Artifact version admin
CLI
You can override an artifact version with push:
polyaxon artifacts register -ver ... --force
Or update specific info:
polyaxon artifacts update -ver ...
and delete
polyaxon artifacts delete -ver ...
Client
from polyaxon.client import ProjectClient
project_client = ProjectClient(project="ORGANIZATION/bot-detection")
# Update
project_client.patch_artifact_version(
version="v1",
data={"description": "new description", "tags": ["new-tag1", "new-tag2"]}
)
# Delete
project_client.delete_artifact_version(version="v1")
UI
You can manage an artifact version using the UI
Artifact version packaging and pulling
CLI
polyaxon artifacts pull -ver VERSION_NAME --help
Client
from polyaxon.client import ProjectClient
project_client = ProjectClient(project="ORGANIZATION/bot-detection")
project_client.pull_artifact_version(
version="v1",
path="/tmp/path"
)
Artifact version promotion from a run tracking
Client
from polyaxon import tracking
tracking.init()
# Artifact lineage reference
artifact_ref = "dataset-view"
# Logging a reference
tracking.log_artifact_ref("path/to/artifact", name=artifact_ref)
# Promoting the run to an artifact version
if some_condition:
tracking.promote_to_artifact_version(
version="rc2",
description="artifact promoted directly from the run",
tags=["tag1", "tag2"],
content={"key": "value"},
artifacts=[artifact_ref]
)
# End
tracking.end()