hydraflow 0.2.9__tar.gz → 0.2.10__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {hydraflow-0.2.9 → hydraflow-0.2.10}/PKG-INFO +1 -1
- {hydraflow-0.2.9 → hydraflow-0.2.10}/pyproject.toml +1 -1
- {hydraflow-0.2.9 → hydraflow-0.2.10}/src/hydraflow/progress.py +15 -26
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/scripts/progress.py +21 -28
- {hydraflow-0.2.9 → hydraflow-0.2.10}/.devcontainer/devcontainer.json +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/.devcontainer/postCreate.sh +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/.devcontainer/starship.toml +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/.gitattributes +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/.gitignore +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/LICENSE +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/README.md +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/src/hydraflow/__init__.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/src/hydraflow/asyncio.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/src/hydraflow/config.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/src/hydraflow/context.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/src/hydraflow/info.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/src/hydraflow/mlflow.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/src/hydraflow/run_collection.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/scripts/__init__.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/scripts/app.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/scripts/watch.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_app.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_asyncio.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_config.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_context.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_info.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_log_run.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_mlflow.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_progress.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_run_collection.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_version.py +0 -0
- {hydraflow-0.2.9 → hydraflow-0.2.10}/tests/test_watch.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: hydraflow
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.10
|
4
4
|
Summary: Hydraflow integrates Hydra and MLflow to manage and track machine learning experiments.
|
5
5
|
Project-URL: Documentation, https://github.com/daizutabi/hydraflow
|
6
6
|
Project-URL: Source, https://github.com/daizutabi/hydraflow
|
@@ -160,43 +160,32 @@ def multi_tasks_progress(
|
|
160
160
|
iterables = list(iterables)
|
161
161
|
|
162
162
|
with Progress(*columns, transient=transient or False, **kwargs) as progress:
|
163
|
-
|
164
|
-
|
165
|
-
task_main = progress.add_task(main_description, total=None) if n > 1 else None
|
166
|
-
tasks = [
|
167
|
-
progress.add_task(description.format(i), start=False, total=None)
|
168
|
-
for i in range(n)
|
169
|
-
]
|
170
|
-
|
163
|
+
task_main = progress.add_task(main_description, total=None)
|
171
164
|
total = {}
|
172
165
|
completed = {}
|
173
166
|
|
174
|
-
def func(i: int) -> None:
|
167
|
+
def func(i: int, iterable: Iterable[int | tuple[int, int]]) -> None:
|
168
|
+
task_id = progress.add_task(description.format(i), total=None)
|
175
169
|
completed[i] = 0
|
176
170
|
total[i] = None
|
177
|
-
progress.start_task(tasks[i])
|
178
171
|
|
179
|
-
for index in
|
172
|
+
for index in iterable:
|
180
173
|
if isinstance(index, tuple):
|
181
174
|
completed[i], total[i] = index[0] + 1, index[1]
|
182
175
|
else:
|
183
176
|
completed[i] = index + 1
|
184
177
|
|
185
|
-
progress.update(
|
186
|
-
if task_main is not None:
|
187
|
-
if all(t is not None for t in total.values()):
|
188
|
-
t = sum(total.values())
|
189
|
-
else:
|
190
|
-
t = None
|
191
|
-
c = sum(completed.values())
|
192
|
-
progress.update(task_main, total=t, completed=c)
|
178
|
+
progress.update(task_id, total=total[i], completed=completed[i])
|
193
179
|
|
194
|
-
|
195
|
-
|
180
|
+
if all(t is not None for t in total.values()):
|
181
|
+
t = sum(total.values())
|
182
|
+
else:
|
183
|
+
t = None
|
184
|
+
c = sum(completed.values())
|
185
|
+
progress.update(task_main, total=t, completed=c)
|
196
186
|
|
197
|
-
|
198
|
-
|
199
|
-
joblib.Parallel(n_jobs, prefer="threads")(it)
|
187
|
+
if transient is not False:
|
188
|
+
progress.remove_task(task_id)
|
200
189
|
|
201
|
-
|
202
|
-
|
190
|
+
it = (joblib.delayed(func)(i, it) for i, it in enumerate(iterables))
|
191
|
+
joblib.Parallel(n_jobs, prefer="threads")(it)
|
@@ -13,16 +13,7 @@ from rich.progress import (
|
|
13
13
|
from hydraflow import multi_tasks_progress, parallel_progress
|
14
14
|
|
15
15
|
|
16
|
-
def
|
17
|
-
for i in range(total or 90):
|
18
|
-
if total is None:
|
19
|
-
yield i
|
20
|
-
else:
|
21
|
-
yield i, total
|
22
|
-
time.sleep(random.random() / 30)
|
23
|
-
|
24
|
-
|
25
|
-
def parallel_progress_test():
|
16
|
+
def test_parallel_progress(**kwargs):
|
26
17
|
def func(x: int) -> str:
|
27
18
|
time.sleep(1)
|
28
19
|
return f"result: {x}"
|
@@ -36,14 +27,22 @@ def parallel_progress_test():
|
|
36
27
|
TimeElapsedColumn(),
|
37
28
|
]
|
38
29
|
|
39
|
-
|
40
|
-
|
30
|
+
parallel_progress(func, it, *columns, n_jobs=-1, **kwargs)
|
31
|
+
|
32
|
+
|
33
|
+
def task(total):
|
34
|
+
for i in range(total or 90):
|
35
|
+
if total is None:
|
36
|
+
yield i
|
37
|
+
else:
|
38
|
+
yield i, total
|
39
|
+
time.sleep(random.random() / 30)
|
41
40
|
|
42
41
|
|
43
|
-
def
|
44
|
-
tasks =
|
45
|
-
if
|
46
|
-
tasks =
|
42
|
+
def test_multi_tasks_progress(total: bool, **kwargs):
|
43
|
+
tasks = (task(random.randint(80, 100)) for _ in range(4))
|
44
|
+
if total:
|
45
|
+
tasks = (task(None), *list(tasks)[:2], task(None))
|
47
46
|
|
48
47
|
columns = [
|
49
48
|
SpinnerColumn(),
|
@@ -52,21 +51,15 @@ def multi_tasks_progress_test(unknown_total: bool):
|
|
52
51
|
TimeElapsedColumn(),
|
53
52
|
]
|
54
53
|
|
55
|
-
|
56
|
-
if unknown_total:
|
54
|
+
if total:
|
57
55
|
kwargs["main_description"] = "unknown"
|
58
56
|
|
59
57
|
multi_tasks_progress(tasks, *columns, n_jobs=4, **kwargs)
|
60
58
|
|
61
59
|
|
62
60
|
if __name__ == "__main__":
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
multi_tasks_progress([task(None)], description="unknown")
|
69
|
-
|
70
|
-
desc = "transient"
|
71
|
-
multi_tasks_progress([task(100), task(None)], main_description=desc, transient=True)
|
72
|
-
multi_tasks_progress([task(100)], description=desc, transient=True)
|
61
|
+
test_parallel_progress(description="parallel")
|
62
|
+
test_parallel_progress(transient=True)
|
63
|
+
test_multi_tasks_progress(False)
|
64
|
+
test_multi_tasks_progress(True, transient=False)
|
65
|
+
test_multi_tasks_progress(False, transient=True)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|