Skip to content

Commit

Permalink
Update sessions.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Fleming committed Jan 17, 2024
1 parent df24b93 commit a3e4169
Showing 1 changed file with 6 additions and 37 deletions.
43 changes: 6 additions & 37 deletions examples/sessions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## show all sessions from the global `SessionManager` instance"
"## Show all sessions from the global `SessionManager` instance"
]
},
{
Expand All @@ -39,7 +39,7 @@
"metadata": {},
"outputs": [],
"source": [
"app.sessions.running()"
"app.sessions.sessions"
]
},
{
Expand Down Expand Up @@ -72,9 +72,7 @@
"metadata": {},
"outputs": [],
"source": [
"app.commands.execute(\n",
" 'console:create', \n",
" app.sessions.current_session)"
"app.commands.execute('console:create', **app.sessions.current_session)"
]
},
{
Expand All @@ -83,42 +81,13 @@
"metadata": {},
"outputs": [],
"source": [
"app.commands.execute(\n",
" 'notebook:create-console', \n",
" {})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Force update session (asynchronous)\n",
"sessions should be updated automatically, you can force a call to `SessionManager.refreshRunning()`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import asyncio\n",
"from ipywidgets import Output\n",
"\n",
"out = Output()\n",
"async def refresh_running():\n",
" await app.sessions.refresh_running()\n",
" sesssions = app.sessions.running()\n",
" out.append_stdout('Session Refreshed')\n",
"\n",
"asyncio.create_task(refresh_running())\n",
"out"
"app.commands.execute('notebook:create-console')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -132,7 +101,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.12.1"
}
},
"nbformat": 4,
Expand Down

0 comments on commit a3e4169

Please sign in to comment.