management
#
The management API lets you perform administration tasks related to your workspace and projects.
The following functions are restricted to project owners (or workspace admins):
add_project_member()
remove_project_member()
add_project_service_account()
remove_project_service_account()
Service account permissions
Service accounts can not use the following functions:
Otherwise, service accounts can perform project actions according to their permissions.
get_project_list()
#
Get a list of projects you have access to.
Parameters
Name | Type | Default | Description |
---|---|---|---|
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Returns
List with project names in the form workspace-name/project-name
.
Example
>>> from neptune import management
>>> projects = management.get_project_list()
>>> print(projects)
['jackie/sandbox', 'ml-team/classification']
create_project()
#
Creates a new project in a workspace.
Note
You can only create a new project if your quota of active projects isn't full.
- Your maximum number of simultaneously active projects is managed by your workspace admin. If your limit is reached, you need to upgrade your subscription or archive another project first.
- Free plans are limited to one active project at a time.
Parameters
Name | Type | Default | Description |
---|---|---|---|
name |
str |
- | The name for the new Neptune project. Can contain letters and hyphens (- ). For example, named-entity-recognition .If you leave out the |
key |
str , optional |
- | Project identifier. Must contain 1-10 uppercase letters or numbers (at least one letter). For example, CLS2 .If you leave it out, Neptune generates a key for you based on the project name. |
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the name argument. |
visibility |
str , management.ProjectVisibility , optional |
priv |
The level of visibility to set for the project. Users with access effectively become project owners.
Note: On plans without project-level access control, you need to set the value to |
description |
str , optional |
None |
Project description. If None , it is left empty. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Returns
The name of the created project.
Examples
>>> from neptune import management
>>> management.create_project(
... workspace="ml-org",
... name="named-entity-recognition",
... key="NER",
... visibility="priv",
... )
'ml-org/named-entity-recognition'
Plan note
On plans without project-level access control, private projects (accessible only to some workspace members) are not available. You need to set the privacy to "workspace" or "public".
>>> from neptune import management
>>> management.create_project(
... workspace="ml-team",
... name="classification",
... key="CLS",
... visibility="workspace",
... )
'ml-team/classification'
delete_project()
#
Deletes a project from a workspace.
Only workspace admins can use this function.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Deprecated name
parameter
The name
parameter has been changed to project
as of neptune-client 0.16.16
.
Example
add_project_member()
#
Adds a user to a project.
Only project owners or workspace admins can use this function.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
username |
str |
- | Name of the Neptune user to add to the project. |
role |
str , management.ProjectMemberRole |
- | Level of permissions the user should have in the project.
|
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Deprecated name
parameter
The name
parameter has been changed to project
as of neptune-client 0.16.16
.
Example
>>> from neptune import management
>>> management.add_project_member(
... project="ml-team/classification", username="jackie", role="contributor"
... )
Related
get_project_member_list()
#
Lists the members of a project.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Deprecated name
parameter
The name
parameter has been changed to project
as of neptune-client 0.16.16
.
Returns
Dictionary with usernames as keys and project roles as values.
Example
>>> from neptune import management
>>> management.get_project_member_list(project="ml-team/classification")
{'johnny': 'owner', 'jackie': 'contributor', 'janus': 'viewer'}
remove_project_member()
#
Removes a user from a project.
Only project owners or workspace admins can use this function.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
username |
str |
- | Name of the Neptune user to remove from the project. |
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Deprecated name
parameter
The name
parameter has been changed to project
as of neptune-client 0.16.16
.
Example
>>> from neptune import management
>>> management.remove_project_member(
... project="ml-team/classification",
... username="janus",
... )
get_workspace_member_list()
#
Lists the members of a workspace.
Parameters
Name | Type | Default | Description |
---|---|---|---|
workspace |
str |
- | Name of the Neptune workspace. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Deprecated name
parameter
The name
parameter has been changed to workspace
as of neptune-client 0.16.16
.
Returns
Dictionary with usernames as keys and workspace roles as values.
Example
>>> from neptune import management
>>> management.get_workspace_member_list(workspace="ml-team")
{'johnny': 'admin', 'jackie': 'member', 'janus': 'member'}
get_workspace_service_account_list()
#
Lists the service accounts of a workspace.
Parameters
Name | Type | Default | Description |
---|---|---|---|
workspace |
str |
- | Name of the Neptune workspace. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Deprecated name
parameter
The name
parameter has been changed to workspace
as of neptune-client 0.16.16
.
Returns
Dictionary with account names as keys and workspace roles as values.
Note
Service accounts can only have the "member" role in a workspace.
Example
>>> from neptune import management
>>> management.get_workspace_service_account_list(workspace="ml-team")
{'cicd@ml-team': 'member', 'test@ml-team': 'member'}
get_project_service_account_list()
#
Lists the service accounts assigned to a project.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Deprecated name
parameter
The name
parameter has been changed to project
as of neptune-client 0.16.16
.
Returns
Dictionary with account names as keys and project roles (owner
, contributor
, or viewer
) as values.
Example
>>> from neptune import management
>>> management.get_project_service_account_list(project="ml-team/classification")
{'cicd@ml-team': 'owner', 'test@ml-team': 'viewer'}
add_project_service_account()
#
Adds a service account to a Neptune project.
Only project owners or workspace admins can use this function.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
service_account_name |
str |
- | Name of the service account to add to the project. |
role |
str , management.ProjectMemberRole |
- | Level of permissions the service account should have in the project.
|
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Deprecated name
parameter
The name
parameter has been changed to project
as of neptune-client 0.16.16
.
Example
>>> from neptune import management
>>> management.add_project_service_account(
... project="ml-team/classification",
... service_account_name="cicd@ml-team",
... role="contributor",
... )
remove_project_service_account()
#
Removes a service account from a Neptune project.
Only project owners or workspace admins can use this function.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
service_account_name |
str |
- | Name of the service account to remove from the project. |
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
User's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Deprecated name
parameter
The name
parameter has been changed to project
as of neptune-client 0.16.16
.
Example
>>> from neptune import management
>>> management.remove_project_service_account(
... project="ml-team/classification", service_account_name="cicd@ml-team"
... )
invite_to_workspace()
#
Invites a user to a workspace.
Only workspace admins can use this function.
Supply either the username
or the email
argument (not both).
Parameters
Name | Type | Default | Description |
---|---|---|---|
username |
str |
- | Name of the Neptune user to invite. If you provide this, leave out the |
email |
str |
- | Email of the user to invite. If you provide this, leave out the |
workspace |
str |
- | Name of your Neptune workspace. |
api_token |
str , optional |
None |
API token of the account that sends the invite. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
role |
str , management.WorkspaceMemberRole |
"member" |
Level of permissions the user should have in the workspace.
For more, see User roles overview. |
add_to_all_projects |
bool |
False |
Whether to add the user to all projects in the workspace. |
Examples
>>> from neptune import management
>>> management.invite_to_workspace(
... username="jackie",
... workspace="ml-team",
... role="admin",
... )
You can also use the WorkspaceMemberRole
enum values to specify the role:
- Administrator:
WorkspaceMemberRole.ADMIN
- Member:
WorkspaceMemberRole.MEMBER
>>> from neptune import management
>>> from management import WorkspaceMemberRole
>>> management.invite_to_workspace(
... username="jackie",
... workspace="ml-team",
... role=WorkspaceMemberRole.ADMIN,
... )
Related
trash_objects()
#
Moves one or more Neptune objects to the project trash.
Trashed objects are retained until the trash is emptied, either through the Neptune app or with the delete_objects_from_trash()
function.
The account that performs the trashing must have at least contributor permissions.
Note for model objects
Trashing a Model
object also trashes all of its ModelVersion
objects.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
ids |
str or list of str |
- | Neptune ID of object to trash (or list of multiple IDs). |
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
Account's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
How do I find the ID?
The Neptune ID is a unique identifier for the run. In the table view, it's displayed in the leftmost column.
The ID is stored in the system namespace (sys/id
).
If the run is active, you can obtain its ID with run["sys/id"].fetch()
. For example:
Examples
Import the management package and initialize the project to trash objects from:
import neptune
from neptune import management
project_name = "workspace-name/project-name" # (1)!
project = neptune.init_project(project=project_name, mode="read-only")
-
The full project name. For example,
"ml-team/classification"
.To copy it to your clipboard, navigate to the project settings in the top-right () and select Edit project details.
Trashing a run with ID "CLS-1":
Fetch runs tagged as "trash" and delete them in batch:
runs_to_trash_df = project.fetch_runs_table(tag="trash").to_pandas()
runs_to_trash = runs_to_trash_df["sys/id"].tolist()
management.trash_objects(project=project_name, ids=runs_to_trash)
Trashing a newly created run:
run = neptune.init_run()
# It's a disaster, let's remove it
run_id = run["sys/id"].fetch()
management.trash_objects(project=project_name, ids=run_id)
You can also delete objects of different types at once:
run_id = run["sys/id"].fetch()
model_id = model["sys/id"].fetch()
model_version_id = model_version["sys/id"].fetch()
management.trash_objects(
project=project_name,
ids=[run_id, model_id, model_version_id]
)
delete_objects_from_trash()
#
Deletes one or more Neptune objects from the project trash.
Caution
- Deleting objects from trash is irreversible.
- Trashing a
Model
object also trashes all of itsModelVersion
objects.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
ids |
str or list of str |
- | Neptune ID of object to delete from trash (or list of multiple IDs). You can find the ID in the leftmost column of the table view, and in the "sys/id" field of each object. |
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
Account's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
How do I find the ID?
The Neptune ID is a unique identifier for the run. In the table view, it's displayed in the leftmost column.
The ID is stored in the system namespace (sys/id
).
If the run is active, you can obtain its ID with run["sys/id"].fetch()
. For example:
Examples
from neptune import management
management.delete_objects_from_trash(project="ml-team/classification", ids="CLS-1")
trash_to_delete = ["CLS-2", "CLS-3", "CLS-PRETRAINED"]
management.delete_objects_from_trash("ml-team/classification", ids=trash_to_delete)
clear_trash()
#
Empties the trash of the specified project.
Caution
- This action permanently deletes all of the objects in the trash.
- Trashing a
Model
object also trashes all of itsModelVersion
objects.
Parameters
Name | Type | Default | Description |
---|---|---|---|
project |
str |
- | Name of the Neptune project. If you leave out the workspace argument, include the workspace name here, in the form workspace-name/project-name . |
workspace |
str , optional |
None |
Name of your Neptune workspace. If None , it will be parsed from the project argument. |
api_token |
str , optional |
None |
Account's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Examples
get_workspace_status()
#
Retrieves status information about a Neptune workspace, as a dictionary.
Includes the following:
- Storage usage and limit
- Active project count and limit
- Member count
Parameters
Name | Type | Default | Description |
---|---|---|---|
workspace |
str , optional |
None |
Name of the Neptune workspace. |
api_token |
str , optional |
None |
Account's API token. If None , the value of the NEPTUNE_API_TOKEN environment variable is used.To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable. |
Example
>>> from neptune import management
>>> management.get_workspace_status(workspace="ml-team")
... {'storageBytesAvailable': 214747451765,
... 'storageBytesLimit': 214748364800,
... 'storageBytesUsed': 913035,
... 'activeProjectsUsage': 1,
... 'activeProjectsLimit': 2,
... 'membersCount': 5}