Skip to content
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

Parse PS memory from the PodResource of plan. #558

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dlrover/python/master/resource/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,11 @@ def _adjust_oom_ps_resource(self, node: Node):
plan = self._resource_optimizer.generate_oom_recovery_plan(
[node], JobOptStage.PS_INITIAL
)
if plan and not plan.empty():
ps = plan.node_group_resources[NodeType.PS]
if plan and not plan.empty() and node.name in plan.node_resources:
resource = plan.node_resources[node.name]
self._ps_resource.node_resource.memory = max(
self._ps_resource.node_resource.memory,
ps.node_resource.memory,
resource.memory,
)
cur_mem = node.config_resource.memory
cur_mem *= NodeResourceLimit.INCREMENTAL_MEMORY_FACTOR
Expand Down
6 changes: 3 additions & 3 deletions dlrover/python/tests/test_resource_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ class MockStub(object):
def optimize(self, request):
res = brain_pb2.OptimizeResponse()
res.job_optimize_plans.add()
group_resources = res.job_optimize_plans[
0
].resource.task_group_resources
plan = res.job_optimize_plans[0]
group_resources = plan.resource.task_group_resources
group_resources[NodeType.WORKER].count = 5
group_resources[NodeType.WORKER].resource.memory = (
_MEMORY * MemoryUnit.MB
Expand All @@ -55,6 +54,7 @@ def optimize(self, request):
group_resources[NodeType.PS].count = 2
group_resources[NodeType.PS].resource.memory = _MEMORY * MemoryUnit.MB
group_resources[NodeType.PS].resource.cpu = 16
plan.resource.pod_resources["ps-0"].memory = _MEMORY * MemoryUnit.MB
return res


Expand Down