diff --git a/scone/head/cli/__init__.py b/scone/head/cli/__init__.py index a128a7a..b58f230 100644 --- a/scone/head/cli/__init__.py +++ b/scone/head/cli/__init__.py @@ -111,22 +111,8 @@ async def cli_async() -> int: os.path.join(head.directory, "depcache.sqlite3") ) - # eprint("Checking dependency cacheā€¦") - # start_ts = time.monotonic() - # depchecks = await run_dep_checks(head, dep_cache, order) - # end_ts = time.monotonic() - # eprint(f"Checking finished in {end_ts - start_ts:.3f} s.") # TODO show counts - # - # for epoch, items in enumerate(order): - # print(f"----- Course {epoch} -----") - # - # for item in items: - # if isinstance(item, Recipe): - # state = depchecks[item].label.name - # print(f" > recipe ({state}) {item}") - # elif isinstance(item, tuple): - # kind, ident, extra = item - # print(f" - we now have {kind} {ident} {dict(extra)}") + kitchen = Kitchen(head, dep_cache) + await kitchen.prepare_to_cook() eprint("Ready to cook? [y/N]: ", end="") if argp.yes: @@ -136,17 +122,6 @@ async def cli_async() -> int: eprint("Stopping.") return 101 - kitchen = Kitchen(head, dep_cache) - - # for epoch, epoch_items in enumerate(order): - # print(f"Cooking Course {epoch} of {len(order)}") - # await kitchen.run_epoch( - # epoch_items, depchecks, concurrency_limit_per_host=8 - # ) - # - # for sous in hosts: TODO this is not definitely safe - # await dep_cache.sweep_old(sous) - try: await kitchen.cook_all() finally: diff --git a/scone/head/kitchen.py b/scone/head/kitchen.py index 771d905..74e491f 100644 --- a/scone/head/kitchen.py +++ b/scone/head/kitchen.py @@ -173,13 +173,9 @@ class Kitchen: return await self._chanproheads[hostuser] - async def cook_all(self): + async def prepare_to_cook(self): await self._emit_fridge_resources() - num_workers = 8 - - self._sleeper_slots = num_workers - 1 - for vertex in self.head.dag.vertices: if isinstance(vertex, Recipe): rec_meta = self.head.dag.recipe_meta[vertex] @@ -201,6 +197,10 @@ class Kitchen: ) self._cookable.put_nowait(vertex) + async def cook_all(self): + num_workers = 8 + self._sleeper_slots = num_workers - 1 + workers = [] workers_routines = [] for _ in range(num_workers):