Fail for unsatisfiable resources before confirmation

Fixes #23
This commit is contained in:
Olivier 'reivilibre' 2021-07-03 11:21:56 +01:00
parent 0560a16b73
commit a092200840
2 changed files with 7 additions and 32 deletions

View File

@ -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:

View File

@ -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):