Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add synchronous route for creating artifacts #13931

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/prefect/client/orchestration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4048,3 +4048,23 @@ def read_deployment(
else:
raise
return DeploymentResponse.model_validate(response.json())

def create_artifact(
self,
artifact: ArtifactCreate,
) -> Artifact:
"""
Creates an artifact with the provided configuration.

Args:
artifact: Desired configuration for the new artifact.
Returns:
Information about the newly created artifact.
"""

response = self._client.post(
"/artifacts/",
json=artifact.model_dump_json(exclude_unset=True),
)

return Artifact.model_validate(response.json())