Skip to content

Commit 8670d04

Browse files
committed
Fix url
1 parent 317b672 commit 8670d04

3 files changed

Lines changed: 5 additions & 21 deletions

File tree

singlestoredb/apps/_config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ def from_env(cls) -> 'AppConfig':
9999
if is_gateway_enabled:
100100
base_url = cls._read_variable('SINGLESTOREDB_PYTHON_UDF_BASE_URL')
101101
base_path = cls._read_variable('SINGLESTOREDB_PYTHON_UDF_BASE_PATH')
102-
assert base_url is not None
103-
assert base_path is not None
104102
else:
105103
raise RuntimeError(
106104
'Running Python UDFs in interactive mode without nova-gateway enabled is not supported'

singlestoredb/apps/_python_udfs.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import asyncio
2-
import textwrap
32
import typing
4-
import os
53

64
from ._config import PythonUdfAppConfig
75
from ._connection_info import ConnectionInfo, PythonUdfConnectionInfo
@@ -16,6 +14,7 @@
1614

1715

1816
async def run_udf_app(
17+
replace_existing: bool,
1918
log_level: str = 'error',
2019
kill_existing_app_server: bool = True,
2120
) -> ConnectionInfo:
@@ -40,7 +39,7 @@ async def run_udf_app(
4039
# Kill if any other process is occupying the port
4140
kill_process_by_port(app_config.listen_port)
4241

43-
app = Application()
42+
app = Application(url=app_config.base_url)
4443
app.root_path = app_config.base_path
4544

4645
config = uvicorn.Config(
@@ -51,9 +50,7 @@ async def run_udf_app(
5150
)
5251
_running_server = AwaitableUvicornServer(config)
5352

54-
# In interactive mode this should be set to true
55-
replace = app_config.running_interactively
56-
app.register_functions(replace=True)
53+
app.register_functions(replace=replace_existing)
5754

5855
asyncio.create_task(_running_server.serve())
5956
await _running_server.wait_for_startup()

singlestoredb/functions/ext/asgi.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -653,18 +653,6 @@ async def __call__(
653653
if func_endpoint is not None:
654654
func, func_info = func_endpoint
655655

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
667-
668656
# Call the endpoint
669657
if method == 'POST' and func is not None and path == self.invoke_path:
670658
data_format = func_info['data_format']
@@ -708,7 +696,7 @@ async def __call__(
708696
await send(self.text_response_dict)
709697

710698
# Return function info
711-
elif method == 'GET' and path == self.show_function_info_path:
699+
elif method == 'GET' and (path == "" or path == ()):
712700
functions = self.get_function_info()
713701
body = json.dumps(dict(functions=functions)).encode('utf-8')
714702
await send(self.text_response_dict)
@@ -750,6 +738,7 @@ def _locate_app_functions(self, cur: Any) -> Tuple[Set[str], Set[str]]:
750738
"""Locate all current functions and links belonging to this app."""
751739
funcs, links = set(), set()
752740
cur.execute('SHOW FUNCTIONS')
741+
print("List Cur", list(cur))
753742
for name, ftype, _, _, _, link in list(cur):
754743
# Only look at external functions
755744
if 'external' not in ftype.lower():

0 commit comments

Comments
 (0)