-
Notifications
You must be signed in to change notification settings - Fork 41
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
docker, core, editoast: add mode single-worker for all infra #9166
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev #9166 +/- ##
============================================
+ Coverage 39.02% 39.14% +0.11%
Complexity 2245 2245
============================================
Files 1289 1289
Lines 97319 97218 -101
Branches 3280 3280
============================================
+ Hits 37981 38054 +73
+ Misses 57399 57225 -174
Partials 1939 1939
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I did not reviewed it yet but I have a small question. This features seems useful for debuging purpose (see #8599). I believe we're talking of core? If so I don't see why we should handle this feature using docker compose. |
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.
LGTM for core with one minor comment.
Not tested yet, I'll probably come back to it later.
WORKER_ID = System.getenv("WORKER_ID") ?: (if (ALL_INFRA) "all_infra_worker" else null) | ||
WORKER_KEY = System.getenv("WORKER_KEY") ?: (if (ALL_INFRA) "all" else null) |
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 sets the priority as "env variable > all infra > null". I'd prefer if we used "all infra > env variable > null". It's quite minor but that way we could change a single flag to enable the "all infra" mode, instead of having to also unset the worker key/id.
WORKER_ID = System.getenv("WORKER_ID") ?: (if (ALL_INFRA) "all_infra_worker" else null) | |
WORKER_KEY = System.getenv("WORKER_KEY") ?: (if (ALL_INFRA) "all" else null) | |
WORKER_ID = if (ALL_INFRA) "all_infra_worker" else System.getenv("WORKER_ID") | |
WORKER_KEY = if (ALL_INFRA) "all" else System.getenv("WORKER_KEY") |
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 went for the safety on regular use, but it's fine to change.
Any reaction to that is welcome to make a "definitive" choice: current choice is to go for @eckter's suggestion.
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.
Ah, I remember, I also wanted to let a possible choice of the worker_key
name, which is not consistent with the "all infra" naming here.
The namings using "all" are about the targeted usage more than what it actually does/permit: no pre-load + work attached to just a grouping key, no matter the infra(s) being used.
Not sure it is useful for now or in the future to change/rename so I went for your suggestion in 302e4ef after upvotes.
Compose file here is more of a helper/documentation to plug all together, as |
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.
LGTM ! Didn't tested it yet. I'm waiting for your rebase to do so and then I'll approve the PR👍🏽
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.
Looks good although, as discussed, it will make us not really use the full complexity of osrdyne
on local, might not help to detect possible bugs in it. That said, all for making the developer experience smoother.
osrdyne
that depends on a Docker daemon that I don't have (using podman, daemon less).
editoast/src/core/mod.rs
Outdated
pub async fn new_mq( | ||
uri: String, | ||
worker_pool_identifier: String, | ||
timeout: u64, | ||
single_worker: bool, | ||
) -> Result<Self> { |
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.
Would it make sense that this function takes directly a mq_client::Options
as an input argument? I'm just triggered by the increasing number of arguments.
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.
Not convinced by the benefits: on the only caller place, we would just embed the mq_client::Options
creation, revealing more of the internals (and adding little more code/import).
Not strictly opposed to it, but not so fond of the idea here.
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'll be helpful to settle the debate: I'm fine with both :p
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.
Is revealing the internal really a problem? It will make calling the function more explicit. Compare these, for example:
new_mq("foobar", "yolo", 42, false);
As a reader of the code, I will therefore need to go consult the function to understand what each of these parameters mean (which in Github might not be trivial, so I may need to pull the code, to benefit from rust-analyzer
).
Compared to this:
new_mq(mq_client::Options {
uri: "foobar",
worker_pool_identifier: "yolo",
timeout: 42,
single_worker: false
});
Sure it's more verbose, but more verbose and more explicit it's not necessarily bad if you think that code is read more often than it's written. In some languages, you can name the parameter when calling but sadly, Rust doesn't allow that (there has been discussion about it).
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.
Convinced by the "named params": 52ffad3#diff-09ec5a58d69869bd41dba8612f5c3973f7bbe0147510aa5f2a1a44632ef30903R417-R422
c23a2d7
to
e7b8258
Compare
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.
Lgtm, not tested
I do not have anything to say about the PR per se, but I'm curious on why we would want to make this change the default behavior ? What's the rationale behind this ? |
@ElysaSrc there is a bit more info in the related issue #8599 but you may already have had a look and I'm not sure about your question. The main purpose is to ease debug of core (mainly without having to spawn a new core and track the id of the infra which can be painful, like for integration tests). Then the rationale of changing the noopdyne compose file is to consider that using dyne as noop is (almost?) only for that use case, so we might as well add the "changes" to editoast and core conf on the way to ease/document that case.
Hope that it answers your question, and maybe it's worth adding a bit of doc and a bit of description (will try to after more test, but any suggestion is welcome). |
Thanks for the detailed response ! |
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.
Tested for core debug purposes. Works as intended. Good job :)
302e4ef
to
56cee29
Compare
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.
Great work!
Should we also rename noopdyne
as single-worker
? It wasn't a great name, and I mostly named it that way because it wasn't a single-worker mode ^^'
WORKER_ID = System.getenv("WORKER_ID") | ||
WORKER_KEY = System.getenv("WORKER_KEY") | ||
ALL_INFRA = !System.getenv("ALL_INFRA").isNullOrEmpty() | ||
WORKER_ID = if (ALL_INFRA) "all_infra_worker" else System.getenv("WORKER_ID") |
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.
pretty sure this will conflict, could you rebase?
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.
It did, ended up refactoring a bit through a getBooleanEnvvar
fun 52ffad3#diff-7f5b2e605ea8cd19fd586f8d299a533f45c5419298dc3b16aca328645dee196aR75
docker-compose.yml
Outdated
environment: | ||
# Should match the reference, see. ./docker/osrdyne.yml | ||
CORE_EDITOAST_URL: "http://osrd-editoast" | ||
JAVA_TOOL_OPTIONS: "-javaagent:/app/opentelemetry-javaagent.jar" | ||
CORE_MONITOR_TYPE: "opentelemetry" | ||
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: "grpc" | ||
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: "http://jaeger:4317" | ||
OTEL_METRICS_EXPORTER: "none" | ||
OTEL_LOGS_EXPORTER: "none" |
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 directly providing the reference in ./docker/osrdyne.yml is a better idea... Or at least make clear that those are just for documentation, and that ./docker/osrdyne.yml
is not the reference, but the actually used values.
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.
Hopefully improved in 52ffad3#diff-e45e45baeda1c1e73482975a664062aa56f20c03dd9d64a827aba57775bed0d3R70-R71
Also cleanup unavailable envvar OSRD_BACKEND_URL Signed-off-by: Pierre-Etienne Bougué <[email protected]>
Signed-off-by: Pierre-Etienne Bougué <[email protected]>
…orker for all infra
56cee29
to
d60f674
Compare
Also:
OSRD_BACKEND_URL
🔍 please review by commit + one more developper should test it (integration + e2e + regular use)
This work may probably be improved (doc, script, etc.) any suggestion is welcome.
Fix: #8599