Commit d472cee3 authored by Klaus Wölfel's avatar Klaus Wölfel

fix: data analysis was created multiple times for same ingestion in streaming case

parent b948d032
from DateTime import DateTime from DateTime import DateTime
from Products.ZSQLCatalog.SQLCatalog import AndQuery, OrQuery, Query, SimpleQuery from Products.ZSQLCatalog.SQLCatalog import AndQuery, OrQuery, Query, NegatedQuery, SimpleQuery
portal = context.getPortalObject() portal = context.getPortalObject()
portal_catalog = portal.portal_catalog portal_catalog = portal.portal_catalog
...@@ -11,12 +11,13 @@ query = AndQuery( ...@@ -11,12 +11,13 @@ query = AndQuery(
Query(**{"stock.quantity": "!=0"}), Query(**{"stock.quantity": "!=0"}),
Query(resource_portal_type = "Data Product"), Query(resource_portal_type = "Data Product"),
# Should be improved to support mor than one analysis per ingestion # Should be improved to support mor than one analysis per ingestion
SimpleQuery(causality_related_relative_url = None), SimpleQuery(parent_causality_related_relative_url = None),
OrQuery( OrQuery(
Query(simulation_state = "stopped", Query(simulation_state = "stopped",
use_relative_url = "use/big_data/ingestion/batch"), use_relative_url = "use/big_data/ingestion/batch"),
Query(simulation_state = "started", AndQuery(
use_relative_url = "use/big_data/ingestion/stream"))) Query(simulation_state = "started"),
Query(use_relative_url = "use/big_data/ingestion/stream"))))
for movement in portal_catalog(query): for movement in portal_catalog(query):
if movement.DataIngestionLine_hasMissingRequiredItem(): if movement.DataIngestionLine_hasMissingRequiredItem():
......
portal = context.getPortalObject() portal = context.getPortalObject()
portal_catalog = portal.portal_catalog
for data_analysis in portal_catalog(portal_type = "Data Analysis", #search_kw = {
simulation_state = "started"): # 'simulation_state': 'started',
# 'portal_type': 'Data Analysis',
#}
#method_kw = {
# 'active_process': this_portal_type_active_process,
#}
#activate_kw = {
# 'tag': tag,
# 'priority': priority,
#}
#portal.portal_catalog.searchAndActivate(
# method_id='DataAnalysis_executeDataOperation',
# method_kw=method_kw,
# activate_kw=activate_kw,
# **search_kw)
for data_analysis in portal.portal_catalog(portal_type = "Data Analysis",
simulation_state = "started"):
data_analysis.activate(serialization_tag=str(data_analysis.getUid()))\ data_analysis.activate(serialization_tag=str(data_analysis.getUid()))\
.DataAnalysis_executeDataOperation() .DataAnalysis_executeDataOperation()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment