marin-shellbox 0.2.280.dev43881683340__tar.gz → 0.2.282.dev43906453060__tar.gz
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.
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/PKG-INFO +8 -4
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/README.md +4 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/pyproject.toml +4 -4
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/daytona/machine.py +14 -3
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/conftest.py +22 -1
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_daytona_machine.py +43 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_daytona_process.py +6 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_docker_machine.py +1 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_gvisor_machine.py +2 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/.gitignore +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/benchmarks/tasktrove/sample.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/__init__.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/__init__.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/daytona/__init__.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/daytona/bridge.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/daytona/connection.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/daytona/process.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/daytona/snapshot.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/daytona/snapshot_cli.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/docker/__init__.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/docker/machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/gvisor/__init__.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/gvisor/machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/iris/__init__.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/iris/machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/local/__init__.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/local/cgroup.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/local/images.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/local/launch.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/local/machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/local/nix.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/local/python_environment.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/local/transfers.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/qemu/__init__.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/qemu/bundle.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/qemu/guest/disk-init +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/qemu/guest/init +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/qemu/guest/pty-agent.c +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/qemu/image.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/qemu/machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/shellsim/__init__.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/backends/shellsim/machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/http_service.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/http_service_guest.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/image.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/process_framing.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/process_session.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/task.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/transfer.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/manual/README.md +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/manual/check_machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/manual/check_prepared_image.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/manual/check_qemu_isolation.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/manual/check_shell.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/manual/tasktrove_nl2bash_command.sh +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_http_service.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_image_cache.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_iris_machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_local_cgroup.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_local_launch.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_local_machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_process_session.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_qemu_machine.py +0 -0
- {marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/test_shellsim_machine.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: marin-shellbox
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.282.dev43906453060
|
|
4
4
|
Summary: Shell execution machines with local and remote backends
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Requires-Dist: bubblewrap-bin==0.11.0; sys_platform == 'linux'
|
|
@@ -8,14 +8,14 @@ Requires-Dist: httpx>=0.27
|
|
|
8
8
|
Requires-Dist: pydantic<3,>=2.12
|
|
9
9
|
Provides-Extra: daytona
|
|
10
10
|
Requires-Dist: daytona==0.200.2; extra == 'daytona'
|
|
11
|
-
Requires-Dist: marin-rigging==0.2.
|
|
11
|
+
Requires-Dist: marin-rigging==0.2.282.dev43906453060; extra == 'daytona'
|
|
12
12
|
Provides-Extra: gvisor
|
|
13
13
|
Provides-Extra: iris
|
|
14
|
-
Requires-Dist: marin-iris==0.2.
|
|
14
|
+
Requires-Dist: marin-iris==0.2.282.dev43906453060; extra == 'iris'
|
|
15
15
|
Provides-Extra: qemu
|
|
16
16
|
Requires-Dist: quicksand-qemu<0.6,>=0.5.12; extra == 'qemu'
|
|
17
17
|
Provides-Extra: shellsim
|
|
18
|
-
Requires-Dist: marin-rigging==0.2.
|
|
18
|
+
Requires-Dist: marin-rigging==0.2.282.dev43906453060; extra == 'shellsim'
|
|
19
19
|
Requires-Dist: shellsim[pypi]>=0.1.38; extra == 'shellsim'
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
|
|
@@ -299,6 +299,10 @@ The factory accepts `DaytonaNetworkPolicy` with `block_all`, `unrestricted`,
|
|
|
299
299
|
`value`. Without a policy override, the factory uses `MachineSpec.network`.
|
|
300
300
|
`MachineSpec.startup_timeout` bounds snapshot preparation and sandbox creation. Without
|
|
301
301
|
this value, the factory uses its `create_timeout` setting.
|
|
302
|
+
Daytona gives stdout and stderr collection a shared 60-second deadline after a
|
|
303
|
+
command exits. `DaytonaMachineFactory(output_collection_timeout=...)` changes
|
|
304
|
+
this deadline without changing the command timeout or cleanup timeouts. Harbor's
|
|
305
|
+
Daytona environment accepts the same `output_collection_timeout` setting.
|
|
302
306
|
The pinned Daytona SDK does not upload local `ADD` inputs. Dockerfiles with `ADD`
|
|
303
307
|
require a prebuilt registry image.
|
|
304
308
|
Other factories do not apply `MachineSpec.startup_timeout`. Callers enforce the
|
|
@@ -278,6 +278,10 @@ The factory accepts `DaytonaNetworkPolicy` with `block_all`, `unrestricted`,
|
|
|
278
278
|
`value`. Without a policy override, the factory uses `MachineSpec.network`.
|
|
279
279
|
`MachineSpec.startup_timeout` bounds snapshot preparation and sandbox creation. Without
|
|
280
280
|
this value, the factory uses its `create_timeout` setting.
|
|
281
|
+
Daytona gives stdout and stderr collection a shared 60-second deadline after a
|
|
282
|
+
command exits. `DaytonaMachineFactory(output_collection_timeout=...)` changes
|
|
283
|
+
this deadline without changing the command timeout or cleanup timeouts. Harbor's
|
|
284
|
+
Daytona environment accepts the same `output_collection_timeout` setting.
|
|
281
285
|
The pinned Daytona SDK does not upload local `ADD` inputs. Dockerfiles with `ADD`
|
|
282
286
|
require a prebuilt registry image.
|
|
283
287
|
Other factories do not apply `MachineSpec.startup_timeout`. Callers enforce the
|
{marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/pyproject.toml
RENAMED
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "marin-shellbox"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.282.dev43906453060"
|
|
8
8
|
description = "Shell execution machines with local and remote backends"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -12,11 +12,11 @@ dependencies = ["httpx>=0.27", "pydantic>=2.12,<3", "bubblewrap-bin==0.11.0; sys
|
|
|
12
12
|
|
|
13
13
|
[project.optional-dependencies]
|
|
14
14
|
qemu = ["quicksand-qemu>=0.5.12,<0.6"]
|
|
15
|
-
shellsim = ["shellsim[pypi]>=0.1.38", "marin-rigging==0.2.
|
|
15
|
+
shellsim = ["shellsim[pypi]>=0.1.38", "marin-rigging==0.2.282.dev43906453060"]
|
|
16
16
|
gvisor = []
|
|
17
|
-
daytona = ["daytona==0.200.2", "marin-rigging==0.2.
|
|
17
|
+
daytona = ["daytona==0.200.2", "marin-rigging==0.2.282.dev43906453060"]
|
|
18
18
|
iris = [
|
|
19
|
-
"marin-iris==0.2.
|
|
19
|
+
"marin-iris==0.2.282.dev43906453060",
|
|
20
20
|
]
|
|
21
21
|
|
|
22
22
|
[project.scripts]
|
|
@@ -53,6 +53,7 @@ from shellbox.machine import (
|
|
|
53
53
|
from shellbox.process_session import finish_owned, own_cleanup
|
|
54
54
|
|
|
55
55
|
DEFAULT_SANDBOX_TTL_MINUTES = 360
|
|
56
|
+
DEFAULT_OUTPUT_COLLECTION_TIMEOUT = 60
|
|
56
57
|
logger = logging.getLogger(__name__)
|
|
57
58
|
CONTROL_PATH = "/usr/sbin:/usr/bin:/sbin:/bin"
|
|
58
59
|
CONTROL_CWD = "/"
|
|
@@ -149,10 +150,18 @@ class DaytonaNetworkPolicy:
|
|
|
149
150
|
class DaytonaMachine:
|
|
150
151
|
"""One Daytona sandbox. Each command gets a fresh process and shared files."""
|
|
151
152
|
|
|
152
|
-
def __init__(
|
|
153
|
+
def __init__(
|
|
154
|
+
self,
|
|
155
|
+
sandbox: AsyncSandbox,
|
|
156
|
+
spec: MachineSpec,
|
|
157
|
+
resources: AsyncExitStack,
|
|
158
|
+
*,
|
|
159
|
+
output_collection_timeout: float = DEFAULT_OUTPUT_COLLECTION_TIMEOUT,
|
|
160
|
+
):
|
|
153
161
|
self.sandbox = sandbox
|
|
154
162
|
self.spec = spec
|
|
155
163
|
self.resources = resources
|
|
164
|
+
self.output_collection_timeout = output_collection_timeout
|
|
156
165
|
self._closed = False
|
|
157
166
|
self._sessions: set[DaytonaProcessSession] = set()
|
|
158
167
|
self._acquisitions: set[asyncio.Task[None]] = set()
|
|
@@ -339,7 +348,7 @@ class DaytonaMachine:
|
|
|
339
348
|
env=environment,
|
|
340
349
|
timeout=math.ceil(command.timeout + 10) if command.timeout is not None else None,
|
|
341
350
|
)
|
|
342
|
-
async with asyncio.timeout(
|
|
351
|
+
async with asyncio.timeout(self.output_collection_timeout):
|
|
343
352
|
limit = command.output_limit_bytes
|
|
344
353
|
stdout, stdout_truncated = await self._read_output(stdout_path, limit)
|
|
345
354
|
stderr, stderr_truncated = await self._read_output(stderr_path, limit)
|
|
@@ -487,11 +496,13 @@ class DaytonaMachineFactory:
|
|
|
487
496
|
*,
|
|
488
497
|
ttl_minutes: int = DEFAULT_SANDBOX_TTL_MINUTES,
|
|
489
498
|
create_timeout: float = 600,
|
|
499
|
+
output_collection_timeout: float = DEFAULT_OUTPUT_COLLECTION_TIMEOUT,
|
|
490
500
|
network_policy: DaytonaNetworkPolicy | None = None,
|
|
491
501
|
):
|
|
492
502
|
self.client_factory = client_factory
|
|
493
503
|
self.ttl_minutes = ttl_minutes
|
|
494
504
|
self.create_timeout = create_timeout
|
|
505
|
+
self.output_collection_timeout = output_collection_timeout
|
|
495
506
|
self.network_policy = network_policy
|
|
496
507
|
|
|
497
508
|
def _clients(self) -> Callable[[], AsyncDaytona]:
|
|
@@ -572,7 +583,7 @@ class DaytonaMachineFactory:
|
|
|
572
583
|
)
|
|
573
584
|
if prepared.exit_code:
|
|
574
585
|
raise UnsupportedMachineSpec("Daytona task images require setsid for command timeout recovery")
|
|
575
|
-
machine = DaytonaMachine(sandbox, spec, lifetime)
|
|
586
|
+
machine = DaytonaMachine(sandbox, spec, lifetime, output_collection_timeout=self.output_collection_timeout)
|
|
576
587
|
if spec.workdir:
|
|
577
588
|
result = await machine.run(Command(("mkdir", "-p", spec.workdir), cwd="/", env={"PATH": CONTROL_PATH}))
|
|
578
589
|
if result.exit_code:
|
{marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/tests/conftest.py
RENAMED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# Copyright The Marin Authors
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
"""
|
|
4
|
+
"""Host requirements and offline OCI images for Shellbox tests."""
|
|
5
5
|
|
|
6
6
|
import hashlib
|
|
7
7
|
import json
|
|
8
|
+
import sys
|
|
8
9
|
from collections.abc import Callable
|
|
9
10
|
from itertools import count
|
|
10
11
|
from pathlib import Path
|
|
@@ -12,6 +13,26 @@ from pathlib import Path
|
|
|
12
13
|
import pytest
|
|
13
14
|
from shellbox.image import PreparedImage, RegistryImage
|
|
14
15
|
|
|
16
|
+
HOST_REQUIREMENTS = {
|
|
17
|
+
"requires_host_setsid": "The local Linux guest fake needs the host setsid executable",
|
|
18
|
+
"requires_linux_process_api": "The local process fake needs Linux /proc and waitid with WNOWAIT",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def pytest_configure(config: pytest.Config) -> None:
|
|
23
|
+
for marker, reason in HOST_REQUIREMENTS.items():
|
|
24
|
+
config.addinivalue_line("markers", f"{marker}: {reason} (skipped on macOS)")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
|
|
28
|
+
if sys.platform != "darwin":
|
|
29
|
+
return
|
|
30
|
+
|
|
31
|
+
for item in items:
|
|
32
|
+
for marker, reason in HOST_REQUIREMENTS.items():
|
|
33
|
+
if item.get_closest_marker(marker) is not None:
|
|
34
|
+
item.add_marker(pytest.mark.skip(reason=reason))
|
|
35
|
+
|
|
15
36
|
|
|
16
37
|
def pytest_addoption(parser):
|
|
17
38
|
parser.addoption("--local-cgroup-parent", help="Writable delegated cgroup v2 parent for manual local-limit tests")
|
|
@@ -289,6 +289,7 @@ def test_snapshot_preflight_builds_without_starting_sandbox_and_reuses_image():
|
|
|
289
289
|
|
|
290
290
|
|
|
291
291
|
@pytest.mark.parametrize("policy", [None, DaytonaNetworkPolicy(DaytonaNetworkMode.DOMAIN_ALLOW_LIST, "example.org")])
|
|
292
|
+
@pytest.mark.requires_host_setsid
|
|
292
293
|
def test_daytona_binary_command_and_files(tmp_path: Path, policy) -> None:
|
|
293
294
|
async def scenario() -> None:
|
|
294
295
|
client = LocalDaytona()
|
|
@@ -344,6 +345,7 @@ def test_daytona_binary_command_and_files(tmp_path: Path, policy) -> None:
|
|
|
344
345
|
asyncio.run(scenario())
|
|
345
346
|
|
|
346
347
|
|
|
348
|
+
@pytest.mark.requires_host_setsid
|
|
347
349
|
def test_daytona_recreated_workdir_preserves_command_output(tmp_path: Path) -> None:
|
|
348
350
|
workdir = tmp_path / "work"
|
|
349
351
|
workdir.mkdir()
|
|
@@ -379,6 +381,7 @@ def test_daytona_recreated_workdir_preserves_command_output(tmp_path: Path) -> N
|
|
|
379
381
|
asyncio.run(scenario())
|
|
380
382
|
|
|
381
383
|
|
|
384
|
+
@pytest.mark.requires_host_setsid
|
|
382
385
|
def test_daytona_output_count_ignores_provider_diagnostics(tmp_path: Path) -> None:
|
|
383
386
|
class NoisyCountProcess(LocalProcess):
|
|
384
387
|
async def exec(self, command, **kwargs):
|
|
@@ -401,6 +404,34 @@ def test_daytona_output_count_ignores_provider_diagnostics(tmp_path: Path) -> No
|
|
|
401
404
|
asyncio.run(scenario())
|
|
402
405
|
|
|
403
406
|
|
|
407
|
+
@pytest.mark.skipif(shutil.which("setsid") is None, reason="Daytona command execution needs setsid")
|
|
408
|
+
@pytest.mark.parametrize("collection_timeout, succeeds", [(0.01, False), (1.0, True)])
|
|
409
|
+
def test_daytona_output_collection_uses_its_own_deadline(collection_timeout: float, succeeds: bool):
|
|
410
|
+
class SlowFiles(LocalFiles):
|
|
411
|
+
async def download_file(self, source: str) -> bytes:
|
|
412
|
+
await asyncio.sleep(0.1)
|
|
413
|
+
return await super().download_file(source)
|
|
414
|
+
|
|
415
|
+
async def scenario():
|
|
416
|
+
client = LocalDaytona()
|
|
417
|
+
client.sandbox.fs = SlowFiles()
|
|
418
|
+
machine = await DaytonaMachineFactory(lambda: client, output_collection_timeout=collection_timeout).create(
|
|
419
|
+
MachineSpec(RegistryImage("ubuntu:24.04"), workdir="")
|
|
420
|
+
)
|
|
421
|
+
try:
|
|
422
|
+
command = Command(("sh", "-c", "printf out; printf err >&2"))
|
|
423
|
+
if succeeds:
|
|
424
|
+
result = await machine.run(command)
|
|
425
|
+
assert (result.stdout, result.stderr) == (b"out", b"err")
|
|
426
|
+
else:
|
|
427
|
+
with pytest.raises(RuntimeError, match="Cannot collect Daytona command output"):
|
|
428
|
+
await machine.run(command)
|
|
429
|
+
finally:
|
|
430
|
+
await machine.close()
|
|
431
|
+
|
|
432
|
+
asyncio.run(scenario())
|
|
433
|
+
|
|
434
|
+
|
|
404
435
|
@pytest.mark.skipif(shutil.which("setsid") is None, reason="The command boundary needs a host setsid executable")
|
|
405
436
|
@pytest.mark.parametrize("interruption", ["timeout", "cancel", "cancel_twice", "cancel_during_timeout_stop"])
|
|
406
437
|
def test_daytona_command_interruption_stops_descendants_and_preserves_next_command(tmp_path, interruption):
|
|
@@ -489,6 +520,7 @@ def test_daytona_command_interruption_stops_descendants_and_preserves_next_comma
|
|
|
489
520
|
|
|
490
521
|
@pytest.mark.parametrize("interrupt_failure", ["exit", "timeout", "files"])
|
|
491
522
|
@pytest.mark.parametrize("interruption", ["timeout", "cancel"])
|
|
523
|
+
@pytest.mark.requires_host_setsid
|
|
492
524
|
def test_daytona_failed_interruption_cleanup_closes_machine(tmp_path, interrupt_failure, interruption):
|
|
493
525
|
entered = asyncio.Event()
|
|
494
526
|
|
|
@@ -534,6 +566,7 @@ def test_daytona_failed_interruption_cleanup_closes_machine(tmp_path, interrupt_
|
|
|
534
566
|
|
|
535
567
|
|
|
536
568
|
@pytest.mark.parametrize("interruption", ["timeout", "cancel"])
|
|
569
|
+
@pytest.mark.requires_host_setsid
|
|
537
570
|
def test_daytona_user_probe_is_bounded_and_cancellation_closes_the_machine(tmp_path, interruption):
|
|
538
571
|
entered = asyncio.Event()
|
|
539
572
|
|
|
@@ -579,6 +612,7 @@ def test_daytona_user_probe_is_bounded_and_cancellation_closes_the_machine(tmp_p
|
|
|
579
612
|
|
|
580
613
|
|
|
581
614
|
@pytest.mark.parametrize("command_timeout", [None, 30])
|
|
615
|
+
@pytest.mark.requires_host_setsid
|
|
582
616
|
def test_daytona_provider_timeout_remains_an_infrastructure_error(tmp_path, command_timeout):
|
|
583
617
|
provider_error = TimeoutError("Provider request timed out")
|
|
584
618
|
|
|
@@ -605,6 +639,7 @@ def test_daytona_provider_timeout_remains_an_infrastructure_error(tmp_path, comm
|
|
|
605
639
|
asyncio.run(scenario())
|
|
606
640
|
|
|
607
641
|
|
|
642
|
+
@pytest.mark.requires_host_setsid
|
|
608
643
|
def test_daytona_cancellation_during_failed_command_cleanup_remains_cancellation():
|
|
609
644
|
entered = asyncio.Event()
|
|
610
645
|
|
|
@@ -633,6 +668,7 @@ def test_daytona_cancellation_during_failed_command_cleanup_remains_cancellation
|
|
|
633
668
|
asyncio.run(scenario())
|
|
634
669
|
|
|
635
670
|
|
|
671
|
+
@pytest.mark.requires_host_setsid
|
|
636
672
|
def test_daytona_output_failure_retains_cleanup_note_on_the_primary_error():
|
|
637
673
|
output_error = TimeoutError("Provider output request timed out")
|
|
638
674
|
|
|
@@ -660,6 +696,7 @@ def test_daytona_output_failure_retains_cleanup_note_on_the_primary_error():
|
|
|
660
696
|
|
|
661
697
|
|
|
662
698
|
@pytest.mark.parametrize("path_source", ["image", "task"])
|
|
699
|
+
@pytest.mark.requires_host_setsid
|
|
663
700
|
def test_daytona_root_cleanup_does_not_execute_candidate_path_programs(tmp_path, path_source):
|
|
664
701
|
binary = tmp_path / "bin"
|
|
665
702
|
binary.mkdir()
|
|
@@ -699,6 +736,7 @@ def test_daytona_root_cleanup_does_not_execute_candidate_path_programs(tmp_path,
|
|
|
699
736
|
asyncio.run(scenario())
|
|
700
737
|
|
|
701
738
|
|
|
739
|
+
@pytest.mark.requires_host_setsid
|
|
702
740
|
def test_daytona_completion_between_probe_and_stop_preserves_the_machine(tmp_path):
|
|
703
741
|
paths = []
|
|
704
742
|
|
|
@@ -743,6 +781,7 @@ def test_daytona_completion_between_probe_and_stop_preserves_the_machine(tmp_pat
|
|
|
743
781
|
|
|
744
782
|
@pytest.mark.parametrize("primary_failure", [False, True])
|
|
745
783
|
@pytest.mark.parametrize("cleanup_failure", ["timeout", "exit"])
|
|
784
|
+
@pytest.mark.requires_host_setsid
|
|
746
785
|
def test_daytona_file_cleanup_failure_closes_machine_and_preserves_primary_error(primary_failure, cleanup_failure):
|
|
747
786
|
class FailedCleanup(LocalProcess):
|
|
748
787
|
async def exec(self, command, **kwargs):
|
|
@@ -869,6 +908,7 @@ def test_nonroot_tampering_cannot_authorize_root_commands(backend, tampering):
|
|
|
869
908
|
asyncio.run(scenario())
|
|
870
909
|
|
|
871
910
|
|
|
911
|
+
@pytest.mark.requires_host_setsid
|
|
872
912
|
def test_daytona_rejects_nonroot_execution_without_session_preserving_su(tmp_path):
|
|
873
913
|
class MissingSessionOption(LocalProcess):
|
|
874
914
|
async def exec(self, command, **kwargs):
|
|
@@ -895,6 +935,7 @@ def test_daytona_rejects_nonroot_execution_without_session_preserving_su(tmp_pat
|
|
|
895
935
|
|
|
896
936
|
|
|
897
937
|
@pytest.mark.parametrize("mode, exit_code", [(0o755, 0), (0o640, 126)])
|
|
938
|
+
@pytest.mark.requires_host_setsid
|
|
898
939
|
def test_daytona_upload_preserves_script_permissions(tmp_path: Path, mode: int, exit_code: int) -> None:
|
|
899
940
|
async def scenario() -> None:
|
|
900
941
|
source = tmp_path / "grader.sh"
|
|
@@ -916,6 +957,7 @@ def test_daytona_upload_preserves_script_permissions(tmp_path: Path, mode: int,
|
|
|
916
957
|
asyncio.run(scenario())
|
|
917
958
|
|
|
918
959
|
|
|
960
|
+
@pytest.mark.requires_host_setsid
|
|
919
961
|
def test_daytona_factory_owns_clients_across_worker_event_loops(tmp_path: Path) -> None:
|
|
920
962
|
clients = []
|
|
921
963
|
|
|
@@ -958,6 +1000,7 @@ def test_daytona_factory_owns_clients_across_worker_event_loops(tmp_path: Path)
|
|
|
958
1000
|
assert sum(client.deleted for client in clients) == 2
|
|
959
1001
|
|
|
960
1002
|
|
|
1003
|
+
@pytest.mark.requires_host_setsid
|
|
961
1004
|
def test_daytona_reuses_snapshot_until_build_inputs_or_resources_change(tmp_path: Path, monkeypatch) -> None:
|
|
962
1005
|
snapshots = LocalSnapshots()
|
|
963
1006
|
clients = []
|
|
@@ -144,6 +144,7 @@ async def output(session):
|
|
|
144
144
|
return bytes(result)
|
|
145
145
|
|
|
146
146
|
|
|
147
|
+
@pytest.mark.requires_linux_process_api
|
|
147
148
|
def test_daytona_process_preserves_binary_pipes_defaults_and_bounded_stderr(session_machine, tmp_path, monkeypatch):
|
|
148
149
|
monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "host-only-canary")
|
|
149
150
|
directory = tmp_path / "command-directory"
|
|
@@ -186,6 +187,7 @@ sys.exit(7)
|
|
|
186
187
|
asyncio.run(scenario())
|
|
187
188
|
|
|
188
189
|
|
|
190
|
+
@pytest.mark.requires_linux_process_api
|
|
189
191
|
def test_daytona_http_capability_uses_one_persistent_provider_session(session_machine, unused_tcp_port):
|
|
190
192
|
async def scenario():
|
|
191
193
|
machine, api = session_machine
|
|
@@ -228,6 +230,7 @@ def test_daytona_http_capability_uses_one_persistent_provider_session(session_ma
|
|
|
228
230
|
|
|
229
231
|
|
|
230
232
|
@pytest.mark.parametrize("stage", ["create", "execute"])
|
|
233
|
+
@pytest.mark.requires_linux_process_api
|
|
231
234
|
def test_daytona_process_cancelled_acquisition_reclaims_accepted_session(session_machine, stage):
|
|
232
235
|
async def scenario():
|
|
233
236
|
machine, api = session_machine
|
|
@@ -256,6 +259,7 @@ def test_daytona_process_cancelled_acquisition_reclaims_accepted_session(session
|
|
|
256
259
|
asyncio.run(scenario())
|
|
257
260
|
|
|
258
261
|
|
|
262
|
+
@pytest.mark.requires_linux_process_api
|
|
259
263
|
def test_daytona_process_cancelled_close_still_terminates_real_child(session_machine):
|
|
260
264
|
async def scenario():
|
|
261
265
|
machine, api = session_machine
|
|
@@ -277,6 +281,7 @@ def test_daytona_process_cancelled_close_still_terminates_real_child(session_mac
|
|
|
277
281
|
asyncio.run(scenario())
|
|
278
282
|
|
|
279
283
|
|
|
284
|
+
@pytest.mark.requires_linux_process_api
|
|
280
285
|
def test_daytona_machine_close_reclaims_active_process_and_releases_reader(session_machine):
|
|
281
286
|
async def scenario():
|
|
282
287
|
machine, api = session_machine
|
|
@@ -294,6 +299,7 @@ def test_daytona_machine_close_reclaims_active_process_and_releases_reader(sessi
|
|
|
294
299
|
|
|
295
300
|
|
|
296
301
|
@pytest.mark.parametrize("wire", ["D!\n", "D" + "A" * 200000, ""])
|
|
302
|
+
@pytest.mark.requires_linux_process_api
|
|
297
303
|
def test_daytona_process_rejects_corrupt_or_truncated_provider_stream_and_stops_child(session_machine, wire):
|
|
298
304
|
async def scenario():
|
|
299
305
|
machine, api = session_machine
|
|
@@ -442,6 +442,7 @@ def test_docker_stop_disposes_a_live_or_unverified_process_group(monkeypatch, pr
|
|
|
442
442
|
|
|
443
443
|
@pytest.mark.parametrize("exit_code,prefix", [(126, b"\x00\xffstart error\r\n"), (127, b"\x00\xffstart error")])
|
|
444
444
|
@pytest.mark.parametrize("output_limit", [0, 1024])
|
|
445
|
+
@pytest.mark.requires_host_setsid
|
|
445
446
|
def test_docker_exec_start_failure_preserves_output_and_the_next_command(monkeypatch, exit_code, prefix, output_limit):
|
|
446
447
|
create_process = asyncio.create_subprocess_exec
|
|
447
448
|
script = (
|
|
@@ -9,11 +9,13 @@ import os
|
|
|
9
9
|
import subprocess
|
|
10
10
|
import tarfile
|
|
11
11
|
|
|
12
|
+
import pytest
|
|
12
13
|
from shellbox.backends.docker.machine import DockerCommandResult
|
|
13
14
|
from shellbox.backends.gvisor.machine import GvisorMachineFactory
|
|
14
15
|
from shellbox.machine import DockerImage, MachineSpec
|
|
15
16
|
|
|
16
17
|
|
|
18
|
+
@pytest.mark.requires_host_setsid
|
|
17
19
|
def test_gvisor_transfers_binary_files_and_directory_contents_through_exec(tmp_path, monkeypatch):
|
|
18
20
|
async def docker(*args, stdin=b"", **kwargs):
|
|
19
21
|
if args[0] in {"run", "rm"}:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{marin_shellbox-0.2.280.dev43881683340 → marin_shellbox-0.2.282.dev43906453060}/src/shellbox/task.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|