mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 12:28:07 +00:00
Add the setup state to the unavailable list (#1731)
* Add the setup state to the unavailable list * Add the init state to the unavailable list * Fix integration test * Wrong import
This commit is contained in:
@ -32,7 +32,7 @@ import requests
|
|||||||
from onefuzz.api import Command, Onefuzz
|
from onefuzz.api import Command, Onefuzz
|
||||||
from onefuzz.backend import ContainerWrapper, wait
|
from onefuzz.backend import ContainerWrapper, wait
|
||||||
from onefuzz.cli import execute_api
|
from onefuzz.cli import execute_api
|
||||||
from onefuzztypes.enums import OS, ContainerType, TaskState, VmState
|
from onefuzztypes.enums import OS, ContainerType, TaskState, VmState, ScalesetState
|
||||||
from onefuzztypes.models import Job, Pool, Repro, Scaleset, Task
|
from onefuzztypes.models import Job, Pool, Repro, Scaleset, Task
|
||||||
from onefuzztypes.primitives import Container, Directory, File, PoolName, Region
|
from onefuzztypes.primitives import Container, Directory, File, PoolName, Region
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
@ -415,6 +415,8 @@ class TestOnefuzz:
|
|||||||
task.config.pool is not None
|
task.config.pool is not None
|
||||||
and scaleset.pool_name == task.config.pool.pool_name
|
and scaleset.pool_name == task.config.pool.pool_name
|
||||||
and scaleset.state not in scaleset.state.available()
|
and scaleset.state not in scaleset.state.available()
|
||||||
|
# not available() does not mean failed
|
||||||
|
and scaleset.state not in [ScalesetState.init, ScalesetState.setup]
|
||||||
):
|
):
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
"task scaleset failed: %s - %s - %s (%s)",
|
"task scaleset failed: %s - %s - %s (%s)",
|
||||||
|
@ -325,7 +325,7 @@ class ScalesetState(Enum):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def available(cls) -> List["ScalesetState"]:
|
def available(cls) -> List["ScalesetState"]:
|
||||||
"""set of states that indicate if it's available for work"""
|
"""set of states that indicate if it's available for work"""
|
||||||
unavailable = [cls.shutdown, cls.halt, cls.creation_failed]
|
unavailable = [cls.shutdown, cls.halt, cls.creation_failed, cls.setup, cls.init]
|
||||||
return [x for x in cls if x not in unavailable]
|
return [x for x in cls if x not in unavailable]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Reference in New Issue
Block a user