ProjectClient

polyaxon.client.project.ProjectClient(owner=None, project=None, client=None)

ProjectClient is a client to communicate with Polyaxon projects endpoints.

If no values are passed to this class, Polyaxon will try to resolve the owner and project from the environment:

  • If you have a configured CLI, Polyaxon will use the configuration of the cli.
  • If you have a cached project using the CLI, the client will default to that cached project unless you override the values.
  • 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.

If you intend to create a new project instance or to list projects, only the owner parameter is required.

  • Properties:

    • project: str.
    • owner: str.
    • project_data: V1Project.
  • Args:

    • owner: str, optional, the owner is the username or the organization name owning this project.
    • project: str, optional, project name.
    • client: PolyaxonClient, optional, an instance of a configured client, if not passed, a new instance will be created based on the available environment.
  • Raises:

    • PolyaxonClientException: If no owner is passed and Polyaxon cannot

    resolve an owner from the environment.


refresh_data

refresh_data(self)

Fetches the project data from the api.


create

create(self, data)

Creates a new project based on the data passed.

Project API

  • Args:

    • data: dict or V1Project, required.
  • Returns: V1Project, project instance from the response.


list

list(self, query=None, sort=None, limit=None, offset=None)

Lists projects under the current owner.

Project API

  • Args:

    • query: str, optional, query filters, please refer to Project PQL
    • sort: str, optional, fields to order by, please refer to Project PQL
    • limit: int, optional, limit of projects to return.
    • offset: int, optional, offset pages to paginate projects.
  • Returns: List[V1Project], list of project instances.


delete

delete(self)

Deletes project based on the current owner and project.


update

update(self, data)

Updates a project based on the data passed.

Project API

  • Args:

    • data: Dict or V1Project, required.
  • Returns: V1Project, project instance from the response.


list_runs

list_runs(self, query=None, sort=None, limit=None, offset=None)

Lists runs under the current owner/project.

Run API

  • Args:

    • query: str, optional, query filters, please refer to Run PQL
    • sort: str, optional, fields to order by, please refer to Run PQL
    • limit: int, optional, limit of runs to return.
    • offset: int, optional, offset pages to paginate runs.
  • Returns: List[V1Run], list of run instances.


list_versions

list_versions(self, kind, query=None, sort=None, limit=None, offset=None)

Lists project versions under the current owner/project.

Project API

  • Args:

    • kind: V1ProjectVersionKind, kind of the project version.
    • query: str, optional, query filters, please refer to Run PQL
    • sort: str, optional, fields to order by, please refer to Run PQL
    • limit: int, optional, limit of runs to return.
    • offset: int, optional, offset pages to paginate runs.
  • Returns: List[V1ProjectVersion], list of versions.


get_version

get_version(self, kind, version)

Get a project version under the current owner/project.

Project API

  • Args:

    • kind: V1ProjectVersionKind, kind of the project version.
    • version: str, optional, the version name/tag.
  • Returns: V1ProjectVersion.


create_version

create_version(self, kind, data)

Create a project version based on the data passed.

Project API

  • Args:

    • kind: V1ProjectVersionKind, kind of the project version.
    • data: Dict or V1ProjectVersion, required.
  • Returns: V1ProjectVersion.


patch_version

patch_version(self, kind, version, data)

Update a project version based on the data passed.

Project API

  • Args:

    • kind: V1ProjectVersionKind, kind of the project version.
    • version: str, optional, the version name/tag.
    • data: Dict or V1ProjectVersion, required.
  • Returns: V1ProjectVersion.


register_version

register_version(self, kind, version, description, tags=None, content=None, run=None, connection=None, artifacts=None, force=False)

Create or Update a project version based on the data passed.

Project API

  • Args:

    • kind: V1ProjectVersionKind, kind of the project version.
    • version: str, optional, the version name/tag.
    • description: str, optional, the version description.
    • tags: str or List[str], optional.
    • content: str, optional, content of the version.
    • run: str, optional, a uuid reference to the run.
    • connection: str, optional, a uuid reference to a connection.
    • artifacts: List[str], optional, list of artifacts to highlight(requires passing a run)
    • force: bool, optional, to force push, i.e. update if exists.
  • Returns: V1ProjectVersion.


delete_version

delete_version(self, kind, version)

Delete a project version under the current owner/project.

Project API

  • Args:
    • kind: V1ProjectVersionKind, kind of the project version.
    • version: str, optional, the version name/tag.

stage_project_version

stage_project_version(self, kind, version, condition)

Create a new a project version stage.

Project API

  • Args:
    • kind: V1ProjectVersionKind, kind of the project version.
    • version: str, optional, the version name/tag.
    • condition: Dict or V1StageCondition.