Closed telegraphic closed 2 years ago
I just started using Bifrost in 3.7 and ran into the same issue with the yield. Instead of changing the read functions in the code, I used the other functions to provide the same functionality in my own code.
I used ReadSequence.increment()
to change sequences in a function and ReadSequence.acquire()
to get the span. Both are within a try-except block.
The ReadSequence does not need to be destroyed until the end of the ring is reached, with ReadSequence.close()
. The ReadSpans returned by ReadSequence.acquire()
need to be released at every span with ReadSpan.release()
I haven't yet played around with views, so I don't have observations on that issue.
@telegraphic Do you have a branch that I can look at for how you implemented EndOfDataStop
?
I haven't been able to reproduce this with the tests that are run through Travis or Jenkins. @telegraphic Do the two code snippets in your original post trigger the original StopIteration problem? If so, can you point me to a dada file to try?
I was able to find an old LEDA64-NM dada file (from 2014!) to test on. My next stumbling block is a function for hdr_callback
.
Hey Jayce, let me put together a failing test and input data and get back to you on this one. The hdr_callback
is a bit of effort - it's needed to populate the bifrost _tensor
from the DADA header (the dada header format is not standardised enough to do this without a helping hand).
Closing with the release of v0.10.0.
Not sure if this is two separate issues, or one inter-related.
Part 1
I was trying to get bifrost working in Python 3.7, and ran into PEP479, which changes how
StopIteration
is handled in a generator: https://www.python.org/dev/peps/pep-0479/Basically
StopIteration
now gets converted into aRuntimeError
. My workaround was instead to raise a new exception,EndOfDataStop
, and catch that in any code that usesyield
or explicitly catchesStopIteration
. This seems to work, athough not sure it is the optimal approach.Part 2
After fixing the
StopIteration
issue, I'm now running into an issue where the code crashes upon pipeline shutdown, with an error:As far as I can tell, this error occurs when two
bf.views
are used one after each other. For example, this runs fine:But this doesn't:
Any ideas? This fails on both Python 3.7 AND Python 3.6. I reverted my StopIteration changes back and Py 3.6 still fails.