Skip to content

Commit 3ed606a

Browse files
committed
fix
1 parent ed779d1 commit 3ed606a

File tree

1 file changed

+4
-3
lines changed
  • services/autoscaling/src/simcore_service_autoscaling

1 file changed

+4
-3
lines changed

services/autoscaling/src/simcore_service_autoscaling/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ def assign_task(self, task, task_resources: Resources) -> None:
2323
def has_resources_for_task(self, task_resources: Resources) -> bool:
2424
return bool(self.available_resources >= task_resources)
2525

26-
def has_assigned_tasks(self) -> bool:
27-
return len(self.assigned_tasks) > 0
28-
2926

3027
@dataclass(frozen=True, kw_only=True, slots=True)
3128
class AssignedTasksToInstanceType(_TaskAssignmentMixin):
@@ -40,6 +37,10 @@ def __post_init__(self) -> None:
4037
if self.available_resources == Resources.create_as_empty():
4138
object.__setattr__(self, "available_resources", self.ec2_instance.resources)
4239

40+
def has_assigned_tasks(self) -> bool:
41+
# NOTE: This function is needed because assigned_tasks can be empty while still have used resources (this is not nice and should be changed)
42+
return bool(self.available_resources < self.ec2_instance.resources)
43+
4344

4445
@dataclass(frozen=True, kw_only=True, slots=True)
4546
class AssociatedInstance(_BaseInstance):

0 commit comments

Comments
 (0)