Skip to content

Commit 04a985e

Browse files
committed
Use SINGLESTOREDB_NOVA_GATEWAY_DEV_BASE_URL
1 parent 988108b commit 04a985e

4 files changed

Lines changed: 5 additions & 11 deletions

File tree

singlestoredb/apps/_config.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def token(self) -> Optional[str]:
7070
class PythonUdfAppConfig:
7171
listen_port: int
7272
base_url: str
73-
base_path: str
7473
running_interactively: bool
7574
is_gateway_enabled: bool
7675

@@ -88,7 +87,6 @@ def _read_variable(name: str) -> str:
8887
def from_env(cls) -> 'AppConfig':
8988
port = cls._read_variable('SINGLESTOREDB_APP_LISTEN_PORT')
9089
base_url = cls._read_variable('SINGLESTOREDB_APP_BASE_URL')
91-
base_path = cls._read_variable('SINGLESTOREDB_APP_BASE_PATH')
9290

9391
workload_type = os.environ.get('SINGLESTOREDB_WORKLOAD_TYPE')
9492
running_interactively = workload_type == 'InteractiveNotebook'
@@ -97,8 +95,7 @@ def from_env(cls) -> 'AppConfig':
9795

9896
if running_interactively:
9997
if is_gateway_enabled:
100-
base_url = cls._read_variable('SINGLESTOREDB_PYTHON_UDF_BASE_URL')
101-
base_path = cls._read_variable('SINGLESTOREDB_PYTHON_UDF_BASE_PATH')
98+
base_url = cls._read_variable('SINGLESTOREDB_NOVA_GATEWAY_DEV_BASE_URL')
10299
else:
103100
raise RuntimeError(
104101
'Running Python UDFs in interactive mode without nova-gateway enabled is not supported'
@@ -107,7 +104,6 @@ def from_env(cls) -> 'AppConfig':
107104
return cls(
108105
listen_port=int(port),
109106
base_url=base_url,
110-
base_path=base_path,
111107
running_interactively=running_interactively,
112108
is_gateway_enabled=is_gateway_enabled,
113109
)

singlestoredb/apps/_python_udfs.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ async def run_udf_app(
3939
# Kill if any other process is occupying the port
4040
kill_process_by_port(app_config.listen_port)
4141

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

4544
config = uvicorn.Config(
4645
app,
@@ -50,12 +49,12 @@ async def run_udf_app(
5049
)
5150
_running_server = AwaitableUvicornServer(config)
5251

52+
# Register the functions
5353
app.register_functions(replace=replace_existing)
5454

5555
asyncio.create_task(_running_server.serve())
5656
await _running_server.wait_for_startup()
5757

5858
connection_info = PythonUdfConnectionInfo(app_config.base_url, app.get_function_info())
5959

60-
6160
return connection_info

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_APP_BASE_URL'],
313+
environ=['SINGLESTOREDB_EXT_FUNC_URL' ],
314314
)
315315

316316
register_option(

singlestoredb/functions/ext/asgi.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,6 @@ def __init__(
649649

650650
else:
651651
alias = funcs.__name__
652-
alias = f'{name_prefix}{alias}{name_suffix}'
653652
external_functions[funcs.__name__] = funcs
654653
alias = f'{name_prefix}{alias}{name_suffix}'
655654
func, info = make_func(alias, funcs)
@@ -702,7 +701,7 @@ async def __call__(
702701
func_info: Dict[str, Any] = {}
703702
if func_endpoint is not None:
704703
func, func_info = func_endpoint
705-
704+
706705
# Call the endpoint
707706
if method == 'POST' and func is not None and path == self.invoke_path:
708707
args_data_format = func_info['args_data_format']

0 commit comments

Comments
 (0)