graviti.openapi.commit#

Interfaces about the commit.

Module Contents#

Functions#

commit_draft(access_key, url, workspace, dataset, *, draft_number, title, description = None)

Execute the OpenAPI POST /v2/datasets/{workspace}/{dataset}/commits.

list_commits(access_key, url, workspace, dataset, *, revision = None, offset = None, limit = None)

Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/commits.

get_commit(access_key, url, workspace, dataset, *, commit_id)

Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/commits/{commit_id}.

get_revision(access_key, url, workspace, dataset, *, revision)

Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/revisions/{revision}.

graviti.openapi.commit.commit_draft(access_key, url, workspace, dataset, *, draft_number, title, description=None)[source]#

Execute the OpenAPI POST /v2/datasets/{workspace}/{dataset}/commits.

Parameters
  • access_key (str) – User’s access key.

  • url (str) – The URL of the graviti website.

  • workspace (str) – The workspace of the dataset.

  • dataset (str) – Name of the dataset, unique for a user.

  • draft_number (int) – The draft number.

  • title (str) – The draft title.

  • description (Optional[str]) – The draft description.

Returns

The response of OpenAPI.

Return type

Dict[str, Any]

Examples

>>> commit_draft(
...     "ACCESSKEY-********",
...     "https://api.graviti.com",
...     "graviti-example",
...     "MNIST",
...     draft_number=2,
...     title="commit-2",
... )
{
   "commit_id": "85c57a7f03804ccc906632248dc8c359",
   "parent_commit_id": "784ba0d3bf0a41f6a7bfd771d8c00fcb",
   "title": "upload data",
   "description": "",
   "committer": "graviti-example",
   "committed_at": "2021-03-03T18:58:10Z"
}
graviti.openapi.commit.list_commits(access_key, url, workspace, dataset, *, revision=None, offset=None, limit=None)[source]#

Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/commits.

Parameters
  • access_key (str) – User’s access key.

  • url (str) – The URL of the graviti website.

  • workspace (str) – The workspace of the dataset.

  • dataset (str) – Name of the dataset, unique for a user.

  • revision (Optional[str]) – The information to locate the specific commit, which can be the commit id, the branch name, or the tag name.

  • offset (Optional[int]) – The offset of the page. The default value of this param in OpenAPIv2 is 0.

  • limit (Optional[int]) – The limit of the page. The default value of this param in OpenAPIv2 is 128.

Returns

The response of OpenAPI.

Return type

Dict[str, Any]

Examples

>>> list_commits(
...     "ACCESSKEY-********",
...     "https://api.graviti.com",
...     "graviti-example",
...     "MNIST",
... )
{
   "commits": [
       {
           "commit_id": "85c57a7f03804ccc906632248dc8c359",
           "parent_commitId": "784ba0d3bf0a41f6a7bfd771d8c00fcb",
           "title": "upload data",
           "description": "",
           "committer": "graviti-example",
           "committed_at": "2021-03-03T18:58:10Z"
       }
   ],
   "offset": 0,
   "record_size": 1,
   "total_count": 1
}
graviti.openapi.commit.get_commit(access_key, url, workspace, dataset, *, commit_id)[source]#

Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/commits/{commit_id}.

Parameters
  • access_key (str) – User’s access key.

  • url (str) – The URL of the graviti website.

  • workspace (str) – The workspace of the dataset.

  • dataset (str) – Name of the dataset, unique for a user.

  • commit_id (str) – The commit ID.

Returns

The response of OpenAPI.

Return type

Dict[str, Any]

Examples

>>> get_commit(
...     "ACCESSKEY-********",
...     "https://api.graviti.com",
...     "graviti-example",
...     "MNIST",
...     commit_id="85c57a7f03804ccc906632248dc8c359"
... )
{
    "commit_id": "85c57a7f03804ccc906632248dc8c359",
    "parent_commit_id": "784ba0d3bf0a41f6a7bfd771d8c00fcb",
    "title": "upload data",
    "description": "",
    "committer": "graviti-example",
    "committed_at": "2021-03-03T18:58:10Z"
}
graviti.openapi.commit.get_revision(access_key, url, workspace, dataset, *, revision)[source]#

Execute the OpenAPI GET /v2/datasets/{workspace}/{dataset}/revisions/{revision}.

Parameters
  • access_key (str) – User’s access key.

  • url (str) – The URL of the graviti website.

  • workspace (str) – The workspace of the dataset.

  • dataset (str) – Name of the dataset, unique for a user.

  • revision (str) – The information to locate the specific commit, which can be the commit id, the branch name, or the tag name.

Returns

The response of OpenAPI.

Return type

Dict[str, Any]

Examples

>>> get_revision(
...     "ACCESSKEY-********",
...     "https://api.graviti.com",
...     "MNIST",
...     revision="branch-1"
... )
{
   "type": "BRANCH",
   "commit_id": "85c57a7f03804ccc906632248dc8c359",
   "parent_commit_id": "784ba0d3bf0a41f6a7bfd771d8c00fcb",
   "title": "upload data",
   "description": "",
   "committer": "graviti-example",
   "committed_at": "2021-03-03T18:58:10Z"
}