Skip to content

Commit 23d3b6f

Browse files
committed
rm cells
1 parent 881dbef commit 23d3b6f

File tree

1 file changed

+11
-45
lines changed

1 file changed

+11
-45
lines changed

nbs/02_shell.ipynb

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@
777777
"[{'name': 'stdout',\n",
778778
" 'output_type': 'stream',\n",
779779
" 'text': ['CPU times: user 1 us, sys: 1 us, total: 2 us\\n',\n",
780-
" 'Wall time: 2.15 us\\n']},\n",
780+
" 'Wall time: 3.1 us\\n']},\n",
781781
" {'data': {'text/plain': ['2']},\n",
782782
" 'metadata': {},\n",
783783
" 'output_type': 'execute_result'}]"
@@ -959,48 +959,6 @@
959959
"await s.run_async(\"1+1\")"
960960
]
961961
},
962-
{
963-
"cell_type": "code",
964-
"execution_count": null,
965-
"metadata": {},
966-
"outputs": [
967-
{
968-
"data": {
969-
"text/plain": [
970-
"[{'name': 'stdout', 'output_type': 'stream', 'text': ['no timeout\\n']}]"
971-
]
972-
},
973-
"execution_count": null,
974-
"metadata": {},
975-
"output_type": "execute_result"
976-
}
977-
],
978-
"source": [
979-
"await s.run_async(\"import time; time.sleep(0.1); print('no timeout')\", timeout=1)"
980-
]
981-
},
982-
{
983-
"cell_type": "code",
984-
"execution_count": null,
985-
"metadata": {},
986-
"outputs": [
987-
{
988-
"data": {
989-
"text/plain": [
990-
"['\\x1b[0;31m---------------------------------------------------------------------------\\x1b[0m\\n',\n",
991-
" '\\x1b[0;31mTimeoutError\\x1b[0m Traceback (most recent call last)\\n']"
992-
]
993-
},
994-
"execution_count": null,
995-
"metadata": {},
996-
"output_type": "execute_result"
997-
}
998-
],
999-
"source": [
1000-
"await s.run_async(\"import time; time.sleep(1.1);\", timeout=1)\n",
1001-
"o[0]['text'][:2]"
1002-
]
1003-
},
1004962
{
1005963
"cell_type": "code",
1006964
"execution_count": null,
@@ -1055,7 +1013,11 @@
10551013
"----> 1 import time; time.sleep(1.1)\n",
10561014
"\n",
10571015
"Cell In[6], line 7, in run_cell.<locals>.handler(*args)\n",
1058-
"----> 7 def handler(*args): raise TimeoutError()\n",
1016+
" 5 if not timeout: timeout = self.timeout\n",
1017+
" 6 if timeout:\n",
1018+
"----> 7 def handler(*args): raise TimeoutError()\n",
1019+
" 8 signal.signal(signal.SIGALRM, handler)\n",
1020+
" 9 signal.alarm(timeout)\n",
10591021
"\n",
10601022
"TimeoutError: \n",
10611023
"</code></pre>\n"
@@ -1094,7 +1056,11 @@
10941056
"<span class=\"ansi-green-fg\">----&gt; 1</span> <span class=\"ansi-bold\" style=\"color: rgb(0,135,0)\">import</span> <span class=\"ansi-bold\" style=\"color: rgb(0,0,255)\">time</span>; time<span style=\"color: rgb(98,98,98)\">.</span>sleep(<span style=\"color: rgb(98,98,98)\">1.1</span>)\n",
10951057
"\n",
10961058
"Cell <span class=\"ansi-green-fg\">In[6], line 7</span>, in <span class=\"ansi-cyan-fg\">run_cell.&lt;locals&gt;.handler</span><span class=\"ansi-blue-fg\">(*args)</span>\n",
1097-
"<span class=\"ansi-green-fg\">----&gt; 7</span> <span class=\"ansi-bold\" style=\"color: rgb(0,135,0)\">def</span> <span style=\"color: rgb(0,0,255)\">handler</span>(<span style=\"color: rgb(98,98,98)\">*</span>args): <span class=\"ansi-bold\" style=\"color: rgb(0,135,0)\">raise</span> <span class=\"ansi-bold\" style=\"color: rgb(215,95,95)\">TimeoutError</span>()\n",
1059+
"<span class=\"ansi-green-intense-fg ansi-bold\"> 5</span> <span class=\"ansi-bold\" style=\"color: rgb(0,135,0)\">if</span> <span class=\"ansi-bold\" style=\"color: rgb(175,0,255)\">not</span> timeout: timeout <span style=\"color: rgb(98,98,98)\">=</span> <span style=\"color: rgb(0,135,0)\">self</span><span style=\"color: rgb(98,98,98)\">.</span>timeout\n",
1060+
"<span class=\"ansi-green-intense-fg ansi-bold\"> 6</span> <span class=\"ansi-bold\" style=\"color: rgb(0,135,0)\">if</span> timeout:\n",
1061+
"<span class=\"ansi-green-fg\">----&gt; 7</span> <span class=\"ansi-bold\" style=\"color: rgb(0,135,0)\">def</span> <span style=\"color: rgb(0,0,255)\">handler</span>(<span style=\"color: rgb(98,98,98)\">*</span>args): <span class=\"ansi-bold\" style=\"color: rgb(0,135,0)\">raise</span> <span class=\"ansi-bold\" style=\"color: rgb(215,95,95)\">TimeoutError</span>()\n",
1062+
"<span class=\"ansi-green-intense-fg ansi-bold\"> 8</span> signal<span style=\"color: rgb(98,98,98)\">.</span>signal(signal<span style=\"color: rgb(98,98,98)\">.</span>SIGALRM, handler)\n",
1063+
"<span class=\"ansi-green-intense-fg ansi-bold\"> 9</span> signal<span style=\"color: rgb(98,98,98)\">.</span>alarm(timeout)\n",
10981064
"\n",
10991065
"<span class=\"ansi-red-fg\">TimeoutError</span>: \n",
11001066
"</code></pre>\n"

0 commit comments

Comments
 (0)