File size: 3,622 Bytes
6aa6c12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""Public RoboDojo Direct-control SIM server with explicit deployment identity."""
from collections.abc import Mapping

from benchmarks.simBenchmarks.RoboDojo.bench_server.adapter import DirectEEFBenchmarkAdapter, INTERFACE_PROTOCOL
from benchkit.sim_server.launch import main as launch

SUPPLEMENTAL_FILES = (
    "benchmarks/simBenchmarks/RoboDojo/__init__.py",
    "benchmarks/simBenchmarks/RoboDojo/server.py",
    "benchmarks/simBenchmarks/RoboDojo/bench_server/__init__.py",
    "benchmarks/simBenchmarks/RoboDojo/bench_server/adapter.py",
    "benchmarks/simBenchmarks/RoboDojo/bench_server/native_worker_client.py",
    "benchmarks/simBenchmarks/RoboDojo/bench_server/protocol/__init__.py",
    "benchmarks/simBenchmarks/RoboDojo/bench_server/protocol/robot_feedback.py",
    "benchmarks/simBenchmarks/RoboDojo/bench_server/protocol/task_catalog.json",
    "benchmarks/simBenchmarks/RoboDojo/bench_server/protocol/task_catalog.py",
    "benchmarks/simBenchmarks/RoboDojo/environment/__init__.py",
    "benchmarks/simBenchmarks/RoboDojo/environment/asset_reference.py",
    "benchmarks/simBenchmarks/RoboDojo/environment/eef_kinematics.py",
    "benchmarks/simBenchmarks/RoboDojo/environment/reference_eef_runtime.py",
    "benchmarks/simBenchmarks/RoboDojo/environment/reference_eef_snapshot.json",
    "benchmarks/simBenchmarks/RoboDojo/environment/worker_runtime.py",
    "benchmarks/simBenchmarks/RoboDojo/environment/native_eef_worker.py",
    "benchmarks/simBenchmarks/RoboDojo/bench_server/official_adapter.py",
    "benchmarks/simBenchmarks/RoboDojo/environment/official_runtime.py",
    "benchmarks/simBenchmarks/RoboDojo/environment/official_worker.py",
)
SERVER_PARAMETERS = frozenset({"task_id", "runtime_manifest", "runtime_manifest_sha256",
    "panel", "gpu_id", "worker_timeout", "deployment_track"})


def make_robodojo(parameters: Mapping[str, object]) -> DirectEEFBenchmarkAdapter:
    """Keep historical and official-source deployments distinctly identified.

    Both use the same fixed sensors/control conversion and named schedule. A
    deployment cannot impersonate the other track's manifest or protocol ID.
    """
    values = dict(parameters)
    if "protocol_track" in values or "robot_feedback" in values:
        raise ValueError("RoboDojo server protocol is fixed; remove protocol selectors")
    unknown = set(values) - SERVER_PARAMETERS
    if unknown:
        raise ValueError(f"unknown RoboDojo server parameters: {sorted(unknown)}")
    track = values.pop("deployment_track", "reference")
    if track == "official":
        from benchmarks.simBenchmarks.RoboDojo.bench_server.official_adapter import OfficialEEFBenchmarkAdapter
        from benchmarks.simBenchmarks.RoboDojo.environment.official_runtime import PROTOCOL
        adapter_type, expected_protocol = OfficialEEFBenchmarkAdapter, PROTOCOL
    elif track == "reference":
        adapter_type, expected_protocol = DirectEEFBenchmarkAdapter, INTERFACE_PROTOCOL
    else:
        raise ValueError("deployment_track must be reference or official")
    adapter = adapter_type(**values, diagnostic=False)
    if adapter.descriptor.protocol_version != expected_protocol:
        raise ValueError("RoboDojo adapter and task-catalog interface protocols differ")
    return adapter


def main(argv=None) -> int:
    """Capture the final private worker while excluding only runtime cache."""
    return launch(make_robodojo, excluded_artifact_directories=("cache",), require_complete_schedule=True,
                  supplemental_sources=SUPPLEMENTAL_FILES, argv=argv)


if __name__ == "__main__":
    raise SystemExit(main())