Skip to content

Commit be9cd9f

Browse files
authored
fix ci error (#1921)
* fix ci error * fix ci error * add comments * add comments
1 parent 85cc748 commit be9cd9f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.github/workflows/test_qlib_from_pip.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ jobs:
3838
run: |
3939
python -m pip install pywinpty --only-binary=:all:
4040
41+
# # joblib was released on 2025-05-04 with version 1.5.0, in which _backend_args was removed and replaced by _backend_kwargs.
42+
# This change caused the application to fail, so the version of joblib is restricted here.
43+
# This restriction will be removed in the next release. The current qlib version is: 0.9.6
4144
- name: Qlib installation test
4245
run: |
4346
python -m pip install pyqlib
47+
python -m pip install "joblib<=1.4.2"
4448
4549
- name: Install Lightgbm for MacOS
4650
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'macos-15' }}

qlib/utils/paral.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from threading import Thread
77
from typing import Callable, Text, Union
88

9+
import joblib
910
from joblib import Parallel, delayed
1011
from joblib._parallel_backends import MultiprocessingBackend
1112
import pandas as pd
@@ -21,7 +22,12 @@ def __init__(self, *args, **kwargs):
2122
maxtasksperchild = kwargs.pop("maxtasksperchild", None)
2223
super(ParallelExt, self).__init__(*args, **kwargs)
2324
if isinstance(self._backend, MultiprocessingBackend):
24-
self._backend_args["maxtasksperchild"] = maxtasksperchild
25+
# 2025-05-04 joblib released version 1.5.0, in which _backend_args was removed and replaced by _backend_kwargs.
26+
# Ref: https://github.com/joblib/joblib/pull/1525/files#diff-e4dff8042ce45b443faf49605b75a58df35b8c195978d4a57f4afa695b406bdc
27+
if joblib.__version__ < "1.5.0":
28+
self._backend_args["maxtasksperchild"] = maxtasksperchild # pylint: disable=E1101
29+
else:
30+
self._backend_kwargs["maxtasksperchild"] = maxtasksperchild # pylint: disable=E1101
2531

2632

2733
def datetime_groupby_apply(

0 commit comments

Comments
 (0)