anatools.client.anaclient module¶
AnaClient is the SDK module for connecting to Rendered.ai’s Platform API.
- class AnaClient(workspaceId=None, environment='prod', email=None, password=None, local=False, verbose=None)¶
Bases:
object
- add_channel_access(channelId, organizationId)¶
Add access to a channel for an organization.
- Parameters
channelId (str) – Id 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.
- 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 guest to an existing workspace.
- Parameters
email (str) – Email of guest to add.
workspaceId (str) – Workspace ID to add a guest to. Uses current if not specified.
- Returns
Response status if guest got added to workspace succesfully.
- Return type
str
- cancel_dataset(datasetId, workspaceId=None)¶
Stop a running job.
- Parameters
datasetId (str) – Dataset ID of the running job to stop.
workspaceId (str) – Workspace ID of the running job. If none is provided, the default workspace will get used.
- Returns
Success or error message about stopping the job execution.
- 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 analytics to generate. Choose one from the list that get_analytics_types method returns.
range (list[int]) – The range of runs to generate analytics for.
workspaceId (str) – Workspace ID of the dataset to generate the analytics 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='', runs=1, priority=1, seed=1, workspaceId=None)¶
Create a new dataset based off an existing staged graph. This will start a new job.
- Parameters
name (str) – Name for dataset.
graphId (str) – ID of the staged graph to create dataset from.
description (str) – Description for new dataset.
runs (int) – Number of times a channel will run within a single job. This is also how many different images will get created within the dataset.
priority (int) – Job priority.
seed (int) – Seed number.
workspaceId (str) – Workspace ID of the staged 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)¶
Create a new GAN dataset based off an existing dataset. This will start a new 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_managed_channel(name, organizationId=None, volumes=[], instance='p2.xlarge', timeout=120)¶
Create a managed channel for your organization.
- Parameters
name (str) – Channel name.
organizationId (str) – Organization ID. Defaults to current if not specified.
volumes (list[str]) – List of the data volume names to associate with this channel.
instance (str) – AWS Instance type.
timeout (int) – Timeout
- Returns
channel data
- Return type
list[dict]
- 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_staged_graph(name, channelId, graph, description=None, workspaceId=None)¶
Generates a new staged graph based off provided parameters. Must provide valid json string to create a new staged graph.
- Parameters
name (str) – Name for the that will get generated.
channelId (str) – Id of channel to generate the staged graph with.
graph (str) – The graph in json format. While YAML files are used in channel development, the Platform SDK and API only support JSON. Ensure that the YAML file is valid in order for the SDK to convert YAML to JSON for you. Otherwise, provide a graph in JSON format.
description (str) – Description of staged graph. Optional.
workspaceId (str) – Workspace ID create the staged graph in. If none is provided, the default workspace will get used.
- Returns
The staged graph id if it was created sucessfully or an error message.
- Return type
str
- create_workspace(name, channelIds=[])¶
Create a new workspace with specific channels.
- Parameters
name (str) – New workspace name.
channels (list[str]) – List of channel names to add to workspace.
- Returns
Workspace ID if creation was successful. Otherwise returns message.
- Return type
str
- delete_analytics(analyticsId, workspaceId=None)¶
Deletes a dataset’s 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_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
volumeId (str) – The ID of a specific Volume.
- Returns
Status
- Return type
str
- delete_staged_graph(graphId, workspaceId=None)¶
Delete a staged graph in a workspace.
- Parameters
graphId (str) – Staged Graph id to delete.
workspaceId (str) – Workspace ID of the staged graph’s workspace. If none is provided, the current workspace will get used.
- Returns
A success or error message based on staged graph’s delete.
- 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.
- Parameters
workspaceId (str) – Workspace ID for workspace to get deleted. Deletes current workspace if not specified.
prompt (bool) – Set to True if avoiding prompts for deleting workspace.
- Returns
Success or failure message if workspace was sucessfully removed.
- Return type
str
- deploy_managed_channel(channelId=None, image=None)¶
Deploy the Docker image of a channel.
- Parameters
channelId (str) – Channel ID that you are pushing the image to. If the channelId isn’t specified, it will use the image name to lookup the channelId.
image (str) – The Docker image name. This should match the channel name when running ana. If image is not specified, it will use the channel name for the channelId.
- Returns
deploymentId for current round of deployment or an error message if something went wrong
- 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 name of 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_staged_graph(graphId, workspaceId=None)¶
Download a staged graph.
- Parameters
graphId (str) – Graph ID of the staged graph to download.
workspaceId (str) – Workspace ID of the staged 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_managed_channel(channelId, name=None, volumes=None, instance=None, timeout=None, status=None)¶
Edit a managed channel for your organization.
- Parameters
channelId (str) – ChannelId ID of the channel to edit.
name (name) – The new name to give the channel.
volumes (list[str]) – Data volumes for the channel.
instance (str) – Instance type to run the channel on.
timeout (int) – Timeout for the channel.
status (str) – The status of 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_staged_graph(graphId, description=None, name=None, workspaceId=None)¶
Update staged graph description and name.
- Parameters
graphId (str) – Staged Graph id to update.
description (str) – New description to update.
name (str) – New name to update.
workspaceId (str) – Workspace ID of the staged graph’s workspace. If none is provided, the current workspace will get used.
- Returns
A success or error message based on staged graph’s update.
- Return type
str
- edit_workspace(name=None, channels=None, workspaceId=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.
- Parameters
name (str) – New name to replace old one.
channels (list[str]) – Names of channels that the workspace will have access to.
workspaceId (str) – Workspace ID for workspace to update.
- Returns
Success or failure message if workspace was sucessfully updated.
- Return type
str
- get_analytics(datasetId, analyticsId, workspaceId=None)¶
Retrieve information about analytics jobs.
- Parameters
datasetId (str) – Dataset ID that the analytics job is associated with.
analyticsId (str) – Job ID for an analytics job.
workspaceId (str) – Workspace ID where the analytics exist. If none is provided, the current workspace will get used.
- Returns
Analytics job information.
- Return type
list[dict]
- get_analytics_types()¶
Retrieve the analytics types available on the Platform.
- Returns
The analytics types available on the Platform.
- Return type
list[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=None, annotationId=None, workspaceId=None)¶
Retrieve information about existing annotations generated for a dataset. Querying requires both datasetId and annotationId.
- Parameters
datasetId (str) – Dataset ID to generate annotations 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
list[dict]
- 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 channels associated with user, workspace, organization or channelId.
- Return type
list[dict]
- 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 datasets 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 dataset’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(channelId)¶
Gets the default graph for a channel.
- Parameters
channelId – Id of channel to get the default graph for.
- Returns
json data representing the graph.
- Return type
json
- get_deployment_status(deploymentId, stream=False)¶
Retrieves status for a channel’s deployment.
- Parameters
deploymentId (str) – The deploymentId to retrieve status for
stream (bool) – Flag to print information to the terminal so the user can avoid constant polling to retrieve status.
- Returns
Deployment status.
- Return type
list[dict]
- 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
list[dict]
- 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
list[dict]
- get_managed_channels(channelId=None, organizationId=None)¶
Get information for all managed channels that you own within your organization.
- Parameters
channelId (str) – Channel Id to filter.
organizationId (str) – Organization ID. Defaults to current if not specified.
- Returns
channel data
- Return type
list[dict]
- 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
list[dict]
- 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
list[dict]
- 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.
- Returns
Information about users of an organization.
- Return type
list[dict]
- get_organization_usage(organizationId=None, year=None, month=None, 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
Organization usage by channels, instanceType, and time as integer.
- Return type
list[dict]
- get_organizations()¶
Shows the organizations the user belongs to and the user’s role in that organization.
- Returns
Information about the organizations you belong to.
- Return type
list[dict]
- get_staged_graphs(graphId=None, name=None, email=None, workspaceId=None)¶
Queries the workspace staged 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 staged graphs in a workspace.
- Parameters
graphid (str) – Staged GraphID to filter on. Optional.
name (str) – Name of the staged graph to filter on. Optional.
email (str) – Owner of staged 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 staged graphs based off provided query parameters if any parameters match.
- Return type
list[dict]
- 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
list[dict]
- get_workspace()¶
Get Workspace ID of current workspace.
- Returns
Workspace ID of current workspace.
- Return type
str
- get_workspace_guests(workspaceId=None)¶
Get guests of a workspace. Uses default workspace if not specified.
- Parameters
workspaceId (str) – Workspace Id. Optional.
- Returns
Information about guests of an workspace.
- Return type
list[dict]
- get_workspace_limits(setting=None, workspaceId=None)¶
Get information about Workspace limits and settings.
- Parameters
setting (str) – Setting name.
workspaceId (str) – Workspace ID. Defaults to current if not specified.
- Returns
Workspace limit information.
- Return type
list[dict]
- get_workspaces(organizationId=None, workspaceId=None)¶
Shows list of workspaces with id, name, and owner data.
- Parameters
organizationId (str) – Organization ID to filter on. Optional
workspaceId (str) – Workspace ID to filter on. Optional
- Returns
Workspace data for all workspaces for a user.
- Return type
list[dict]
- login(email=None, password=None)¶
Log in to the SDK.
- Parameters
workspaceId (str) – ID of the workspace to log in to. Uses default if not specified.
environment (str) – Environment to log into. Defaults to production.
email (str) – Email for the login. Will prompt if not provided.
password (str) – Password to login. Will prompt if not provided.
local (bool) – Used for development to indicate pointing to local API.
verbose (str) – Flag to turn on verbose logging. Use ‘debug’ to view log output.
- 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
channelId (str) – Id 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 organization.
- Parameters
email (str) – Member email to remove.
organizationId (str) – Organization ID to remove member from. Removes from current organization if not specified.
- Returns
Response status if member got removed from organization 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 guest from an existing workspace.
- Parameters
email (str) – Guest email to remove.
workspaceId (str) – Workspace ID to remove guest from. Removes from current workspace if not specified.
- Returns
Response status if guest got removed from workspace succesfully.
- Return type
str
- set_default_graph(channelId, 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 optionally a 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 limit for a setting.
- Parameters
setting (str) – Setting name.
limit (int) – Limit for the setting.
organizationId (str) – Organization ID. Defaults to current if not specified.
- Returns
Organization limit information.
- Return type
list[dict]
- set_workspace(workspaceId)¶
Set the workspace to the one you wish to work in.
- Parameters
workspaceId (str) – Workspace ID for the workspace you wish to work in.
- set_workspace_limit(setting, limit, workspaceId=None)¶
Set a limit for a workspace.
- Parameters
setting (str) – Setting name.
limit (int) – Limit to set at.
workspaceId (str) – Workspace ID. Defaults to current if not specified.
- Returns
Workspace limit information.
- Return type
list[dict]
- upload_volume_data(volumeId, files=[], localDir=None)¶
Upload data to a volume.
- Parameters
volumeId (str) – VolumeId to remove access to.
files (list[str]) – The specific files to push to the volume from the localDir. 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