Skip to content
Snippets Groups Projects
Commit 98489564 authored by payno's avatar payno
Browse files

Doc: add example on how to do some pre-processing from scan processing state

close #964
parent 00a7e70d
No related branches found
No related tags found
No related merge requests found
...@@ -199,3 +199,34 @@ On this example: ...@@ -199,3 +199,34 @@ On this example:
# reset key for coherence # reset key for coherence
scan._distance = None scan._distance = None
out_data = scan out_data = scan
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.
.. code-block:: python
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment