@@ -1216,6 +1216,9 @@ class ApiSaveKernelRequest(KaggleObject):
12161216 `{username}/{model-slug}/{framework}/{variation-slug}`
12171217 Or versioned:
12181218 `{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.
12191222 """
12201223
12211224 def __init__ (self ):
@@ -1235,6 +1238,7 @@ def __init__(self):
12351238 self ._enable_internet = None
12361239 self ._docker_image_pinning_type = None
12371240 self ._model_data_sources = []
1241+ self ._session_timeout_seconds = None
12381242 self ._freeze ()
12391243
12401244 @property
@@ -1496,6 +1500,23 @@ def model_data_sources(self, model_data_sources: Optional[List[str]]):
14961500 raise TypeError ('model_data_sources must contain only items of type str' )
14971501 self ._model_data_sources = model_data_sources
14981502
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+
14991520 def endpoint (self ):
15001521 path = '/api/v1/kernels/push'
15011522 return path .format_map (self .to_field_map (self ))
@@ -1902,6 +1923,7 @@ def creation_date(self, creation_date: str):
19021923 FieldMetadata ("enableInternet" , "enable_internet" , "_enable_internet" , bool , None , PredefinedSerializer (), optional = True ),
19031924 FieldMetadata ("dockerImagePinningType" , "docker_image_pinning_type" , "_docker_image_pinning_type" , str , None , PredefinedSerializer (), optional = True ),
19041925 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 ),
19051927]
19061928
19071929ApiSaveKernelResponse ._fields = [
0 commit comments