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

Fixes #5738 #5740

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions py-scoring/src/ai/h2o/sparkling/Initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ def __get_sw_jar(sc):
if zipfile.is_zipfile(packagePath):
return Initializer.__extracted_jar_path(sc)
else:
from pkg_resources import resource_filename
return os.path.abspath(resource_filename("sparkling_water", BackingJar.getName()))
import importlib.resources as resources
with resources.path("sparkling_water", BackingJar.getName()) as jar_path:
return jar_path.resolve()

@staticmethod
def __get_logger(jvm):
Expand Down Expand Up @@ -192,11 +193,11 @@ def __add_url_to_classloader(gateway, url):

@staticmethod
def isRunningViaDBCConnect():
import pkg_resources as pkg
try:
pkg.get_distribution('databricks-connect')
return True
except:
from importlib.util import find_spec
spec = find_spec('databricks.connect')
return spec is not None
except ImportError:
return False

@staticmethod
Expand Down