Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
allgo
allgo
Commits
03eca6b8
Commit
03eca6b8
authored
Apr 25, 2017
by
BAIRE Anthony
Browse files
use --cpu-shares
parent
bc1cbfc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
controller/controller.py
View file @
03eca6b8
...
...
@@ -1107,12 +1107,16 @@ class JobManager(Manager):
cap_add
=
[
"dac_override"
],
cpu_period
=
ctrl
.
cpu_period
,
cpu_quota
=
ctrl
.
cpu_quota
,
# cpu_shares = ctrl.cpu_shares,
# mem_reservation = ctrl.mem_soft_limit,
mem_limit
=
ctrl
.
mem_hard_limit
,
)
if
ctrl
.
mem_soft_limit
:
# TODO: upgrade docker-py (and use create_host_config)
hc
[
"MemoryReservation"
]
=
ctrl
.
mem_soft_limit
if
ctrl
.
cpu_shares
:
# TODO: upgrade docker-py (and use create_host_config)
hc
[
"CpuShares"
]
=
ctrl
.
cpu_shares
log
.
debug
(
"host_config %r"
,
hc
)
info
.
ctr_id
=
info
.
client
.
create_container
(
image
,
name
=
info
.
ctr_name
,
working_dir
=
"/tmp"
,
...
...
@@ -1513,6 +1517,7 @@ class DockerController:
self
.
cpu_quota
=
None
if
cpus
is
None
else
int
(
cpus
*
100000
)
self
.
cpu_period
=
None
if
cpus
is
None
else
100000
self
.
cpu_shares
=
None
if
cpus
is
None
else
int
(
cpus
)
self
.
mem_soft_limit
=
None
if
mem_soft_limit
is
None
else
docker
.
utils
.
parse_bytes
(
mem_soft_limit
)
self
.
mem_hard_limit
=
None
if
mem_hard_limit
is
None
else
docker
.
utils
.
parse_bytes
(
mem_hard_limit
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment