API Client represents a low level interface for Notebook API. All API operation can be performed using this.
A Low-Level client for Notebook API
from abeja.notebook import APIClient
api_client = APIClient()
create a notebook.
API reference: POST /organizations/{organization_id}/training/definitions/{job_definition_name}/notebooks
organization_id = "1410000000000"
job_definition_name = "test_job_definition"
instance_type = 'cpu-1'
image = 'abeja-inc/all-cpu:19.10'
notebook_type = 'lab'
response = api_client.create_notebook(
organization_id, job_definition_name,
instance_type, image, notebook_type
)
organization_id (str): organization id
job_definition_name (str): training job definition name
instance_type (str): [optional] instance type (ex. cpu-1)
image (str): [optional] runtime environment (ex. abeja-inc/all-cpu:19.10)
notebook_type (str): [optional] notebook type (notebook or lab)
dict
{
"job_definition_id": "1234567890123",
"training_notebook_id": "1410000000000",
"name": "notebook-3",
"description": None,
"status": "Pending",
"status_message": None,
"instance_type": "cpu-1",
"image": "abeja-inc/all-cpu:18.10",
"creator": {
"updated_at": "2018-01-04T03:02:12Z",
"role": "admin",
"is_registered": True,
"id": "1122334455660",
"email": "test@abeja.asia",
"display_name": None,
"created_at": "2017-05-26T01:38:46Z"
},
"created_at": "2018-06-07T04:42:34.913644Z",
"modified_at": "2018-06-07T04:42:34.913726Z"
}
NotFound
BadRequest
Unauthorized: Authentication failed
InternalServerError
delete a notebook.
API reference: DELETE /organizations/{organization_id}/training/definitions/{job_definition_name}/notebooks/{notebook_id}
organization_id = "1410000000000"
job_definition_name = "test_job_definition"
notebook_id = "1230000000000"
response = api_client.delete_notebook(
organization_id, job_definition_name, notebook_id
)
organization_id (str): organization id
job_definition_name (str): training job definition name
notebook_id (str): notebook id
dict
{
"value": {
"message": "1111111111111 deleted"
}
}
NotFound
Unauthorized: Authentication failed
InternalServerError
get a notebook.
API reference: GET /organizations/{organization_id}/training/definitions/{job_definition_name}/notebooks/{notebook_id}
organization_id = "1410000000000"
job_definition_name = "test_job_definition"
notebook_id = "1230000000000"
response = api_client.get_notebook(
organization_id, job_definition_name, notebook_id
)
organization_id (str): organization id
job_definition_name (str): training job definition name
notebook_id (str): notebook id
dict
{
"job_definition_id": "1234567890123",
"training_notebook_id": "1410000000000",
"name": "notebook-3",
"description": None,
"status": "Pending",
"status_message": None,
"instance_type": "cpu-1",
"image": "abeja-inc/all-cpu:18.10",
"creator": {
"updated_at": "2018-01-04T03:02:12Z",
"role": "admin",
"is_registered": True,
"id": "1122334455660",
"email": "test@abeja.asia",
"display_name": None,
"created_at": "2017-05-26T01:38:46Z"
},
"created_at": "2018-06-07T04:42:34.913644Z",
"modified_at": "2018-06-07T04:42:34.913726Z"
}
NotFound
Unauthorized: Authentication failed
InternalServerError
get recent logs of the notebook.
API reference: GET /organizations/{organization_id}/training/definitions/{job_definition_name}/notebooks/{notebook_id}/recentlogs
organization_id = "1410000000000"
job_definition_name = "test_job_definition"
notebook_id = "1230000000000"
response = api_client.get_notebook_recent_logs(
organization_id, job_definition_name, notebook_id
)
organization_id (str): organization id
job_definition_name (str): training job definition name
notebook_id (str): notebook id
next_forward_token (str): [optional] token for the next page of logs
next_backward_token (str): [optional] token for the next previous of logs
dict
{
"events": [
{
"message": "start executing model with abeja-runtime-python36 (version: 0.X.X)",
"timestamp": "2019-10-16T00:00:00.000Z"
}
],
"next_backward_token": "...",
"next_forward_token": "..."
}
NotFound
Unauthorized: Authentication failed
InternalServerError
get notebooks.
API reference: GET /organizations/{organization_id}/training/definitions/{job_definition_name}/notebooks
organization_id = "1410000000000"
job_definition_name = "test_job_definition"
response = api_client.get_notebooks(
organization_id, job_definition_name
)
organization_id (str): organization id
job_definition_name (str): training job definition name
dict
{
"total": 1,
"offset": 0,
"limit": 10,
"entries": [
{
"job_definition_id": "1234567890123",
"training_notebook_id": "1410000000000",
"name": "notebook-3",
"description": None,
"status": "Pending",
"status_message": None,
"instance_type": "cpu-1",
"image": "abeja-inc/all-cpu:18.10",
"creator": {
"updated_at": "2018-01-04T03:02:12Z",
"role": "admin",
"is_registered": True,
"id": "1122334455660",
"email": "test@abeja.asia",
"display_name": None,
"created_at": "2017-05-26T01:38:46Z"
},
"created_at": "2018-06-07T04:42:34.913644Z",
"modified_at": "2018-06-07T04:42:34.913726Z"
}
]
}
NotFound
Unauthorized: Authentication failed
InternalServerError
start a notebook.
API reference: POST /organizations/{organization_id}/training/definitions/{job_definition_name}/notebooks/{notebook_id}/start
organization_id = "1410000000000"
job_definition_name = "test_job_definition"
notebook_id = "1230000000000"
response = api_client.start_notebook(
organization_id, job_definition_name, notebook_id
)
organization_id (str): organization id
job_definition_name (str): training job definition name
notebook_id (str): notebook id
notebook_type (str): [optional] notebook type (notebook or lab)
dict
{
"job_definition_id": "1234567890123",
"training_notebook_id": 0,
"name": "notebook-3",
"description": None,
"status": "Pending",
"status_message": None,
"instance_type": "cpu-1",
"image": "abeja-inc/all-cpu:18.10",
"creator": {
"updated_at": "2018-01-04T03:02:12Z",
"role": "admin",
"is_registered": True,
"id": "1122334455660",
"email": "test@abeja.asia",
"display_name": None,
"created_at": "2017-05-26T01:38:46Z"
},
"created_at": "2018-06-07T04:42:34.913644Z",
"modified_at": "2018-06-07T04:42:34.913726Z"
}
NotFound
Unauthorized: Authentication failed
InternalServerError
stop a notebook.
API reference: POST /organizations/{organization_id}/training/definitions/{job_definition_name}/notebooks/{notebook_id}/stop
organization_id = "1410000000000"
job_definition_name = "test_job_definition"
notebook_id = "1230000000000"
response = api_client.stop_notebook(
organization_id, job_definition_name, notebook_id
)
organization_id (str): organization id
job_definition_name (str): training job definition name
notebook_id (str): notebook id
dict
{
"job_definition_id": "1234567890123",
"training_notebook_id": 0,
"name": "notebook-3",
"description": None,
"status": "Pending",
"status_message": None,
"instance_type": "cpu-1",
"image": "abeja-inc/all-cpu:18.10",
"creator": {
"updated_at": "2018-01-04T03:02:12Z",
"role": "admin",
"is_registered": True,
"id": "1122334455660",
"email": "test@abeja.asia",
"display_name": None,
"created_at": "2017-05-26T01:38:46Z"
},
"created_at": "2018-06-07T04:42:34.913644Z",
"modified_at": "2018-06-07T04:42:34.913726Z"
}
NotFound
Unauthorized: Authentication failed
InternalServerError
update a notebook.
API reference: PUT /organizations/{organization_id}/training/definitions/{job_definition_name}/notebooks/{notebook_id}
organization_id = "1410000000000"
job_definition_name = "test_job_definition"
notebook_id = "1230000000000"
instance_type = 'cpu-1'
image = 'abeja-inc/all-cpu:19.10'
response = api_client.update_notebook(
organization_id, job_definition_name, notebook_id,
instance_type=instance_type, image=image
)
organization_id (str): organization id
job_definition_name (str): training job definition name
notebook_id (str): notebook id
instance_type (str): [optional] instance type (ex. cpu-1)
image (str): [optional] runtime environment (ex. abeja-inc/all-cpu:19.10)
notebook_type (str): [optional] notebook type (notebook or lab)
dict
{
"job_definition_id": "1234567890123",
"training_notebook_id": 0,
"name": "notebook-3",
"description": None,
"status": "Pending",
"status_message": None,
"instance_type": "cpu-1",
"image": "abeja-inc/all-cpu:18.10",
"creator": {
"updated_at": "2018-01-04T03:02:12Z",
"role": "admin",
"is_registered": True,
"id": "1122334455660",
"email": "test@abeja.asia",
"display_name": None,
"created_at": "2017-05-26T01:38:46Z"
},
"created_at": "2018-06-07T04:42:34.913644Z",
"modified_at": "2018-06-07T04:42:34.913726Z"
}
NotFound
BadRequest
Unauthorized: Authentication failed
InternalServerError