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
Paul Graydon
wendelin
Commits
9cbc3708
Commit
9cbc3708
authored
Jan 11, 2024
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup trailing spaces.
parent
b33b8afe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
41 deletions
+20
-41
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.IngestionPolicy.py
...teItem/portal_components/document.erp5.IngestionPolicy.py
+17
-17
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.IngestionPolicy.xml
...eItem/portal_components/document.erp5.IngestionPolicy.xml
+3
-24
No files found.
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.IngestionPolicy.py
View file @
9cbc3708
...
@@ -28,25 +28,25 @@ from zExceptions import BadRequest, NotFound
...
@@ -28,25 +28,25 @@ from zExceptions import BadRequest, NotFound
class
IngestionPolicy
(
Folder
):
class
IngestionPolicy
(
Folder
):
"""
"""
A policy for ingesting raw (usually) data inside ERP5.
A policy for ingesting raw (usually) data inside ERP5.
Every Sensor, Data Acquisition Unit or Data Aggregation Unit will be
Every Sensor, Data Acquisition Unit or Data Aggregation Unit will be
configured to access a different policy.
configured to access a different policy.
Each policy will have a python script which based on input data will find
Each policy will have a python script which based on input data will find
respective Data Supply which itself contains all required information for
respective Data Supply which itself contains all required information for
later ingestion and analytics.
later ingestion and analytics.
"""
"""
meta_type
=
'ERP5 Ingestion Policy'
meta_type
=
'ERP5 Ingestion Policy'
portal_type
=
'Ingestion Policy'
portal_type
=
'Ingestion Policy'
# Declarative security
# Declarative security
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
def
unpack
(
self
,
data
):
def
unpack
(
self
,
data
):
"""
"""
Unpack data coming from fluentd. Hand
l
y alias.
Unpack data coming from fluentd. Handy alias.
"""
"""
return
self
.
portal_ingestion_policies
.
unpack
(
data
)
return
self
.
portal_ingestion_policies
.
unpack
(
data
)
security
.
declarePublic
(
'ingest'
)
security
.
declarePublic
(
'ingest'
)
def
ingest
(
self
,
**
kw
):
def
ingest
(
self
,
**
kw
):
"""
"""
...
@@ -65,23 +65,23 @@ class IngestionPolicy(Folder):
...
@@ -65,23 +65,23 @@ class IngestionPolicy(Folder):
self
.
REQUEST
.
form
[
'data_chunk'
]
=
self
.
REQUEST
.
_file
.
read
()
self
.
REQUEST
.
form
[
'data_chunk'
]
=
self
.
REQUEST
.
_file
.
read
()
finally
:
finally
:
environ
[
'REQUEST_METHOD'
]
=
method
environ
[
'REQUEST_METHOD'
]
=
method
tag_parsing_script_id
=
self
.
getScriptId
()
tag_parsing_script_id
=
self
.
getScriptId
()
if
tag_parsing_script_id
is
None
:
if
tag_parsing_script_id
is
None
:
raise
NotFound
(
'No tag parsing script found.'
)
raise
NotFound
(
'No tag parsing script found.'
)
tag_parsing_script
=
getattr
(
self
,
tag_parsing_script_id
,
None
)
tag_parsing_script
=
getattr
(
self
,
tag_parsing_script_id
,
None
)
if
tag_parsing_script
is
None
:
if
tag_parsing_script
is
None
:
raise
NotFound
(
'No tag parsing script found.'
)
raise
NotFound
(
'No tag parsing script found.'
)
# XXX Compatibility with old ingestion. Must be dropped before merging
# XXX Compatibility with old ingestion. Must be dropped before merging
# with wendelin master
# with wendelin master
if
tag_parsing_script_id
==
"ERP5Site_handleDefaultFluentdIngestion"
:
if
tag_parsing_script_id
==
"ERP5Site_handleDefaultFluentdIngestion"
:
return
tag_parsing_script
(
**
kw
)
return
tag_parsing_script
(
**
kw
)
reference
=
self
.
REQUEST
.
get
(
'reference'
)
reference
=
self
.
REQUEST
.
get
(
'reference'
)
data_chunk
=
self
.
REQUEST
.
get
(
'data_chunk'
)
data_chunk
=
self
.
REQUEST
.
get
(
'data_chunk'
)
# the script parses the fluentd tag (reference) and returns a dictionary
# the script parses the fluentd tag (reference) and returns a dictionary
# which describes the ingestion movement. Then we use this dictionary to
# which describes the ingestion movement. Then we use this dictionary to
...
@@ -104,7 +104,7 @@ class IngestionPolicy(Folder):
...
@@ -104,7 +104,7 @@ class IngestionPolicy(Folder):
data_operation_script
=
getattr
(
self
,
data_operation_script_id
,
None
)
data_operation_script
=
getattr
(
self
,
data_operation_script_id
,
None
)
if
data_operation_script
is
None
:
if
data_operation_script
is
None
:
raise
NotFound
(
'No data operation script found.'
)
raise
NotFound
(
'No data operation script found.'
)
ingestion_operation
,
parameter_dict
=
data_operation_script
(
movement_dict
,
\
ingestion_operation
,
parameter_dict
=
data_operation_script
(
movement_dict
,
\
reference
)
reference
)
...
@@ -114,9 +114,9 @@ class IngestionPolicy(Folder):
...
@@ -114,9 +114,9 @@ class IngestionPolicy(Folder):
ingestion_script_id
=
ingestion_operation
.
getScriptId
()
ingestion_script_id
=
ingestion_operation
.
getScriptId
()
if
ingestion_script_id
is
None
:
if
ingestion_script_id
is
None
:
raise
NotFound
(
'No ingestion operation script id defined.'
)
raise
NotFound
(
'No ingestion operation script id defined.'
)
ingestion_script
=
getattr
(
self
,
ingestion_script_id
,
None
)
ingestion_script
=
getattr
(
self
,
ingestion_script_id
,
None
)
if
ingestion_script
is
None
:
if
ingestion_script
is
None
:
raise
NotFound
(
'No such ingestion script found: %s'
%
ingestion_script_id
)
raise
NotFound
(
'No such ingestion script found: %s'
%
ingestion_script_id
)
ingestion_script
(
data_chunk
=
data_chunk
,
**
parameter_dict
)
ingestion_script
(
data_chunk
=
data_chunk
,
**
parameter_dict
)
\ No newline at end of file
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.IngestionPolicy.xml
View file @
9cbc3708
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
IngestionPolicy
</string>
</value>
<value>
<string>
IngestionPolicy
</string>
</value>
...
@@ -53,28 +47,13 @@
...
@@ -53,28 +47,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -87,7 +66,7 @@
...
@@ -87,7 +66,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -96,7 +75,7 @@
...
@@ -96,7 +75,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
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