-
Notifications
You must be signed in to change notification settings - Fork 241
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
Add support for disk resource isolation #241
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a562c4b
Add support for disk resource isolation
nhandler bd60b5b
Mention disk resource in yelpsoa_configs docs
nhandler f9602fc
Clarify error messages to mention ints are valid
nhandler f0f620d
Update some tests to check for the correct message
nhandler e50e8ec
Use dict get default arg, and pass isinstance a tuple
nhandler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,10 @@ canary: | |
cpus: 0.1 | ||
instances: 1 | ||
mem: 500 | ||
disk: 750 | ||
nerve_ns: main | ||
main: | ||
cpus: 0.1 | ||
instances: 3 | ||
mem: 500 | ||
disk: 600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
chronos_job: | ||
cpus: .1 | ||
mem: 100 | ||
disk: 300 | ||
schedule: 'R/2015-08-14T10:00:00+00:00/PT10M' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
main: | ||
cpus: .1 | ||
mem: 100 | ||
disk: 450 | ||
instances: 1 | ||
env: | ||
FOO: BAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
chronos_job: | ||
cpus: .1 | ||
mem: 100 | ||
disk: 200 | ||
epsilon: foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
main: | ||
cpus: .1 | ||
mem: 100 | ||
disk: 200 | ||
instances: 1 | ||
env: | ||
FOO: BAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
chronos_job: | ||
cpus: .1 | ||
mem: 100 | ||
disk: 250.2 | ||
schedule: 'R/2015-08-14T10:00:00+00:00/PT10M' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
main: | ||
cpus: .1 | ||
mem: 100 | ||
disk: 200.0 | ||
instances: 1 | ||
env: | ||
FOO: BAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,17 +95,26 @@ def get_mem(self): | |
Defaults to 1024 (1G) if no value specified in the config. | ||
|
||
:returns: The amount of memory specified by the config, 1024 if not specified""" | ||
mem = self.config_dict.get('mem') | ||
return mem if mem else 1024 | ||
mem = self.config_dict.get('mem', 1024) | ||
return mem | ||
|
||
def get_cpus(self): | ||
"""Gets the number of cpus required from the service's configuration. | ||
|
||
Defaults to .25 (1/4 of a cpu) if no value specified in the config. | ||
|
||
:returns: The number of cpus specified in the config, .25 if not specified""" | ||
cpus = self.config_dict.get('cpus') | ||
return cpus if cpus else .25 | ||
cpus = self.config_dict.get('cpus', .25) | ||
return cpus | ||
|
||
def get_disk(self): | ||
"""Gets the amount of disk space required from the service's configuration. | ||
|
||
Defaults to 1024 (1G) if no value is specified in the config. | ||
|
||
:returns: The amount of disk space specified by the config, 1024 if not specified""" | ||
disk = self.config_dict.get('disk', 1024) | ||
return disk | ||
|
||
def get_cmd(self): | ||
"""Get the docker cmd specified in the service's configuration. | ||
|
@@ -190,15 +199,22 @@ def get_force_bounce(self): | |
def check_cpus(self): | ||
cpus = self.get_cpus() | ||
if cpus is not None: | ||
if not isinstance(cpus, float) and not isinstance(cpus, int): | ||
return False, 'The specified cpus value "%s" is not a valid float.' % cpus | ||
if not isinstance(cpus, (float, int)): | ||
return False, 'The specified cpus value "%s" is not a valid float or int.' % cpus | ||
return True, '' | ||
|
||
def check_mem(self): | ||
mem = self.get_mem() | ||
if mem is not None: | ||
if not isinstance(mem, float) and not isinstance(mem, int): | ||
return False, 'The specified mem value "%s" is not a valid float.' % mem | ||
if not isinstance(mem, (float, int)): | ||
return False, 'The specified mem value "%s" is not a valid float or int.' % mem | ||
return True, '' | ||
|
||
def check_disk(self): | ||
disk = self.get_disk() | ||
if disk is not None: | ||
if not isinstance(disk, (float, int)): | ||
return False, 'The specified disk value "%s" is not a valid float or int.' % disk | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isinstance can be passed a tuple for its second argument so this could just be Ditto for line 202 and 209 |
||
return True, '' | ||
|
||
def check(self, param): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can you add blank lines between each if/else in here? These blocks kind of run into each other.