anatools.client.anaclient module¶
AnaClient is a python module for accessing Rendered.ai’s Platform API.
- class anatools.client.anaclient.AnaClient(workspaceId=None, environment='prod', email=None, password=None, local=False, verbose=False)¶
Bases:
object
- add_channel_access(channelId, organizationId)¶
Add access to a channel for an organization.
- Parameters
channel (str) – Name of channel to add access for.
organizationId (str) – Organization ID. Defaults to current if not specified.
- Returns
Access status.
- Return type
str
- add_organization_member(email, role, organizationId=None)¶
Add a user to an existing organization.
- Parameters
email (str) – Email of user to add.
role (str) – Role for user.
organizationId (str) – Organization ID to add members too. Uses current if not specified.
workspaceId (str) – Workspace ID to add members to. Uses current if not specified.
- Returns
Response status if user got added to workspace succesfully.
- Return type
str
- add_volume_access(volumeId, organizationId)¶
Add access to a volume for an organization.
- Parameters
volumeId (str) – VolumeId to add access for.
organizationId (str) – Organization ID to add access
- Returns
Status
- Return type
str
- add_workspace_guest(email, workspaceId=None)¶
Add a user to an existing organization. :param email: Email of user to add. :type email: str :param role: Role for user. :type role: str :param organizationId: Organization ID to add members too. Uses current if not specified. :type organizationId: str :param workspaceId: Workspace ID to add members to. Uses current if not specified. :type workspaceId: str
- Returns
Response status if user got added to workspace succesfully.
- Return type
str
- check_logout()¶
- create_analytics(datasetId, type, range=[], images=True, workspaceId=None)¶
Generate analytics for a dataset.
- Parameters
datasetId (str) – Dataset ID to download image annotation for.
type (str) – The type of dataset analytics to generate.
range ([int]) – The range of runs to generate analytics for.
workspaceId (str) – Workspace ID of the dataset to generate annotation for. If none is provided, the current workspace will get used.
- Returns
The analyticsId for the analytics job.
- Return type
str
- create_annotation(datasetId, format, map, workspaceId=None)¶
Generates annotations for an existing dataset.
- Parameters
datasetId (str) – Dataset ID to generate annotation for.
format (str) – Annotation format. Call get_annotation_formats() to find supported formats.
map (str) – The map file used for annotations. Call get_annotation_maps() to find supported maps.
workspaceId (str) – Workspace ID of the dataset to generate annotation for. If none is provided, the current workspace will get used.
- Returns
The annotationsId for the annotation job.
- Return type
str
- create_dataset(name, graphId, description, interpretations=1, priority=1, seed=1, workspaceId=None)¶
Create a new dataset based off an existing graph. This will start a new job.
- Parameters
name (str) – Name for dataset.
graphId (str) – Graph ID of the graph to create dataset from.
description (str) – Description for new dataset.
interpretations (int) – Number of interpretations.
priority (int) – Job priority.
seed (int) – Seed number.
workspaceId (str) – Workspace ID of the graph’s workspace. If none is provided, the current workspace will get used.
- Returns
Success or failure message about dataset creation.
- Return type
str
- create_gan_dataset(modelId, datasetId, workspaceId=None)¶
Creates a new GAN dataset job.
- Parameters
modelId (str) – Model ID to use for the GAN.
datasetId (str) – Dataset ID to input into the GAN.
workspaceId (str) – Workspace ID where the dataset exists.
- Returns
The datsetId for the GAN Dataset job.
- Return type
str
- create_graph(name, channel, graph, description=None, workspaceId=None)¶
Generates a new graph based off provided parameters.
- Parameters
name (str) – Graph name that will get generated.
channel (str) – Name of channel to generate the graph with.
graph (json) – Location of yaml file. Check out the readme for more details (step 3 for how to use ana)
description (str) – Description of graph. Optional.
workspaceId (str) – Workspace ID create the graph in. If none is provided, the default workspace will get used.
- Returns
The graph id if it was created sucessfully or an error message.
- Return type
str
- create_managed_channel(name, organizationId=None, dataVolumes=None, instanceType=None, timeout=None)¶
Create a managed channel for your organization.
- Parameters
organizationId (str) – Organization ID. Defaults to current if not specified.
name (name) – Channel name.
dataVolumes (str) – Data volume
instanceType (str) – AWS Instance type
timeout (int) – Timeout
- Returns
channel data
- Return type
json
- create_managed_volume(name, organizationId=None)¶
Creates a new volume with the specified name in the organization.
- Parameters
name (str) – The name of the new volume. Note: this name needs to be unique per organization.
organizationId (str) – The ID of the organization that the managed volume will belong to.
- Returns
volumeId
- Return type
str
- create_workspace(name, channels=[])¶
Create a new workspace with specific channels. :param name: New workspace name. :type name: str :param channels: List of channel names to add to workspace. :type channels: list
- Returns
Workspace ID if creation was successful. Otherwise returns message.
- Return type
str
- delete_analytics(analyticsId, workspaceId=None)¶
Deletes a dataset analytics.
- Parameters
analyticsId (str) – Analytics ID for the analytics to delete.
workspaceId (str) – Workspace ID where the analytics exist. If none is provided, the current workspace will get used.
- Returns
If true, successfully deleted the analytics.
- Return type
bool
- delete_annotation(annotationId, workspaceId=None)¶
Delete a dataset annotation.
- Parameters
annotationId (str) – AnnoationId of the annotation job.
workspaceId (str) – Workspace ID of the dataset to generate annotation for. If none is provided, the current workspace will get used.
- Returns
If true, successfully deleted the annotation.
- Return type
bool
- delete_dataset(datasetId, workspaceId=None)¶
Delete an existing dataset.
- Parameters
datasetId (str) – Dataset ID of dataset to delete.
workspaceId (str) – Workspace ID that the dataset is in. If none is provided, the current workspace will get used.
- Returns
Success or failure message about dataset deletion.
- Return type
str
- delete_gan_dataset(datasetId, workspaceId=None)¶
Deletes a GAN dataset job.
- Parameters
datasetId (str) – Dataset ID for the GAN dataset.
workspaceId (str) – Workspace ID where the dataset exists.
- Returns
Returns true if the GAN dataset was successfully deleted.
- Return type
bool
- delete_graph(graphId, workspaceId=None)¶
Delete a graph in a workspace.
- Parameters
graphId (str) – Graph id to delete.
workspaceId (str) – Workspace ID of the graph’s workspace. If none is provided, the current workspace will get used.
- Returns
A success or error message based on graph’s delete.
- Return type
str
- delete_managed_volume(volumeId)¶
Removes the volumeId from the organization. Note that this will delete any remote data in the volume and channels that rely on this volume will need to be updated.
- Parameters
organizationId (str) – The ID of the organization that the managed volume belongs to.
volumeId (str) – The ID of a specific Volume.
- Returns
Status
- Return type
str
- delete_volume_data(volumeId, files=[])¶
Delete data from a volume.
- Parameters
volumeId (str) – VolumeId to remove access to.
files (str) – The specific files to delete from the volume, if you wish to delete all then leave the list empty.
- Returns
Status
- Return type
str
- delete_workspace(workspaceId=None, prompt=True)¶
Delete an existing workspace. :param workspaceId: Workspace ID for workspace to get deleted. Deletes current workspace if not specified. :type workspaceId: str :param prompt: Set to True if avoiding prompts for deleting workspace. :type prompt: bool
- Returns
Success or failure message if workspace was sucessfully removed.
- Return type
str
- deploy_channel(channel, alias=None)¶
Deploy the docker image of a channel.
- Parameters
channel (str) – Channel name for the docker image, this must match the channel docker image.
- Returns
Success or failure message about docker registration.
- Return type
str
- download_annotation(datasetId, annotationId, workspaceId=None)¶
Downloads annotations archive.
- Parameters
datasetId (str) – Dataset ID to download image annotation for.
annotationId (str) – Id of previously generated image annotation.
workspaceId (str) – Workspace ID of the dataset to generate annotation for. If none is provided, the current workspace will get used.
- Returns
The archive file that got downloaded.
- Return type
str
- download_dataset(datasetId, workspaceId=None)¶
Download a dataset.
- Parameters
datasetId (str) – Dataset ID of dataset to download.
workspaceId (str) – Workspace ID that the dataset is in. If none is provided, the default workspace will get used.
- Returns
Success or failure message about dataset download.
- Return type
str
- download_graph(graphId, workspaceId=None)¶
Download a graph.
- Parameters
graphId (str) – Graph ID of the graph to download.
workspaceId (str) – Workspace ID of the graph’s workspace. If none is provided, the default workspace will get used.
- Returns
A download URL that can be used in the browser or a failure message.
- Return type
str
- download_volume_data(volumeId, files=[], localdir=None)¶
Download data from a volume.
- Parameters
volumeId (str) – VolumeId to remove access to.
files (str) – The specific files to retrieve from the volume, if you wish to retrieve all then leave the list empty.
localdir (str) – The location of the local directory to download the files to. If not specified, this will download the files to the current directory.
- Returns
Status
- Return type
str
- edit_dataset(datasetId, description=None, name=None, workspaceId=None)¶
Update dataset description.
- Parameters
datasetId (str) – Dataset ID to update description for.
description (str) – New description.
name (str) – New name for dataset.
workspaceId (str) – Workspace ID of the dataset to get updated. If none is provided, the current workspace will get used.
- Returns
Success or failure message about dataset update.
- Return type
str
- edit_graph(graphId, description=None, name=None, workspaceId=None)¶
Update graph description and name.
- Parameters
graphId (str) – Graph id to update.
description (str) – New description to update.
name (str) – New name to update.
workspaceId (str) – Workspace ID of the graph’s workspace. If none is provided, the current workspace will get used.
- Returns
A success or error message based on graph’s update.
- Return type
str
- edit_managed_channel(name, volumes, instanceType, timeout)¶
Edit a managed channel for your organization.
- Parameters
organizationId (str) – Organization ID. Defaults to current if not specified.
name (name) – Channel name.
volumes ([str]) – Data volumes
instanceType (str) – AWS instance type
timeout (int) – Timeout for the channel
- Returns
If true, the channel was successfully edited.
- Return type
bool
- edit_managed_volume(volumeId, name)¶
Edits the name of a volume.
- Parameters
volumeId (str) – The volumeId that will be updated.
name (str) – The new name of the new volume. Note: this name needs to be unique per organization.
- Returns
Status
- Return type
str
- edit_organization(name, organizationId=None)¶
Update the organization name. Uses current organization if no organizationId provided.
- Parameters
name (str) – Name to update organization to.
organizationId (str) – Organization Id to update.
- Returns
True if organization was edited successfully, False otherwise.
- Return type
bool
- edit_organization_member(email, role, organizationId=None)¶
Edit a member’s role.
- Parameters
email (str) – Member email to edit.
role (str) – Role to assign.
organizationId (str) – Organization ID to remove member from. Edits member in current organization if not specified.
- Returns
Response if member got edited succesfully.
- Return type
str
- edit_workspace(name, workspaceId=None, channels=None)¶
Edit workspace information. Provided channels list will result in the workspace having those channels. If channels is not provided, then no change will occur. :param name: New name to replace old one. :type name: str :param workspaceId: Workspace ID for workspace to update. :type workspaceId: str :param channels: Names of channels to add to workspace. :type channels: list
- Returns
Success or failure message if workspace description was sucessfully updated.
- Return type
str
- get_analytics(datasetId, analyticsId, workspaceId=None)¶
Retrieve information about analytics jobs for a dataset or analyticsId.
- Parameters
datasetId (str) – Dataset ID to retrieve analytics for.
analyticsId (str) – Analytics ID to retrieve analytics for.
workspaceId (str) – Workspace ID where the analytics exist. If none is provided, the current workspace will get used.
- Returns
Analytics information.
- Return type
json
- get_analytics_types()¶
Retrieve the analytics types available on the platform.
- Returns
The analytics types available on the platform.
- Return type
str
- get_annotation_formats()¶
Retrieves the annotation formats supported by the platform.
- Returns
The annotation formats supported by the platform.
- Return type
str
- get_annotation_maps(channelId)¶
Retrieves the map files that are supported by the channel.
- Parameters
channelId (str) – Channel ID to retrieve maps for.
- Returns
The annotation maps supported by the channel.
- Return type
str
- get_annotations(datasetId, annotationId, workspaceId=None)¶
Retrieve information about existing annotations generated for a dataset.
- Parameters
datasetId (str) – Dataset ID to generate annotation for.
annotationId (str) – Annotation ID for a specific annotations job.
workspaceId (str) – Workspace ID where the annotations exist. If none is provided, the current workspace will get used.
- Returns
Annotation information.
- Return type
json
- get_channels(organizationId=None, workspaceId=None, channelId=None)¶
Shows all channels available to the user. Can filter by organizationId, workspaceId, or channelId.
- Parameters
organizationId (str) – Filter channel list on what’s available to the organization.
workspaceId (str) – Filter channel list on what’s available to the workspace.
channelId (str) – Filter channel list on the specific channelId.
- Returns
List of all possible channel names.
- Return type
list
- get_datasets(datasetId=None, name=None, email=None, workspaceId=None)¶
Queries the workspace datasets based off provided parameters. Checks on datasetId, name, owner in this respective order within the specified workspace. If only workspace ID is provided, this will return all the graphs in a workspace.
- Parameters
datasetId (str) – Dataset ID to filter.
name (str) – Dataset name.
email (str) – Owner of the dataset.
workspaceId (str) – Workspace ID of the graph’s workspace. If none is provided, the current workspace will get used.
- Returns
Information about the dataset based off the query parameters provided or a failure message.
- Return type
str
- get_default_graph(channel)¶
Gets the default graph for a channel.
- Parameters
channel – Name of channel to get the default graph for.
- Returns
json data representing the graph.
- Return type
json
- get_gan_dataset(datasetId, workspaceId=None)¶
Retrieve information about GAN dataset jobs.
- Parameters
datasetId (str) – Dataset ID to retrieve information for.
workspaceId (str) – Workspace ID where the dataset exists.
- Returns
Information about the GAN Dataset.
- Return type
json
- get_gan_models(modelId=None)¶
Retrieve information about GAN models that exist on the platform.
- Parameters
modelId (str) – Model ID to retrieve information for.
- Returns
GAN Model information.
- Return type
json
- get_graphs(graphId=None, name=None, email=None, workspaceId=None)¶
Queries the workspace graphs based off provided parameters. Checks on graphId, name, or owner in this respective order within the specified workspace. If only workspace ID is provided, this will return all the graphs in a workspace.
- Parameters
graphid (str) – GraphID to filter on. Optional.
name (str) – Name of the graph to filter on. Optional.
email (str) – Owner of graphs to filter on. Optional.
workspaceId (str) – Workspace ID to filter on. If none is provided, the default workspace will get used.
- Returns
A list of graphs based off provided query parameters if any parameters match.
- Return type
list
- get_managed_channels(channelId=None, organizationId=None)¶
Get managed channels by organization.
- Parameters
organizationId (str) – Organization ID. Defaults to current if not specified.
channel (name) – Channel name to filter.
- Returns
channel data
- Return type
json
- get_managed_volumes(organizationId=None, volumeId=None)¶
Retrieves the managed volumes for an organization.
- Parameters
organizationId (str) – The ID of the organization that the managed volume belongs to.
volumeId (str) – The ID of a specific Volume.
- Returns
Volume Info
- Return type
json
- get_organization()¶
Get organization id of current organization.
- Returns
Organization ID of current workspace.
- Return type
str
- get_organization_limits(organizationId=None, setting=None)¶
Get information about Organization limits and setting.
- Parameters
organizationId (str) – Organization ID. Defaults to current if not specified.
setting (str) – Setting name.
- Returns
Organization limit information.
- Return type
json
- get_organization_members(organizationId=None)¶
Get users of an organization optionally filtered on workspace.
- Parameters
organizationId (str) – Organization ID. Defaults to current if not specified.
workspaceId (str) – Workspace Id. Optional.
- Returns
json object with users of an organization
- Return type
json
- get_organization_usage(organizationId, year, month, workspaceId=None, member=None)¶
Get organization usage optionally filtered on workspace or a user.
- Parameters
organizationId (str) – Organization ID. Defaults to current if not specified.
year (str) – Usage year to filter on.
month (str) – Usage month to filter on.
workspaceId (str) – Workspace Id. Optional.
member (str) – User email. Optional.
- Returns
json object with organization usage by channels, instanceType, and time as integer.
- Return type
json
- get_organizations()¶
Shows the organizations the user belongs to and the user’s role in that organization.
- Returns
List of members emails that belong to a workspace.
- Return type
list
- get_volume_data(volumeId, files=[])¶
Retrieves information about data from a volume.
- Parameters
volumeId (str) – VolumeId to remove access to.
files (str) – The specific files to retrieve information about from the volume, if you wish to retrieve all then leave the list empty.
- Returns
Status
- Return type
str
- get_volumes(organizationId=None, volumeId=None)¶
Retrieves the managed volumes for an organization.
- Parameters
organizationId (str) – The ID of the organization that the managed volume belongs to.
volumeId (str) – The ID of a specific Volume.
- Returns
Volume Info
- Return type
json
- get_workspace()¶
Get workspace id of current workspace. :returns: Workspace ID of current workspace. :rtype: str
- get_workspace_guests(workspaceId=None)¶
Get users of an organization optionally filtered on workspace. :param organizationId: Organization ID. Defaults to current if not specified. :type organizationId: str :param workspaceId: Workspace Id. Optional. :type workspaceId: str
- Returns
json object with users of an organization
- Return type
json
- get_workspace_limits(setting=None, workspaceId=None)¶
Get information about Organization limits and setting. :param workspaceId: Workspace ID. Defaults to current if not specified. :type workspaceId: str :param setting: Setting name. :type setting: str
- Returns
Workspace limit information.
- Return type
json
- get_workspaces(organizationId=None, workspaceId=None)¶
Shows list of workspaces with id, name, and owner data. :returns: Workspace data for all workspaces for a user. :rtype: dict
- login(email=None, password=None)¶
Log in to ana sdk
- Parameters
workspace (str) – ID of the workspace to log in to. Uses default if not specified.
environment (str) – Environment to log into. Defaults to production.
- logout()¶
Logs out of the ana sdk and removes credentials from ana.
- refresh_token()¶
- remove_channel_access(channelId, organizationId)¶
Remove access to a channel for an organization.
- Parameters
channel (str) – Name of channel to remove access to.
organizationId (str) – Organization ID. Defaults to current if not specified.
- Returns
Access status.
- Return type
str
- remove_organization_member(email, organizationId=None)¶
Remove a member from an existing workspace.
- Parameters
email (str) – Member email to remove.
organizationId (str) – Organization ID to remove member from. Removes from current organization if not specified.
workspaceId (str) – Workspace ID to remove member from. Removes from current workspace if not specified.
- Returns
Response status if member got removed from organization or workspace succesfully.
- Return type
str
- remove_volume_access(volumeId, organizationId)¶
Remove access to a volume for an organization.
- Parameters
volumeId (str) – VolumeId to remove access to.
organizationId (str) – Organization ID to remove access.
- Returns
Status
- Return type
str
- remove_workspace_guest(email, workspaceId=None)¶
Remove a member from an existing workspace. :param email: Member email to remove. :type email: str :param organizationId: Organization ID to remove member from. Removes from current organization if not specified. :type organizationId: str :param workspaceId: Workspace ID to remove member from. Removes from current workspace if not specified. :type workspaceId: str
- Returns
Response status if member got removed from organization or workspace succesfully.
- Return type
str
- set_default_graph(channel, workspaceId, graphId)¶
Sets the default graph for a channel. User must be in the organization that manages the channel.
- Parameters
channel (str) – The name of the channel to update the default graph.
workspaceId (str) – The ID of the Workspace that the graph is in.
graphId (str) – The ID of the graph that you want to be the default for the channel.
- Returns
Status
- Return type
str
- set_organization(organizationId, workspaceId=None)¶
Set the organization (and workspace) to the one you wish to work in.
- Parameters
organizationId (str) – Organization ID for the organization you wish to work in.
workspaceId (str) – Workspace ID for the workspace you wish to work in. Uses default workspace if this is not set.
- set_organization_limit(setting, limit, organizationId=None)¶
Set Organization limits for a setting.
- Parameters
organizationId (str) – Organization ID. Defaults to current if not specified.
setting (str) – Setting name.
limit (int) – Limit to set at.
- Returns
Organization limit information.
- Return type
json
- set_workspace(workspaceId)¶
Set the workspace to the one you wish to work in. :param workspaceid: Workspace ID for the workspace you wish to work in. :type workspaceid: str
- set_workspace_limit(setting, limit, workspaceId=None)¶
Set a limit for a workspace. :param workspaceId: Workspace ID. Defaults to current if not specified. :type workspaceId: str :param setting: Setting name. :type setting: str :param limit: Limit to set at. :type limit: Int
- Returns
Workspace limit information.
- Return type
json
- upload_volume_data(volumeId, files=[], localdir=None)¶
Upload data to a volume.
- Parameters
volumeId (str) – VolumeId to remove access to.
files (str) – The specific files to push to the volume, if you wish to push all then leave the list empty.
localdir (str) – The location of the local directory to upload the files from. If not specified, this will try to upload the files from the current directory.
- Returns
Status
- Return type
str