Skip to content

Support new artifacts data model #647

@alahiff

Description

@alahiff

Creating an artifact
To create an artifact do a POST to /api/artifacts with JSON body:

{
    "name": "<filename>",
    "checksum": "<checksum>",
    "size": <size>,
    "type": "<mime type>",
    "originalPath": "<original path>"
}

By default there is no checksum deduplication, i.e. you can create as many artifacts as you want (with different ids) with the same checksum. If you do want checksum deduplication set a boolean query parameter deduplicate to True. In this case if there is an existing artifact with the same checksum the id of that artifact is returned.

Optionally metadata can be included, e.g. when creating an artifact provide an attribute metadata in a similar way to runs and folders:

{
    "name": "<filename>",
    "checksum": "<checksum>",
    "size": <size>,
    "type": "<mime type>",
    "originalPath": "<original path>",
    "metadata": {"exampleAttribute": "hello"}
}

Confirming artifact upload
After uploading an artifact to cloud object storage (if applicable), do a PUT to /api/artifacts/{artifact_id}with JSON body:

{
    "uploaded": true
}

Connecting an artifact to a run
To connect an artifact to a run, do a PUT to /api/runs/{run_id}/artifacts/{artifact_id} with JSON body:

{
    "category": "input|code|output"
}

with the category set as appropriate.

Disconnecting an artifact from a run
To disconnect an artifact from a run, do a DELETE to /api/runs/{run_id}/artifacts/{artifact_id}?category=input|code|output with the category set as appropriate.

Deleting an artifact
To delete an artifact by id, do a DELETE to /api/artifacts/{artifact_id}.

Getting an artifact
To get an artifact by id, do a GET to /api/artifacts/{artifact_id}. If the storage system used is S3 or similar, the response will contain a presigned url which can be used to download the file. Artifacts can also be downloaded using the deprecated /api/artifacts/{artifact_id}/download but this should not be used.

Listing artifacts
To get a list of artifacts, do a GET to /api/artifacts. Possible query parameters include:

  • count: (integer) return this number of artifacts,
  • start: (integer) start with this artifact,
  • filters: filters (not yet implemented, as this functionality isn't in use anywhere yet)
  • sorting: sorting (not yet implemented, as this functionality isn't in use anywhere yet)

Updating artifacts
To update metadata etc, do a PUT to /api/artifacts/{artifact_id}. Apart from setting uploaded this isn't implemented yet.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions