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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Klaus Wölfel
wendelin
Commits
9b8f5496
Commit
9b8f5496
authored
Jul 03, 2019
by
Eteri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_wendelin : move creation of items to consistency checks
parent
b0ddd24d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
75 deletions
+18
-75
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/ERP5Site_createDataAnalysisList.py
...al_skins/erp5_wendelin/ERP5Site_createDataAnalysisList.py
+18
-75
No files found.
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/ERP5Site_createDataAnalysisList.py
View file @
9b8f5496
...
...
@@ -98,82 +98,24 @@ for movement in portal_catalog(query):
# In case of shared data anylsis only add additional input lines
if
is_shared_data_analysis
and
quantity
>
-
1
:
continue
aggregate_set
=
set
()
# manually add device to every line
aggregate_set
.
add
(
movement
.
getAggregateDevice
())
if
transformation_line
.
getPortalType
()
==
\
"Data Transformation Resource Line"
:
# at the moment, we only check for positive or negative quantity
if
quantity
<
0
:
# it is an input line
# aggregate transformed item from data ingestion batch related to our
# movement. If it is an input resource line, then we search for an
# ingestion line with the same resource. If it is an operation line
# then we search for an ingestion line with resource portal type
# Data Product
batch_relative_url
=
movement
.
getAggregateDataIngestionBatch
()
# If it is batch processing we additionally get items from the other
# batch movements and deliver the other batch movements
if
transformation_line
.
getUse
()
==
"big_data/ingestion/batch"
and
\
transformation_line
.
getPortalType
()
==
\
"Data Transformation Resource Line"
and
quantity
<
0
:
batch_relative_url
=
movement
.
getAggregateDataIngestionBatch
()
if
batch_relative_url
is
not
None
:
related_movement_list
=
portal_catalog
(
portal_type
=
"Data Ingestion Line"
,
aggregate_relative_url
=
batch_relative_url
,
resource_relative_url
=
resource
.
getRelativeUrl
())
else
:
# get related movements only from current data ingestion
related_movement_list
=
movement
.
getParentValue
().
searchFolder
(
portal_type
=
[
"Data Ingestion Line"
,
"Data Analysis Line"
],
resource_relative_url
=
resource
.
getRelativeUrl
())
#for related_movement in related_movement_list:
#aggregate_set.update(related_movement.getAggregateSet()) ########## do not copy device configurations to lines!!
#if related_movement.getUse() == "big_data/ingestion/batch":
#related_movement.getParentValue().deliver()
# create new item based on item_type if it is not already aggregated
aggregate_type_set
=
set
(
[
portal
.
restrictedTraverse
(
a
).
getPortalType
()
for
a
in
aggregate_set
])
for
item_type
in
transformation_line
.
getAggregatedPortalTypeList
():
# create item if it does note exist yet.
# Except if it is a Data Array Line, then it is currently created by
# data operation itself (probably this exception is inconsistent)
if
batch_relative_url
is
not
None
:
related_movement_list
=
portal_catalog
(
portal_type
=
"Data Ingestion Line"
,
aggregate_relative_url
=
batch_relative_url
,
resource_relative_url
=
resource
.
getRelativeUrl
())
for
related_movement
in
related_movement_list
:
#aggregate_set.update(related_movement.getAggregateSet())
related_movement
.
getParentValue
().
deliver
()
if
transformation_line
.
getPortalType
()
==
"Data Transformation Operation Line"
and
item_type
not
in
aggregate_type_set
:
if
item_type
in
portal
.
getPortalDeviceConfigurationTypeList
()
+
portal
.
getPortalDataConfigurationTypeList
():
item
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
item_type
,
#validation_state="validated",
item_project_relative_url
=
data_analysis
.
getDestinationProject
(),
item_source_relative_url
=
data_analysis
.
getSource
())
elif
item_type
!=
"Data Array Line"
:
item
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
item_type
,
validation_state
=
"validated"
,
item_variation_text
=
transformation_line
.
getVariationText
(),
item_device_relative_url
=
movement
.
getAggregateDevice
(),
item_project_relative_url
=
data_analysis
.
getDestinationProject
(),
item_resource_uid
=
resource
.
getUid
(),
item_source_relative_url
=
data_analysis
.
getSource
())
if
item
is
None
:
module
=
portal
.
getDefaultModule
(
item_type
)
item
=
module
.
newContent
(
portal_type
=
item_type
,
title
=
transformation
.
getTitle
(),
reference
=
"%s-%s"
%
(
transformation
.
getTitle
(),
delivery
.
getReference
()),
version
=
'001'
)
try
:
item
.
validate
()
except
AttributeError
:
pass
aggregate_set
.
add
(
item
.
getRelativeUrl
())
# find other items such as device configuration and data configuration
# from data ingestion and data supply
#composed = data_analysis.asComposedDocument()
#line_list = [l for l in delivery.objectValues(portal_type="Data Ingestion Line")]
#line_list += [l for l in composed.objectValues(portal_type="Data Supply Line")]
#for line in line_list:
#if line.getResourceValue().getPortalType() == "Data Operation":
#aggregate_set.update(line.getAggregateList())
data_analysis_line
=
data_analysis
.
newContent
(
portal_type
=
"Data Analysis Line"
,
title
=
transformation_line
.
getTitle
(),
...
...
@@ -184,13 +126,14 @@ for movement in portal_catalog(query):
quantity
=
quantity
,
quantity_unit
=
transformation_line
.
getQuantityUnit
(),
use
=
transformation_line
.
getUse
(),
aggregate
_set
=
aggregate_set
)
aggregate
=
movement
.
getAggregateDevice
()
)
# for intput lines of first level analysis set causality and specialise
if
quantity
<
0
and
delivery
.
getPortalType
()
==
"Data Ingestion"
:
data_analysis_line
.
edit
(
causality_value
=
delivery
,
specialise_value_list
=
data_supply_list
)
data_analysis
.
checkConsistency
(
fixit
=
True
)
try
:
data_analysis
.
start
()
...
...
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