Exit code 0 with failing C++ notebook

Hello,

When converting the attached notebook (I cannot upload .ipynb format), I am expecting a non-zero exit code since one of the cells errors out. Unfortunately, the following exits with code 0.

jupyter convert --execute cpp_reproducer.ipynb

On the other hand, running a Python notebook which also contains a failing cell, does in fact return a non-zero exit code.

Could anyone please confirm this to be a bug, and if so have a look for a solution? We are using jupyter convert to test our C++ notebooks in a shell script, but currently, any failing notebook goes by undetected. We also use the output html files to upload to our website.

Cheers,
Ahmad

cpp_reproducer.ipynb

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[1minput_line_31:1:10: \u001b[0m\u001b[0;1;31mfatal error: \u001b[0m\u001b[1m'non-existing-header' file not found\u001b[0m\n",
      "#include \"non-existing-header\"\n",
      "\u001b[0;1;32m         ^~~~~~~~~~~~~~~~~~~~~\n",
      "\u001b[0m"
     ]
    }
   ],
   "source": [
    "#include \"non-existing-header\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ROOT C++",
   "language": "c++",
   "name": "root"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".C",
   "mimetype": " text/x-c++src",
   "name": "c++"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}


ROOT Version: 6.18/04
Platform: Ubuntu
Compiler: GCC 9.3


@linev, any ideas?

Hi,

I am not sure that notebook have to return non-zero code in case of failure - there are too many layers in between. But this is rather question for @etejedor

Regards,
Sergey

Wasn’t sure either about that, but one of the contributors to the nbconvert project claims that it is part of the spec to return a non-zero exit code when a cell fails: https://github.com/jupyter/nbconvert/issues/1058

It makes sense to me :grin:

The ROOT C++ kernel is based on metakernel, so it could be an issue in metakernel or a bug in the ROOT C++ kernel itself.

Please open an issue in JIRA:
https://sft.its.cern.ch/jira/projects/ROOT

to follow this up.

OK i made the following bug report: https://sft.its.cern.ch/jira/browse/ROOT-10977

Thank you, much appreciated.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.