Skip to content

Commit daf4ccd

Browse files
committed
simple changes
1 parent af3b2cc commit daf4ccd

File tree

9 files changed

+23
-27
lines changed

9 files changed

+23
-27
lines changed

docs/api_reference/notebook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ nisystemlink.clients.notebook
1111
.. automethod:: update_notebook
1212
.. automethod:: delete_notebook
1313
.. automethod:: create_notebook
14-
.. automethod:: query_notebooks_paged
14+
.. automethod:: query_notebooks
1515
.. automethod:: get_notebook_content
1616
.. automethod:: create_executions
1717
.. automethod:: get_execution_by_id

examples/notebook/notebook.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@
4141

4242
# Query notebook by name
4343
query_request = QueryNotebookRequest(
44-
filter="name='Example Notebook'",
44+
filter='name="Example Notebook"',
4545
)
4646

47-
query_response = client.query_notebooks_paged(query_request)
47+
query_response = client.query_notebooks(query_request)
4848

4949
# Query notebooks by take
5050
query_request = QueryNotebookRequest(take=2)
51-
query_response = client.query_notebooks_paged(query_request)
51+
query_response = client.query_notebooks(query_request)
5252

5353
query_request = QueryNotebookRequest(
5454
continuation_token=query_response.continuation_token,
5555
take=1,
5656
)
57-
query_response = client.query_notebooks_paged(query_request)
57+
query_response = client.query_notebooks(query_request)
5858

5959
# Delete the notebook by ID
6060
client.delete_notebook("your_notebook_id")

nisystemlink/clients/notebook/_notebook_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ def create_notebook(
184184
)
185185

186186
@post("ninotebook/v1/notebook/query")
187-
def query_notebooks_paged(
187+
def query_notebooks(
188188
self, query: models.QueryNotebookRequest
189-
) -> models.QueryNotebookResponse:
189+
) -> models.PagedNotebooks:
190190
"""Queries notebooks.
191191
192192
Args:

nisystemlink/clients/notebook/models/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from ._notebook_metadata import NotebookMetadata
22
from ._query_notebook_request import QueryNotebookRequest
3-
from ._query_notebook_response import QueryNotebookResponse
3+
from ._query_notebook_response import PagedNotebooks
44
from ._query_execution_request import (
55
ExecutionField,
66
ExecutionSortField,
@@ -14,7 +14,7 @@
1414
CreateExecutionRequest,
1515
)
1616
from ._create_execution_response import (
17-
CreatedExecutionModal,
17+
CreatedExecution,
1818
CreateExecutionsResponse,
1919
)
2020
from ._execution import (

nisystemlink/clients/notebook/models/_create_execution_request.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ class CreateExecutionRequest(JsonModel):
3434
A value of 0 means do not reuse results from any previous executions. A value of -1 means always reuse results if
3535
possible and return an error if not possible. This prevents actual execution of a notebook."""
3636

37-
source: Optional[Source] = None
38-
"""An object that defines properties set by routine service"""
39-
4037
report_settings: Optional[ReportSettings] = None
4138
"""Settings of the Report"""
4239

@@ -49,3 +46,4 @@ class CreateExecutionRequest(JsonModel):
4946
"""Execution priority. Can be one of Low, Medium or High."""
5047

5148
resource_profile: Optional[ExecutionResourceProfile] = None
49+
"""Resource profile of the execution."""

nisystemlink/clients/notebook/models/_create_execution_response.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from ._execution import Execution
77

88

9-
class CreatedExecutionModal(Execution):
9+
class CreatedExecution(Execution):
1010
cached_result: bool
1111
"""Returns true if the execution is returned from cache"""
1212

@@ -15,6 +15,7 @@ class CreateExecutionsResponse(JsonModel):
1515
"""Model for response to a request to create an execution."""
1616

1717
error: Optional[ApiError] = None
18+
"""The error that occurred during the request, if any."""
1819

19-
executions: Optional[List[CreatedExecutionModal]] = None
20+
executions: Optional[List[CreatedExecution]] = None
2021
"""Gets or sets the collection of authorized executions."""

