mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 12:28:07 +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
|
||||
# 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()
|
||||
nodes = Node.search_states(states=NodeState.needs_work())
|
||||
for node in nodes:
|
||||
@ -38,14 +49,6 @@ def main(mytimer: func.TimerRequest, dashboard: func.Out[str]) -> None: # noqa:
|
||||
for scaleset in scalesets:
|
||||
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()
|
||||
if events:
|
||||
dashboard.set(events)
|
||||
|
Reference in New Issue
Block a user