Skip to content

Commit

Permalink
Update scenario/bq notebooks and its helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
IonesioJunior committed Sep 25, 2024
1 parent e527318 commit b3d8b15
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions notebooks/scenarios/bigquery/020-configure-api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
" description=\"This endpoint allows to query Bigquery storage via SQL queries.\",\n",
" private_function=private_func,\n",
" mock_function=mock_func,\n",
" worker_pool=this_worker_pool_name,\n",
" worker_pool_name=this_worker_pool_name,\n",
")\n",
"\n",
"high_client.custom_api.add(endpoint=new_endpoint)"
Expand Down Expand Up @@ -376,7 +376,7 @@
" settings={\n",
" \"calls_per_min\": 5,\n",
" },\n",
" worker_pool=this_worker_pool_name,\n",
" worker_pool_name=this_worker_pool_name,\n",
")"
]
},
Expand Down Expand Up @@ -431,7 +431,7 @@
"outputs": [],
"source": [
"submit_query_function = make_submit_query(\n",
" settings={}, worker_pool=this_worker_pool_name\n",
" settings={}, worker_pool_name=this_worker_pool_name\n",
")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
" settings={\n",
" \"calls_per_min\": 5,\n",
" },\n",
" worker_pool=this_worker_pool_name,\n",
" worker_pool_name=this_worker_pool_name,\n",
")"
]
},
Expand Down Expand Up @@ -270,7 +270,7 @@
" description=\"This endpoint allows to query Bigquery storage via SQL queries.\",\n",
" private_function=private_func,\n",
" mock_function=mock_func,\n",
" worker_pool=this_worker_pool_name,\n",
" worker_pool_name=this_worker_pool_name,\n",
")\n",
"\n",
"high_client.custom_api.add(endpoint=new_endpoint)"
Expand Down Expand Up @@ -393,7 +393,7 @@
"outputs": [],
"source": [
"submit_query_function = make_submit_query(\n",
" settings={}, worker_pool=this_worker_pool_name\n",
" settings={}, worker_pool_name=this_worker_pool_name\n",
")"
]
},
Expand Down Expand Up @@ -614,7 +614,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from syft.rate_limiter import is_within_rate_limit


def make_schema(settings: dict, worker_pool: str) -> Callable:
def make_schema(settings: dict, worker_pool_name: str) -> Callable:
updated_settings = {
"calls_per_min": 5,
"rate_limiter_enabled": True,
Expand All @@ -26,7 +26,7 @@ def make_schema(settings: dict, worker_pool: str) -> Callable:
helper_functions=[
is_within_rate_limit
], # Adds ratelimit as this is also a method available to data scientists
worker_pool=worker_pool,
worker_pool_name=worker_pool_name,
)
def live_schema(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .data import schema_dict


def make_schema(settings, worker_pool) -> Callable:
def make_schema(settings, worker_pool_name) -> Callable:
updated_settings = {
"calls_per_min": 5,
"rate_limiter_enabled": True,
Expand All @@ -21,7 +21,7 @@ def make_schema(settings, worker_pool) -> Callable:
description="This endpoint allows for visualising the metadata of tables available in BigQuery.",
settings=updated_settings,
helper_functions=[is_within_rate_limit],
worker_pool=worker_pool,
worker_pool_name=worker_pool_name,
)
def mock_schema(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import syft as sy


def make_submit_query(settings, worker_pool):
updated_settings = {"user_code_worker": worker_pool} | settings
def make_submit_query(settings, worker_pool_name):
updated_settings = {"user_code_worker": worker_pool_name} | settings

@sy.api_endpoint(
path="bigquery.submit_query",
description="API endpoint that allows you to submit SQL queries to run on the private data.",
worker_pool=worker_pool,
worker_pool_name=worker_pool_name,
settings=updated_settings,
)
def submit_query(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
" description=\"This endpoint allows to query Bigquery storage via SQL queries.\",\n",
" private_function=private_func,\n",
" mock_function=mock_func,\n",
" worker_pool=this_worker_pool_name,\n",
" worker_pool_name=this_worker_pool_name,\n",
")\n",
"\n",
"high_client.custom_api.add(endpoint=new_endpoint)"
Expand Down Expand Up @@ -407,7 +407,7 @@
" settings={\n",
" \"calls_per_min\": 5,\n",
" },\n",
" worker_pool=this_worker_pool_name,\n",
" worker_pool_name=this_worker_pool_name,\n",
")"
]
},
Expand Down Expand Up @@ -462,7 +462,7 @@
"outputs": [],
"source": [
"submit_query_function = make_submit_query(\n",
" settings={}, worker_pool=this_worker_pool_name\n",
" settings={}, worker_pool_name=this_worker_pool_name\n",
")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
" description=\"This endpoint allows to query Bigquery storage via SQL queries.\",\n",
" private_function=private_func,\n",
" mock_function=mock_func,\n",
" worker_pool=this_worker_pool_name,\n",
" worker_pool_name=this_worker_pool_name,\n",
")\n",
"\n",
"high_client.custom_api.add(endpoint=new_endpoint)"
Expand Down Expand Up @@ -221,7 +221,7 @@
" settings={\n",
" \"calls_per_min\": 5,\n",
" },\n",
" worker_pool=this_worker_pool_name,\n",
" worker_pool_name=this_worker_pool_name,\n",
")"
]
},
Expand Down Expand Up @@ -282,7 +282,7 @@
"outputs": [],
"source": [
"submit_query_function = make_submit_query(\n",
" settings={}, worker_pool=this_worker_pool_name\n",
" settings={}, worker_pool_name=this_worker_pool_name\n",
")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ..rate_limiter import is_within_rate_limit


def make_schema(settings: dict, worker_pool: str) -> Callable:
def make_schema(settings: dict, worker_pool_name: str) -> Callable:
updated_settings = {
"calls_per_min": 5,
"rate_limiter_enabled": True,
Expand All @@ -28,7 +28,7 @@ def make_schema(settings: dict, worker_pool: str) -> Callable:
helper_functions=[
is_within_rate_limit
], # Adds ratelimit as this is also a method available to data scientists
worker_pool=worker_pool,
worker_pool_name=worker_pool_name,
)
def live_schema(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .data import schema_dict


def make_schema(settings, worker_pool) -> Callable:
def make_schema(settings, worker_pool_name) -> Callable:
updated_settings = {
"calls_per_min": 5,
"rate_limiter_enabled": True,
Expand All @@ -21,7 +21,7 @@ def make_schema(settings, worker_pool) -> Callable:
description="This endpoint allows for visualising the metadata of tables available in BigQuery.",
settings=updated_settings,
helper_functions=[is_within_rate_limit],
worker_pool=worker_pool,
worker_pool_name=worker_pool_name,
)
def mock_schema(
context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import syft as sy


def make_submit_query(settings, worker_pool):
updated_settings = {"user_code_worker": worker_pool} | settings
def make_submit_query(settings, worker_pool_name):
updated_settings = {"user_code_worker": worker_pool_name} | settings

@sy.api_endpoint(
path="bigquery.submit_query",
description="API endpoint that allows you to submit SQL queries to run on the private data.",
worker_pool=worker_pool,
worker_pool_name=worker_pool_name,
settings=updated_settings,
)
def submit_query(
Expand Down

0 comments on commit b3d8b15

Please sign in to comment.