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 central scheduler logging to be configured based on the logging… #1633

Merged
merged 4 commits into from
Apr 7, 2016
Merged

Allow central scheduler logging to be configured based on the logging… #1633

merged 4 commits into from
Apr 7, 2016

Conversation

brianestlin
Copy link
Contributor

….conf file specified in luigi.cfg.

Although the luigi configuration file has an option to specify a logging conf file, this option currently only applies to the workers, not the central scheduler, which AFAICT ignores any logging configuration and starts up with a basic configuration. I poked around and didn't see any way to configure the central scheduler's logging other than hacking on its entry point; hence this PR.

@dlstadther
Copy link
Collaborator

What is it that the central scheduler could log that you want to see? (mainly just curious and uninformed)

+ tests? https://github.com/spotify/luigi/blob/master/test/cmdline_test.py

@Tarrasch
Copy link
Contributor

Tarrasch commented Apr 6, 2016

Haha, I just needed this last Monday! I got surprised nobody had sent a PR yet. You're two days late! :D

logging_conf = config.get('core', 'logging_conf_file', None)
if logging_conf is not None and not os.path.exists(logging_conf):
logging_conf = None
if logging_conf is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

This code block can be simplified I think. Why first logging_conf = None and then if logging_conf is not None. Just introduce the variable in the code path that you use it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Since L47-L49 may not execute, the variable logging_conf needs to be defined as something in order to check if it is not None (L50), right? (thus why the variable declaration at L45). At least, that's how i'm thinking through it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Eh.. Yea.

Actually I think the server should just plain out die and not start if the condition logging_conf is not None and not os.path.exists(logging_conf) holds true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to raise exception if the logging conf file is missing.

@Tarrasch
Copy link
Contributor

Tarrasch commented Apr 6, 2016

Also, can you please also add print() statements saying "Loading logging conf from file" or "Defaulting to only logging to stdout. You're highly advised to setup logging"? Something like that.

@brianestlin
Copy link
Contributor Author

@dlstadther "What is it that the central scheduler could log that you want to see?"
This came up for me recently when I wanted to turn on SQLAlchemy logging of the database statements made to the task history database.

@brianestlin
Copy link
Contributor Author

Added unit tests and print statements. PTAL. Also let me know if you want me to squash the commits.

@Tarrasch
Copy link
Contributor

Tarrasch commented Apr 6, 2016

Looks good to me. I will squash-accept this PR so no need to merge commits.

@Tarrasch Tarrasch merged commit df4d3a4 into spotify:master Apr 7, 2016
Tarrasch added a commit to Tarrasch/luigi that referenced this pull request Apr 7, 2016
I think it makes sense to log less, because currently I think INFO level
should not be verbose. In particular "No workers connected" message is
verbose and going to be said many more times than it will be actually
removed (when used with assistants).

Further, I think now is a sane time to change the name of the logger to
the "recommended" `getLogger(__name__)` style. Because PR
spotify#1633 was just merged and it's less likely that people have
relied on the logger name prior to that.
Tarrasch added a commit that referenced this pull request Apr 11, 2016
I think it makes sense to log less, because currently I think INFO level
should not be verbose. In particular "No workers connected" message is
verbose and going to be said many more times than it will be actually
removed (when used with assistants).

Further, I think now is a sane time to change the name of the logger to
the "recommended" `getLogger(__name__)` style. Because PR
#1633 was just merged and it's less likely that people have
relied on the logger name prior to that.
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.

3 participants