Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow output to be hidden in nbrun() #1864

Merged
merged 1 commit into from
May 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions metaflow/runner/nbrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class NBRunner(object):
def __init__(
self,
flow,
show_output: bool = False,
show_output: bool = True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the self.runner is used in other places too such as run, resume, async_run and async_resume -- and the default way here should be to suppress outputs.

It is only for nbrun and nbresume methods that we want to show outputs by default.

Setting the default value to True will make it show for the run, resume, async_run and async_resume methods as well, which we don't want..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to show output by default for run and resume. For async_ calls, show_output doesn't have any effect, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, show output should have no effect on async_

profile: Optional[str] = None,
env: Optional[Dict] = None,
base_dir: str = DEFAULT_DIR,
Expand Down Expand Up @@ -93,18 +93,12 @@ def __init__(
)

def nbrun(self, **kwargs):
self.old_val_show_output = self.show_output
self.runner.show_output = True
result = self.runner.run(**kwargs)
self.runner.show_output = self.old_val_show_output
self.runner.spm.cleanup()
return result.run

def nbresume(self, **kwargs):
self.old_val_show_output = self.show_output
self.runner.show_output = True
result = self.runner.resume(**kwargs)
self.runner.show_output = self.old_val_show_output
self.runner.spm.cleanup()
return result.run

Expand Down
Loading