Skip to content

Commit

Permalink
Merge pull request #8883 from OpenMined/refactor/syft-error-handling
Browse files Browse the repository at this point in the history
Refactor: syft error handling
  • Loading branch information
koenvanderveen authored Aug 26, 2024
2 parents 2f6a196 + 8dd7b0d commit 755a4db
Show file tree
Hide file tree
Showing 199 changed files with 9,803 additions and 10,644 deletions.
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": false
}
17 changes: 3 additions & 14 deletions notebooks/api/0.8/00-load-data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@
"outputs": [],
"source": [
"# Launch a fresh datasite server named \"test-datasite-1\" in dev mode on the local machine\n",
"server = sy.orchestra.launch(\n",
" name=\"test-datasite-1\", port=\"auto\", dev_mode=True, reset=True\n",
")"
"server = sy.orchestra.launch(name=\"test-datasite-1\", dev_mode=True, reset=True)"
]
},
{
Expand Down Expand Up @@ -609,11 +607,7 @@
},
{
"cell_type": "markdown",
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"metadata": {},
"source": [
"### Reading the Syft Dataset from Datasite Server\n",
"\n",
Expand Down Expand Up @@ -717,11 +711,6 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand All @@ -732,7 +721,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.12.5"
},
"toc": {
"base_numbering": 1,
Expand Down
39 changes: 6 additions & 33 deletions notebooks/api/0.8/01-submit-code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"outputs": [],
"source": [
"# third party\n",
"import pandas as pd\n",
"\n",
"# syft absolute\n",
"import syft as sy\n",
Expand Down Expand Up @@ -222,18 +221,7 @@
"metadata": {},
"outputs": [],
"source": [
"# cannot access the private data\n",
"asset.data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Test\n",
"assert not isinstance(asset.data, pd.DataFrame) # returns a permission error"
"assert asset.data is None"
]
},
{
Expand Down Expand Up @@ -461,7 +449,8 @@
"outputs": [],
"source": [
"# create the same code request with the exact same function should return an error\n",
"result = new_project.create_code_request(sum_trade_value_mil, jane_client)"
"with sy.raises(sy.SyftException, show=True):\n",
" result = new_project.create_code_request(sum_trade_value_mil, jane_client)"
]
},
{
Expand Down Expand Up @@ -537,19 +526,8 @@
},
"outputs": [],
"source": [
"result = jane_client.code.sum_trade_value_mil(trade_data=asset)\n",
"result"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"assert isinstance(result, sy.SyftError)"
"with sy.raises(sy.SyftException, show=True):\n",
" jane_client.code.sum_trade_value_mil(trade_data=asset)"
]
},
{
Expand Down Expand Up @@ -584,11 +562,6 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand All @@ -599,7 +572,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.12.5"
},
"toc": {
"base_numbering": 1,
Expand Down
7 changes: 1 addition & 6 deletions notebooks/api/0.8/02-review-code-and-approve.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,6 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand All @@ -501,7 +496,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.12.5"
},
"toc": {
"base_numbering": 1,
Expand Down
20 changes: 12 additions & 8 deletions notebooks/api/0.8/03-data-scientist-download-result.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@
"As the Syft Function policy requires exact input match, let's get the asset for which we wanted to run our function on."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"datasite_client.datasets"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -189,8 +198,8 @@
},
"outputs": [],
"source": [
"assert isinstance(ops.is_valid, sy.SyftError)\n",
"assert ops.count > 0"
"assert not ops.is_valid\n",
"assert ops.count().unwrap() > 0"
]
},
{
Expand All @@ -216,11 +225,6 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand All @@ -231,7 +235,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.12.5"
},
"toc": {
"base_numbering": 1,
Expand Down
7 changes: 1 addition & 6 deletions notebooks/api/0.8/04-pytorch-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,6 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
Expand All @@ -418,7 +413,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.1.-1"
"version": "3.12.5"
},
"toc": {
"base_numbering": 1,
Expand Down
Loading

0 comments on commit 755a4db

Please sign in to comment.