nisystemlink/clients/notebook/models/_query_execution_response.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ class QueryExecutionResponse(JsonModel):
6969
result: Optional[Dict[str, Optional[str]]] = None
7070
"""Result of the execution. This is used only when status is SUCCEEDED."""
7171

72-
source: Optional[Source] = None
73-
"""An object that defines properties set by routine service"""
74-
7572
priority: Optional[ExecutionPriority] = None
7673
"""Execution priority. Can be one of Low, Medium or High."""
7774

nisystemlink/clients/notebook/models/_query_notebook_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from ._notebook_metadata import NotebookMetadata
66

77

8-
class QueryNotebookResponse(WithPaging):
8+
class PagedNotebooks(WithPaging):
99
"""Model for a query notebooks response."""
1010

1111
notebooks: Optional[List[NotebookMetadata]] = None

tests/integration/notebook/test_notebook_client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test__query_notebook_by_id__return_notebook_matches_id(
209209

210210
request = QueryNotebookRequest(filter=f'id="{notebook.id}"')
211211
print(request)
212-
response = client.query_notebooks_paged(request)
212+
response = client.query_notebooks(request)
213213

214214
assert response.notebooks is not None
215215
assert len(response.notebooks) == 1
@@ -219,7 +219,7 @@ def test__query_notebook_by_id__return_notebook_matches_id(
219219

220220
def test__query_notebook_by_invalid_id__returns_empty_list(self, client):
221221
request = QueryNotebookRequest(filter='id="invalid_id"')
222-
response = client.query_notebooks_paged(request)
222+
response = client.query_notebooks(request)
223223

224224
assert len(response.notebooks) == 0
225225
assert response.continuation_token is None
@@ -231,7 +231,7 @@ def test__query_notebook_by_name__returns_notebook_matches_name(
231231
notebook = create_notebook(metadata=metadata)
232232

233233
request = QueryNotebookRequest(filter=f'name.StartsWith("{random_filename}")')
234-
response = client.query_notebooks_paged(request)
234+
response = client.query_notebooks(request)
235235

236236
assert len(response.notebooks) == 1
237237
assert response.continuation_token is None
@@ -240,14 +240,14 @@ def test__query_notebook_by_name__returns_notebook_matches_name(
240240

241241
def test__query_notebook_by_invalid_name__returns_empty_list(self, client):
242242
request = QueryNotebookRequest(filter='name="invalid_name"')
243-
response = client.query_notebooks_paged(request)
243+
response = client.query_notebooks(request)
244244

245245
assert len(response.notebooks) == 0
246246
assert response.continuation_token is None
247247

248248
def test__query_by_taking_3_notebooks__returns_3_notebooks(self, client):
249249
request = QueryNotebookRequest(take=3)
250-
response = client.query_notebooks_paged(request)
250+
response = client.query_notebooks(request)
251251

252252
assert len(response.notebooks) == 3
253253
assert response.continuation_token is not None
@@ -256,13 +256,13 @@ def test__query_notebooks_by_continuation_token__returns_next_page_of_notebooks(
256256
self, client
257257
):
258258
request = QueryNotebookRequest(take=3)
259-
response = client.query_notebooks_paged(request)
259+
response = client.query_notebooks(request)
260260

261261
assert len(response.notebooks) == 3
262262
assert response.continuation_token is not None
263263

264264
request.continuation_token = response.continuation_token
265-
response = client.query_notebooks_paged(request)
265+
response = client.query_notebooks(request)
266266

267267
assert len(response.notebooks) != 0
268268
assert response.continuation_token is not None
@@ -627,11 +627,11 @@ def test__query_executions_by_projection__returns_executions_with_projected_prop
627627
"status": "IN_PROGRESS",
628628
},
629629
{
630-
"id": "execution_id_1",
630+
"id": "execution_id_2",
631631
"status": "TIMED_OUT",
632632
},
633633
{
634-
"id": "execution_id_1",
634+
"id": "execution_id_3",
635635
"status": "FAILED",
636636
},
637637
]

0 commit comments

Comments
 (0)