blaxel 0.2.7rc85__py3-none-any.whl → 0.2.7rc86__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- blaxel/core/sandbox/process.py +16 -5
- blaxel/core/sandbox/sandbox.py +15 -2
- {blaxel-0.2.7rc85.dist-info → blaxel-0.2.7rc86.dist-info}/METADATA +1 -1
- {blaxel-0.2.7rc85.dist-info → blaxel-0.2.7rc86.dist-info}/RECORD +6 -6
- {blaxel-0.2.7rc85.dist-info → blaxel-0.2.7rc86.dist-info}/WHEEL +0 -0
- {blaxel-0.2.7rc85.dist-info → blaxel-0.2.7rc86.dist-info}/licenses/LICENSE +0 -0
blaxel/core/sandbox/process.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import asyncio
|
2
|
-
from typing import Callable, Dict, Literal, Optional, Union
|
2
|
+
from typing import Any, Callable, Dict, Literal, Optional, Union
|
3
3
|
|
4
4
|
import httpx
|
5
5
|
|
@@ -76,15 +76,26 @@ class SandboxProcess(SandboxAction):
|
|
76
76
|
return {"close": close}
|
77
77
|
|
78
78
|
async def exec(
|
79
|
-
self, process: Union[ProcessRequest, ProcessRequestWithLog]
|
79
|
+
self, process: Union[ProcessRequest, ProcessRequestWithLog, Dict[str, Any]]
|
80
80
|
) -> Union[ProcessResponse, ProcessResponseWithLog]:
|
81
81
|
"""Execute a process in the sandbox."""
|
82
|
-
on_log
|
83
|
-
if isinstance(process, ProcessRequestWithLog)
|
82
|
+
on_log = None
|
83
|
+
if isinstance(process, ProcessRequestWithLog):
|
84
84
|
on_log = process.on_log
|
85
|
+
process = process.to_dict()
|
85
86
|
|
86
|
-
|
87
|
+
if isinstance(process, dict):
|
88
|
+
if "on_log" in process:
|
89
|
+
on_log = process["on_log"]
|
90
|
+
del process["on_log"]
|
91
|
+
process = ProcessRequest.from_dict(process)
|
87
92
|
|
93
|
+
# Store original wait_for_completion setting
|
94
|
+
should_wait_for_completion = process.wait_for_completion
|
95
|
+
|
96
|
+
# Always start process without wait_for_completion to avoid server-side blocking
|
97
|
+
if should_wait_for_completion and on_log is not None:
|
98
|
+
process.wait_for_completion = False
|
88
99
|
async with self.get_client() as client_instance:
|
89
100
|
response = await client_instance.post("/process", json=process.to_dict())
|
90
101
|
# Parse JSON response only once, with better error handling
|
blaxel/core/sandbox/sandbox.py
CHANGED
@@ -47,7 +47,7 @@ class SandboxInstance:
|
|
47
47
|
def spec(self):
|
48
48
|
return self.sandbox.spec
|
49
49
|
|
50
|
-
async def wait(self, max_wait: int = 60000, interval: int = 1000) ->
|
50
|
+
async def wait(self, max_wait: int = 60000, interval: int = 1000) -> "SandboxInstance":
|
51
51
|
start_time = time.time() * 1000 # Convert to milliseconds
|
52
52
|
while self.sandbox.status != "DEPLOYED":
|
53
53
|
await asyncio.sleep(interval / 1000) # Convert to seconds
|
@@ -68,6 +68,17 @@ class SandboxInstance:
|
|
68
68
|
if (time.time() * 1000) - start_time > max_wait:
|
69
69
|
raise Exception("Sandbox did not deploy in time")
|
70
70
|
|
71
|
+
if self.sandbox.status == "DEPLOYED":
|
72
|
+
try:
|
73
|
+
# This is a hack for sometime receiving a 502,
|
74
|
+
# need to remove this once we have a better way to handle this
|
75
|
+
await self.fs.ls("/")
|
76
|
+
except:
|
77
|
+
# pass
|
78
|
+
pass
|
79
|
+
|
80
|
+
return self
|
81
|
+
|
71
82
|
@classmethod
|
72
83
|
async def create(
|
73
84
|
cls, sandbox: Union[Sandbox, SandboxCreateConfiguration, Dict[str, Any], None] = None
|
@@ -109,7 +120,9 @@ class SandboxInstance:
|
|
109
120
|
sandbox = Sandbox(
|
110
121
|
metadata=Metadata(name=name),
|
111
122
|
spec=SandboxSpec(
|
112
|
-
runtime=Runtime(
|
123
|
+
runtime=Runtime(
|
124
|
+
image=image, memory=memory, ports=ports, envs=envs, generation="mk3"
|
125
|
+
)
|
113
126
|
),
|
114
127
|
)
|
115
128
|
else:
|
@@ -309,8 +309,8 @@ blaxel/core/sandbox/action.py,sha256=9Zjkco7YkLzBThD3N2Hr5SpeEiqU_-Ktk8HlKpkpiAg
|
|
309
309
|
blaxel/core/sandbox/filesystem.py,sha256=dyIvDdlPZO0ijD6mXXX8Yl0t75VijQ6_uMz_9rJd-_4,11317
|
310
310
|
blaxel/core/sandbox/network.py,sha256=P5jLd4AAg1zgyIK4qGWvZaDZ5BzIcxRx2ffz_JLsLMI,357
|
311
311
|
blaxel/core/sandbox/preview.py,sha256=g0uVbMsIi8gRXmmyOfSyqm1qO4Cv6rsq92fs_k884dY,6120
|
312
|
-
blaxel/core/sandbox/process.py,sha256=
|
313
|
-
blaxel/core/sandbox/sandbox.py,sha256=
|
312
|
+
blaxel/core/sandbox/process.py,sha256=95fu9WU-CCdJcnHV8tYErkKTv5YoRcOqO68BH9NopvQ,8837
|
313
|
+
blaxel/core/sandbox/sandbox.py,sha256=J7wGqtelXZFk5XV99qTWSWS0TMHjo2C5qqZ7EYrD8j8,9036
|
314
314
|
blaxel/core/sandbox/session.py,sha256=3PfoekfdVzLYttsmKeK3MePhuprjqv_FDyVQTQME0OE,5277
|
315
315
|
blaxel/core/sandbox/types.py,sha256=hf3WCk8P2e87jT4cJGuz3aZCihffun8bVb2k91YfVBU,6894
|
316
316
|
blaxel/core/sandbox/client/__init__.py,sha256=N26bD5o1jsTb48oExow6Rgivd8ylaU9jaWZfZsVilP8,128
|
@@ -402,7 +402,7 @@ blaxel/telemetry/instrumentation/map.py,sha256=PCzZJj39yiYVYJrxLBNP-NW-tjjYyTijw
|
|
402
402
|
blaxel/telemetry/instrumentation/utils.py,sha256=KInMYZH-mu9_wvetmf0EmgrfN3Sw8IWk2Y95v2u90_U,1901
|
403
403
|
blaxel/telemetry/log/log.py,sha256=RvQByRjZMoP_dRaAZu8oK6DTegsHs-xV4W-UIqis6CA,2461
|
404
404
|
blaxel/telemetry/log/logger.py,sha256=NPAS3g82ryROjvc_DEZaTIfrcehoLEZoP-JkLxADxc0,4113
|
405
|
-
blaxel-0.2.
|
406
|
-
blaxel-0.2.
|
407
|
-
blaxel-0.2.
|
408
|
-
blaxel-0.2.
|
405
|
+
blaxel-0.2.7rc86.dist-info/METADATA,sha256=LVVDBCFGGEIuh90oSVc7EJtRtfGVHFLClRT4y5HhWbc,9879
|
406
|
+
blaxel-0.2.7rc86.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
407
|
+
blaxel-0.2.7rc86.dist-info/licenses/LICENSE,sha256=p5PNQvpvyDT_0aYBDgmV1fFI_vAD2aSV0wWG7VTgRis,1069
|
408
|
+
blaxel-0.2.7rc86.dist-info/RECORD,,
|
File without changes
|
File without changes
|