-
Notifications
You must be signed in to change notification settings - Fork 24
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
Adding support of transient federates #358
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great start, but I have some doubts about the concurrency handling as indicated in the comments. I will have to finish reviewing later, but I think there is enough to work with to go ahead and submit this provisional review.
core/federated/RTI/rti_common.c
Outdated
result.tag = e->next_event; | ||
return result; | ||
} | ||
} else if (lf_tag_compare(min_upstream_completed, e->last_granted) > 0 | ||
&& lf_tag_compare(min_upstream_completed, e->next_event) >= 0 // The enclave has to advance its tag | ||
) { | ||
result.tag = min_upstream_completed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that if you just change this one line to:
result.tag = min_upstream_completed; | |
result.tag = e->next_event; |
then none of your num_connected_upstream
tracking and testing is necessary. As the code was originally written, if a federate has no upstream federates, it would always be granted TAG(FOREVER_TAG). But with transient federates, this is no longer OK. So think this one-line change would also make everything clearer.
core/federated/RTI/rti_remote.c
Outdated
(lf_tag_compare(fed->pending_grant, NEVER_TAG) == 0) | ||
&& (lf_tag_compare(fed->pending_provisional_grant, NEVER_TAG) >= 0) | ||
) { | ||
fed->pending_provisional_grant = tag; | ||
lf_thread_create(&(fed->pending_provisional_grant_thread_id), pending_provisional_grant_thread, fed); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I'm worried about just dropping this PTAG. Could the test failure that showed up the TS tests might be a consequence of this (not for this PTAG but for the TAG)? I bet that's a flaky test failure.
core/federated/RTI/rti_remote.c
Outdated
fed->requested_stop = true; | ||
} | ||
if (rti_remote->base.num_scheduling_nodes_handling_stop | ||
== rti_remote->base.number_of_scheduling_nodes) { | ||
== (rti_remote->base.number_of_scheduling_nodes - rti_remote->number_of_transient_federates)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to take into account transient federates that are connected, no? Otherwise, a transient federate that is connected may be told to stop at a tag that it has already passed.
include/core/federated/federate.h
Outdated
* @brief Return the directory containing the executables of the individual | ||
* federates. | ||
*/ | ||
char* lf_get_federates_bin_directory(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exposing information about the file system location at compile time to the program seems like a pretty bad idea to me. Paths can change, binaries get deployed to other systems. If it really is needed, it should be provided as a parameter at runtime.
include/core/federated/federate.h
Outdated
* | ||
* This function is particularly useful for testing transient federates. | ||
*/ | ||
void lf_stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is used for testing, should we really make it part of the public API?
In the "files changed" view, you can add suggestions to batch and commit them all at once. This way, we can avoid having lots of commit messages without a descriptive commit message. |
You probably want to use an interactive rebase to |
3725f73
to
798cb32
Compare
…t federates, cont.
… but did not started yet
… is an absent transient
…TAG to issue is the NET. This is to avoid starvation.
…bin_directory(), and lf_get_federaion_id() declarations to util.h
…ribe interface preservation checking in case of a hot swap
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Transient federates: Use a priority queue sorted by tags to manage delayed grants.
This PR replaces #192, and supports the latest major refactoring of the RTI.
It implements the transient feature in the federation execution. Details of the implementation are documented in Discussion lf-lang/lingua-franca#2212.