Closed basnijholt closed 2 months ago
Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.
Welcome to the EBP community! :tada:
@agoose77 the failing CI check is unrelated to these changes
@agoose77, friendly ping. Could you take a look at this?
I have a very similar problem in one of my repos, but this fix doesn't seem to work, I still get the fragmented output in the rendered HTML.
@bsipocz, did you set nb_merge_streams = True
?
@bsipocz, did you set nb_merge_streams = True?
Yeap, I didn't have that, but discovered the option by following the link to your https://github.com/pipefunc/pipefunc/pull/125 PR. So thank you.
So now my issue is fixed even without this PR.
While this PR does pass all tests, and doesn't seem to break anything, I suppose it would be nice to add your failing case to the tests, too.
I added a test. Without the changes here the test will fail:
________________________________________________ test_merge_streams_parallel ________________________________________________
sphinx_run = <conftest.SphinxFixture object at 0x7e810491f9b0>
file_regression = <conftest.FileRegression object at 0x7e80b65fe3f0>
@pytest.mark.sphinx_params(
"merge_streams_parallel.ipynb",
conf={"nb_execution_mode": "off", "nb_merge_streams": True},
)
def test_merge_streams_parallel(sphinx_run, file_regression):
"""Test configuring multiple concurrent stdout/stderr outputs to be merged."""
sphinx_run.build()
assert sphinx_run.warnings() == ""
doctree = sphinx_run.get_resolved_doctree("merge_streams_parallel")
> file_regression.check(doctree.pformat(), extension=".xml", encoding="utf-8")
/home/bas.nijholt/repos/MyST-NB/tests/test_render_outputs.py:116:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <conftest.FileRegression object at 0x7e80b65fe3f0>
data = '<document source="merge_streams_parallel" translation_progress="{\'total\': 0, \'translated\': 0}">\n <container c... \n \n \n \n \n \n \n'
kwargs = {'encoding': 'utf-8', 'extension': '.xml'}
def check(self, data, **kwargs):
> return self.file_regression.check(self._strip_ignores(data), **kwargs)
E AssertionError: FILES DIFFER:
E /home/bas.nijholt/.tmp/pytest-of-bas.nijholt/pytest-49/test_merge_streams_parallel0/test_render_outputs/test_merge_streams_parallel.xml
E /home/bas.nijholt/.tmp/pytest-of-bas.nijholt/pytest-49/test_merge_streams_parallel0/test_render_outputs/test_merge_streams_parallel.obtained.xml
E HTML DIFF: /home/bas.nijholt/.tmp/pytest-of-bas.nijholt/pytest-49/test_merge_streams_parallel0/test_render_outputs/test_merge_streams_parallel.obtained.diff.html
E ---
E +++
E @@ -9,13 +9,13 @@
E pass
E <container classes="cell_output" nb_element="cell_code_output">
E <literal_block classes="output stream" language="myst-ansi" linenos="False" xml:space="preserve">
E + 000000000
E 0
E - 0
E - 0
E - 0
E - 0
E - 0
E - 0
E - 0
E - 0
E - 0
E +
E +
E +
E +
E +
E +
E +
E +
The notebook is executed via jupyter nbconvert --execute merge_streams_parallel.ipynb --to ipynb
and I committed the executed ipynb.
In the PipeFunc documentation I have the following problem when executing code with a
ProcessPoolExecutor
:With this fix it becomes:
The root of the issue is that
nbconvert --execute
produces this output: