Skip to content

Commit

Permalink
Merge pull request #113 from knopki/fix-110-os-mismatch
Browse files Browse the repository at this point in the history
OS logic mismatch fix
  • Loading branch information
blokhin committed Jul 5, 2023
2 parents dc01763 + 30e478f commit 639b473
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion yascheduler/remote_machine/remote_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ async def setup_node(self, engines: PEngineRepository):
conn=conn,
run=self.run,
quote=self.quote,
engines=engines,
engines=engines.filter_platforms(self.platforms),
engines_dir=self.engines_dir,
log=self.log,
)
Expand Down
2 changes: 1 addition & 1 deletion yascheduler/remote_machine/remote_machine_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def filter(

checks: Sequence[Callable[[PRemoteMachine], bool]] = []
if busy is True:
checks.append(lambda x: x.meta.busy)
checks.append(lambda x: x.meta.busy is True)
if busy is False:
checks.append(lambda x: not x.meta.busy)
if platforms:
Expand Down
6 changes: 3 additions & 3 deletions yascheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ async def allocate_task(self, task: TaskModel) -> bool:
"Allocate task to a free remote machine or ask allocation of new cloud machine"
self.log.debug(f"Allocating task {task.task_id}")
engine_name: Optional[str] = task.metadata.get("engine", None)
if not engine_name or engine_name not in self.config.engines:
engine: Optional[Engine] = self.config.engines.get(engine_name)
if engine is None:
self.log.warning(
"Unsupported engine '%s' for task_id=%s" % (engine_name, task.task_id)
)
Expand All @@ -298,7 +299,6 @@ async def allocate_task(self, task: TaskModel) -> bool:
)
await self.do_task_webhook(task.task_id, task.metadata, TaskStatus.DONE)
return False
engine: Engine = self.config.engines[engine_name]

busy_node_ips = [
t.ip for t in await self.db.get_tasks_by_status((TaskStatus.RUNNING,))
Expand Down Expand Up @@ -518,7 +518,7 @@ async def task_consumer_consumer(
broken_tasks_passes = 20
task_id, task = msg.id, msg.payload
machine = self.remote_machines.get(task.ip)
if not machine:
if machine is None:
self.log.warning(f"Task {task_id} - machine {task.ip} is gone")
machine_not_found.update([task_id])
if machine_not_found[task_id] > broken_tasks_passes:
Expand Down

0 comments on commit 639b473

Please sign in to comment.