Skip to content

Commit

Permalink
Wrap the package version check in a logger so it doesn't push excepti…
Browse files Browse the repository at this point in the history
…ons to the execution console (#134) (#136)

* Wrap the package version check in a logger so it doesn't push exceptions to the execution console

* make style
  • Loading branch information
markurtz committed Mar 10, 2022
1 parent 286246a commit 2348014
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/sparsezoo/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,23 @@ def version_check_execution_condition(
:param package_integration: package integration of the client
"""
if (
os.getenv("NM_VERSION_CHECK") is None
or os.getenv("NM_VERSION_CHECK").lower().strip() != "false"
os.getenv("NM_VERSION_CHECK") is not None
and os.getenv("NM_VERSION_CHECK").lower().strip() == "false"
):
LOGGER.info("Skipping Neural Magic's latest package version check")
return

try:
package_version_check_request(
package_name=package_name,
package_integration=package_integration,
package_version=package_version,
)
else:
LOGGER.info(
"Skipping Neural Magic's internal code exection: "
"latest package version check"
except Exception as err:
LOGGER.warning(
"Neural Magic's latest package version check raised an exception. "
"To turn off set the following in the environment NM_VERSION_CHECK=false "
f"Exception: {err}"
)


Expand Down

0 comments on commit 2348014

Please sign in to comment.