Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kagglesdk/kaggle_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def set_from_dict(self, instance, json_dict):
if self.json_name not in json_dict:
return # Ignore unknown fields
value = json_dict[self.json_name]
if value == self.default_value:
return # Ignore default values
if value is None or value == self.default_value:
return # Ignore null and default values
try:
setattr(
instance,
Expand Down
35 changes: 33 additions & 2 deletions kagglesdk/kernels/services/kernels_api_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,31 @@ def list_kernels(self, request: ApiListKernelsRequest = None) -> ApiListKernelsR
return self._client.call("kernels.KernelsApiService", "ListKernels", request, ApiListKernelsResponse)

def list_kernel_files(self, request: ApiListKernelFilesRequest = None) -> ApiListKernelFilesResponse:
r"""
r"""List the source/data files attached to a kernel version.
Note: this returns files that are part of the kernel's source (scripts,
notebooks, attached datasets). To list the output artifacts produced when
a kernel runs (CSVs, model weights, predictions, etc.) use
list_kernel_session_output instead.
Args:
request (ApiListKernelFilesRequest):
The request object; initialized to empty instance if not specified.
request.user_name and request.kernel_slug are required.
Raises:
ValueError: if request.user_name or request.kernel_slug is not set.
"""

if request is None:
request = ApiListKernelFilesRequest()

if not request.user_name or not request.kernel_slug:
raise ValueError(
"request.user_name and request.kernel_slug are required. "
"If you are trying to list run output files, use list_kernel_session_output instead."
)

return self._client.call("kernels.KernelsApiService", "ListKernelFiles", request, ApiListKernelFilesResponse)

def get_kernel(self, request: ApiGetKernelRequest = None) -> ApiGetKernelResponse:
Expand Down Expand Up @@ -58,15 +74,30 @@ def save_kernel(self, request: ApiSaveKernelRequest = None) -> ApiSaveKernelResp
return self._client.call("kernels.KernelsApiService", "SaveKernel", request, ApiSaveKernelResponse)

def list_kernel_session_output(self, request: ApiListKernelSessionOutputRequest = None) -> ApiListKernelSessionOutputResponse:
r"""
r"""List the output artifacts produced when a kernel runs.
Use this method to retrieve files generated by a kernel run (CSVs, model
weights, predictions, etc.). To list the source/data files that make up
the kernel itself, use list_kernel_files instead.
Args:
request (ApiListKernelSessionOutputRequest):
The request object; initialized to empty instance if not specified.
request.user_name and request.kernel_slug are required.
Raises:
ValueError: if request.user_name or request.kernel_slug is not set.
"""

if request is None:
request = ApiListKernelSessionOutputRequest()

if not request.user_name or not request.kernel_slug:
raise ValueError(
"request.user_name and request.kernel_slug are required. "
"If you are trying to list kernel source files, use list_kernel_files instead."
)

return self._client.call("kernels.KernelsApiService", "ListKernelSessionOutput", request, ApiListKernelSessionOutputResponse)

def get_kernel_session_status(self, request: ApiGetKernelSessionStatusRequest = None) -> ApiGetKernelSessionStatusResponse:
Expand Down
23 changes: 17 additions & 6 deletions kagglesdk/kernels/types/kernels_api_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,10 +1393,16 @@ def creation_date(self, creation_date: str):


class ApiListKernelFilesRequest(KaggleObject):
r"""
r"""Request to list source/data files attached to a kernel version.
Use this to enumerate the files that are part of the kernel's source
(scripts, notebooks, attached datasets). To list the output artifacts
produced when a kernel runs (CSVs, model weights, predictions, etc.),
use ApiListKernelSessionOutputRequest with list_kernel_session_output.
Attributes:
user_name (str)
kernel_slug (str)
user_name (str): Required. The owner's username.
kernel_slug (str): Required. The kernel slug.
page_size (int)
page_token (str)
version_label (str)
Expand Down Expand Up @@ -1526,10 +1532,15 @@ def nextPageToken(self):


class ApiListKernelSessionOutputRequest(KaggleObject):
r"""
r"""Request to list output artifacts produced when a kernel runs.
Use this to retrieve files generated by a kernel run (CSVs, model weights,
predictions, etc.). To list the source/data files that make up the kernel
itself, use ApiListKernelFilesRequest with list_kernel_files.
Attributes:
user_name (str)
kernel_slug (str)
user_name (str): Required. The owner's username.
kernel_slug (str): Required. The kernel slug.
page_size (int)
page_token (str)
version_label (str)
Expand Down