Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stateful Notebooks #9298

Merged
merged 42 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1c33ce5
initial implementation of checkpoint state
shubham3121 Sep 17, 2024
6ab466e
Merge branch 'dev' into shubham/notebooks-with-state
shubham3121 Sep 17, 2024
3ea39c7
Merge branch 'dev' into shubham/notebooks-with-state
shubham3121 Sep 18, 2024
78f3cdb
clean up code
shubham3121 Sep 18, 2024
c8ee04f
Merge branch 'dev' into shubham/notebooks-with-state
shubham3121 Sep 20, 2024
2db9c38
move checkpoint to syft util test_helpers
shubham3121 Sep 20, 2024
ab13b9b
Merge branch 'dev' into shubham/notebooks-with-state
shubham3121 Sep 20, 2024
972649a
add an API for database reset
shubham3121 Sep 23, 2024
1b5b083
disable reset database API
shubham3121 Sep 24, 2024
ec25150
update scenario notebooks with checkpoint
shubham3121 Sep 24, 2024
66552da
update load checkpoint to prune initial pools and images
shubham3121 Sep 25, 2024
c4501e2
Merge branch 'dev' into shubham/notebooks-with-state
shubham3121 Sep 25, 2024
859a602
fix argument name in load_checkpoint
shubham3121 Sep 25, 2024
c7a24e0
fix checkpoint path if not running from notebook
shubham3121 Sep 25, 2024
ed74096
extract notebook name from pytest environment if running in pytest
shubham3121 Sep 26, 2024
ce02a8d
Merge branch 'dev' into shubham/notebooks-with-state
shubham3121 Sep 26, 2024
c7e12ec
add ability to reset and load migrated data with custom worker pools
rasswanth-s Sep 26, 2024
8aa464a
fix worker pool list
rasswanth-s Sep 26, 2024
a43ef8a
Change env imports paths in grid/server.py
rasswanth-s Sep 26, 2024
580805f
Fix load_migration_data to separate out reset db
rasswanth-s Sep 26, 2024
3d4350b
Merge pull request #9320 from OpenMined/rasswanth/exp-reset-checkpoint
rasswanth-s Sep 26, 2024
0bed0a1
pass root email and pwd to load checkpoint in scenario notebooks
shubham3121 Sep 26, 2024
b81affb
fix security bugs
shubham3121 Sep 26, 2024
44751d5
fix uid mismatch when external uid is passed via values.yml in k8s
shubham3121 Sep 26, 2024
79c2271
update tags to latest in devspace
shubham3121 Sep 27, 2024
7c461ff
Merge branch 'dev' into shubham/notebooks-with-state
shubham3121 Sep 27, 2024
43a70ad
fix worker image.get_all API not returning all images
shubham3121 Sep 27, 2024
17327d8
add few more prints
shubham3121 Sep 27, 2024
e429570
Merge branch 'dev' into shubham/notebooks-with-state
shubham3121 Sep 27, 2024
69de9a7
fix lint
shubham3121 Sep 27, 2024
97c5cd1
fix pytest
shubham3121 Sep 27, 2024
5771b49
fix api/notebooks 11-container
shubham3121 Sep 27, 2024
67d651d
checkpoint can load other checkpoint folder apart from last checkpoint
shubham3121 Sep 28, 2024
8ffbdf8
Merge branch 'dev' into shubham/notebooks-with-state
shubham3121 Sep 30, 2024
eb6cc1e
remove startup overwrite logic
shubham3121 Sep 30, 2024
73b581a
remove reset from 001 scale notebook
shubham3121 Sep 30, 2024
63b5684
remove checkpoint relation with jupyter
rasswanth-s Sep 30, 2024
9e98cf4
use devspace timestamp tag for backend
shubham3121 Sep 30, 2024
bc23abc
remove unused method from db stash
shubham3121 Sep 30, 2024
1487d07
Merge branch 'shubham/notebooks-with-state' into rasswanth/remove-nam…
shubham3121 Sep 30, 2024
f7a2e20
update notebooks with new checkpoint function names
rasswanth-s Oct 1, 2024
1c260e8
Merge pull request #9331 from OpenMined/rasswanth/remove-name-input
rasswanth-s Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions notebooks/api/0.8/11-container-images-k8s.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,7 @@
"assert workerimage is not None, str([image.__dict__ for image in image_list])\n",
"assert workerimage.is_built is not None, str(workerimage)\n",
"assert workerimage.built_at is not None, str(workerimage)\n",
"assert workerimage.image_hash is not None, str(workerimage)\n",
"assert image_list[workerimage.built_image_tag] == workerimage"
rasswanth-s marked this conversation as resolved.
Show resolved Hide resolved
"assert workerimage.image_hash is not None, str(workerimage)"
]
},
{
Expand Down Expand Up @@ -1037,10 +1036,6 @@
"assert workerimage_opendp.built_at is not None, str(workerimage_opendp.__dict__)\n",
"assert workerimage_opendp.image_hash is not None, str(workerimage_opendp.__dict__)\n",
"\n",
"assert _images[workerimage_opendp.built_image_tag] == workerimage_opendp, str(\n",
rasswanth-s marked this conversation as resolved.
Show resolved Hide resolved
" workerimage_opendp\n",
")\n",
"\n",
"workerimage_opendp"
]
},
Expand Down Expand Up @@ -1394,6 +1389,11 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "syft-3.11",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand All @@ -1404,7 +1404,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.5"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"\n",
"# syft absolute\n",
"import syft as sy\n",
"from syft.util.test_helpers.checkpoint import create_checkpoint\n",
"from syft.util.test_helpers.email_helpers import get_email_server"
]
},
Expand Down Expand Up @@ -87,6 +88,15 @@
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"root_client.users"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -195,6 +205,15 @@
"# Cleanup"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"create_checkpoint(root_client)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -223,7 +242,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -237,7 +256,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
85 changes: 58 additions & 27 deletions notebooks/scenarios/bigquery/001-scale-delete-worker-pools.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
"source": [
"# stdlib\n",
"import os\n",
"from os import environ as env\n",
"\n",
"# syft absolute\n",
"import syft as sy\n",
"from syft.util.test_helpers.checkpoint import load_from_checkpoint\n",
"from syft.util.test_helpers.email_helpers import Timeout\n",
"from syft.util.test_helpers.email_helpers import get_email_server"
]
Expand All @@ -46,17 +48,29 @@
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {},
"outputs": [],
"source": [
"# in case we are not in k8s we set them here for orchestra to use\n",
"env[\"DEFAULT_ROOT_EMAIL\"] = ROOT_EMAIL\n",
"env[\"DEFAULT_ROOT_PASSWORD\"] = ROOT_PASSWORD"
]
},
{
"cell_type": "markdown",
"id": "4",
"metadata": {},
"source": [
"### Launch server & login"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4",
"id": "5",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -67,13 +81,30 @@
" port=\"8080\",\n",
" n_consumers=num_workers, # How many workers to be spawned\n",
" create_producer=True, # Can produce more workers\n",
" reset=True,\n",
rasswanth-s marked this conversation as resolved.
Show resolved Hide resolved
" log_level=10,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"id": "6",
"metadata": {},
"outputs": [],
"source": [
"load_from_checkpoint(\n",
" prev_nb_filename=\"000-start-and-configure-server-and-admins\",\n",
" client=server.client,\n",
" root_email=ROOT_EMAIL,\n",
" root_password=ROOT_PASSWORD,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -83,7 +114,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"id": "8",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -95,7 +126,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"id": "9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -105,7 +136,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8",
"id": "10",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -115,15 +146,15 @@
},
{
"cell_type": "markdown",
"id": "9",
"id": "11",
"metadata": {},
"source": [
"### Scale Worker pool"
]
},
{
"cell_type": "markdown",
"id": "10",
"id": "12",
"metadata": {},
"source": [
"##### Scale up"
Expand All @@ -132,7 +163,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"id": "13",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -146,7 +177,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "12",
"id": "14",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -156,7 +187,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"id": "15",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -176,7 +207,7 @@
},
{
"cell_type": "markdown",
"id": "14",
"id": "16",
"metadata": {},
"source": [
"##### Scale down"
Expand All @@ -185,7 +216,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "15",
"id": "17",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -200,7 +231,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "16",
"id": "18",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -219,7 +250,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "17",
"id": "19",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -232,7 +263,7 @@
},
{
"cell_type": "markdown",
"id": "18",
"id": "20",
"metadata": {},
"source": [
"#### Delete Worker Pool"
Expand All @@ -241,7 +272,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "19",
"id": "21",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -254,7 +285,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "20",
"id": "22",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -264,7 +295,7 @@
},
{
"cell_type": "markdown",
"id": "21",
"id": "23",
"metadata": {},
"source": [
"#### Re-launch the default worker pool"
Expand All @@ -273,7 +304,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "22",
"id": "24",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -283,7 +314,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "23",
"id": "25",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -297,7 +328,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "24",
"id": "26",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -311,7 +342,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "25",
"id": "27",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -321,7 +352,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "26",
"id": "28",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -331,15 +362,15 @@
{
"cell_type": "code",
"execution_count": null,
"id": "27",
"id": "29",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "syft",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -353,7 +384,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
Loading
Loading