Skip to content

Commit 35db0ef

Browse files
committed
fix: harden Labtasker evaluation and simplify setup
1 parent 59483cf commit 35db0ef

27 files changed

Lines changed: 778 additions & 69 deletions

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: pip install ruff
2222

2323
- name: Lint
24-
run: ruff check openwam/ scripts/ tests/ docker/
24+
run: ruff check openwam/ benchmarks/ scripts/ tests/ docker/
2525

2626
tests:
2727
runs-on: ubuntu-latest
@@ -38,8 +38,7 @@ jobs:
3838
run: |
3939
python -m pip install --upgrade pip
4040
python -m pip install --index-url https://download.pytorch.org/whl/cpu torch==2.7.1 torchvision==0.22.1
41-
python -m pip install -e .
42-
python -m pip install pytest labtasker==2.5.0
41+
python -m pip install -e ".[dev]"
4342
4443
- name: Run standard checks
4544
run: make check

‎Makefile‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ tri-system-smoke:
2626
$(PYTHON) -m pytest -q $(TRI_SYSTEM_SMOKE_ARGS)
2727

2828
lint:
29-
$(PYTHON) -m ruff check openwam/ scripts/ tests/ docker/
29+
$(PYTHON) -m ruff check openwam/ benchmarks/ scripts/ tests/ docker/
3030

3131
format:
32-
$(PYTHON) -m ruff format openwam/ scripts/ tests/ docker/
33-
$(PYTHON) -m ruff check --fix openwam/ scripts/ tests/ docker/
32+
$(PYTHON) -m ruff format openwam/ benchmarks/ scripts/ tests/ docker/
33+
$(PYTHON) -m ruff check --fix openwam/ benchmarks/ scripts/ tests/ docker/
3434

3535
compile:
36-
$(PYTHON) -m compileall openwam scripts tests docker
36+
$(PYTHON) -m compileall openwam benchmarks scripts tests docker
3737

3838
check: compile test
3939

‎benchmarks/libero/LABTASKER.md‎

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
This lightweight integration gives you more built-in features with less custom
44
orchestration. Labtasker handles task scheduling, retries and progress tracking,
55
keeping the evaluation adapter small and the workflow simple: submit Tasks,
6-
start Workers and inspect results. On a single machine, its local server starts
7-
automatically.
6+
start Workers and inspect results. On a single machine with a local-filesystem
7+
checkout, you can explicitly authorize its managed local server on first use.
88

99
Compared with the traditional launcher, you get:
1010

