Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/core/garf/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
'ApiReportFetcher',
]

__version__ = '1.0.1'
__version__ = '1.0.2'
8 changes: 7 additions & 1 deletion libs/core/garf/core/report_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ async def afetch(
self,
query_specification: str | query_editor.QuerySpecification,
args: query_editor.GarfQueryParameters | None = None,
title: str | None = None,
**kwargs: str,
) -> report.GarfReport:
"""Asynchronously fetches data from API based on query_specification.
Expand All @@ -130,19 +131,21 @@ async def afetch(
query_specification: Query text that will be passed to API
alongside column_names, customizers and virtual columns.
args: Arguments that need to be passed to the query.
title: Optional title of the query.

Returns:
GarfReport with results of query execution.
"""
return await asyncio.to_thread(
self.fetch, query_specification, args, **kwargs
self.fetch, query_specification, args, title, **kwargs
)

@tracer.start_as_current_span('fetch')
def fetch(
self,
query_specification: str | query_editor.QuerySpecification,
args: query_editor.GarfQueryParameters | None = None,
title: str | None = None,
**kwargs: str,
) -> report.GarfReport:
"""Fetches data from API based on query_specification.
Expand All @@ -151,6 +154,7 @@ def fetch(
query_specification: Query text that will be passed to API
alongside column_names, customizers and virtual columns.
args: Arguments that need to be passed to the query.
title: Optional title of the query.

Returns:
GarfReport with results of query execution.
Expand All @@ -168,6 +172,8 @@ def fetch(
args=args,
)
query = query_specification.generate()
if not query.title:
query.title = title
if query.is_builtin_query:
span.set_attribute('is_builtin_query', True)
if not (builtin_report := self.builtin_queries.get(query.title)):
Expand Down
2 changes: 1 addition & 1 deletion libs/executors/garf/executors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def setup_executor(
'ApiExecutionContext',
]

__version__ = '1.0.3'
__version__ = '1.0.4'
3 changes: 3 additions & 0 deletions libs/executors/garf/executors/api_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from __future__ import annotations

import logging
import pathlib

from garf.core import report_fetcher
from garf.executors import (
Expand Down Expand Up @@ -110,9 +111,11 @@ def execute(
span.set_attribute('query.title', title)
span.set_attribute('query.text', query)
logger.debug('starting query %s', query)
title = pathlib.Path(title).name.split('.')[0]
results = self.fetcher.fetch(
query_specification=query,
args=context.query_parameters,
title=title,
**context.fetcher_parameters,
)
writer_clients = context.writer_clients
Expand Down