Managing Pool Resizing at service side (#107)

This commit is contained in:
Anshuman Goel
2020-10-13 11:04:26 -07:00
committed by GitHub
parent ab43890615
commit 7f0c25e2da
17 changed files with 319 additions and 40 deletions

View File

@ -16,7 +16,7 @@ from onefuzztypes.enums import (
PoolState,
ScalesetState,
)
from onefuzztypes.models import Error
from onefuzztypes.models import AutoScaleConfig, Error
from onefuzztypes.models import Node as BASE_NODE
from onefuzztypes.models import NodeAssignment, NodeCommand
from onefuzztypes.models import NodeTasks as BASE_NODE_TASK
@ -327,6 +327,7 @@ class Pool(BASE_POOL, ORMMixin):
arch: Architecture,
managed: bool,
client_id: Optional[UUID],
autoscale: Optional[AutoScaleConfig],
) -> "Pool":
return cls(
name=name,
@ -335,6 +336,7 @@ class Pool(BASE_POOL, ORMMixin):
managed=managed,
client_id=client_id,
config=None,
autoscale=autoscale,
)
def save_exclude(self) -> Optional[MappingIntStrAny]:
@ -854,14 +856,18 @@ class Scaleset(BASE_SCALESET, ORMMixin):
self.state = ScalesetState.halt
self.delete()
def max_size(self) -> int:
@classmethod
def scaleset_max_size(cls, image: str) -> int:
# https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/
# virtual-machine-scale-sets-placement-groups#checklist-for-using-large-scale-sets
if self.image.startswith("/"):
if image.startswith("/"):
return 600
else:
return 1000
def max_size(self) -> int:
return Scaleset.scaleset_max_size(self.image)
@classmethod
def search_states(
cls, *, states: Optional[List[ScalesetState]] = None