mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 20:38:06 +00:00
update pools before nodes or scalesets (#503)
This commit is contained in:
@ -28,6 +28,17 @@ def process_scaleset(scaleset: Scaleset) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def main(mytimer: func.TimerRequest, dashboard: func.Out[str]) -> None: # noqa: F841
|
def main(mytimer: func.TimerRequest, dashboard: func.Out[str]) -> None: # noqa: F841
|
||||||
|
# NOTE: Update pools first, such that scalesets impacted by pool updates
|
||||||
|
# (such as shutdown or resize) happen during this iteration `timer_worker`
|
||||||
|
# rather than the following iteration.
|
||||||
|
pools = Pool.search()
|
||||||
|
for pool in pools:
|
||||||
|
if pool.state in PoolState.needs_work():
|
||||||
|
logging.info("update pool: %s (%s)", pool.pool_id, pool.name)
|
||||||
|
process_state_updates(pool)
|
||||||
|
elif pool.state in PoolState.available() and pool.autoscale:
|
||||||
|
autoscale_pool(pool)
|
||||||
|
|
||||||
Node.mark_outdated_nodes()
|
Node.mark_outdated_nodes()
|
||||||
nodes = Node.search_states(states=NodeState.needs_work())
|
nodes = Node.search_states(states=NodeState.needs_work())
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
@ -38,14 +49,6 @@ def main(mytimer: func.TimerRequest, dashboard: func.Out[str]) -> None: # noqa:
|
|||||||
for scaleset in scalesets:
|
for scaleset in scalesets:
|
||||||
process_scaleset(scaleset)
|
process_scaleset(scaleset)
|
||||||
|
|
||||||
pools = Pool.search()
|
|
||||||
for pool in pools:
|
|
||||||
if pool.state in PoolState.needs_work():
|
|
||||||
logging.info("update pool: %s (%s)", pool.pool_id, pool.name)
|
|
||||||
process_state_updates(pool)
|
|
||||||
elif pool.state in PoolState.available() and pool.autoscale:
|
|
||||||
autoscale_pool(pool)
|
|
||||||
|
|
||||||
events = get_events()
|
events = get_events()
|
||||||
if events:
|
if events:
|
||||||
dashboard.set(events)
|
dashboard.set(events)
|
||||||
|
Reference in New Issue
Block a user