Filter scan having failled processes#
Here is an example retrieving processing states of a dataset during is life time. We can imagine having this as pre-processing of the ‘email notification for example’ in order to receive a notification only when a scan has some ‘failure’ during processing.
from processview.core.manager import ProcessManager, DatasetState
scan = in_data
def get_processes_with_state(state_search, tomo_obj):
states = {}
for process in ProcessManager().get_processes():
state = ProcessManager().get_dataset_state(
dataset_id=tomo_obj.get_identifier(),
process=process,
)
if state is state_search:
states[process] = state
return states
failed_processes = get_processes_with_state(DatasetState.FAILED, tomo_obj=scan)
if len(failed_processes) > 0:
out_data = scan
else:
out_data = None