-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin compliant with new features. #4
Comments
Hi @MisterOwlPT, thank you for the heads up! I've done as you suggested and created a new branch for the plugin repo, also called flow and changed both the plugin and Rigelfile to work with it. Thank you and enjoy your holiday! |
Hi @MisterOwlPT! I don't know why, but I can't get to make it so that my plugin runs after the compose plugin. Here's my Rigelfile. Thanks in advance :) |
Hi @Kazadhum, What do you mean by "runs after"? Looking at the Rigelfile you provided, if you do Is this not the behavior you were expecting? |
Hi @Kazadhum, I've committed some more changes to Rigel (branch flow). UPDATES TO RIGEL
Deprecated applications field:
Jobs were declared within an application, and multiple applications were supported. # ...
applications:
my_ros_application:
distro: "{{ distro }}"
jobs:
# ... We reached the conclusion that it doesn't make much sense to have multiple ROS applications declared within a single Rigelfile. Each application must have its own Rigelfile. A new Rigelfile now looks as this: # ...
application:
distro: "{{ distro }}"
jobs:
# ... Notice that:
Parallel execution flows fixed behavior:The way I had implemented parallel execution flows was wrong! Consider the following example sequence: # ...
sequences:
example_sequence:
stages:
-
parallel:
-
jobs: ["a", "b"]
-
jobs: ["c", "d"]
# ... I told you in my last message that if you run With the new version, the following will happen instead:
Notice now that the same exact same plugins are called in all the different threads. Parallel execution flows support matrix field:Consider the following example sequence: # ...
sequences:
drive:
stages:
-
matrix:
driver: ["Diogo", "Pedro"]
car: ["Volvo", "Ferrari", "Mitsubishi", "Opel"] # <-- DISCLAIMER: I don't know much about cars
parallel:
-
jobs: ["test_drive"] Notice the new field If you run Rigel ensures all combinations are tested. Inside the plugin, you can access the data using the class attribute
Parallel execution flows support dynamic decoding of variables:Before, all template variables ( the ones declared with Consider the previous example of the cars and drivers.
An alternative version of the previous example could then be written as this: # ...
jobs:
filter_drivers:
plugin: "example.Plugin"
with:
drivers: ["Diogo", "Ruca", "Pedro"]
# ...
sequences:
drive:
stages:
-
jobs: ["filter_drivers]
-
matrix:
driver: "{{ data.allowed_drivers }}"
car: ["Volvo", "Ferrari", "Mitsubishi", "Opel"] # <-- DISCLAIMER: I don't know much about cars
parallel:
-
jobs: ["test_drive"] This is what will happen if you run
Rigel is now programmed to ignore template variables starting with
And... that's it! Try using these new features to parameterize the parallel execution of jobs based on the output values of preceding jobs. As usual, let me know if you have any questions or suggestions 😃 |
Hi @Kazadhum, The Compose plugin now supports a field If the default value is used then the containers will run indefinitely (until CTRL-C/CTRL-Z is pressed). Changes committed to branch flow. Let me know if you have any other questions or doubts about this issue 😃 |
Hey @MisterOwlPT, thank you! :D |
Hello @MisterOwlPT! Just one more thing! In this version of Rigel, I've noticed that the containers get a different name each time the Compose plugin is run, like: This is fine, except for when saving
So the Thank you! 😄 |
Hello @Kazadhum, Whoops... I forgot about this "detail". Please let me know if you still have any problems with this 😄 |
Hi @Kazadhum, (@rarrais for reference) I've committed some more changes to Rigel (branch flow). Here is a description of the changes: UPDATES TO RIGELNew mechanism for data decodingPreviously all template variables (the ones declared using Not there are considered two types of template variables:
The difference between them is that static template variables are decoded when parsing the Rigelfile (i.e., the existing mechanism).
Dynamic template variables are decoded at run-time before loading each Plugin. In this case, Rigel uses an internal structure called
Plugin constructor changesAll plugins are now passed the # ...
def __init__(
self,
raw_data: PluginRawData,
global_data: RigelfileGlobalData,
application: Application,
providers_data: Dict[str, Any],
shared_data: Dict[str, Any] = {} # <-------- add this line
) -> None:
super().__init__(
raw_data,
global_data,
application,
providers_data,
shared_data # <-------- add this line
)
# ... No more changes are required.
Plugin call changesSince dynamic template variables are now a thing, all Plugins must be configured explicitly using the Rigelfile. Take for instance an updated example for the test:
plugin: "rigel.plugins.core.TestPlugin"
with:
timeout: "{{ data.simulation_duration }}"
hostname: "{{ data.simulation_address }}"
requirements:
- 'globally : some /OSPS/TM/HeartBeep [osps_msgs/TMHeartBeep] {publisherId = "friday"}'
- "globally : some /OSPS/TM/TaskStatus [osps_msgs/TMTaskStatus] {statusCode = 5}" Previously the fields Now, all configuration data must be defined explicitly (even if in practice we end up referring to the same shared data as before). This allows for more customization if so required.
I hope this message proves useful to you. Try updating your Rigelfile and external plugin to match these changes. |
Hello @MisterOwlPT ! Sorry for the delay, I've been trying to focus a little more on writing as of late. However, I just got to try to try and update everything on my flow branch to match these changes and I'm running into a problem. After making these changes and trying to run the
I made the changes to my plugin just like you showed me but I'm running into an issue when declaring variables. Maybe I'm getting this wrong, but from what I can gather, if I want to access the value of a variable declared in a |
Hi @Kazadhum! It's okay 😃 happy to hear from you again. No, dynamic data has no internal hierarchy, and all fields are placed at the same root level (this is something I am considering implementing). All dynamic data can only be accessed via Therefore you must change |
Thanks @MisterOwlPT, it works now! 😃 |
Hi @Kazadhum
I implemented core new features to the Rigel framework that will, among other things, support your work (Rigel now supports concurrent execution of multiple plugins and decouples introspection from infrastructure launching).
However, to take advantage of these new features you'll need to change some things in your plugin and the Rigefileyou are using. I leave here a detailed description of everything that changed for your reference (@rarrais included).
Please keep in mind the following:
The new features are working but were not yet tested intensively. For this reason, I created a new branch flow. This way you'll always have the stable develop intact if something goes wrong and you need to revert. I suggest you do something similar with your work. Consider creating a branch for your updated plugin and associated Rigelfiles.
Next week I'll be on holiday. I'll try to pay attention to GitHub issues and help you if required.
UPDATES TO RIGEL
Rigel plugins
Changes to interface
The
run
function was renamed tostart
.A new function
process(self) -> None
was introduced.All other required functions remain the same.
During execution, the following plugin functions are now called in the following order:
setup()
start()
process()
stop()
Notice that
process
is always called afterstart
.Rigel plugins must be compliant with this new interface.
New function process()
Whenever applicable, this function acts as a complement to
start
and should contain logic that is either:input
, keyboard events, ...)while
loops,time.sleep
, ...)All other business logic should remain inside
start
.This division allows for concurrent execution of plugins.
Depending on the chosen flow of execution the function
process
may or not be called.Check the section on executors below for more information.
Data sharing mechanism
Plugins that are executed in sequence can now share data between themselves!
This is done via a class attribute
shared_data
of typeDict[str, Any]
. This attribute is automatically passed between all plugins for them to store/read data according as required.All plugins automatically have access to this attribute without the need for changes (you can use access it
self.shared_data
).New plugin rigel.plugins.core.ComposePlugin
The existing plugin
rigel.plugins.core.TestPlugin
was broken into two plugins. One kept the original name and the other name was called_rigel.plugins.core.ComposePlugin_
.The new
ComposePlugin
is responsible only for launching a containerized ROS application (think of it as Docker Compose for ROS). After launching the containers it waits forever for user input (CTRL-C / CTRL-Z). Check the following Rigelfile excerpt:If a component is declared with
introspection: True
the plugin will store the name of the container for that component in the shared plugin data (keysimulation_hostname
). This can be used by other plugins, if applicable. If required, check the plugin model.The
TestPlugin
is now responsible only for the introspection of a containerized ROS system. It still requires ROS bridge. Check the following Rigelfile excerpt:If no field
hostname
orport
were declared the plugin will automatically look for connection data inside the shared plugin data. If required check the plugin model.Updated plugins
All plugins except
rigel.plugins.aws.RoboMakerPlugin
were updated, are compliant with the new protocol and are ready to use.Executors, job sequences and execution flows
Until now Rigel was only capable of executing sequential job sequences (via the
rigel run sequence
command).Now it supports the following execution flows:
Sequential job sequences
Consider the following Rigelfile excerpt where an example sequential job sequence
example_sequence
is declared:Assume that job
a
uses pluginPluginA
and jobb
uses pluginPluginB
.Executing the command
rigel run sequence example_sequence
will trigger the execution of the following functions:PluginA.setup()
PluginA.start()
PluginA.process()
PluginA.stop()
PluginB.setup()
PluginB.start()
PluginB.process()
PluginB.stop()
Summary:
PluginA
executes completely and thenPluginB
executes completely.Concurrent job sequences
Consider the following Rigelfile excerpt where an example concurrent job sequence
example_sequence
is declared:Assume that job
a
uses pluginPluginA
, jobb
uses pluginPluginB
... and vice-versa.Executing the command
rigel run sequence example_sequence
will trigger the execution of the following functions:PluginC.setup()
PluginC.start()
PluginD.setup()
PluginD.start()
PluginA.setup()
PluginA.start()
PluginA.process()
PluginA.stop()
PluginB.setup()
PluginB.start()
PluginB.process()
PluginB.stop()
PluginC.stop()
PluginD.stop()
Summary:
PluginC
andPluginD
are partially executed (functionprocess
is never called). Before thestop
function is called,PluginA
andPluginB
are completely executed and in sequence.Parallel job sequences
Consider the following Rigelfile excerpt where an example parallel job sequence
example_sequence
is declared:Here, exceptionally, each stage declared within
stages
must consist of either a sequential or concurrent sequence of jobs.Assume that job
a
uses pluginPluginA
, jobb
uses pluginPluginB
... and vice-versa.Executing the command
rigel run sequence example_sequence
will trigger the execution of the following functions:PluginA.setup()
PluginD.setup()
PluginA.start()
PluginD.start()
PluginA.process()
PluginC.setup()
PluginA.stop()
PluginC.start()
PluginB.setup()
PluginC.process()
PluginB.start()
PluginC.stop()
PluginB.process()
PluginD.stop()
PluginB.stop()
Summary: plugins are called according to the type of subsequence. Each subsequence is executed on a different thread.
I hope you find this message useful 😄
Let me know if you have any questions or found any problems.
Happy Easter! 🐰
The text was updated successfully, but these errors were encountered: