Fixing VMSS Re-Image 7-Day Timer (#1616)

* Fixing VMSS Re-Image 7-Day Timer

* Updating use of TimeStamp to created_at

* Renaming.

* Updating field name.

* Removing test chagne.

* Updating query to work if init_at entry does not exist yet.

* Changing timer for testing.

* Adding field comment.

* Formatting models.py

* Fixing where save is called.

* Adidng logging.

* Removing logging. Ready for merge.

* Update src/pytypes/onefuzztypes/models.py

Co-authored-by: Joe Ranweiler <joe@lemma.co>

* Formatting.

* Updating datetime.

* Testing after datetime change.

* Removing test.

Co-authored-by: nharper285 <nharper285@gmail.com>
Co-authored-by: Joe Ranweiler <joe@lemma.co>
This commit is contained in:
Noah McGregor Harper
2022-01-26 17:40:27 -08:00
committed by GitHub
parent f374801d35
commit 6100191aaf
3 changed files with 16 additions and 7 deletions

View File

@ -3,6 +3,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import datetime
import logging
from typing import Optional, cast
from uuid import UUID
@ -75,7 +76,9 @@ def on_state_update(
# they send 'init' with reimage_requested, it's because the node was reimaged
# successfully.
node.reimage_requested = False
node.initialized_at = datetime.datetime.now(datetime.timezone.utc)
node.set_state(state)
return None
logging.info("node state update: %s from:%s to:%s", machine_id, node.state, state)