GithubHelp home page GithubHelp logo

Tests fail on 1-core machine about nbclient HOT 5 OPEN

jupyter avatar jupyter commented on July 26, 2024
Tests fail on 1-core machine

from nbclient.

Comments (5)

MSeal avatar MSeal commented on July 26, 2024

That's definitely not an expected behavior. I take it your build chain with 2 cores is passing (to eliminate possibility of it being dependency related rather than hardware)? Are you running the test suite sequentially or in parallel with other tests? If you can modify the source running uncommenting those debug lines above the stack trace might be helpful to see if it is one missed message or something more systemic.

from nbclient.

bmwiedemann avatar bmwiedemann commented on July 26, 2024

just re-tested and found that there are also issues with 2 and 4 cores :-(

FAILED nbclient/tests/test_client.py::TestExecute::test_cleanup_kernel_client
FAILED nbclient/tests/test_client.py::TestExecute::test_reset_kernel_client

we are on 0.4.0 - I can also try to go to 0.4.3 first.

from nbclient.

bmwiedemann avatar bmwiedemann commented on July 26, 2024

0.4.3 looks somewhat better. there, 2-core and 4-core runs passed and 1-core tests had just this 1 failure:

 =================================== FAILURES ===================================
 ________________________ test_async_parallel_notebooks _________________________
 
 capfd = <_pytest.capture.CaptureFixture object at 0x7f16c8b959d0>
 tmpdir = local('/tmp/pytest-of-abuild/pytest-0/test_async_parallel_notebooks0')
 
     def test_async_parallel_notebooks(capfd, tmpdir):
         """Two notebooks should be able to be run simultaneously without problems.
     
         The two notebooks spawned here use the filesystem to check that the other notebook
         wrote to the filesystem."""
     
         opts = dict(kernel_name="python")
         input_name = "Parallel Execute {label}.ipynb"
         input_file = os.path.join(current_dir, "files", input_name)
         res = notebook_resources()
     
         with modified_env({"NBEXECUTE_TEST_PARALLEL_TMPDIR": str(tmpdir)}):
             tasks = [
                 async_run_notebook(input_file.format(label=label), opts, res)
                 for label in ("A", "B")
             ]
             loop = asyncio.get_event_loop()
 >           loop.run_until_complete(asyncio.gather(*tasks))
 
 nbclient/tests/test_client.py:340: 
 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 /usr/lib64/python3.8/asyncio/base_events.py:616: in run_until_complete
     return future.result()
 nbclient/tests/test_client.py:112: in async_run_notebook
     output_nb = await executor.async_execute()
 nbclient/client.py:535: in async_execute
     await self.async_execute_cell(
 nbclient/client.py:827: in async_execute_cell
     self._check_raise_for_error(cell, exec_reply)
 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 
 self = <nbclient.client.NotebookClient object at 0x7f16c4306040>
 cell = {'cell_type': 'code', 'metadata': {'execution': {'iopub.status.busy': '2035-10-28T18:12:31.520994Z', 'iopub.execute_in...nelse:\n    assert False, "Timed out –\xa0didn\'t get a message from {}".format(other_notebook)', 'execution_count': 3}
 exec_reply = {'buffers': [], 'content': {'ename': 'AssertionError', 'engine_info': {'engine_id': -1, 'engine_uuid': '9e75de9b-82a2-...e, 'engine': '9e75de9b-82a2-465e-b2b7-07eab5d42c43', 'started': '2035-10-28T18:12:31.509561Z', 'status': 'error'}, ...}
 
     def _check_raise_for_error(
             self,
             cell: NotebookNode,
             exec_reply: t.Optional[t.Dict]) -> None:
     
         cell_allows_errors = self.allow_errors or "raises-exception" in cell.metadata.get(
             "tags", []
         )
     
         if self.force_raise_errors or not cell_allows_errors:
             if (exec_reply is not None) and exec_reply['content']['status'] == 'error':
 >               raise CellExecutionError.from_cell_and_msg(cell, exec_reply['content'])
 E               nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
 E               ------------------
 E               start = time.time()
 E               timeout = 5
 E               end = start + timeout
 E               target_file = os.path.join(directory, 'test_file_{}.txt'.format(other_notebook))
 E               while time.time() < end:
 E                   time.sleep(0.1)
 E                   if os.path.exists(target_file):
 E                       with open(target_file, 'r') as f:
 E                           text = f.read()
 E                       if text == 'Hello from {}'.format(other_notebook):
 E                           break
 E               else:
 E                   assert False, "Timed out – didn't get a message from {}".format(other_notebook)
 E               ------------------
 E               
 E               ---------------------------------------------------------------
 E               AssertionError                            Traceback (most recent call last)
 E               <ipython-input-3-b099cd1c75aa> in <module>
 E                    11             break
 E                    12 else:
 E               ---> 13     assert False, "Timed out – didn't get a message from {}".format(other_notebook)
 E               
 E               AssertionError: Timed out – didn't get a message from B
 E               AssertionError: Timed out – didn't get a message from B
 
 nbclient/client.py:735: CellExecutionError
 =============================== warnings summary ===============================
 nbclient/tests/test_client.py::test_startnewkernel_with_kernelmanager
 nbclient/tests/test_client.py::test_start_new_kernel_history_file_setting
   /usr/lib/python3.8/site-packages/jupyter_client/manager.py:362: FutureWarning: Method cleanup(connection_file=True) is deprecated, use cleanup_resources(restart=False).
     warnings.warn("Method cleanup(connection_file=True) is deprecated, use cleanup_resources(restart=False).",
 
 nbclient/tests/test_client.py::TestRunCell::test_deadline_iopub
   /usr/lib64/python3.8/unittest/mock.py:740: RuntimeWarning: coroutine 'make_async.<locals>._' was never awaited
     return object.__setattr__(self, name, value)
 
 nbclient/tests/test_client.py::TestRunCell::test_display_data_message
 nbclient/tests/test_client.py::TestRunCell::test_raises_exception_tag
   /usr/lib64/python3.8/unittest/mock.py:2076: RuntimeWarning: coroutine 'make_async.<locals>._' was never awaited
     self.name = name
 
 nbclient/tests/test_client.py::TestRunCell::test_eventual_deadline_iopub
   /home/abuild/rpmbuild/BUILD/nbclient-0.4.3/nbclient/tests/test_client.py:843: RuntimeWarning: coroutine 'make_async.<locals>._' was never awaited
     message_mock.side_effect = message_seq(list(message_mock.side_effect)[:-1])
 
 nbclient/tests/test_client.py::TestRunCell::test_eventual_deadline_iopub
   /usr/lib64/python3.8/unittest/mock.py:773: RuntimeWarning: coroutine 'make_async.<locals>._' was never awaited
     return object.__setattr__(self, name, value)
 
 nbclient/tests/test_client.py::TestRunCell::test_execute_result_with_display_message
   /usr/lib64/python3.8/enum.py:309: RuntimeWarning: coroutine 'make_async.<locals>._' was never awaited
     return cls.__new__(cls, value)
 
 -- Docs: https://docs.pytest.org/en/stable/warnings.html
 =========================== short test summary info ============================
 FAILED nbclient/tests/test_client.py::test_async_parallel_notebooks - nbclien...
 ====== 1 failed, 71 passed, 1 deselected, 8 warnings in 129.20s (0:02:09) ======

from nbclient.

bmwiedemann avatar bmwiedemann commented on July 26, 2024

Also tested 0.5.0 and in 1 of 2 tries, I got the test_async_parallel_notebooks Timeout.

from nbclient.

MSeal avatar MSeal commented on July 26, 2024

test_async_parallel_notebooks has a known issue rooted in jupyter_client that is unresolved: jupyter/jupyter_client#487. Basically there's a race condition that test are sometimes loosing for port aquisition.

from nbclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.