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 2 commits into
base: main
Choose a base branch
from

Conversation

cademirch
Copy link
Contributor

Description

Removes seemingly extra call to setup_logger() in api, see #2797 for details.

Still not super familiar with API changes, so @johanneskoester please advise.

QC

  • The PR contains a test case for the changes or the changes are already covered by an existing test case.
  • The documentation (docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).

@cademirch cademirch changed the title remove extra call to setup_logger() fix: remove extra call to setup_logger() Apr 13, 2024
@cademirch
Copy link
Contributor Author

@johanneskoester could you take a look at this when you get a chance? Would be good to get this fixed before moving forward with monitoring plugin.

Comment on lines -526 to -530
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,
)
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

Copy link

sonarcloud bot commented Apr 28, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants