OrganizationClient
polyaxon._client.organization.OrganizationClient(owner=None, client=None, is_offline=None, no_op=None, manual_exceptions_handling=False, *, log_context=False)OrganizationClient is a client to communicate with Polyaxon organizations endpoints.
If no values are passed to this class, Polyaxon will try to resolve the owner from the environment:
- If you have a configured CLI, Polyaxon will use the configuration of the cli.
- If you use this client in the context of a job or a service managed by Polyaxon, a configuration will be available to resolve the values based on that run.
Context logging is disabled by default. Set log_context=True to log the
cached owner, including team scope, and its cache path once at construction.
Notices use INFO through the polyaxon.cli logger and your existing logging
configuration. Explicit owners and the community default owner produce no
cache-use notice. The same behavior applies to AsyncOrganizationClient.
Team Scoping (Using as a Team Client): This client can be used as a Team Client by providing the owner in the format "owner/team". When a team is specified, all applicable methods will operate within that team's scope rather than organization-wide.
Team-scoped methods include:
- Runs: list_runs, get_run, approve_runs, archive_runs, restore_runs, delete_runs, stop_runs, skip_runs, invalidate_runs, bookmark_runs, tag_runs, transfer_runs
- Versions: list_versions, list_component_versions, list_model_versions, list_artifact_versions
- Artifacts: list_runs_artifacts_lineage
- Examples:
# Organization-wide operations
org_client = OrganizationClient(owner="my-org")
org_client.list_runs() # All runs across the organization
org_client.list_model_versions() # All model versions across the organization
# Team-scoped operations (effectively a "Team Client")
team_client = OrganizationClient(owner="my-org/engineering")
team_client.list_runs() # Only runs within the engineering team
team_client.list_model_versions() # Only model versions within the team-
Properties:
- owner: str.
- team: str.
- organization_data: V1Organization.
-
Args:
- owner: str, optional, the owner is the username or the organization name. Can be specified as "owner" for organization-wide scope or "owner/team" for team-scoped operations.
- client: PolyaxonClient, optional, an instance of a configured client, if not passed, a new instance will be created based on the available environment.
- is_offline: bool, optional,
To trigger the offline mode manually instead of depending on
POLYAXON_IS_OFFLINE. - no_op: bool, optional,
To set the NO_OP mode manually instead of depending on
POLYAXON_NO_OP. - log_context: bool, optional, default: False, Log cached owner and its cache path at construction through the Python logger.
-
Raises:
- PolyaxonClientException: If no owner is passed and Polyaxon cannot resolve an owner from the environment.
refresh_data
refresh_data(self)Fetches the organization data from the api.
list
list(self, query=None, sort=None, limit=None, offset=None)Lists organizations.
-
Args:
- query: str, optional, query filters
- sort: str, optional, fields to order by
- limit: int, optional, limit of organizations to return.
- offset: int, optional, offset pages to paginate organizations.
-
Returns: V1ListOrganizationsResponse, list of organization instances.
list_members
list_members(self, query=None, sort=None, limit=None, offset=None)Lists organization members.
-
Args:
- query: str, optional, query filters
- sort: str, optional, fields to order by
- limit: int, optional, limit of members to return.
- offset: int, optional, offset pages to paginate members.
-
Returns: V1ListOrganizationMembersResponse, list of organization member instances.
get_member
get_member(self, user)Gets an organization member.
-
Args:
- user: str, required, the username of the member.
-
Returns: V1OrganizationMember, organization member instance.
create_member
create_member(self, data, email=None)Creates a new organization member.
-
Args:
- data: Dict or V1OrganizationMember, required.
- email: str, optional, email of the member to invite.
-
Returns: V1OrganizationMember, organization member instance from the response.
update_member
update_member(self, user, data)Updates an organization member based on the data passed.
-
Args:
- user: str, required, the username of the member.
- data: Dict or V1OrganizationMember, required.
-
Returns: V1OrganizationMember, organization member instance from the response.
patch_member
patch_member(self, user, data)Patches an organization member based on the data passed.
-
Args:
- user: str, required, the username of the member.
- data: Dict or V1OrganizationMember, required.
-
Returns: V1OrganizationMember, organization member instance from the response.
delete_member
delete_member(self, user)Deletes an organization member.
- Args:
- user: str, required, the username of the member.
list_teams
list_teams(self, query=None, sort=None, limit=None, offset=None, bookmarks=False, mode=None)Lists teams in the organization.
- Args:
- query: str, optional, query filters
- sort: str, optional, fields to order by
- limit: int, optional, limit of teams to return.
- offset: int, optional, offset pages to paginate teams.
- bookmarks: bool, optional, filter by bookmarks.
- mode: str, optional, mode of the search.
- Returns: V1ListTeamsResponse, list of team instances.
list_runs
list_runs(self, query=None, sort=None, limit=None, offset=None)Lists runs across all projects in the organization or team.
-
Args:
- query: str, optional, query filters
- sort: str, optional, fields to order by
- limit: int, optional, limit of runs to return.
- offset: int, optional, offset pages to paginate runs.
-
Returns: V1ListRunsResponse, list of run instances.
get_run
get_run(self, uuid)Gets a run by uuid from the organization or team.
-
Args:
- uuid: str, required, the run uuid.
-
Returns: V1Run, run instance.
approve_runs
approve_runs(self, uuids)Approves multiple runs in the organization.
- Args:
- uuids: List[str] or V1Uuids, required, list of run uuids to approve.
archive_runs
archive_runs(self, uuids)Archives multiple runs in the organization.
- Args:
- uuids: List[str] or V1Uuids, required, list of run uuids to archive.
restore_runs
restore_runs(self, uuids)Restores multiple runs in the organization.
- Args:
- uuids: List[str] or V1Uuids, required, list of run uuids to restore.
delete_runs
delete_runs(self, uuids)Deletes multiple runs in the organization or team.
- Args:
- uuids: List[str] or V1Uuids, required, list of run uuids to delete.
stop_runs
stop_runs(self, uuids)Stops multiple runs in the organization or team.
- Args:
- uuids: List[str] or V1Uuids, required, list of run uuids to stop.
skip_runs
skip_runs(self, uuids)Skips multiple runs in the organization.
- Args:
- uuids: List[str] or V1Uuids, required, list of run uuids to skip.
invalidate_runs
invalidate_runs(self, uuids)Invalidates multiple runs in the organization or team.
- Args:
- uuids: List[str] or V1Uuids, required, list of run uuids to invalidate.
bookmark_runs
bookmark_runs(self, uuids)Bookmarks multiple runs in the organization.
- Args:
- uuids: List[str] or V1Uuids, required, list of run uuids to bookmark.
tag_runs
tag_runs(self, uuids, tags)Tags multiple runs in the organization.
- Args:
- data: Dict, required, must include 'uuids' and 'tags' fields.
transfer_runs
transfer_runs(self, uuids, to_project)Transfers multiple runs to another project in the organization.
- Args:
- uuids: List[str] or V1Uuids, required, list of run uuids to transfer.
- to_project: str, required, the destination project to transfer the runs to.
list_versions
list_versions(self, kind, query=None, sort=None, limit=None, offset=None)Lists project versions across all projects in the organization or team.
This is a generic function that lists versions of a specific kind across all projects in the organization or team:
- component versions
- model versions
- artifact versions
-
Args:
- kind: V1ProjectVersionKind, kind of the project version.
- query: str, optional, query filters
- sort: str, optional, fields to order by
- limit: int, optional, limit of versions to return.
- offset: int, optional, offset pages to paginate versions.
-
Returns: V1ListProjectVersionsResponse, list of project versions across all projects.
list_component_versions
list_component_versions(self, query=None, sort=None, limit=None, offset=None)Lists component versions across all projects in the organization or team.
-
Args:
- query: str, optional, query filters
- sort: str, optional, fields to order by
- limit: int, optional, limit of versions to return.
- offset: int, optional, offset pages to paginate versions.
-
Returns: V1ListProjectVersionsResponse, list of component versions.
list_model_versions
list_model_versions(self, query=None, sort=None, limit=None, offset=None)Lists model versions across all projects in the organization or team.
-
Args:
- query: str, optional, query filters
- sort: str, optional, fields to order by
- limit: int, optional, limit of versions to return.
- offset: int, optional, offset pages to paginate versions.
-
Returns: V1ListProjectVersionsResponse, list of model versions.
list_artifact_versions
list_artifact_versions(self, query=None, sort=None, limit=None, offset=None)Lists artifact versions across all projects in the organization or team.
-
Args:
- query: str, optional, query filters
- sort: str, optional, fields to order by
- limit: int, optional, limit of versions to return.
- offset: int, optional, offset pages to paginate versions.
-
Returns: V1ListProjectVersionsResponse, list of artifact versions.
list_runs_artifacts_lineage
list_runs_artifacts_lineage(self, name=None, query=None, sort=None, limit=None, offset=None, bookmarks=False, mode=None)Lists artifact lineage for runs across all projects in the organization.
-
Args:
- name: str, optional, entity name filter.
- query: str, optional, query filters
- sort: str, optional, fields to order by
- limit: int, optional, limit of artifacts to return.
- offset: int, optional, offset pages to paginate artifacts.
- bookmarks: bool, optional, filter by bookmarks.
- mode: str, optional, mode of the search.
-
Returns: V1ListRunArtifactsResponse, list of run artifacts with lineage info.