hopsworks.core.project_members_api #
ProjectMembersApi #
API for managing the members of a Hopsworks project.
Use Project.get_members_api to get an instance of this class.
Returned by
add_member #
add_member(
email: str, role: _ROLE_ARG
) -> project_member_mod.ProjectMember
Add a single user to the project.
Example
import hopsworks
project = hopsworks.login()
project.get_members_api().add_member("alice@example.com", "Data scientist")
| PARAMETER | DESCRIPTION |
|---|---|
email | Email address of the user to add. TYPE: |
role | The project role to grant, one of TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
project_member_mod.ProjectMember | The newly added |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If |
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request, for example if the caller is not a project owner. |
RuntimeError | If the add succeeded but |
add_members #
add_members(
emails_and_roles: dict[str, _ROLE_ARG],
) -> list[project_member_mod.ProjectMember]
Add one or more users to the project in a single call.
| PARAMETER | DESCRIPTION |
|---|---|
emails_and_roles | Mapping of a member's email to the project role to grant them, one of |
| RETURNS | DESCRIPTION |
|---|---|
list[project_member_mod.ProjectMember] | List of the newly added |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If any role is not a settable project role. |
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request, for example if the caller is not a project owner. |
get_members #
get_members() -> list[project_member_mod.ProjectMember]
Get all members of the project.
Example
import hopsworks
project = hopsworks.login()
for member in project.get_members_api().get_members():
print(member.email, member.role)
| RETURNS | DESCRIPTION |
|---|---|
list[project_member_mod.ProjectMember] | List of |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
remove_member #
Remove a member from the project by email.
Deletes the member's project files when delete_home_dir=True
All files under this member's home directory in the project are permanently deleted and cannot be recovered.
Example
import hopsworks
project = hopsworks.login()
project.get_members_api().remove_member("alice@example.com")
| PARAMETER | DESCRIPTION |
|---|---|
email | Email address of the member to remove. TYPE: |
delete_home_dir | Whether to also delete the member's home directory in the project. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request, for example if a data scientist tries to remove someone other than themselves. |
update_role #
update_role(
email: str, role: _ROLE_ARG
) -> project_member_mod.ProjectMember | None
Change a project member's role by email.
Example
import hopsworks
project = hopsworks.login()
project.get_members_api().update_role("alice@example.com", "Observer")
| PARAMETER | DESCRIPTION |
|---|---|
email | Email address of the member to update. TYPE: |
role | The new project role, one of TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
project_member_mod.ProjectMember | None | The updated |
project_member_mod.ProjectMember | None | found immediately after the update. |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If |
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request, for example if the caller is not a project owner or |