Commit fc1e8f8a authored by Roque Porchetto's avatar Roque Porchetto

erp5_wendelin_telecom_ingestion: handle invalids alarm disabled and minor changes in logs

parent c6fbd2c0
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -20,7 +20,7 @@ for line_data_ingestion in portal_catalog(**query_dict): ...@@ -20,7 +20,7 @@ for line_data_ingestion in portal_catalog(**query_dict):
# Create Analysis # Create Analysis
try: try:
try: try:
log("creating Data Analysis for Data Ingestion " + str(data_ingestion.getReference())) context.logEntry("creating Data Analysis for Data Ingestion " + str(data_ingestion.getReference()))
data_analysis = portal.data_analysis_module.newContent( data_analysis = portal.data_analysis_module.newContent(
portal_type = "Data Analysis", portal_type = "Data Analysis",
id = data_ingestion.getId(), id = data_ingestion.getId(),
...@@ -35,13 +35,13 @@ for line_data_ingestion in portal_catalog(**query_dict): ...@@ -35,13 +35,13 @@ for line_data_ingestion in portal_catalog(**query_dict):
destination = data_ingestion.getDestination(), destination = data_ingestion.getDestination(),
destination_section = data_ingestion.getDestinationSection(), destination_section = data_ingestion.getDestinationSection(),
destination_project = data_ingestion.getDestinationProject()) destination_project = data_ingestion.getDestinationProject())
context.logEntry("Data Analyisis created for Data Ingestion %s (ID: %s)" % (str(data_ingestion.getReference()), data_analysis.getId())) context.logEntry("Data Analyisis created for Data Ingestion %s (ID: %s)" % (str(data_ingestion.getReference()), data_ingestion.getId()))
except: except:
context.logEntry("[ERROR] Error creating Data Analysis for Data Ingestion '%s' (ID: %s). Script returned" % (str(data_ingestion.getReference()), data_analysis.getId())) context.logEntry("[ERROR] Error creating Data Analysis for Data Ingestion '%s' (ID: %s). Script returned" % (str(data_ingestion.getReference()), data_ingestion.getId()))
return # Data Analysis was already created return # Data Analysis was already created
# create input and output lines # create input and output lines
log("creating input and output lines") context.logEntry("creating input and output lines of data analysis %s (ID: %s)" % (str(data_ingestion.getReference()), data_ingestion.getId()))
for transformation_line in transformation.objectValues( for transformation_line in transformation.objectValues(
portal_type=["Data Transformation Resource Line", portal_type=["Data Transformation Resource Line",
"Data Transformation Operation Line"]): "Data Transformation Operation Line"]):
...@@ -69,8 +69,7 @@ for line_data_ingestion in portal_catalog(**query_dict): ...@@ -69,8 +69,7 @@ for line_data_ingestion in portal_catalog(**query_dict):
if(related_line.getParentValue().getReference() == data_ingestion.getReference() and related_line.getParentValue().getSimulationState() == "stopped"): if(related_line.getParentValue().getReference() == data_ingestion.getReference() and related_line.getParentValue().getSimulationState() == "stopped"):
aggregate_set.update(related_line.getAggregateSet()) aggregate_set.update(related_line.getAggregateSet())
related_line.getParentValue().deliver() related_line.getParentValue().deliver()
log("DATA INGESTION DELIVERED") context.logEntry("Data Ingestion '%s' delivered. (ID: %s)" % (str(data_ingestion.getReference()), data_ingestion.getId()))
context.logEntry("Data Ingestion '%s' delivered. (ID: %s)" % (str(data_ingestion.getReference()), data_analysis.getId()))
else: else:
# it is an output line # it is an output line
# create new item based on item_type: data array, stream, descriptor, etc. # create new item based on item_type: data array, stream, descriptor, etc.
...@@ -83,8 +82,7 @@ for line_data_ingestion in portal_catalog(**query_dict): ...@@ -83,8 +82,7 @@ for line_data_ingestion in portal_catalog(**query_dict):
version = '001') version = '001')
if "Data Descriptor" not in item_type: if "Data Descriptor" not in item_type:
item.validate() item.validate()
log("Creating " + str(item_type)) context.logEntry(str(item_type) + " %s created (ID: %s)" % (str(data_ingestion.getReference()), data_ingestion.getId()))
context.logEntry(str(item_type) + " created.")
aggregate_set = set() aggregate_set = set()
aggregate_set.add(item) aggregate_set.add(item)
...@@ -99,6 +97,6 @@ for line_data_ingestion in portal_catalog(**query_dict): ...@@ -99,6 +97,6 @@ for line_data_ingestion in portal_catalog(**query_dict):
aggregate_value_set = aggregate_set) aggregate_value_set = aggregate_set)
data_analysis.plan() data_analysis.plan()
log("DATA ANALYSIS PLANNED") context.logEntry("Data Anaysis '%s' planned. (ID: %s)" % (str(data_ingestion.getReference()), data_ingestion.getId()))
except Exception as e: except Exception as e:
context.logEntry("[ERROR] Error creating Data Analysis for Data Ingestion '%s' (ID: %s): %s" % (data_ingestion.getReference(), data_ingestion.getId(), str(e))) context.logEntry("[ERROR] Error creating Data Analysis for Data Ingestion '%s' (ID: %s): %s" % (data_ingestion.getReference(), data_ingestion.getId(), str(e)))
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