-
Notifications
You must be signed in to change notification settings - Fork 5.7k
implementation of initial_scale service option (issue #116) #630
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
Conversation
fig/service.py
Outdated
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 validation should happen much easier. For one, it's duplicated in two places right now, which is not good.
This feels more like configuration validate code, which right now is done in the constructor for Service. You'll have to change can_be_scaled() slightly to accept the options as a param (instead of using self.options), but that should be fine (you could even move the function off the class if you wanted to, since self wouldn't be used any more).
I also noticed there's a bug in can_be_scaled() that will return True if the external interface is specified but no external port (it should really return False in that case) , but I guess that can be fixed later if you wanted to leave it for now.
|
I refactored the PR to match the suggestions of dnephin. I also added some unit tests for the feature. Along the way, I noticed, that a different test case was patching the Container class globally, which can get (and does, in this case) in the way of other test cases using Container. |
|
LGTM, but please do squash the commits into a single one. |
|
@EmilTH Cool! Thanks! Needs rebasing though, I'm afraid. :( |
|
@bfirsh OK, rebased onto docker/fig master. |
|
Looks like it needs another rebase, sorry. It could also do with some documentation in |
|
I did the rebase and also added the documentation. Don't know, why the tests fail, but this seems to be a problem with the build setup. |
|
I reran the build, it ran this time. There is just one error from |
Signed-off-by: Emil Kroymann <emil.kroymann@gmail.com>
|
I fixed the flake8 inconsistency and also made sure all tests pass. 2015-01-04 19:45 GMT+01:00 Daniel Nephin notifications@github.com:
|
|
Just an update: I think this PR is good, but I'm holding off on an LGTM because I've been thinking about configuration a lot and I'm worried about introducing stuff into service definition that isn't focused on application structure. I do think that it should be possible to define an initial scale for each service in a version-controlled configuration file, so that your first For context, there are a handful of other concerns relating to the structure and content of
Scaling directives fit in this category too, where there seems to be a boundary between an abstract, portable app definition and concrete, host-specific configuration. We're going to need to make a decision about where the latter should live but I still want to be cautious about what we allow in (Of course, since we already allow you to specify volume host paths etc, it's likely that there'll be breaking changes whatever we decide, so maybe it doesn't matter.) |
|
+1 to this PR. I think an app could be need a scale factor > 1 for a container at initial configuration. Not for service definition, needed to the app structure. |
|
Any update on this? |
|
Ping? |
|
Sorry, I got side tracked and did not have time to look into @aanand's proposal or resolve conflicts with master branch. If desired, I can put some work into this. |
|
Well, I just tested it and Still, does sound like a useful feature nonetheless. |
|
Thanks for the contribution! As @aanand mentioned here this is something we're considering, but it doesn't hit into the Compose file. We're discussing a new file or directory for this type of configuration here: #745 (comment) And there is a issue tracking this feature in #1661 |
Implementation of the initial_scale service option discussed in option (issue #116). Initial scale is applied whenever the containers for a service are newly created, ie. on "fig up" or "fig up --no-recreate".
Signed-off-by: Emil Kroymann emil.kroymann@gmail.com