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

Add support for joblib 1.4.2 #55

Merged
merged 3 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ jobs:
PIN_MODE: [false, true]
PYSPARK_VERSION: ["3.0.3", "3.1.3", "3.2.3", "3.3.2", "3.4.0"]
include:
- PYSPARK_VERSION: "3.4.0"
- PYSPARK_VERSION: "3.5.1"
PYTHON_VERSION: "3.11"
JOBLIB_VERSION: "1.3.0"
- PYSPARK_VERSION: "3.4.0"
- PYSPARK_VERSION: "3.5.1"
PYTHON_VERSION: "3.11"
JOBLIB_VERSION: "1.4.2"
- PYSPARK_VERSION: "3.5.1"
PYTHON_VERSION: "3.12"
JOBLIB_VERSION: "1.3.0"
- PYSPARK_VERSION: "3.5.1"
PYTHON_VERSION: "3.12"
JOBLIB_VERSION: "1.4.2"
exclude:
- PYSPARK_VERSION: "3.0.3"
PIN_MODE: true
Expand Down
15 changes: 10 additions & 5 deletions joblibspark/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@
import AutoBatchingMixin, ParallelBackendBase, register_parallel_backend, SequentialBackend

try:
from joblib._parallel_backends import SafeFunction
# joblib >=1.4.0
from joblib._utils import _TracebackCapturingWrapper as SafeFunction
except ImportError:
# joblib >= 1.3.0
from joblib._parallel_backends import PoolManagerMixin
SafeFunction = None
try:
from joblib._parallel_backends import SafeFunction
except ImportError:
# joblib >= 1.3.0
from joblib._parallel_backends import PoolManagerMixin
SafeFunction = None

from py4j.clientserver import ClientServer

Expand Down Expand Up @@ -170,7 +174,7 @@

def run_on_worker_and_fetch_result():
if not self._is_running:
raise RuntimeError('The task is canceled due to ipython command canceled.')

Check failure on line 177 in joblibspark/backend.py

View workflow job for this annotation

GitHub Actions / Run test on pyspark 3.2.3, pin_mode false, python 3.10, joblib 1.3.0

The task is canceled due to ipython command canceled.

Check failure on line 177 in joblibspark/backend.py

View workflow job for this annotation

GitHub Actions / Run test on pyspark 3.2.3, pin_mode false, python 3.10, joblib 1.3.0

The task is canceled due to ipython command canceled.

# TODO: handle possible spark exception here. # pylint: disable=fixme
worker_rdd = self._spark.sparkContext.parallelize([0], 1)
Expand Down Expand Up @@ -216,7 +220,8 @@
)

return self._get_pool().apply_async(
SafeFunction(run_on_worker_and_fetch_result), callback=callback
SafeFunction(run_on_worker_and_fetch_result),
callback=callback, error_callback=callback
)


Expand Down
Loading