-
Notifications
You must be signed in to change notification settings - Fork 29
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
Proposal: Use depends_on for container startup order #568
Proposal: Use depends_on for container startup order #568
Conversation
That PR looks excellent! The logic looks sound and from just looking at it should do exactly what Having the healthcheck logic also integrated would be a dream, but I would argue it is more reasonable to merge this first and then we keep the other issue open for people interesting to open a PR on this. I will give it a more detailed look tomorrow and make a proper review. |
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 gave the PR a closer look. The approach is great!
I put some comments and remarks. Please give it a look and share your thoughts.
@ArneTR Thanks for the review and your helpful comments! I'm a quite inexperienced (Python) programmer, so it is also good for me for learning 😊 I think I have now made all the requested changes. boot:
wait_time_dependencies: 20 Does this make sense for you? |
The key in the config is aptly named. Can you put it under "measurement" though. I think this makes more sense, as we already have config vars there that influence measurements. So hierarchy would be measurement -> boot -> wait_time_dependencies
Let me know if you need a sample yml. |
The config looks now as follows: measurement:
idle-time-start: 10
idle-time-end: 5
flow-process-runtime: 3800
phase-transition-time: 1
boot:
wait_time_dependencies: 20
metric-providers: Is it the way you had in mind? The faulty implementation of the cycle detection is a little embarrassing. Should be fixed now. |
The position of the config option is exactly how I had it in mind, thanks for moving that! @ribalba can you have a look at the cycle protection implementation and how David implemented it. Am a bit short in time today and tomorrow. |
# Check if there are dependencies defined with 'depends_on'. | ||
# If so, change the order of the services accordingly. | ||
for service_name in services.keys(): | ||
order_of_service_names = self.order_service_names(order_of_service_names, service_name) |
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.
Hey, thank you for this great PR again. Arne and me just talked about the code and while this code is fully functional we see that it might be hard to maintain in the future as you carry the whole list order_of_service_names
or order_array
into every sub iteration. While this is fine for now we see that this might be the source of errors in a few years time as it is harder to comprehend. Also this pattern can be the source of errors when doing more complex things. When calling recursive functions it might be better to only pass in the context of the recursion and then handle the building of the list in the parent. Not something we need to fix right now but just as a remark.
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.
Based on this feedback I created an alternative PR with some refactorings:
#593
As soon as this is merged I will add a more complex test. As I can't write to @davidkopp repo. |
Is it really the case that you don't have the permissions? The option "Allowing edits by maintainers" is enabled.
|
This was merged here #593 (comment) |
This PR tries to resolve #567.
It uses
depends_on
to determine a better startup order, and it checks if the dependent containers are running before starting the respective container.There are some open questions that have to be discussed. Therefore, this PR is currently more like a proposal.