This repository was archived by the owner on Jan 23, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
packages/jumpstarter/jumpstarter Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class Lease(ContextManagerMixin, AsyncContextManagerMixin):
4747 controller : jumpstarter_pb2_grpc .ControllerServiceStub = field (init = False )
4848 tls_config : TLSConfigV1Alpha1 = field (default_factory = TLSConfigV1Alpha1 )
4949 grpc_options : dict [str , Any ] = field (default_factory = dict )
50+ acquisition_timeout : int = field (default = 300 ) # Timeout in seconds for lease acquisition, polled in 5s intervals
5051 exporter_name : str = field (default = "remote" , init = False ) # Populated during acquisition
5152
5253 def __post_init__ (self ):
@@ -115,7 +116,7 @@ async def _acquire(self):
115116
116117 Makes sure the lease is ready, and returns the lease object.
117118 """
118- with fail_after (60 ): # TODO: configurable timeout
119+ with fail_after (self . acquisition_timeout ):
119120 while True :
120121 logger .debug ("Polling Lease %s" , self .name )
121122 result = await self .get ()
Original file line number Diff line number Diff line change @@ -86,6 +86,17 @@ def decode_unsafe(self) -> Self:
8686 return self
8787
8888
89+ class ClientConfigV1Alpha1Lease (BaseSettings ):
90+ """Configuration for lease operations."""
91+
92+ acquisition_timeout : int = Field (
93+ default = 300 ,
94+ description = "Timeout in seconds for lease acquisition" ,
95+ ge = 5 , # Must be at least 5 seconds (polling interval)
96+ le = 43200 , # Maximum 12 hours
97+ )
98+
99+
89100class ClientConfigV1Alpha1 (BaseSettings ):
90101 CLIENT_CONFIGS_PATH : ClassVar [Path ] = CONFIG_PATH / "clients"
91102
@@ -108,6 +119,8 @@ class ClientConfigV1Alpha1(BaseSettings):
108119
109120 shell : ShellConfigV1Alpha1 = Field (default_factory = ShellConfigV1Alpha1 )
110121
122+ leases : ClientConfigV1Alpha1Lease = Field (default_factory = ClientConfigV1Alpha1Lease )
123+
111124 async def channel (self ):
112125 if self .endpoint is None or self .token is None :
113126 raise ConfigurationError ("endpoint or token not set in client config" )
@@ -258,6 +271,7 @@ async def lease_async(
258271 release = release_lease ,
259272 tls_config = self .tls ,
260273 grpc_options = self .grpcOptions ,
274+ acquisition_timeout = self .leases .acquisition_timeout ,
261275 ) as lease :
262276 yield lease
263277
You can’t perform that action at this time.
0 commit comments