Skip to content

Commit

Permalink
fix: Revert breaking changes to execution progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
b-butler committed Aug 28, 2023
1 parent 65825bd commit 8f3cead
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions flow/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -3300,7 +3300,7 @@ def _op_submission_summary(counter):
print("\n" + "\n".join(profiling_results), file=file)

def _run_operations(
self, operations, pretend=False, np=None, timeout=None, hide_progress=True
self, operations, pretend=False, np=None, timeout=None, progress=True
):
"""Execute the next operations as specified by the project's workflow.
Expand All @@ -3321,16 +3321,16 @@ def _run_operations(
An optional timeout for each operation in seconds after which
execution will be cancelled. Use None to indicate no timeout
(Default value = None).
hide_progress : bool
Hides progress bar when printing status output (Default value = True).
progress : bool
Show a progress bar during execution (Default value = False).
"""
if timeout is not None and timeout < 0:
timeout = None
operations = list(operations) # ensure list

if np is None or np == 1 or pretend:
if not hide_progress:
if progress:
operations = tqdm(operations)
for operation in operations:
self._execute_operation(operation, timeout, pretend)
Expand All @@ -3342,7 +3342,7 @@ def _run_operations(
)
try:
self._run_operations_in_parallel(
pool, operations, hide_progress, timeout
pool, operations, progress, timeout
)
except self._PickleError as error:
raise RuntimeError(
Expand Down Expand Up @@ -3370,7 +3370,7 @@ def _job_operation_from_tuple(self, data):
id, name, jobs, cmd, directives, directives._keys_set_by_user
)

def _run_operations_in_parallel(self, pool, operations, hide_progress, timeout):
def _run_operations_in_parallel(self, pool, operations, progress, timeout):
"""Execute operations in parallel.
This function executes the given list of operations with the provided
Expand All @@ -3386,8 +3386,8 @@ def _run_operations_in_parallel(self, pool, operations, hide_progress, timeout):
Process pool.
operations : Sequence of instances of :class:`_JobOperation`
The operations to execute.
hide_progress : bool
Hides progress bar when printing status output (Default value = True).
progress : bool
Show a progress bar during execution.
timeout : float
A timeout for each operation in seconds after which
execution will be cancelled. Use None to indicate no timeout
Expand Down Expand Up @@ -3415,7 +3415,7 @@ def _run_operations_in_parallel(self, pool, operations, hide_progress, timeout):
pool.apply_async(_deserialize_and_run_operation, task)
for task in serialized_tasks
]
if not hide_progress:
if progress:
results = tqdm(results)
for result in results:
result.get(timeout=timeout)
Expand Down Expand Up @@ -3522,7 +3522,7 @@ def run(
timeout=None,
num=None,
num_passes=1,
hide_progress=True,
progress=False,
order=None,
ignore_conditions=IgnoreConditions.NONE,
):
Expand Down Expand Up @@ -3565,8 +3565,8 @@ def run(
The total number of executions of one specific job-operation pair
will not exceed this argument. The default is 1, there is no limit
if this argument is None.
hide_progress : bool
Hides progress bar when printing status output (Default value = True).
progress : bool
Show a progress bar during execution (Default value = False).
order : str, callable, or None
Specify the order of operations. Possible values are:
Expand Down Expand Up @@ -3753,7 +3753,7 @@ def key_func_by_job(operation):
pretend=pretend,
np=np,
timeout=timeout,
hide_progress=hide_progress,
progress=progress,
)

def _gather_flow_groups(self, names=None):
Expand Down Expand Up @@ -4858,7 +4858,7 @@ def _main_run(self, args):
timeout=args.timeout,
num=args.num,
num_passes=args.num_passes,
hide_progress=args.hide_progress,
progress=args.progress,
order=args.order,
ignore_conditions=args.ignore_conditions,
)
Expand Down Expand Up @@ -5050,9 +5050,9 @@ class MyProject(FlowProject):
help="Do not actually execute commands, just show them.",
)
execution_group.add_argument(
"--hide_progress",
action="store_false",
help="Hide the progress bar during execution.",
"--progress",
action="store_true",
help="Display a progress bar during execution.",
)
execution_group.add_argument(
"--num-passes",
Expand Down

0 comments on commit 8f3cead

Please sign in to comment.