@@ -1216,6 +1216,9 @@ class ApiSaveKernelRequest(KaggleObject):
1216
1216
`{username}/{model-slug}/{framework}/{variation-slug}`
1217
1217
Or versioned:
1218
1218
`{username}/{model-slug}/{framework}/{variation-slug}/{version-number}`
1219
+ session_timeout_seconds (int)
1220
+ If specified, terminate the kernel session after this many seconds of
1221
+ runtime, which must be lower than the global maximum.
1219
1222
"""
1220
1223
1221
1224
def __init__ (self ):
@@ -1235,6 +1238,7 @@ def __init__(self):
1235
1238
self ._enable_internet = None
1236
1239
self ._docker_image_pinning_type = None
1237
1240
self ._model_data_sources = []
1241
+ self ._session_timeout_seconds = None
1238
1242
self ._freeze ()
1239
1243
1240
1244
@property
@@ -1496,6 +1500,23 @@ def model_data_sources(self, model_data_sources: Optional[List[str]]):
1496
1500
raise TypeError ('model_data_sources must contain only items of type str' )
1497
1501
self ._model_data_sources = model_data_sources
1498
1502
1503
+ @property
1504
+ def session_timeout_seconds (self ) -> int :
1505
+ r"""
1506
+ If specified, terminate the kernel session after this many seconds of
1507
+ runtime, which must be lower than the global maximum.
1508
+ """
1509
+ return self ._session_timeout_seconds or 0
1510
+
1511
+ @session_timeout_seconds .setter
1512
+ def session_timeout_seconds (self , session_timeout_seconds : int ):
1513
+ if session_timeout_seconds is None :
1514
+ del self .session_timeout_seconds
1515
+ return
1516
+ if not isinstance (session_timeout_seconds , int ):
1517
+ raise TypeError ('session_timeout_seconds must be of type int' )
1518
+ self ._session_timeout_seconds = session_timeout_seconds
1519
+
1499
1520
def endpoint (self ):
1500
1521
path = '/api/v1/kernels/push'
1501
1522
return path .format_map (self .to_field_map (self ))
@@ -1902,6 +1923,7 @@ def creation_date(self, creation_date: str):
1902
1923
FieldMetadata ("enableInternet" , "enable_internet" , "_enable_internet" , bool , None , PredefinedSerializer (), optional = True ),
1903
1924
FieldMetadata ("dockerImagePinningType" , "docker_image_pinning_type" , "_docker_image_pinning_type" , str , None , PredefinedSerializer (), optional = True ),
1904
1925
FieldMetadata ("modelDataSources" , "model_data_sources" , "_model_data_sources" , str , [], ListSerializer (PredefinedSerializer ())),
1926
+ FieldMetadata ("sessionTimeoutSeconds" , "session_timeout_seconds" , "_session_timeout_seconds" , int , None , PredefinedSerializer (), optional = True ),
1905
1927
]
1906
1928
1907
1929
ApiSaveKernelResponse ._fields = [
0 commit comments