Tags for XIR Model Management

So, with the introduction of IoT devices and blackbox devices, we need a better way for the user to select these in their model.

I’m proposing to add string tags to a resource that can be reconciled against. For example, something like when facility modeling:


tb.Node(
  fmt.Sprintf("alexa%02d", i),
  ExperimentTags(
     "alexa",
      "iot",
      "arm",
      "alexa-vVERSION"
  ),

Then, during experiment modelling, you would do something like:

a = net.Node("alexa", tags>=("alexa"))

or so.

For tags, the operators meaning would probably be:

  • ==: Exactly match all tags
  • !=: Do not contain any of those tags
  • >=: The resource has at least these tags
  • <=: The resource has at least one of these tags (kind of like subset)

Now, I am not particularly enthused about string matching myself, but I think that different facility owners can maintain a list of their tags as a python package. So instead, you would having something like:

import net
import neuiot

a = net.Node("alexa", tags>=(neuiot.tags.alexa))

In practice, we would probably have a set of common tags (like architecture, server, embedded) or so that’s common for everyone to use that prefixed with common

  • “common.x86_64”
  • “common.server”
  • “common.embedded”

While specific facilities would have their own tags prefixed with their own facility:

  • “neu.alexa”
  • “neu.speaker”

The idea is that devices with the same tags should be interchangeable with each other, including which images they can run. As a result, even if different facilities have the same devices, unless they’re accessed in the same way (which is unlikely for IoT devices), they should have different tags.

The default tag constraint would probably be tags>=(common.server, common.x86_64) and current nodes would have their added in their model.

I agree we need something like that. I think instead of overloading >= and such, it might be better to be more descriptive by having methods like “contain_all” and/or “contain_any” , although maybe overloading “~” for inverting makes sense.

Also making images dependent on tags is a good idea. Maybe consider having an explicit tag for that, e.g. “image” (that you can also select on).

Having facility-specific tags might be reasonable as a new facility comes together, but I’d try push for unifying tags as much as possible. So facilities who do not see a standard tag could create their own and we’ll include it in our set.

Another use of tags that you didn’t mention: constraints on node uses/allocations. E.g. A speaker device cannot be allocated if a microphone device has been allocated for another experiment. How we express these constraints for maximum flexibility needs to be thought through.

Constraints are traditionally implemented by overloading those operators (it’s why it’s image=='string' for example), so that’s why, but yeah, that is more informative.

a = net.Node("alexa", tags==contain_all(...)) could work. a = net.Node("alexa", tags_contains_all(...)) could work too.

I didn’t go into details about images or multiple node use/allocations because they’re a little bit of a different topic and still a little bit unsolved.

For images, due to protobufs, the simplest thing would be for every resource to also have a list of images that it can run. This should be based off the tags (maybe you’ll get a warning if not the case).

As for multiple node use/allocation, like resource pools, I don’t think you have to do anything fancier than adding a list of resource pools, in which if you allocate anything in the pool, you allocate everything else in the pool.