Skip to content

Commit

Permalink
deploy: a0728c5
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Nov 18, 2024
1 parent b91b349 commit 0730ed5
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions artifact-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ collection = await artifact_manager.create(
manifest=gallery_manifest,
config={"permissions": {"*": "r", "@": "r+"}}
)
print("Dataset Gallery created.")
print("Dataset Gallery created with ID:", collection.id)
```

**Tips: The returned `collection.id` is the unique identifier for the collection with the format `workspace_id/alias`. You can use this ID to refer to the collection in subsequent operations. You can also use only `alias` as a shortcut, however, this only works in the same workspace.**

### Step 3: Adding a Dataset to the Gallery

After creating the gallery, you can add datasets to it, with each dataset having its own metadata and permissions.
Expand All @@ -65,6 +67,8 @@ dataset = await artifact_manager.create(
print("Dataset added to the gallery.")
```

**Tips: The `version="stage"` parameter stages the dataset for review and commit. You can edit the dataset before committing it to the collection.**

### Step 4: Uploading Files to the Dataset with Download Statistics

Each dataset can contain multiple files. Use pre-signed URLs for secure uploads and set `download_weight` to track file downloads.
Expand Down Expand Up @@ -701,10 +705,10 @@ The `Artifact Manager` provides an HTTP endpoint for retrieving artifact manifes

### Endpoints:

- `/{workspace}/artifacts/{artifact_id}` for fetching the artifact manifest.
- `/{workspace}/artifacts/{artifact_id}/children` for listing all artifacts in a collection.
- `/{workspace}/artifacts/{artifact_id}/files` for listing all files in the artifact.
- `/{workspace}/artifacts/{artifact_id}/files/{file_path:path}` for downloading a file from the artifact (will be redirected to a pre-signed URL).
- `/{workspace}/artifacts/{artifact_alias}` for fetching the artifact manifest.
- `/{workspace}/artifacts/{artifact_alias}/children` for listing all artifacts in a collection.
- `/{workspace}/artifacts/{artifact_alias}/files` for listing all files in the artifact.
- `/{workspace}/artifacts/{artifact_alias}/files/{file_path:path}` for downloading a file from the artifact (will be redirected to a pre-signed URL).


### Request Format:
Expand All @@ -718,7 +722,7 @@ The `Artifact Manager` provides an HTTP endpoint for retrieving artifact manifes
The path parameters are used to specify the artifact or file to access. The following parameters are supported:

- **workspace**: The workspace in which the artifact is stored.
- **artifact_id**: The id of the artifact to access. This can be an uuid generated by `create` or `edit` function, or it can be an alias of the artifact under the current workspace. Note that this artifact_id can only be the uuid or the alias without the workspace id.
- **artifact_alias**: The alias or id of the artifact to access. This can be an artifact id generated by `create` or `edit` function, or it can be an alias of the artifact under the current workspace. Note that this artifact_alias should not contain the workspace.
- **file_path**: Optional, the relative path to a file within the artifact. This is optional and only required when downloading a file.

### Query Parameters:
Expand All @@ -738,13 +742,13 @@ Qury parameters are passed after the `?` in the URL and are used to control the

### Response:

For `/{workspace}/artifacts/{artifact_id}`, the response will be a JSON object representing the artifact manifest. For `/{workspace}/artifacts/{artifact_id}/__files__/{file_path:path}`, the response will be a pre-signed URL to download the file. The artifact manifest will also include any metadata such as download statistics, e.g. `view_count`, `download_count`. For private artifacts, make sure if the user has the necessary permissions.
For `/{workspace}/artifacts/{artifact_alias}`, the response will be a JSON object representing the artifact manifest. For `/{workspace}/artifacts/{artifact_alias}/__files__/{file_path:path}`, the response will be a pre-signed URL to download the file. The artifact manifest will also include any metadata such as download statistics, e.g. `view_count`, `download_count`. For private artifacts, make sure if the user has the necessary permissions.

For `/{workspace}/artifacts/{artifact_id}/children`, the response will be a list of artifacts in the collection.
For `/{workspace}/artifacts/{artifact_alias}/children`, the response will be a list of artifacts in the collection.

For `/{workspace}/artifacts/{artifact_id}/files`, the response will be a list of files in the artifact, each file is a dictionary with the `name` and `type` fields.
For `/{workspace}/artifacts/{artifact_alias}/files`, the response will be a list of files in the artifact, each file is a dictionary with the `name` and `type` fields.

For `/{workspace}/artifacts/{artifact_id}/files/{file_path:path}`, the response will be a pre-signed URL to download the file.
For `/{workspace}/artifacts/{artifact_alias}/files/{file_path:path}`, the response will be a pre-signed URL to download the file.

### Example: Fetching a public artifact with download statistics

Expand Down

0 comments on commit 0730ed5

Please sign in to comment.