Skip to content

feat: make the local harness work standalone

Jordan Bonser requested to merge harness_standalone into main

the local harness was only usable as a context manager. this commit adds a new target:

bazelisk run //bazel/labgrid/local:harness

this makes the harness available as a standalone program, which sets up a dummy place and tags for it to be used by the labgrid client.

the harness chooses a free port on the machine and outputs its url to stdout.

the program is terminated using keyboard interrupt.

To use the harness, first run the above command and you will see something like:

Coordinator URL: localhost:33643

You can then in a separate terminal run:

export LG_COORDINATOR=localhost:33643
bazelisk run //labgrid/client:client -- -vv places

You should receive output like this:

INFO: Analyzed target //labgrid/client:client (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //labgrid/client:client up-to-date:
  bazel-bin/labgrid/client/client
  bazel-bin/labgrid/client/rules_python_entry_point_client.py
INFO: Elapsed time: 0.140s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/labgrid/client/client -vv places
Place 'test_place':
  tags: fake=device
  matches:
    e132765/example-group/NetworkService
  acquired: None
  acquired resources:
  created: 2025-04-15 15:13:33.958646
  changed: 2025-04-15 15:13:34.339430

relates to: #50 (closed)

Edited by Jordan Bonser

Merge request reports

Loading