cook-build 0.7.0__py3-none-any.whl → 0.7.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cook/actions.py +4 -1
- cook/contexts.py +1 -1
- cook/controller.py +12 -14
- cook/manager.py +1 -1
- cook/task.py +4 -4
- {cook_build-0.7.0.dist-info → cook_build-0.7.2.dist-info}/METADATA +1 -1
- cook_build-0.7.2.dist-info/RECORD +14 -0
- {cook_build-0.7.0.dist-info → cook_build-0.7.2.dist-info}/WHEEL +1 -1
- cook_build-0.7.0.dist-info/RECORD +0 -14
- {cook_build-0.7.0.dist-info → cook_build-0.7.2.dist-info}/entry_points.txt +0 -0
- {cook_build-0.7.0.dist-info → cook_build-0.7.2.dist-info}/licenses/LICENSE +0 -0
- {cook_build-0.7.0.dist-info → cook_build-0.7.2.dist-info}/top_level.txt +0 -0
cook/actions.py
CHANGED
|
@@ -36,6 +36,7 @@ executor with a deprecation warning.
|
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
38
|
import asyncio
|
|
39
|
+
import functools
|
|
39
40
|
import hashlib
|
|
40
41
|
import logging
|
|
41
42
|
import os
|
|
@@ -94,7 +95,9 @@ class FunctionAction(Action):
|
|
|
94
95
|
else:
|
|
95
96
|
# Run sync function in executor
|
|
96
97
|
loop = asyncio.get_running_loop()
|
|
97
|
-
await loop.run_in_executor(
|
|
98
|
+
await loop.run_in_executor(
|
|
99
|
+
None, functools.partial(self.func, task, *self.args, **self.kwargs)
|
|
100
|
+
)
|
|
98
101
|
|
|
99
102
|
|
|
100
103
|
class SubprocessAction(Action):
|
cook/contexts.py
CHANGED
|
@@ -152,7 +152,7 @@ class create_target_directories(Context):
|
|
|
152
152
|
create = self.manager.create_task(
|
|
153
153
|
name,
|
|
154
154
|
action=actions.FunctionAction(
|
|
155
|
-
lambda _
|
|
155
|
+
lambda _, p=target.parent: p.mkdir(parents=True, exist_ok=True)
|
|
156
156
|
),
|
|
157
157
|
)
|
|
158
158
|
task.task_dependencies.append(create)
|
cook/controller.py
CHANGED
|
@@ -290,8 +290,8 @@ class Controller:
|
|
|
290
290
|
dep_futures = [task_futures[dep] for dep in dep_tasks]
|
|
291
291
|
await asyncio.gather(*dep_futures)
|
|
292
292
|
|
|
293
|
-
start = datetime.now()
|
|
294
293
|
digest = self._evaluate_task_hexdigest(task)
|
|
294
|
+
start: datetime | None = None
|
|
295
295
|
|
|
296
296
|
try:
|
|
297
297
|
# Log what we're doing
|
|
@@ -307,22 +307,19 @@ class Controller:
|
|
|
307
307
|
" action: %s",
|
|
308
308
|
task.action,
|
|
309
309
|
)
|
|
310
|
-
else:
|
|
311
|
-
LOGGER.log(
|
|
312
|
-
logging.DEBUG if task.name.startswith("_") else logging.INFO,
|
|
313
|
-
"executing %s ...",
|
|
314
|
-
task,
|
|
315
|
-
)
|
|
316
|
-
|
|
317
|
-
# Update DB for start
|
|
318
|
-
if not dry_run:
|
|
319
|
-
params = {"name": task.name, "last_started": start}
|
|
320
|
-
self.connection.execute(QUERIES["upsert_task_started"], params)
|
|
321
|
-
self.connection.commit()
|
|
322
310
|
|
|
323
311
|
# Execute the task
|
|
324
312
|
if not dry_run:
|
|
325
313
|
async with semaphore:
|
|
314
|
+
start = datetime.now()
|
|
315
|
+
LOGGER.log(
|
|
316
|
+
logging.DEBUG if task.name.startswith("_") else logging.INFO,
|
|
317
|
+
"executing %s ...",
|
|
318
|
+
task,
|
|
319
|
+
)
|
|
320
|
+
params = {"name": task.name, "last_started": start}
|
|
321
|
+
self.connection.execute(QUERIES["upsert_task_started"], params)
|
|
322
|
+
self.connection.commit()
|
|
326
323
|
await task.execute()
|
|
327
324
|
|
|
328
325
|
# Check that all targets were created
|
|
@@ -344,6 +341,7 @@ class Controller:
|
|
|
344
341
|
self.connection.commit()
|
|
345
342
|
|
|
346
343
|
# Log completion
|
|
344
|
+
assert start is not None
|
|
347
345
|
delta = util.format_timedelta(datetime.now() - start)
|
|
348
346
|
LOGGER.log(
|
|
349
347
|
logging.DEBUG if task.name.startswith("_") else logging.INFO,
|
|
@@ -362,7 +360,7 @@ class Controller:
|
|
|
362
360
|
self.connection.execute(QUERIES["upsert_task_failed"], params)
|
|
363
361
|
self.connection.commit()
|
|
364
362
|
|
|
365
|
-
delta = util.format_timedelta(datetime.now() - start)
|
|
363
|
+
delta = util.format_timedelta(datetime.now() - start) if start else "?"
|
|
366
364
|
LOGGER.exception("failed to execute %s after %s", task, delta)
|
|
367
365
|
raise util.FailedTaskError(ex, task=task) from ex
|
|
368
366
|
|
cook/manager.py
CHANGED
|
@@ -150,7 +150,7 @@ def create_task(
|
|
|
150
150
|
|
|
151
151
|
Args:
|
|
152
152
|
name: Name of the new task. Defaults to the string representation of the first
|
|
153
|
-
|
|
153
|
+
target if not provided.
|
|
154
154
|
action: Action to execute or a string for shell commands.
|
|
155
155
|
targets: Paths for files to be generated.
|
|
156
156
|
dependencies: Paths to files on which this task depends.
|
cook/task.py
CHANGED
|
@@ -34,12 +34,12 @@ class Task:
|
|
|
34
34
|
location: tuple[str, int] | None = None,
|
|
35
35
|
) -> None:
|
|
36
36
|
self.dependencies = dependencies or []
|
|
37
|
+
self.targets = [Path(path) for path in (targets or [])]
|
|
37
38
|
if name is None:
|
|
38
|
-
if not self.
|
|
39
|
-
raise ValueError("name is required if there are no
|
|
40
|
-
name = str(self.
|
|
39
|
+
if not self.targets:
|
|
40
|
+
raise ValueError("'name' is required if there are no targets.")
|
|
41
|
+
name = str(self.targets[0])
|
|
41
42
|
self.name = name
|
|
42
|
-
self.targets = [Path(path) for path in (targets or [])]
|
|
43
43
|
self.action = action
|
|
44
44
|
self.task_dependencies = task_dependencies or []
|
|
45
45
|
self.location = location or util.get_location()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
cook/__init__.py,sha256=SCa9_i6B84IzSAwq0wnSQqvycyL4dvTO7dRIysJXZj4,179
|
|
2
|
+
cook/__main__.py,sha256=4sO22TsNTt3oirT71dJjZJwmynsRyUGT-CHJNlDgCkk,13242
|
|
3
|
+
cook/actions.py,sha256=jHAsj0NzPGeLam9GmFF_mb-tLdHLIIVXWD8XCppU33I,7465
|
|
4
|
+
cook/contexts.py,sha256=-L4o_b_XPNZ_MBuYAgR1LYbptWPankDyj-00Pji7EVg,10710
|
|
5
|
+
cook/controller.py,sha256=-6KhAMYJn15szTRLR49PO9LFly0sqjHusOpoOutqIIY,13486
|
|
6
|
+
cook/manager.py,sha256=dk-erHToyl89Xlq6risgYc9hkVVg2AZZKxui-5QPKF8,6237
|
|
7
|
+
cook/task.py,sha256=-LNMwHdFlTUG45DF_QyWlIHw55_n_u2Xf5beKB7LrdY,2308
|
|
8
|
+
cook/util.py,sha256=15MMG07CYZZ-YdFE_2jzRRTaqHMsw83UFg0s7e72MhI,2435
|
|
9
|
+
cook_build-0.7.2.dist-info/licenses/LICENSE,sha256=3Nuj_WTTcz7JDg4-9EzNf6vHlKRWpdLUccg-pvoZ3WE,1500
|
|
10
|
+
cook_build-0.7.2.dist-info/METADATA,sha256=Ok39Muj7dI2nL1SEwOPXd0gxzsn5iYLw0BPbKeKMuq0,4586
|
|
11
|
+
cook_build-0.7.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
+
cook_build-0.7.2.dist-info/entry_points.txt,sha256=5UP0ZmmxSNKevTVISUJxmdXEQsKrI4n54OQYkjrdX2c,48
|
|
13
|
+
cook_build-0.7.2.dist-info/top_level.txt,sha256=ewNQIn2oRSYV98vAsUnw88u2Q8XHKhAz70ed2PEdR2c,5
|
|
14
|
+
cook_build-0.7.2.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
cook/__init__.py,sha256=SCa9_i6B84IzSAwq0wnSQqvycyL4dvTO7dRIysJXZj4,179
|
|
2
|
-
cook/__main__.py,sha256=4sO22TsNTt3oirT71dJjZJwmynsRyUGT-CHJNlDgCkk,13242
|
|
3
|
-
cook/actions.py,sha256=1VLyWL-pACuWpAjIyNWPBeu6wlKkoqi6t3lHr6hV0EQ,7399
|
|
4
|
-
cook/contexts.py,sha256=AMKO7Uz-nI52OsdPQ_zCLXjOf77V4pgzvDyj6-N8Ods,10705
|
|
5
|
-
cook/controller.py,sha256=vpF3QhiM3HImaI0rHJ58T8i5AQi5_P4Z2p42qFvG1po,13426
|
|
6
|
-
cook/manager.py,sha256=Y-QGVw9x8ZpSBMRALJIHgcMmIZulAV9KxwtBJz35Gpw,6241
|
|
7
|
-
cook/task.py,sha256=2UsXJiPe7htnlFqAKYm3Ot3bz9jXGHm3qfeqh6l5alM,2320
|
|
8
|
-
cook/util.py,sha256=15MMG07CYZZ-YdFE_2jzRRTaqHMsw83UFg0s7e72MhI,2435
|
|
9
|
-
cook_build-0.7.0.dist-info/licenses/LICENSE,sha256=3Nuj_WTTcz7JDg4-9EzNf6vHlKRWpdLUccg-pvoZ3WE,1500
|
|
10
|
-
cook_build-0.7.0.dist-info/METADATA,sha256=j_WuF101Muusbbdrw_w8lv-pB_p0bEJbBuUZLUh8V30,4586
|
|
11
|
-
cook_build-0.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
-
cook_build-0.7.0.dist-info/entry_points.txt,sha256=5UP0ZmmxSNKevTVISUJxmdXEQsKrI4n54OQYkjrdX2c,48
|
|
13
|
-
cook_build-0.7.0.dist-info/top_level.txt,sha256=ewNQIn2oRSYV98vAsUnw88u2Q8XHKhAz70ed2PEdR2c,5
|
|
14
|
-
cook_build-0.7.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|