lava icon indicating copy to clipboard operation
lava copied to clipboard

Multi-var monitoring for PyProcModels

Open elvinhajizada opened this issue 3 years ago • 0 comments

Issue Number: #75

Objective of pull request: Enable multi-Var and multi-OutPort probing of multiple processes using single Monitor proc.

Pull request checklist

Your PR fulfills the following requirements:

  • [x] Issue created that explains the change and why it's needed
  • [x] Tests are part of the PR (for bug fixes / features)
  • [x] Docs reviewed and added / updated if needed (for bug fixes / features)
  • [x] PR conforms to Coding Conventions
  • [x] PR applys BSD 3-clause or LGPL2.1+ Licenses to all code files
  • [x] Lint (flakeheaven lint src/lava tests/) and (bandit -r src/lava/.) pass locally
  • [x] Build tests (pytest) passes locally

Pull request type

Please check your PR type:

  • [ ] Bugfix
  • [x] Feature
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation changes
  • [ ] Other (please describe):

What is the current behavior?

  • One Monitor Process can only probe single Var or OutPort of another Process. Multi-Var or Multi-OutPort monitoring of multiple processes are not possible. Each time user needs to create a new Monitor process.

What is the new behavior?

  • Now user need to a single Monitor process, which can be used to probe multiple Vars and/or OutPorts of several other processes.

Does this introduce a breaking change?

  • [x] No

Supplemental information

To enable multi-var probing this PR introduce dynamic creation of Vars and Ports in processes. For this purpose it introduces a new attribute to Vars and Ports, called parent_list_name. This is just a string that points to the name of a LavaType in ProcModel, corresponding to the collection of dynamically generated Ports or Vars of a specific type (e.g. RefPort, InPort, etc.). Practically, all of the members of a process that has the same parent_list_name attribute will use the same LavaType in its ProcModel with the name parent_list_name. This solves the problem of correspondence between Process members and ProcModel members in the case of dynamical creation new Ports or Vars

elvinhajizada avatar Apr 06 '22 16:04 elvinhajizada