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

fix: remove extra call to setup_logger() #2809

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions snakemake/api.py
Expand Up @@ -523,12 +523,6 @@ def execute_workflow(
"For local execution, --shared-fs-usage has to be unrestricted."
)

self.snakemake_api.setup_logger(
stdout=executor_plugin.common_settings.dryrun_exec,
mode=self.workflow_api.workflow_settings.exec_mode,
dryrun=executor_plugin.common_settings.dryrun_exec,
)
Comment on lines -526 to -530
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason for this extra call is that with calling execute, the dryrun info might be new, as well as the exec mode. One could of course offer a method to just update these in the logger api.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I'm not sure I follow. It seems setup logger is called here

self.setup_logger(mode=workflow_settings.exec_mode)

How can the the info be new by time execute is called? Regardless, I think you're right, we can provide setters for these in the logger

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could we just do this instead of calling setup_logger()?

Suggested change
self.snakemake_api.setup_logger(
stdout=executor_plugin.common_settings.dryrun_exec,
mode=self.workflow_api.workflow_settings.exec_mode,
dryrun=executor_plugin.common_settings.dryrun_exec,
)
logger.stdout = executor_plugin.common_settings.dryrun_exec
logger.mode = self.workflow_api.workflow_settings.exec_mode
logger.dryrun = executor_plugin.common_settings.dryrun_exec


if executor_plugin.common_settings.local_exec:
if (
not executor_plugin.common_settings.dryrun_exec
Expand Down