Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
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
Iliya Manolov
wendelin
Commits
bde87c2e
Commit
bde87c2e
authored
Aug 28, 2017
by
Iliya Manolov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed DataStreams reindexing when appending new data and added a test...
parent
d2867d16
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
176 additions
and
2 deletions
+176
-2
bt5/erp5_wendelin/ExtensionTemplateItem/portal_components/extension.erp5.Wendelin.py
...TemplateItem/portal_components/extension.erp5.Wendelin.py
+17
-0
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/Base_denyObjectReindexation.xml
...ortal_skins/erp5_wendelin/Base_denyObjectReindexation.xml
+28
-0
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
...tTemplateItem/portal_components/test.erp5.testWendelin.py
+61
-1
bt5/erp5_wendelin/WorkflowTemplateItem/portal_workflow/data_stream_interaction_workflow/interactions/DataStream_appendData.xml
...teraction_workflow/interactions/DataStream_appendData.xml
+3
-1
bt5/erp5_wendelin/WorkflowTemplateItem/portal_workflow/data_stream_interaction_workflow/scripts/DataStream_denyObjectReindexation.py
...ion_workflow/scripts/DataStream_denyObjectReindexation.py
+5
-0
bt5/erp5_wendelin/WorkflowTemplateItem/portal_workflow/data_stream_interaction_workflow/scripts/DataStream_denyObjectReindexation.xml
...on_workflow/scripts/DataStream_denyObjectReindexation.xml
+62
-0
No files found.
bt5/erp5_wendelin/ExtensionTemplateItem/portal_components/extension.erp5.Wendelin.py
View file @
bde87c2e
...
@@ -5,6 +5,23 @@
...
@@ -5,6 +5,23 @@
from
wendelin.bigarray.array_zodb
import
ZBigArray
from
wendelin.bigarray.array_zodb
import
ZBigArray
import
numpy
as
np
import
numpy
as
np
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
def
Base_denyObjectReindexation
(
self
):
tv
=
getTransactionalVariable
()
key
=
'explicitly_deny_object_reindexation_list'
try
:
tmp
=
tv
[
key
]
if
not
isinstance
(
tmp
,
list
):
tv
[
key
]
=
[]
except
KeyError
:
tv
[
key
]
=
[]
tv
[
key
].
append
(
self
)
def
DataStream_copyCSVToDataArray
(
data_stream
,
chunk_list
,
start
,
end
,
\
def
DataStream_copyCSVToDataArray
(
data_stream
,
chunk_list
,
start
,
end
,
\
data_array_reference
=
None
):
data_array_reference
=
None
):
"""
"""
...
...
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/Base_denyObjectReindexation.xml
0 → 100644
View file @
bde87c2e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
Base_denyObjectReindexation
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
Wendelin
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_denyObjectReindexation
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
View file @
bde87c2e
...
@@ -34,6 +34,7 @@ import msgpack
...
@@ -34,6 +34,7 @@ import msgpack
import
numpy
as
np
import
numpy
as
np
import
string
import
string
import
random
import
random
import
transaction
def
getRandomString
():
def
getRandomString
():
return
'test_%s'
%
''
.
join
([
random
.
choice
(
string
.
ascii_letters
+
string
.
digits
)
\
return
'test_%s'
%
''
.
join
([
random
.
choice
(
string
.
ascii_letters
+
string
.
digits
)
\
...
@@ -73,6 +74,24 @@ class Test(ERP5TypeTestCase):
...
@@ -73,6 +74,24 @@ class Test(ERP5TypeTestCase):
return
ingestion_policy
,
data_supply
,
data_stream
,
data_array
return
ingestion_policy
,
data_supply
,
data_stream
,
data_array
def
countObjectReinstantiations
(
self
,
ob
):
"""
Counts how many portal activity messages with a method_id of
immediateReindexObject have been called on ob.
"""
activity_tool
=
self
.
portal
.
portal_activities
activity_messages
=
activity_tool
.
getMessageList
()
result
=
0
last_messages
=
activity_messages
[
-
10
:]
for
message
in
last_messages
:
if
message
.
getObject
(
activity_tool
)
==
ob
and
message
.
method_id
==
'immediateReindexObject'
:
result
+=
1
return
result
def
test_0_import
(
self
):
def
test_0_import
(
self
):
"""
"""
...
@@ -340,4 +359,45 @@ context.activate().DataStream_readChunkListAndTransform( \
...
@@ -340,4 +359,45 @@ context.activate().DataStream_readChunkListAndTransform( \
# test as sequence
# test as sequence
bucket
=
bucket_stream
.
getBucketItemSequence
(
start_key
=
10
,
count
=
1
)[
0
]
bucket
=
bucket_stream
.
getBucketItemSequence
(
start_key
=
10
,
count
=
1
)[
0
]
self
.
assertEqual
(
100000
,
bucket
[
1
].
value
)
self
.
assertEqual
(
100000
,
bucket
[
1
].
value
)
\ No newline at end of file
def
test_05_NoReindexDataStream
(
self
):
"""
Test if DataStreams reindex themselves when they have data appended to them.
"""
portal
=
self
.
portal
reference
=
getRandomString
()
row
=
','
.
join
([
'%s'
%
x
for
x
in
range
(
1000
)])
number_string_list
=
[
row
]
*
20
real_data
=
'
\
n
'
.
join
(
number_string_list
)
data_stream
=
portal
.
data_stream_module
.
newContent
(
portal_type
=
'Data Stream'
,
reference
=
reference
)
self
.
tic
()
data_stream
.
appendData
(
real_data
)
transaction
.
commit
()
result
=
self
.
countObjectReinstantiations
(
data_stream
)
self
.
assertEquals
(
result
,
0
)
reference
=
getRandomString
()
data_array
=
portal
.
data_array_module
.
newContent
(
portal_type
=
'Data Array'
,
reference
=
reference
)
self
.
tic
()
data_array
.
edit
(
title
=
'New title'
)
transaction
.
commit
()
result
=
self
.
countObjectReinstantiations
(
data_array
)
self
.
assertNotEquals
(
result
,
0
)
\ No newline at end of file
bt5/erp5_wendelin/WorkflowTemplateItem/portal_workflow/data_stream_interaction_workflow/interactions/DataStream_appendData.xml
View file @
bde87c2e
...
@@ -79,7 +79,9 @@
...
@@ -79,7 +79,9 @@
<item>
<item>
<key>
<string>
script_name
</string>
</key>
<key>
<string>
script_name
</string>
</key>
<value>
<value>
<tuple/>
<list>
<string>
DataStream_denyObjectReindexation
</string>
</list>
</value>
</value>
</item>
</item>
<item>
<item>
...
...
bt5/erp5_wendelin/WorkflowTemplateItem/portal_workflow/data_stream_interaction_workflow/scripts/DataStream_denyObjectReindexation.py
0 → 100644
View file @
bde87c2e
"""
Handle appended data chunks.
"""
data_stream
=
state_change
[
'object'
]
data_stream
.
Base_denyObjectReindexation
()
bt5/erp5_wendelin/WorkflowTemplateItem/portal_workflow/data_stream_interaction_workflow/scripts/DataStream_denyObjectReindexation.xml
0 → 100644
View file @
bde87c2e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
DataStream_denyObjectReindexation
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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