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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
erp5
Commits
36290703
Commit
36290703
authored
Oct 26, 2017
by
Hardik Juneja
Committed by
Hardik Juneja
Nov 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some cleanup
parent
049fdd57
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
30 deletions
+6
-30
bt5/erp5_joblib/ExtensionTemplateItem/portal_components/extension.erp5.joblibUseCaseExamples.py
...portal_components/extension.erp5.joblibUseCaseExamples.py
+2
-4
bt5/erp5_joblib/TestTemplateItem/portal_components/test.erp5.testJoblibActivityUseCase.py
.../portal_components/test.erp5.testJoblibActivityUseCase.py
+4
-6
product/ERP5Type/ZopePatch.py
product/ERP5Type/ZopePatch.py
+0
-1
product/ERP5Type/patches/JoblibParallelPrint.py
product/ERP5Type/patches/JoblibParallelPrint.py
+0
-19
No files found.
bt5/erp5_joblib/ExtensionTemplateItem/portal_components/extension.erp5.joblibUseCaseExamples.py
View file @
36290703
...
...
@@ -30,8 +30,7 @@ def example_simple_function(self, active_process_path):
result
=
Parallel
(
n_jobs
=
2
,
pre_dispatch
=
'all'
,
timeout
=
30
,
verbose
=
30
)(
delayed
(
sqrt
)(
i
**
2
)
for
i
in
range
(
5
))
# Set result value and an id to the active result and post it
result
=
ActiveResult
(
result
=
result
)
result
.
signature
=
12345
result
=
ActiveResult
(
result
=
result
,
signature
=
12345
)
active_process
.
postResult
(
result
)
log
(
"joblib activity result"
,
result
)
return
result
...
...
@@ -87,8 +86,7 @@ def example_random_forest_function(self, active_process_path):
score
=
final_model
.
score
(
X_test
,
y_test
)
# Set result value and an id to the active result and post it
result
=
ActiveResult
(
result
=
score
)
result
.
signature
=
123
result
=
ActiveResult
(
result
=
score
,
signature
=
123
)
active_process
.
postResult
(
result
)
log
(
'ok'
,
len
(
final_model
.
estimators_
))
return
'ok'
,
len
(
final_model
.
estimators_
),
score
...
...
bt5/erp5_joblib/TestTemplateItem/portal_components/test.erp5.testJoblibActivityUseCase.py
View file @
36290703
...
...
@@ -49,7 +49,6 @@ class Test(ERP5TypeTestCase):
script
.
ZPythonScript_edit
(
'**kw'
,
"""import time
active_process = context.portal_activities.newActiveProcess()
active_process.useBTree()
active_process_id = active_process.getId()
path = active_process.getPhysicalPath()
...
...
@@ -59,8 +58,8 @@ return path""")
path
=
portal_skins
.
erp5_joblib
.
Base_driverScriptRandomForest
()
self
.
tic
(
1
)
active_process
=
portal_skins
.
erp5_joblib
.
portal_activities
.
unrestrictedTraverse
(
path
)
result
=
active_process
.
getResult
(
123
)
self
.
assertEquals
(
0.98444444444444446
,
result
.
result
)
result
=
active_process
.
getResult
Dict
(
)
self
.
assertEquals
(
0.98444444444444446
,
result
[
123
]
.
result
)
def
test_UnderRootOfSquaresFunction
(
self
):
portal_skins
=
self
.
getPortal
().
portal_skins
...
...
@@ -75,7 +74,6 @@ return path""")
script
.
ZPythonScript_edit
(
'**kw'
,
"""import time
active_process = context.portal_activities.newActiveProcess()
active_process.useBTree()
active_process_id = active_process.getId()
path = active_process.getPhysicalPath()
...
...
@@ -85,6 +83,6 @@ return path""")
path
=
portal_skins
.
erp5_joblib
.
Base_driverScriptSquareRoot
()
self
.
tic
(
1
)
active_process
=
self
.
portal
.
portal_activities
.
unrestrictedTraverse
(
path
)
result
=
active_process
.
getResult
(
12345
)
self
.
assertEquals
([
0.0
,
1.0
,
2.0
,
3.0
,
4.0
],
result
.
result
)
result
=
active_process
.
getResult
Dict
(
)
self
.
assertEquals
([
0.0
,
1.0
,
2.0
,
3.0
,
4.0
],
result
[
12345
]
.
result
)
product/ERP5Type/ZopePatch.py
View file @
36290703
...
...
@@ -87,7 +87,6 @@ from Products.ERP5Type.patches import ZopePageTemplate
from
Products.ERP5Type.patches
import
ZSQLMethod
from
Products.ERP5Type.patches
import
MimetypesRegistry
from
Products.ERP5Type.patches
import
users
from
Products.ERP5Type.patches
import
JoblibParallelPrint
# These symbols are required for backward compatibility
from
Products.ERP5Type.patches.PropertyManager
import
ERP5PropertyManager
...
...
product/ERP5Type/patches/JoblibParallelPrint.py
deleted
100644 → 0
View file @
049fdd57
ENABLE_PATCH
=
True
try
:
import
sklearn
#from sklearn.externals import joblib
#from sklearn.externals.joblib.parallel import Parallel
from
joblib.parallel
import
Parallel
except
ImportError
:
ENABLE_PATCH
=
False
if
ENABLE_PATCH
:
from
zLOG
import
LOG
,
WARNING
def
_print
(
self
,
msg
,
msg_args
):
msg
=
msg
%
msg_args
LOG
(
'Parallel._print'
,
WARNING
,
'[%s]: %s
\
n
'
%
(
self
,
msg
))
Parallel
.
_print
=
_print
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