Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
70cb2e18
Commit
70cb2e18
authored
Mar 05, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
joblib: python3
parent
df160681
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
9 deletions
+23
-9
bt5/erp5_joblib/ExtensionTemplateItem/portal_components/extension.erp5.joblibUseCaseExamples.py
...portal_components/extension.erp5.joblibUseCaseExamples.py
+7
-2
bt5/erp5_joblib/TestTemplateItem/portal_components/test.erp5.testJoblibActivityUseCase.py
.../portal_components/test.erp5.testJoblibActivityUseCase.py
+1
-1
product/CMFActivity/joblib/CMFActivityParallelBackend.py
product/CMFActivity/joblib/CMFActivityParallelBackend.py
+15
-6
No files found.
bt5/erp5_joblib/ExtensionTemplateItem/portal_components/extension.erp5.joblibUseCaseExamples.py
View file @
70cb2e18
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
##############################################################################
##############################################################################
import
time
import
time
import
six
import
numpy
as
np
import
numpy
as
np
from
copy
import
copy
from
copy
import
copy
...
@@ -38,8 +39,12 @@ from sklearn.base import clone
...
@@ -38,8 +39,12 @@ from sklearn.base import clone
from
sklearn.utils
import
check_random_state
from
sklearn.utils
import
check_random_state
from
sklearn.model_selection
import
train_test_split
from
sklearn.model_selection
import
train_test_split
from
sklearn.ensemble
import
RandomForestClassifier
from
sklearn.ensemble
import
RandomForestClassifier
from
sklearn.externals
import
joblib
if
six
.
PY2
:
from
sklearn.externals.joblib.parallel
import
parallel_backend
,
Parallel
,
delayed
from
sklearn.externals
import
joblib
from
sklearn.externals.joblib.parallel
import
parallel_backend
,
Parallel
,
delayed
else
:
import
joblib
from
joblib.parallel
import
parallel_backend
,
Parallel
,
delayed
from
sklearn.datasets
import
load_digits
from
sklearn.datasets
import
load_digits
from
sklearn.svm
import
SVC
from
sklearn.svm
import
SVC
from
sklearn.model_selection
import
GridSearchCV
from
sklearn.model_selection
import
GridSearchCV
...
...
bt5/erp5_joblib/TestTemplateItem/portal_components/test.erp5.testJoblibActivityUseCase.py
View file @
70cb2e18
...
@@ -40,7 +40,7 @@ class Test(ERP5TypeTestCase):
...
@@ -40,7 +40,7 @@ class Test(ERP5TypeTestCase):
self
.
tic
()
self
.
tic
()
active_process
=
self
.
portal
.
portal_activities
.
unrestrictedTraverse
(
path
)
active_process
=
self
.
portal
.
portal_activities
.
unrestrictedTraverse
(
path
)
result
=
active_process
.
getResultList
()
result
=
active_process
.
getResultList
()
self
.
assertAlmostEqual
(
0.9
8444444444444446
,
result
[
0
].
result
)
self
.
assertAlmostEqual
(
0.9
,
result
[
0
].
result
,
0
)
def
test_UnderRootOfSquaresFunction
(
self
):
def
test_UnderRootOfSquaresFunction
(
self
):
path
=
self
.
portal
.
Base_driverScriptSquareRoot
()
path
=
self
.
portal
.
Base_driverScriptSquareRoot
()
...
...
product/CMFActivity/joblib/CMFActivityParallelBackend.py
View file @
70cb2e18
...
@@ -25,18 +25,27 @@
...
@@ -25,18 +25,27 @@
#
#
##############################################################################
##############################################################################
from
zLOG
import
LOG
,
INFO
,
WARNING
import
logging
from
ZODB.POSException
import
ConflictError
from
ZODB.POSException
import
ConflictError
from
Products.CMFActivity.ActivityRuntimeEnvironment
import
\
from
Products.CMFActivity.ActivityRuntimeEnvironment
import
\
getActivityRuntimeEnvironment
getActivityRuntimeEnvironment
import
six
logger
=
logging
.
getLogger
(
__name__
)
try
:
try
:
if
six
.
PY2
:
from
sklearn.externals.joblib
import
register_parallel_backend
from
sklearn.externals.joblib
import
register_parallel_backend
from
sklearn.externals.joblib.parallel
import
ParallelBackendBase
,
parallel_backend
from
sklearn.externals.joblib.parallel
import
ParallelBackendBase
,
parallel_backend
from
sklearn.externals.joblib.parallel
import
FallbackToBackend
,
SequentialBackend
from
sklearn.externals.joblib.parallel
import
FallbackToBackend
,
SequentialBackend
from
sklearn.externals.joblib.hashing
import
hash
as
joblib_hash
from
sklearn.externals.joblib.hashing
import
hash
as
joblib_hash
else
:
from
joblib
import
register_parallel_backend
from
joblib.parallel
import
ParallelBackendBase
,
parallel_backend
from
joblib.parallel
import
FallbackToBackend
,
SequentialBackend
from
joblib.hashing
import
hash
as
joblib_hash
except
ImportError
:
except
ImportError
:
LOG
(
__name__
,
WARNING
,
"Joblib cannot be imported, support disabled"
)
logger
.
warn
(
"Joblib cannot be imported, support disabled"
)
else
:
else
:
class
JoblibResult
(
object
):
class
JoblibResult
(
object
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment