hydraflow 0.2.9__py3-none-any.whl → 0.2.10__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.
hydraflow/progress.py CHANGED
@@ -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
- n = len(iterables)
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 iterables[i]:
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(tasks[i], total=total[i], completed=completed[i])
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
- if transient or n > 1:
195
- progress.remove_task(tasks[i])
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
- if n > 1:
198
- it = (joblib.delayed(func)(i) for i in range(n))
199
- joblib.Parallel(n_jobs, prefer="threads")(it)
187
+ if transient is not False:
188
+ progress.remove_task(task_id)
200
189
 
201
- else:
202
- func(0)
190
+ it = (joblib.delayed(func)(i, it) for i, it in enumerate(iterables))
191
+ joblib.Parallel(n_jobs, prefer="threads")(it)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hydraflow
3
- Version: 0.2.9
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
@@ -4,9 +4,9 @@ hydraflow/config.py,sha256=6TCKNQZ3sSrIEvl245T2udwFuknejyN1dMcIVmOHdrQ,2102
4
4
  hydraflow/context.py,sha256=G7JMrG70sgBH2qILXl5nkGWNUoRggj518JWUq0ZiJ9E,7776
5
5
  hydraflow/info.py,sha256=Vj2sT66Ric63mmaq7Yu8nDFhsGQYO3MCHrxFpapDufc,3458
6
6
  hydraflow/mlflow.py,sha256=Q8RGijSURTjRkEDxzi_2Tk9KOx3QK__al5aArGQriHA,7249
7
- hydraflow/progress.py,sha256=UIIKlweji3L0uRi4hZ_DrtRcnayHPlsMoug7hVEKq8k,6753
7
+ hydraflow/progress.py,sha256=hinjOnz29DJj7HskW21XyrkheaWtScj7th0MYFCQIbM,6537
8
8
  hydraflow/run_collection.py,sha256=V5lGdGHYgsSpBOYGaVEL1mpKJvdiEshBL0KmmZ8qeZo,29161
9
- hydraflow-0.2.9.dist-info/METADATA,sha256=ZjJQz_4MogGkcs16dOwnsp_J0icg9ypgQdXOYxVdxJg,4181
10
- hydraflow-0.2.9.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
11
- hydraflow-0.2.9.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
12
- hydraflow-0.2.9.dist-info/RECORD,,
9
+ hydraflow-0.2.10.dist-info/METADATA,sha256=dyQTcKSv2A0sKgEqSWXpkFYN9HA-0tFhRF5qXjaVMS0,4182
10
+ hydraflow-0.2.10.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
11
+ hydraflow-0.2.10.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
12
+ hydraflow-0.2.10.dist-info/RECORD,,