use the primitive types in more places (#514)

This commit is contained in:
bmc-msft
2021-02-05 13:10:37 -05:00
committed by GitHub
parent 51f4eea069
commit 1d74379a70
17 changed files with 74 additions and 61 deletions

View File

@ -49,7 +49,7 @@ def check_container(
compare: Compare,
expected: int,
container_type: ContainerType,
containers: Dict[ContainerType, List[str]],
containers: Dict[ContainerType, List[Container]],
) -> None:
actual = len(containers.get(container_type, []))
if not check_val(compare, expected, actual):
@ -62,7 +62,7 @@ def check_container(
def check_containers(definition: TaskDefinition, config: TaskConfig) -> None:
checked = set()
containers: Dict[ContainerType, List[str]] = {}
containers: Dict[ContainerType, List[Container]] = {}
for container in config.containers:
if container.name not in checked:
if not container_exists(container.name, StorageType.corpus):

View File

@ -18,6 +18,7 @@ from onefuzztypes.events import (
from onefuzztypes.models import Error
from onefuzztypes.models import Task as BASE_TASK
from onefuzztypes.models import TaskConfig, TaskVm, UserInfo
from onefuzztypes.primitives import PoolName
from ..azure.image import get_os
from ..azure.queue import create_queue, delete_queue
@ -165,7 +166,7 @@ class Task(BASE_TASK, ORMMixin):
return task
@classmethod
def get_tasks_by_pool_name(cls, pool_name: str) -> List["Task"]:
def get_tasks_by_pool_name(cls, pool_name: PoolName) -> List["Task"]:
tasks = cls.search_states(states=TaskState.available())
if not tasks:
return []