diff --git a/libs/executors/garf/executors/entrypoints/server.py b/libs/executors/garf/executors/entrypoints/server.py index 5d2d839..5db161d 100644 --- a/libs/executors/garf/executors/entrypoints/server.py +++ b/libs/executors/garf/executors/entrypoints/server.py @@ -13,6 +13,7 @@ # limitations under the License. """FastAPI endpoint for executing queries.""" + from __future__ import annotations import pathlib @@ -108,7 +109,7 @@ async def info() -> dict[str, str]: @app.get('/api/fetchers') async def get_fetchers() -> list[str]: """Shows all available API sources.""" - return list(garf.executors.fetchers.find_fetchers()) + return list(garf.executors.setup.find_executors()) @app.post('/api/execute') @@ -177,7 +178,7 @@ def execute_workflow( ) async def execute_workflow_task( workflow_file: Optional[fastapi.UploadFile] = fastapi.File(None), - workflow_path: str | pathlib.Path = None, + workflow_path: str | pathlib.Path = None, config_file: Optional[fastapi.UploadFile] = fastapi.File(None), config_path: str | pathlib.Path = None, selected_aliases: Optional[list[str]] = None, diff --git a/libs/executors/garf/executors/entrypoints/typer_cli.py b/libs/executors/garf/executors/entrypoints/typer_cli.py index 7d8bfc9..104f778 100644 --- a/libs/executors/garf/executors/entrypoints/typer_cli.py +++ b/libs/executors/garf/executors/entrypoints/typer_cli.py @@ -39,6 +39,7 @@ TraceContextTextMapPropagator, ) from rich.console import Console +from rich.table import Table from typing_extensions import Annotated LoggingInstrumentor().instrument(set_logging_format=False) @@ -47,7 +48,7 @@ FetcherEnum = enum.Enum( 'FetcherEnum', - ((f, f) for f in sorted(garf.executors.fetchers.find_fetchers())), + ((f, f) for f in sorted(setup.find_executors())), ) initialize_tracer() @@ -385,8 +386,8 @@ def deploy( @typer_app.command() def fetchers() -> set[str]: """Displays all available fetchers.""" - table = rich.table.Table('Fetcher') - for fetcher in garf.executors.fetchers.find_fetchers(): + table = Table('Fetcher') + for fetcher in setup.find_executors(): table.add_row(fetcher) console.print(table) diff --git a/libs/executors/garf/executors/setup.py b/libs/executors/garf/executors/setup.py index 784c032..9ba6a5e 100644 --- a/libs/executors/garf/executors/setup.py +++ b/libs/executors/garf/executors/setup.py @@ -28,6 +28,12 @@ logger = logging.getLogger('garf.executors.setup') +def find_executors() -> set[str]: + available_fetchers = fetchers.find_fetchers() + available_executors = {'bq', 'duckdb', 'opensearch', 'sqldb', 'elasticsearch'} + return sorted(available_fetchers | available_executors) + + @tracer.start_as_current_span('executor.setup') def setup_executor( source: str,