Tracking records that could not be processed#
NotCompleted is a special result type provided by the scinexus package. Apps return a NotCompleted result when a condition is not met (FALSE type) or an unexpected error occurs (ERROR type). These objects evaluate to False, carry information about the failure, and propagate through composed pipelines so that subsequent steps are skipped.
A cogent3 example#
Below, an app that selects specific sequences returns a NotCompleted because the requested sequence "Mouse" does not exist in the primate data set.
from cogent3 import get_app
reader = get_app("load_aligned", format_name="fasta")
select_seqs = get_app("take_named_seqs", "Mouse", "Human")
aln = reader("data/primate_brca1.fasta")
result = select_seqs(aln)
assert result == False
result
NotCompleted(type=FAIL, origin=take_named_seqs, source="primate_brca1", message="named seq(s) {'Mouse'} not in ('Galago', 'HowlerMon', 'Rhesus', 'Orangutan', 'Gorilla', 'Human', 'Chimpanzee')")
The NotCompleted instance has attributes identifying what data failed,
result.source
'primate_brca1'
where the failure occurred
result.origin
'take_named_seqs'
and the reason for the failure
result.message
"named seq(s) {'Mouse'} not in ('Galago', 'HowlerMon', 'Rhesus', 'Orangutan', 'Gorilla', 'Human', 'Chimpanzee')"