Tags Client Methods#

This page lists all relevant methods for Dioptra Tags that are available via the Python Client.

Requirements#

Tags - CRUD methods#

After importing and initializing the client, these methods can be executed via client.tags.METHOD_NAME().

Create Tag#

TagsCollectionClient.create(group_id: int, name: str) dioptra.client.tags.T[source]#

Creates a tag.

Parameters
  • group_id – The id of the group that will own the tag.

  • name – The name of the new tag.

Returns

The response from the Dioptra API.

Get Tags#

TagsCollectionClient.get(group_id: int | None = None, index: int = 0, page_length: int = 10, sort_by: str | None = None, descending: bool | None = None, search: str | None = None) dioptra.client.tags.T[source]#

Get a list of tags.

Parameters
  • group_id – The group id the tags belong to. If None, return tags from all groups that the user has access to. Optional, defaults to None.

  • index – The paging index. Optional, defaults to 0.

  • page_length – The maximum number of tags to return in the paged response. Optional, defaults to 10.

  • sort_by – The field to use to sort the returned list. Optional, defaults to None.

  • descending – Sort the returned list in descending order. Optional, defaults to None.

  • search – Search for tags using the Dioptra API’s query language. Optional, defaults to None.

Returns

The response from the Dioptra API.

Get Tag by ID#

TagsCollectionClient.get_by_id(tag_id: str | int) dioptra.client.tags.T[source]#

Get the tag matching the provided id.

Parameters

tag_id – The tag id, an integer.

Returns

The response from the Dioptra API.

Modify Tag#

TagsCollectionClient.modify_by_id(tag_id: str | int, name: str) dioptra.client.tags.T[source]#

Modify the tag matching the provided id.

Parameters
  • tag_id – The tag id, an integer.

  • name – The new name of the tag.

Returns

The response from the Dioptra API.

Delete Tag#

TagsCollectionClient.delete_by_id(tag_id: str | int) dioptra.client.tags.T[source]#

Delete the tag matching the provided id.

Parameters

tag_id – The tag id, an integer.

Returns

The response from the Dioptra API.

Tags - Other Methods#

Get Dioptra Resources for Tag#

TagsCollectionClient.get_resources_for_tag(tag_id: str | int, resource_type: str | None = None, index: int = 0, page_length: int = 10) dioptra.client.tags.T[source]#

Get a list of resources labeled with a tag.

Parameters
  • tag_id – The tag id, an integer.

  • resource_type – The type of resource to filter by. If None, return all resources associated with the tag. Optional, defaults to None.

  • index – The paging index.

  • page_length – The maximum number of tags to return in the paged response.

Returns

The response from the Dioptra API.

Attached Tags - Methods#

These methods exist within the class TagsSubCollectionClient. In other resource clients (like Experiments or Jobs), they are typically accessed via a tags property.

Example - Get Tags for an Experiment

Get Tags for an Experiment

client.experiments.tags.get(1)

Get Attached Tags#

TagsSubCollectionClient.get(*resource_ids: str | int) dioptra.client.tags.T[source]#

Get a list of tags.

Parameters

*resource_ids – The parent resource ids that own the tags sub-collection.

Returns

The response from the Dioptra API.

Replace All Attached Tags#

TagsSubCollectionClient.modify(*resource_ids: str | int, ids: list[int]) dioptra.client.tags.T[source]#

Change the list of tags associated with an endpoint resource.

This method overwrites the existing list of tags associated with an endpoint resource. To non-destructively append multiple tags, use the append method. To delete an individual tag, use the remove method.

Parameters
  • *resource_ids – The parent resource ids that own the tags sub-collection.

  • ids – The list of tag ids to set on the resource.

Returns

The response from the Dioptra API.

Append Tags to Resource#

TagsSubCollectionClient.append(*resource_ids: str | int, ids: list[int]) dioptra.client.tags.T[source]#

Append one or more tags to an endpoint resource.

Tag ids that have already been appended to the endpoint resource will be ignored.

Parameters
  • *resource_ids – The parent resource ids that own the tags sub-collection.

  • ids – The list of tag ids to append to the endpoint resource.

Returns

The response from the Dioptra API.

Remove One Tag from Resource#

TagsSubCollectionClient.remove(*resource_ids: str | int, tag_id: int) dioptra.client.tags.T[source]#

Remove a tag from an endpoint resource.

Parameters
  • *resource_ids – The parent resource ids that own the tags sub-collection.

  • tag_id – The id of the tag to remove from the endpoint resource.

Returns

The response from the Dioptra API.

Remove All Tags from Resource#

TagsSubCollectionClient.remove_all(*resource_ids: str | int) dioptra.client.tags.T[source]#

Remove all tags from an endpoint resource.

This method will remove all tags from the endpoint resource and cannot be reversed. To remove individual tags, use the remove method.

Parameters

*resource_ids – The parent resource ids that own the tags sub-collection.

Returns

The response from the Dioptra API.