Augment Local Env With Coordinator-side Remote Env#1889
Conversation
…ed methods Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Bastian Krause <bst@pengutronix.de>
…nfig() Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Bastian Krause <bst@pengutronix.de>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1889 +/- ##
========================================
- Coverage 46.0% 45.8% -0.2%
========================================
Files 180 180
Lines 14464 14561 +97
========================================
+ Hits 6654 6674 +20
- Misses 7810 7887 +77
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
Hi @Bastian-Krause, Sorry for the late reply, I only found time to look at this now. Overall, the approach makes sense to me. In the meeting I mentioned defining this kind of configuration via the exporters, mainly because I had the case in mind where the person changing the hardware is physically close to the setup and could update the configuration directly there. But if the remote environment can be edited via the client, then that requirement mostly goes away. I have a few questions/comments: First, I am wondering about the relationship between places and targets in this model. So far I have thought of a place mostly as a named group of hardware resources, while a target describes how that hardware is used for a specific use case. With the current implementation, is it possible to store more than one remote environment for a single place? I think this could be useful, for example if the same hardware setup can be used in different ways. On the CLI side, selecting one of multiple remote environments might be relatively straightforward, but I am not sure yet what the best interface would be. Second, I would like to better understand the intended scope of this feature. Is the goal mainly to augment a local environment with configuration from the coordinator, or is it also intended to allow some users to avoid local env files completely? I think the latter is already achieved within the PR. If one user has configured the remote environment for a place, another user can directly use it without interacting with any env file at all. I think that would be a really nice property for larger labs. One more related point: in the example, I saw a Regarding storage, I do not have a very strong opinion yet, but my first preference would probably be something versioned :) Those were the main things that came to my mind. I would also be happy to help with some of the open tasks if needed. |
Do you have an example how different use cases for a place could look like? If different drivers would interact with the same resources, you could simply add all of them to the place, but only activate the relevant subset of drivers for your use case? I can't really think of a remote environment making one use case incompatible. Maybe an example would help.
If your current local environment config consists only of target configurations (everything under the targets: key, see the env skeleton in the docs), I guess you don't need a local env at all. However note that currently, at least for pytest, you need a minimal environment with the RemotePlace(s) (see "Minimal test with pytest" above). I guess a follow up PR could allow specifying one or more places directly. But that would need some restructuring of labgrid's pytest plugin fixtures currently relying on the
What's the use case for logging in into the DUT with you local username?
Let's see what tasks I'll tackle in this PR and let's wait for it to be merged. Please let us know before you start working on any related tasks (by opening an issue or a discussion), so we don't implement things twice. |
My concern is mostly about readability and CLI ergonomics, not about whether this is technically impossible to model in one environment. If a place has multiple resources/drivers of the same kind, a single combined remote environment means users need to know the internal names and pass them explicitly, for example via --name, depending on the command. If that would add too much complexity to the model or implementation, we should not have that, it is not a must anyways 👍
labgrid may open SSH connections to the exporter and copy files there, for example via ManagedFile or explicit put_file/rsync-style calls. ManagedFile currently uses a cache path by default, but users can also choose explicit remote destinations. So, I think it is useful that these exporter-side operations keep a per-user identity. Otherwise several labgrid users may effectively share the same remote context, which can cause collisions.
Will do 👍 |
|
Hey @Bastian-Krause, I implemented the following:
You can see it here: Bastian-Krause#15 Maybe we could also go with |
|
I can also work on more tests and documentation as well if you have not started yet. |
|
Discussion with @jluebbe and @Emantor:
Edit: moved to PR description above. |
Edit: moved to PR description above. |
|
@ozan956 Thanks, I'll have a look. Please don't put any more effort into this until this we've merged #1889. Also I'm not a huge fan of PRs in forks. No need to do anything about that now, I'll see if/how I can integrate your work. But for future work, please open a stacked draft PR and reference the base PR into the description. |
Hi @Bastian-Krause, do you have an idea when you might finish this? We're starting to role out Labgrid across the company and it isn't viable to have everyone manage the configurations locally (i.e. on the client), so we really need this functionality. That is why Ozan is trying to help contribute to the effort to get this across the finish line. |
|
I understand, but please try be patient. Contributions based on an in discussion draft PR are not helping, but rather slow down the process even further. We'd like to merge a solution that makes sense architecturally and does not behave surprisingly. This takes time. |
Description
In larger labs, maintaining and distributing environment configs for all the different places can become cumbersome. Defining resources, drivers, feature and options per place in the coordinator could help solve that problem.
This prototype adds a remote_env attribute to the Place class, a SetPlaceRemoteEnv method to the Coordinator class and a new sub command
labgrid-client editto edit the remote environment. The remote environment is printed inlabgrid-client showandlabgrid-client env. The RemotePlaceManager creates resources and drivers after expanding resource matches. If a local environment exists, it is augmented with the remote environment.This is a prototype. Open tasks:
remote/client: consider remote env resources/drivers in get_target_config()edit_remote_env()RemotePlace.ignore_drivers/RemotePlace.ignore_resources(class:name) in the local env (see resource/remote: add ignore_resources and ignore_drivers to RemotePlace Bastian-Krause/labgrid#15)Follow-up tasks could be
labgrid-client editlabgrid-client editMinimal test with
labgrid-clientSave this in your editor:
Minimal test with
pytest(using the place created above in "Minimal test withlabgrid-client")env.yaml:
$ pytest --lg-env env.yamlChecklist
Closes #1866