@@ -43,11 +43,70 @@ export LIBERO_PATH=/path/to/LIBERO
4343
python -m pip install -r benchmarks/libero/requirements-labtasker.txt
4444
```
4545

46-
On one machine, no Labtasker server setup is needed.
46+
**On one machine with the repository on a local disk, you can continue to
47+
the first-run commands below.** Their `--auto-start-local-server` flag starts
48+
Labtasker for you; later commands reconnect automatically. No separate server
49+
command, port or database configuration is needed. The project GPU Docker image
50+
already includes the full Labtasker package needed for this workflow.
51+
52+
For multiple machines, or a checkout on NFS, WekaFS or Lustre, use the setup
53+
below first. Use it also if automatic startup reports an unknown filesystem.
54+
55+
<details>
56+
<summary>Setup for multiple machines or a shared-filesystem checkout</summary>
57+
58+
If your team already runs a Labtasker server, ask for its URL and token and
59+
skip to the client settings below. Otherwise, run this once on one machine:
60+
61+
```bash
62+
# Supply your own secret token.
63+
export LABTASKER_SERVER_TOKEN=... # do not commit the token
64+
labtasker-server serve --connection http --host 0.0.0.0
65+
```
66+
67+
By default, the server saves its records in `.labtasker/` under the directory
68+
where you start it. Its automatically created `server.db` stores submitted
69+
task inputs, task status and reported results. Keep this directory to retain
70+
your evaluation history.
71+
72+
To choose another location, add just `--labtasker-root /path/to/openwam-eval`;
73+
`server.db` follows that directory automatically. `--database` only overrides
74+
the database file's location separately and is unnecessary for this setup.
75+
Local disks and NFS/shared storage are supported: the server detects the
76+
filesystem automatically. On shared storage, run only one server for that
77+
directory/database, even when several machines can access it. The local-disk
78+
restriction applies to `--auto-start-local-server`, not this manual command.
79+
80+
Workers keep their execution logs and run records under their own
81+
`.labtasker/runs/`; setting the server's `--labtasker-root` does not move remote
82+
Worker logs. Benchmark logs, videos and detailed evaluation results still go
83+
to the output directories described below.
84+
85+
The server listens on port **8000** by default. Keep this command running in
86+
its terminal or under your process supervisor.
87+
88+
In each shell that submits tasks, runs Workers or reads results, set:
89+
90+
```bash
91+
export LABTASKER_URL=http://SERVER_HOST:8000
92+
export LABTASKER_TOKEN=... # same token as the server
93+
```
94+
95+
Replace `SERVER_HOST` with the server machine's reachable hostname or IP.
96+
Then follow the evaluation steps below, omitting `--auto-start-local-server`.
97+
All Workers must be able to access the submitted checkpoint and manifest paths.
98+
99+
</details>
100+
101+
For background, see the optional
102+
[Labtasker guide and demo video](https://luocfprime.github.io/labtasker/latest/).
47103

48104
> [!TIP]
49-
> Labtasker uses a server–client architecture and a shared task queue to manage
50-
> concurrent Workers. See the [conceptual guide and demo video](https://luocfprime.github.io/labtasker/latest/).
105+
> To let your coding agent help with Labtasker setup, task submission, progress
106+
> monitoring, troubleshooting and result summaries, install the **Labtasker skill**.
107+
> See the [Agent Skill guide](https://github.com/luocfprime/labtasker/blob/main/docs/guides/agent-skill.md)
108+
> for installation instructions. Describe the evaluation you want to run; the
109+
> agent can help translate it into the required Labtasker commands and settings.
51110
52111
<a id="first-run"></a>
53112

@@ -60,7 +119,8 @@ On one machine, no Labtasker server setup is needed.
60119
### 1. Submit manifest-building Tasks
61120

62121
```bash
63-
python benchmarks/libero/labtasker_submit.py --operation build_manifest
122+
python benchmarks/libero/labtasker_submit.py --auto-start-local-server \
123+
--operation build_manifest
64124
```
65125

66126
Save the submission ID printed by this command.
@@ -98,7 +158,7 @@ Replace `SUBMISSION_ID` with the printed ID. Continue when the count reaches zer
98158
Once the cache is ready:
99159

100160
```bash
101-
python benchmarks/libero/labtasker_submit.py \
161+
python benchmarks/libero/labtasker_submit.py --auto-start-local-server \
102162
-- --ckpt-dir /path/to/checkpoint
103163
```
104164

‎benchmarks/libero/labtasker_runtime.py‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@
3232
from benchmarks.utils.eval_sharding import split_range # noqa: E402
3333
from benchmarks.utils.labtasker_utils import ( # noqa: E402
3434
count_task_statuses,
35+
create_client,
3536
list_submission_tasks,
3637
print_submission_id,
3738
print_summary_table,
3839
project_context,
3940
submit_tasks,
41+
validate_submission_coverage,
4042
)
4143
from benchmarks.utils.labtasker_utils import new_submission_id as new_submission_id # noqa: E402, F401
4244
from benchmarks.utils.owned_processes import ProcessRegistry # noqa: E402, F401
@@ -632,6 +634,11 @@ def _build_parser(mode: str = "submit") -> argparse.ArgumentParser:
632634
worker = mode == "worker"
633635
parser.add_argument("--route", help="Task route (default: openwam-libero-<operation>)")
634636
parser.add_argument("--queue")
637+
parser.add_argument(
638+
"--auto-start-local-server",
639+
action="store_true",
640+
help="explicitly authorize startup of the project-local Labtasker Server",
641+
)
635642
parser.add_argument("--operation", choices=("build_manifest", "run_eval"), default="run_eval")
636643
if not worker:
637644
parser.add_argument("--policy-config", type=Path, default=DEFAULT_POLICY_CONFIG)
@@ -757,6 +764,7 @@ def submit(
757764
max_attempts: int = 3,
758765
priority: int = 0,
759766
note: str | None = None,
767+
auto_start_local_server: bool = False,
760768
) -> list[str]:
761769
"""Retry the original definition; never rewrite or requeue an existing Task."""
762770
inputs = list(inputs)
@@ -785,7 +793,7 @@ def submit(
785793
f"libero({item['suite']}):task{item['task_id']:02d}_{grouped_indices[key]:0{width}d}_{total:0{width}d}"
786794
)
787795
names.append(display + (f"_{note}" if note else ""))
788-
with project_context(), labtasker.Client(queue=queue) as client:
796+
with project_context(), create_client(queue=queue, auto_start_local_server=auto_start_local_server) as client:
789797
task_ids = submit_tasks(
790798
client,
791799
inputs,
@@ -846,11 +854,18 @@ def validated_task_result(task: labtasker.Task) -> dict[str, Any] | None:
846854
return result
847855

848856

849-
def summarize(submission_id: str, output: str | Path, *, queue: str | None = None) -> int:
850-
with project_context(), labtasker.Client(queue=queue) as client:
857+
def summarize(
858+
submission_id: str,
859+
output: str | Path,
860+
*,
861+
queue: str | None = None,
862+
auto_start_local_server: bool = False,
863+
) -> int:
864+
with project_context(), create_client(queue=queue, auto_start_local_server=auto_start_local_server) as client:
851865
tasks = list_libero_submission_tasks(client, submission_id, "run_eval")
852866
if not tasks:
853867
raise ValueError(f"LIBERO eval submission not found: {submission_id}")
868+
validate_submission_coverage(tasks)
854869
_summarize(Path(output), tasks)
855870
return 0
856871

‎benchmarks/libero/labtasker_submit.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def main(argv=None):
2727
max_attempts=args.max_attempts,
2828
priority=args.priority,
2929
note=args.note,
30+
auto_start_local_server=args.auto_start_local_server,
3031
)
3132
return 0
3233

‎benchmarks/libero/labtasker_summarize.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
import sys
66
from pathlib import Path
77

8-
from labtasker_runtime import summarize
8+
import labtasker_runtime as runtime
99

1010

1111
def main(argv=None):
1212
parser = argparse.ArgumentParser(description=__doc__)
1313
parser.add_argument("submission_id")
1414
parser.add_argument("--output-dir", type=Path, required=True)
1515
parser.add_argument("--queue")
16+
parser.add_argument("--auto-start-local-server", action="store_true")
1617
args = parser.parse_args(argv)
17-
return summarize(args.submission_id, args.output_dir.expanduser().absolute(), queue=args.queue)
18+
return runtime.summarize(
19+
args.submission_id,
20+
args.output_dir.expanduser().absolute(),
21+
queue=args.queue,
22+
auto_start_local_server=args.auto_start_local_server,
23+
)
1824

1925

2026
if __name__ == "__main__":

‎benchmarks/libero/labtasker_worker.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ def main(argv: list[str] | None = None) -> int:
193193
args.gpu, args.render_gpu if args.render_gpu is not None else args.gpu, args.port
194194
)
195195
try:
196+
if args.auto_start_local_server:
197+
with project_context(), runtime.create_client(queue=args.queue, auto_start_local_server=True) as client:
198+
client.count_tasks()
196199
print(f"[worker] route={args.route} operation={args.operation} gpu={worker_resources.gpu}", flush=True)
197200
with project_context():
198201
run_worker(args, worker_resources, server)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Install in SERVER_PYTHON; the isolated LIBERO environment is unchanged.
2-
labtasker==2.5.0
2+
labtasker==2.6.0
33
PyYAML>=6.0

‎benchmarks/robotwin/LABTASKER.md‎

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
This lightweight integration gives you more built-in features with less custom
44
orchestration. Labtasker handles task scheduling, retries and progress tracking,
55
keeping the evaluation adapter small and the workflow simple: submit Tasks,
6-
start Workers and inspect results. On a single machine, its local server starts
7-
automatically.
6+
start Workers and inspect results. On a single machine with a local-filesystem
7+
checkout, you can explicitly authorize its managed local server on first use.
88

99
Compared with the traditional launcher, you get:
1010

@@ -43,11 +43,70 @@ export ROBOTWIN_PATH=/path/to/RoboTwin
4343
python -m pip install -r benchmarks/robotwin/requirements-labtasker.txt
4444
```
4545

