Skip to content

Commit

Permalink
suppress plotting for single pipeline call
Browse files Browse the repository at this point in the history
  • Loading branch information
skim0119 committed Jun 30, 2023
1 parent 4ff6c42 commit 1e3312a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions miv/core/operator/chainable.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class BaseChainingMixin:

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.pipeline_called = False
self._downstream_list: list[_Chainable] = []
self._upstream_list: list[_Chainable] = []

Expand Down
2 changes: 1 addition & 1 deletion miv/core/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,5 @@ def run(
self._execute()
cache_called = self.cacher.cache_called
# TODO
if not skip_plot and not cache_called:
if not skip_plot and not cache_called and not self.pipeline_called:
self.plot(show=False, save_path=True, dry_run=dry_run)
12 changes: 11 additions & 1 deletion miv/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ def run(
print("Running: ", node)
if hasattr(node, "cacher"):
node.cacher.cache_policy = "OFF" if no_cache else "AUTO"
node.run(dry_run=dry_run, save_path=working_directory, skip_plot=skip_plot)

# in case of error, add message
try:
node.pipeline_called = False
node.run(
dry_run=dry_run, save_path=working_directory, skip_plot=skip_plot
)
node.pipeline_called = True
except Exception as e:
raise Exception(f'Error while running the operator "{node.tag}"') from e

if verbose:
print(f"Finished: {time.time() - stime:.03f} sec")
if verbose:
Expand Down

0 comments on commit 1e3312a

Please sign in to comment.