Skip to content

Commit 2875760

Browse files
committed
wip
1 parent af01a31 commit 2875760

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

singlestoredb/apps/_python_udfs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
async def run_udf_app(
1818
app: Application,
1919
log_level: str = 'error',
20-
kill_existing_app_server: bool = True,
20+
kill_existing_app_server: bool = False,
2121
) -> ConnectionInfo:
2222
global _running_server
2323
from ._uvicorn_util import AwaitableUvicornServer
@@ -42,6 +42,8 @@ async def run_udf_app(
4242

4343
app.root_path = app_config.base_path
4444

45+
print("Listening on port", app_config.listen_port)
46+
4547
config = uvicorn.Config(
4648
app,
4749
host='0.0.0.0',

singlestoredb/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
register_option(
311311
'external_function.url', 'string', check_str, 'http://localhost:8000/invoke',
312312
'Specifies the URL of the external function application.',
313-
environ=['SINGLESTOREDB_EXT_FUNC_URL'],
313+
environ=['SINGLESTOREDB_APP_BASE_URL'],
314314
)
315315

316316
register_option(

singlestoredb/functions/ext/asgi.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ def __init__(
500500
]
501501
] = None,
502502
app_mode: str = get_option('external_function.app_mode'),
503-
url: str = get_option('external_function.url'),
503+
url: str = get_option('external_function.url') + "invoke",
504504
data_format: str = get_option('external_function.data_format'),
505505
data_version: str = get_option('external_function.data_version'),
506506
link_name: Optional[str] = get_option('external_function.link_name'),
@@ -652,6 +652,18 @@ async def __call__(
652652
func_info: Dict[str, Any] = {}
653653
if func_endpoint is not None:
654654
func, func_info = func_endpoint
655+
656+
if method == 'GET' and (path == () or path == ""):
657+
await send({
658+
'type': 'http.response.start',
659+
'status': 200,
660+
'headers': [(b'content-type', b'text/plain')],
661+
})
662+
await send({
663+
'type': 'http.response.body',
664+
'body': b'Server is alive!',
665+
})
666+
return
655667

656668
# Call the endpoint
657669
if method == 'POST' and func is not None and path == self.invoke_path:
@@ -884,6 +896,7 @@ def register_functions(
884896
for link in links:
885897
cur.execute(f'DROP LINK {link}')
886898
for func in self.get_create_functions(replace=replace):
899+
print("FUNC: ", func)
887900
cur.execute(func)
888901

889902
def drop_functions(

0 commit comments

Comments
 (0)