-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix log level in conda/core/prefix_data.py #9998
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
Conversation
Also, $ git grep log.trace
conda/base/context.py: log.trace("Tried envs_dir but not writable: %s", envs_dir)
conda/common/_logic.py: log.trace('Eliminating %d/%d terms for bound violation' % (nprune, nterms))
conda/common/_logic.py: log.trace('Beginning peak minimization')
conda/common/_logic.py: log.trace('Beginning sum minimization')
conda/common/_logic.py: log.trace("Initial range (%d,%d)" % (lo, hi))
conda/common/_logic.py: log.trace('Bisection attempt: (%d,%d), (%d+%d) clauses' %
conda/common/_logic.py: log.trace("Bisection failure, new range=(%d,%d)" % (lo, hi))
conda/common/_logic.py: log.trace("Bisection success, new range=(%d,%d)" % (lo, hi))
conda/core/package_cache_data.py: log.trace("package cache directory '%s' does not exist", self.pkgs_dir)
conda/core/package_cache_data.py: log.trace("adding to package cache %s", package_tarball_full_path)
conda/core/path_actions.py: log.trace("linking %s => %s", self.source_full_path, self.target_full_path)
conda/core/path_actions.py: log.trace("reversing link creation %s", self.target_prefix)
conda/core/path_actions.py: log.trace("ignoring prefix update for symlink with source path %s",
conda/core/path_actions.py: log.trace("copying %s => %s", self.source_full_path, self.intermediate_path)
conda/core/path_actions.py: log.trace("rewriting prefixes in %s", self.target_full_path)
conda/core/path_actions.py: log.trace("linking %s => %s", source_path, self.target_full_path)
conda/core/path_actions.py: log.trace("making menu for %s", self.target_full_path)
conda/core/path_actions.py: log.trace("removing menu for %s", self.target_full_path)
conda/core/path_actions.py: log.trace("touching nonadmin %s", self.target_full_path)
conda/core/path_actions.py: log.trace("removing nonadmin file %s", self.target_full_path)
conda/core/path_actions.py: log.trace("compiling %s", ' '.join(self.target_full_paths))
conda/core/path_actions.py: log.trace("reversing pyc creation %s", ' '.join(self.target_full_paths))
conda/core/path_actions.py: log.trace("creating python entry point %s", self.target_full_path)
conda/core/path_actions.py: log.trace("reversing python entry point creation %s", self.target_full_path)
conda/core/path_actions.py:# log.trace("creating application entry point %s => %s",
conda/core/path_actions.py:# log.trace("creating application softlink via %s %s => %s",
conda/core/path_actions.py:# log.trace('%r', e)
conda/core/path_actions.py: log.trace("creating linked package record %s", self.target_full_path)
conda/core/path_actions.py: log.trace("reversing linked package record creation %s", self.target_full_path)
conda/core/path_actions.py: log.trace("updating environment history %s", self.target_full_path)
conda/core/path_actions.py: log.trace("moving %s => %s", self.hold_path, self.target_full_path)
conda/core/path_actions.py: log.trace("registering environment in catalog %s", self.target_prefix)
conda/core/path_actions.py: log.trace("renaming %s => %s", self.target_short_path, self.holding_short_path)
conda/core/path_actions.py: log.trace("reversing rename %s => %s", self.holding_short_path, self.target_short_path)
conda/core/path_actions.py: log.trace("removing menu for %s ", self.target_prefix)
conda/core/path_actions.py: log.trace("re-creating menu for %s ", self.target_prefix)
conda/core/path_actions.py: log.trace("unregistering environment in catalog %s", self.target_prefix)
conda/core/path_actions.py: log.trace("caching url %s => %s", self.url, self.target_full_path)
conda/core/path_actions.py: log.trace("moving %s => %s", self.hold_path, self.target_full_path)
conda/core/path_actions.py: log.trace("extracting %s => %s", self.source_full_path, self.target_full_path)
conda/core/path_actions.py: log.trace("moving %s => %s", self.hold_path, self.target_full_path)
conda/core/solve.py: log.trace("using PrefixGraph to remove records for %s", spec)
conda/gateways/disk/__init__.py: log.trace("retrying %s/%s %s() in %g sec",
conda/gateways/disk/__init__.py: log.trace(repr(e))
conda/gateways/disk/__init__.py: log.trace('making directory %s', path)
conda/gateways/disk/__init__.py: log.trace('making directory %s', path)
conda/gateways/disk/__init__.py: # log.trace("chowning %s:%s %s", uid, gid, path)
conda/gateways/disk/__init__.py: log.trace("Failed to set permissions to 2775 on %s (%d %d)",
conda/gateways/disk/create.py: log.trace("writing json to file %s", file_path)
conda/gateways/disk/create.py: log.trace("creating hard link %s => %s", src, dst)
conda/gateways/disk/create.py: log.trace("soft linking %s => %s", src, dst)
conda/gateways/disk/create.py: log.trace("soft linking %s => %s", src, dst)
conda/gateways/disk/create.py: log.trace("copying %s => %s", src, dst)
conda/gateways/disk/create.py: log.trace("hard linking %s => %s", src, dst)
conda/gateways/disk/create.py: log.trace(command)
conda/gateways/disk/create.py: log.trace("creating package cache directory '%s'", pkgs_dir)
conda/gateways/disk/create.py: log.trace("cannot create package cache directory '%s'", pkgs_dir)
conda/gateways/disk/create.py: log.trace("creating envs directory '%s'", envs_dir)
conda/gateways/disk/create.py: log.trace("cannot create envs directory '%s'", envs_dir)
conda/gateways/disk/delete.py: log.trace("rm_rf %s", path)
conda/gateways/disk/delete.py: log.trace("rm_rf failed. Not a link, file, or directory: %s", path)
conda/gateways/disk/delete.py: log.trace("no such file or directory: %s", path)
conda/gateways/disk/permissions.py: log.trace('chmod +x %s', path)
conda/gateways/disk/test.py: log.trace("checking path is writable %s", path)
conda/gateways/disk/test.py: log.trace("hard link supported for %s => %s", source_file, dest_dir)
conda/gateways/disk/test.py: log.trace("hard link IS NOT supported for %s => %s", source_file, dest_dir)
conda/gateways/disk/test.py: log.trace("hard link IS NOT supported for %s => %s", source_file, dest_dir)
conda/gateways/disk/test.py: log.trace("checking soft link capability for %s => %s", source_file, dest_dir)
conda/gateways/disk/update.py: log.trace("in-place update path locked for %s", file_full_path)
conda/gateways/disk/update.py: log.trace("renaming %s => %s", source_path, destination_path)
conda/gateways/disk/update.py: log.trace("Could not rename %s => %s due to errno [%s]. Falling back"
conda/gateways/disk/update.py: log.trace("cannot rename; source path does not exist '%s'", source_path)
conda/gateways/disk/update.py: log.trace("touching path %s", path)
conda/gateways/disk/update.py: # log.trace("chowning %s:%s %s", uid, gid, path)
conda/gateways/subprocess.py: log.trace(formatted_output)
conda/plan.py: log.trace("action {0} not in actions".format(op))
conda/plan.py: log.trace("action {0} has None value".format(op)) Is it worth for me to change these places as well? Thanks! |
Currently supported logging levels: https://docs.python.org/3/library/logging.html#logging-levels. |
Conda uses Python conda/conda/gateways/logging.py Lines 234 to 241 in 95e80f1
|
Apparently that module isn't always getting exec-ed, or least not before the first time that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this! Now that CI is unstuck I am inclined to see this in, but I don't know enough about the intent of the logging design. Will need to get another core contributor to look this over.
conda/core/prefix_data.py
Outdated
@@ -165,7 +165,7 @@ def _prefix_records(self): | |||
return self.__prefix_records or self.load() or self.__prefix_records | |||
|
|||
def _load_single_record(self, prefix_record_json_path): | |||
log.trace("loading prefix record %s", prefix_record_json_path) | |||
log.info("loading prefix record %s", prefix_record_json_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more I think about it, the more I think that info
is the wrong loglevel. It's more likely that the right answer is either 1) debug
or 2) patching conda/core/prefix_data.py
so that it picks up the trace
option properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kalefranz @mingwandroid thoughts? ^^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review, @mcg1969.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrakitin of course! I'd love for @kalefranz to see this but he's out right for a bit. When he gets back I'll check in with him.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @mcg1969 and @kalefranz! Just encountered the same issue with programmatic access of the conda package list, and remembered I proposed a fix. It would be great to not celebrate an anniversary for this PR 😄. What would you recommend to unblock it? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
491f278 added the TRACE log level, which on hindsight seems to have been to work around a test setup issue. (#3833 has the full changes that this was included in).
Since I don't know what the reasons for any of these things were, I'm inclined to:
- call the TRACE logging level a technical debt we need to clean up by removing it, since it's a non-standard logging level and not what most Python users would expect
- ask @mrakitin to update this patch to use
log.debug
instead oflog.info
to reduce the chance of spamming our users
Thanks, @jezdez! I updated the log level for (2), as suggested. |
Hi again, is there anything that is blocking this PR from merging? Thanks! |
Nope, thanks for the update. We were just working on other things. |
Hi @jezdez, no worries, thanks for merging this PR! |
* Fix log level in conda/core/prefix_data.py * Change the logging level to debug in _load_single_record() Co-authored-by: Michael C. Grant <mcg@cvxr.com>
Description
I was trying to programmatically access the output of
conda list --show-channel-url
output with the following code:Proposed fix
With the proposed fix, it works as expected:
Env info: