MCPcopy Create free account
hub / github.com/RoboVerseOrg/RoboVerse / _run_worker

Function _run_worker

scripts/trajectory_simpler_env.py:144–158  ·  view source on GitHub ↗

Run the worker subprocess; return (npz_dict | None, error_str | None).

(task, seed, steps, full=False, actions_b64="-")

Source from the content-addressed store, hash-verified

142
143
144def _run_worker(task, seed, steps, full=False, actions_b64="-"):
145 """Run the worker subprocess; return (npz_dict | None, error_str | None)."""
146 proc = subprocess.run(
147 [sys.executable, "-c", _WORKER, task, str(seed), str(steps), "1" if full else "0", actions_b64],
148 check=False,
149 capture_output=True,
150 text=True,
151 )
152 for line in proc.stdout.splitlines():
153 if line.startswith("NPZ_B64:"):
154 data = np.load(io.BytesIO(base64.b64decode(line[len("NPZ_B64:") :])), allow_pickle=False)
155 return {k: data[k] for k in data.files}, None
156 if line.startswith("ERR_B64:"):
157 return None, base64.b64decode(line[len("ERR_B64:") :]).decode()
158 return None, (proc.stderr[-2000:] or "no NPZ emitted")
159
160
161_SIG_KEYS = ["img_sum", "img_sq", "reward", "terminated", "truncated", "success", "instruction"]

Callers 3

op_recordFunction · 0.85
op_replayFunction · 0.85
op_determinismFunction · 0.85

Calls 2

runMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected