Commit 88be7c22 authored by Roque Porchetto's avatar Roque Porchetto

erp5_wendelin_telecom_ingestion: revert process fif raw data and fix getDataStreamList performance

parent 541e9e80
...@@ -70,17 +70,15 @@ def getMNEReportJSON(file_name, raw): ...@@ -70,17 +70,15 @@ def getMNEReportJSON(file_name, raw):
def getRawData(file_name): def getRawData(file_name):
raw = None raw = None
raw_functions = [mne.io.read_raw_fif, mne.io.read_raw_edf, mne.io.read_events_eeglab, mne.io.read_annotations_eeglab, mne.io.read_raw_eeglab, try:
mne.io.read_raw_artemis123, mne.io.read_raw_bti, mne.io.read_raw_cnt, mne.io.read_raw_ctf, mne.io.read_raw_brainvision, raw = mne.io.read_raw_fif(file_name, preload=False, verbose=None)
mne.io.read_raw_kit, mne.read_epochs_kit, mne.io.read_raw_nicolet, mne.io.read_raw_eeglab, mne.io.read_raw_brainvision, except:
mne.io.read_raw_egi, mne.io.read_info, mne.io.read_epochs_eeglab] pass
for function in raw_functions: if raw is None:
try: try:
raw = function(file_name) raw = mne.io.read_raw_edf(file_name, preload=False, verbose=None)
print("Function %s could read file %s " % (str(function), file_name)) except:
break pass
except Exception as e:
print("Exception reading raw data with function %s: %s" % (str(function), str(e)))
if raw is None: raise StandardError("the file does not contain raw data.") if raw is None: raise StandardError("the file does not contain raw data.")
return raw return raw
......
...@@ -52,11 +52,13 @@ ...@@ -52,11 +52,13 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W:100, 8: Unused variable \'times\' (unused-variable)</string> <string>W: 75, 2: No exception type(s) specified (bare-except)</string>
<string>W:137, 6: No exception type(s) specified (bare-except)</string> <string>W: 80, 4: No exception type(s) specified (bare-except)</string>
<string>W:173, 8: Unreachable code (unreachable)</string> <string>W: 98, 8: Unused variable \'times\' (unused-variable)</string>
<string>W:192, 11: Using type() instead of isinstance() for a typecheck. (unidiomatic-typecheck)</string> <string>W:135, 6: No exception type(s) specified (bare-except)</string>
<string>W:196, 10: No exception type(s) specified (bare-except)</string> <string>W:171, 8: Unreachable code (unreachable)</string>
<string>W:190, 11: Using type() instead of isinstance() for a typecheck. (unidiomatic-typecheck)</string>
<string>W:194, 10: No exception type(s) specified (bare-except)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -18,25 +18,21 @@ data_set = portal.data_set_module.get(data_set_reference) ...@@ -18,25 +18,21 @@ data_set = portal.data_set_module.get(data_set_reference)
if data_set is None: if data_set is None:
return [] return []
states_query = ComplexQuery(Query(simulation_state='Delivered'),
Query(simulation_state='Stopped'),
Query(simulation_state='Started'),
logical_operator="OR")
query_dict = { query_dict = {
"query": states_query, "portal_type": "Data Stream",
"portal_type": "Data Ingestion Line", "reference": data_set.getReference() + "/%",
"resource_portal_type": "Data Product"} "validation_state": 'validated'}
data_stream_list = [] data_stream_list = []
for line in portal_catalog(**query_dict): for stream in portal_catalog(**query_dict):
if line.getAggregateDeviceConfiguration() == "data_set_module/" + str(data_set.getId()): ing_dict = {
for item in line.getAggregateSet(): "portal_type": "Data Ingestion",
if "data_stream_module/" in item: "reference": stream.getReference()}
data_stream = context.restrictedTraverse(item) ingestions = portal_catalog(**ing_dict)
if data_stream.getValidationState == "invalidated" or data_stream.getReference().endswith("_invalid"): if len(ingestions) > 0:
break ingestion = ingestions[0]
data_stream_list.append([item, data_stream.getReference()]) if ingestion.getSimulationState() in ['started','stopped','delivered']:
break data_stream_list.append(["data_stream_module/"+stream.getId(), stream.getReference()])
return { "status_code": 0, "result": data_stream_list } return { "status_code": 0, "result": data_stream_list }
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