Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zoe
main
Commits
9235c44a
Commit
9235c44a
authored
Oct 11, 2017
by
Daniele Venzano
Browse files
Copying and serializing the image list for each node is very costly, do it only when needed
parent
65976d37
Pipeline
#4585
passed with stages
in 3 minutes and 3 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
zoe_master/backends/interface.py
View file @
9235c44a
...
...
@@ -25,7 +25,7 @@ from zoe_lib.state import Execution, Service, SQLManager # pylint: disable=unus
from
zoe_master.backends.base
import
BaseBackend
from
zoe_master.backends.service_instance
import
ServiceInstance
from
zoe_master.exceptions
import
ZoeStartExecutionFatalException
,
ZoeStartExecutionRetryException
,
ZoeException
from
zoe_master.stats
import
ClusterStats
# pylint: disable=unused-import
from
zoe_master.stats
import
ClusterStats
,
NodeStats
# pylint: disable=unused-import
try
:
from
zoe_master.backends.swarm.backend
import
SwarmBackend
...
...
@@ -167,12 +167,14 @@ def terminate_execution(execution: Execution) -> None:
execution
.
set_terminated
()
def
get_platform_state
(
state
:
SQLManager
)
->
ClusterStats
:
def
get_platform_state
(
state
:
SQLManager
,
with_images
=
False
)
->
ClusterStats
:
"""Retrieves the state of the platform by querying the container backend. Platform state includes information on free/reserved resources for each node. This information is used for advanced scheduling."""
backend
=
_get_backend
()
platform_state
=
backend
.
platform_state
()
for
node
in
platform_state
.
nodes
:
for
node
in
platform_state
.
nodes
:
# type: NodeStats
node
.
services
=
state
.
service_list
(
backend_host
=
node
.
name
,
backend_status
=
Service
.
BACKEND_START_STATUS
)
if
not
with_images
:
node
.
image_list
=
[]
return
platform_state
...
...
zoe_master/scheduler/elastic_scheduler.py
View file @
9235c44a
...
...
@@ -190,7 +190,7 @@ class ZoeElasticScheduler:
log
.
debug
(
"-> {}"
.
format
(
job
))
try
:
platform_state
=
get_platform_state
(
self
.
state
)
platform_state
=
get_platform_state
(
self
.
state
,
with_images
=
True
)
except
ZoeException
:
log
.
error
(
'Cannot retrieve platform state, cannot schedule'
)
for
job
in
jobs_to_attempt_scheduling
:
...
...
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