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

Executor-specific logging #17

Open
vsoch opened this issue May 22, 2020 · 4 comments
Open

Executor-specific logging #17

vsoch opened this issue May 22, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@vsoch
Copy link
Owner

vsoch commented May 22, 2020

I suspect that when more executors are added, it might be useful to have executor-specific logging. I'm going to wait until someone explicitly asks for it, however.

@yarikoptic
Copy link
Contributor

I would not bother too much about it ATM besides giving them dedicated logger/level, e.g. qme.executors.<name> (so you get logger by logging.getLogger(f"qme.executors.{name}") or alike). Then a dedicated formatter etc could be configured for any such specific logger and by default just follow its parent(s) (i.e. "qme.executors" and if that not custom "qme")

@vsoch
Copy link
Owner Author

vsoch commented May 29, 2020

Well, the actual logger is a custom logger I made years ago for singularity - not default python logging. We could switch to default python logging but then it would be an overhaul of my current logger (e.g. bot.<level>()

@yarikoptic
Copy link
Contributor

oh, I saw

$> git grep logging -- qme
qme/app/server.py:import logging
qme/app/server.py:    file_handler = logging.FileHandler(os.path.join(queue.config_dir, "dashboard.log"))
qme/app/server.py:    formatter = logging.Formatter(
qme/app/server.py:    app.logger.setLevel(logging.DEBUG)
qme/logger/message.py:        self.level = get_logging_level()
qme/logger/message.py:def get_logging_level():
qme/logger/message.py:    """get_logging_level will configure a logging to standard out based on
qme/logger/message.py:    # User knows logging levels and set one
qme/logger/progress.py:        # Only show bar in terminals by default (better for piping, logging etc.)

and I thought it was the default one, but indeed seems to be used only in app.server?.

I could only strongly encourage use of standard logger, especially for library projects. It allows to unify logging for downstream applications by e.g. reusing application logger backends etc. We do that in a few spots in datalad - then it becomes quite nice when needed to debug while retaining consistent logging across all used components etc. Should be quite straightforward since likely interface and levels are probably aligned, e.g. seeing

qme/app/views/main.py:    app.logger.debug("Received deletion request for %s" % json.get("taskid"))
qme/app/views/main.py:    app.logger.debug("Received re-run request for %s" % json.get("taskid"))
qme/app/views/main.py:    app.logger.debug("Client connected")
qme/app/views/main.py:    app.logger.debug("Starting Thread")
qme/app/views/main.py:    app.logger.debug("Client disconnected")

probably nothing but replacing .logger object with a standard logger would strictly be needed (although as I had mentioned elsewhere string interpolations could then be delayed and arguments to them passed as arguments to .debug(msg, ...)

@vsoch
Copy link
Owner Author

vsoch commented May 30, 2020

Yeah I have to agree with you here - I’ll want to preserve the bot.table function and just put it somewhere else.

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

No branches or pull requests

2 participants