Remote places
With labgrid-client
, you can reserve and acquire a remote place before interacting with it:
$ eval `labgrid-client reserve --shell --wait device=odroid-2n-plus`
$ labgrid-client -p + acquire
$ labgrid-client -p + ssh echo "Hello, world!"
$ labgrid-client -p + release
The equivalent in rules_labgrid
should be:
platform(
name = "odroid-2n-plus",
constraint_values = [
"//constraint/device:odroid-2n-plus",
],
)
labgrid_genrule(
name = "hello",
srcs = ["@ape//ape:echo"],
outs = ["stdout.log"],
cmd = "$(location @rules_labgrid//labgrid/run) $(location @ape//ape:echo) \"Hello, world!\" > $@",
platform = ":odroid-2n-plus",
tools = ["@rules_labgrid//labgrid/run"],
)
Reservation and acquisition would happen implicitly as part of the toolchain definition:
labgrid_config_toolchain(
name = "odroid-2n-plus",
src = "config.yaml",
managers = [
"@rules_labgrid//labgrid/manager:reserve",
"@rules_labgrid//labgrid/manager:acquire",
],
target_compatible_with = [
"//constraint/device:odroid-2n-plus",
],
# ...
The managers @rules_labgrid//labgrid/manager:{reserve,acquire}
would be implemented to match the behaviour of their respective labgrid-client
subcommands. The tags used in the reserve
command could be inferred from the toolchain's target constraints or set explicitly as a tags
attribute in labgrid_config_toolchain
.
Edited by Alex Tercete