task_manager: fix race conditions

This commit is contained in:
lassulus
2023-10-04 17:41:20 +02:00
parent 827fcbfe46
commit fe1a3f0541
3 changed files with 48 additions and 44 deletions

View File

@@ -15,7 +15,7 @@ from .inspect import VmConfig, inspect_vm
class BuildVmTask(BaseTask):
def __init__(self, uuid: UUID, vm: VmConfig) -> None:
super().__init__(uuid)
super().__init__(uuid, num_cmds=4)
self.vm = vm
def get_vm_create_info(self, cmds: Iterator[Command]) -> dict:
@@ -30,13 +30,13 @@ class BuildVmTask(BaseTask):
]
)
)
vm_json = "".join(cmd.lines)
vm_json = "".join(cmd.stdout)
self.log.debug(f"VM JSON path: {vm_json}")
with open(vm_json.strip()) as f:
return json.load(f)
def run(self) -> None:
cmds = self.register_commands(4)
cmds = self.commands()
machine = self.vm.flake_attr
self.log.debug(f"Creating VM for {machine}")