46-
On one machine, no Labtasker server setup is needed.
46+
**On one machine with the repository on a local disk, you can continue to
47+
the first-run commands below.** Their `--auto-start-local-server` flag starts
48+
Labtasker for you; later commands reconnect automatically. No separate server
49+
command, port or database configuration is needed. The project GPU Docker image
50+
already includes the full Labtasker package needed for this workflow.
51+
52+
For multiple machines, or a checkout on NFS, WekaFS or Lustre, use the setup
53+
below first. Use it also if automatic startup reports an unknown filesystem.
54+
55+
<details>
56+
<summary>Setup for multiple machines or a shared-filesystem checkout</summary>
57+
58+
If your team already runs a Labtasker server, ask for its URL and token and
59+
skip to the client settings below. Otherwise, run this once on one machine:
60+
61+
```bash
62+
# Supply your own secret token.
63+
export LABTASKER_SERVER_TOKEN=... # do not commit the token
64+
labtasker-server serve --connection http --host 0.0.0.0
65+
```
66+
67+
By default, the server saves its records in `.labtasker/` under the directory
68+
where you start it. Its automatically created `server.db` stores submitted
69+
task inputs, task status and reported results. Keep this directory to retain
70+
your evaluation history.
71+
72+
To choose another location, add just `--labtasker-root /path/to/openwam-eval`;
73+
`server.db` follows that directory automatically. `--database` only overrides
74+
the database file's location separately and is unnecessary for this setup.
75+
Local disks and NFS/shared storage are supported: the server detects the
76+
filesystem automatically. On shared storage, run only one server for that
77+
directory/database, even when several machines can access it. The local-disk
78+
restriction applies to `--auto-start-local-server`, not this manual command.
79+
80+
Workers keep their execution logs and run records under their own
81+
`.labtasker/runs/`; setting the server's `--labtasker-root` does not move remote
82+
Worker logs. Benchmark logs, videos and detailed evaluation results still go
83+
to the output directories described below.
84+
85+
The server listens on port **8000** by default. Keep this command running in
86+
its terminal or under your process supervisor.
87+
88+
In each shell that submits tasks, runs Workers or reads results, set:
89+
90+
```bash
91+
export LABTASKER_URL=http://SERVER_HOST:8000
92+
export LABTASKER_TOKEN=... # same token as the server
93+
```
94+
95+
Replace `SERVER_HOST` with the server machine's reachable hostname or IP.
96+
Then follow the evaluation steps below, omitting `--auto-start-local-server`.
97+
All Workers must be able to access the submitted checkpoint and manifest paths.
98+
99+
</details>
100+
101+
For background, see the optional
102+
[Labtasker guide and demo video](https://luocfprime.github.io/labtasker/latest/).
47103

48104
> [!TIP]
49-
> Labtasker uses a server–client architecture and a shared task queue to manage
50-
> concurrent Workers. See the [conceptual guide and demo video](https://luocfprime.github.io/labtasker/latest/).
105+
> To let your coding agent help with Labtasker setup, task submission, progress
106+
> monitoring, troubleshooting and result summaries, install the **Labtasker skill**.
107+
> See the [Agent Skill guide](https://github.com/luocfprime/labtasker/blob/main/docs/guides/agent-skill.md)
108+
> for installation instructions. Describe the evaluation you want to run; the
109+
> agent can help translate it into the required Labtasker commands and settings.
51110
52111
<a id="first-run"></a>
53112

@@ -60,7 +119,8 @@ On one machine, no Labtasker server setup is needed.
60119
### 1. Submit manifest-building Tasks
61120

62121
```bash
63-
python benchmarks/robotwin/labtasker_submit.py --operation build_manifest --mode demo_clean
122+
python benchmarks/robotwin/labtasker_submit.py --auto-start-local-server \
123+
--operation build_manifest --mode demo_clean
64124
```
65125

66126
Save the submission ID printed by this command.
@@ -98,7 +158,7 @@ Replace `SUBMISSION_ID` with the printed ID. Continue when the count reaches zer
98158
Once the cache is ready:
99159

100160
```bash
101-
python benchmarks/robotwin/labtasker_submit.py --mode demo_clean \
161+
python benchmarks/robotwin/labtasker_submit.py --auto-start-local-server --mode demo_clean \
102162
-- --ckpt-dir /path/to/checkpoint
103163
```
104164

0 commit comments

Comments
 (0)