garf-executors 0.1.3__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {garf_executors-0.1.3 → garf_executors-0.1.5}/PKG-INFO +1 -1
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/__init__.py +1 -1
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/api_executor.py +0 -18
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/entrypoints/cli.py +6 -3
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/executor.py +18 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/sql_executor.py +2 -1
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors.egg-info/PKG-INFO +1 -1
- {garf_executors-0.1.3 → garf_executors-0.1.5}/README.md +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/bq_executor.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/config.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/entrypoints/__init__.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/entrypoints/server.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/entrypoints/tracer.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/entrypoints/utils.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/exceptions.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/execution_context.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/fetchers.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors/telemetry.py +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors.egg-info/SOURCES.txt +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors.egg-info/dependency_links.txt +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors.egg-info/entry_points.txt +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors.egg-info/requires.txt +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/garf_executors.egg-info/top_level.txt +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/pyproject.toml +0 -0
- {garf_executors-0.1.3 → garf_executors-0.1.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: garf-executors
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Executes queries against API and writes data to local/remote storage.
|
|
5
5
|
Author-email: "Google Inc. (gTech gPS CSE team)" <no-reply@google.com>, Andrei Markin <andrey.markin.ppc@gmail.com>
|
|
6
6
|
License: Apache 2.0
|
|
@@ -62,24 +62,6 @@ class ApiQueryExecutor(executor.Executor):
|
|
|
62
62
|
concrete_api_fetcher = fetchers.get_report_fetcher(source)
|
|
63
63
|
return ApiQueryExecutor(concrete_api_fetcher(**fetcher_parameters))
|
|
64
64
|
|
|
65
|
-
async def aexecute(
|
|
66
|
-
self,
|
|
67
|
-
query: str,
|
|
68
|
-
title: str,
|
|
69
|
-
context: ApiExecutionContext,
|
|
70
|
-
) -> str:
|
|
71
|
-
"""Performs query execution asynchronously.
|
|
72
|
-
|
|
73
|
-
Args:
|
|
74
|
-
query: Location of the query.
|
|
75
|
-
title: Name of the query.
|
|
76
|
-
context: Query execution context.
|
|
77
|
-
|
|
78
|
-
Returns:
|
|
79
|
-
Result of writing the report.
|
|
80
|
-
"""
|
|
81
|
-
return await asyncio.to_thread(self.execute, query, title, context)
|
|
82
|
-
|
|
83
65
|
@tracer.start_as_current_span('api.execute')
|
|
84
66
|
def execute(
|
|
85
67
|
self,
|
|
@@ -117,14 +117,17 @@ def main():
|
|
|
117
117
|
enable_cache=args.enable_cache,
|
|
118
118
|
cache_ttl_seconds=args.cache_ttl_seconds,
|
|
119
119
|
)
|
|
120
|
-
if args.parallel_queries:
|
|
120
|
+
if args.parallel_queries and len(args.query) > 1:
|
|
121
121
|
logger.info('Running queries in parallel')
|
|
122
122
|
batch = {query: reader_client.read(query) for query in args.query}
|
|
123
123
|
query_executor.execute_batch(batch, context, args.parallel_threshold)
|
|
124
124
|
else:
|
|
125
|
-
|
|
125
|
+
if len(args.query) > 1:
|
|
126
|
+
logger.info('Running queries sequentially')
|
|
126
127
|
for query in args.query:
|
|
127
|
-
query_executor.execute(
|
|
128
|
+
query_executor.execute(
|
|
129
|
+
query=reader_client.read(query), title=query, context=context
|
|
130
|
+
)
|
|
128
131
|
logging.shutdown()
|
|
129
132
|
|
|
130
133
|
|
|
@@ -50,6 +50,24 @@ class Executor:
|
|
|
50
50
|
)
|
|
51
51
|
)
|
|
52
52
|
|
|
53
|
+
async def aexecute(
|
|
54
|
+
self,
|
|
55
|
+
query: str,
|
|
56
|
+
title: str,
|
|
57
|
+
context: execution_context.ExecutionContext,
|
|
58
|
+
) -> str:
|
|
59
|
+
"""Performs query execution asynchronously.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
query: Location of the query.
|
|
63
|
+
title: Name of the query.
|
|
64
|
+
context: Query execution context.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Result of writing the report.
|
|
68
|
+
"""
|
|
69
|
+
return await asyncio.to_thread(self.execute, query, title, context)
|
|
70
|
+
|
|
53
71
|
async def _run(
|
|
54
72
|
self,
|
|
55
73
|
batch: dict[str, str],
|
|
@@ -25,6 +25,7 @@ except ImportError as e:
|
|
|
25
25
|
|
|
26
26
|
import logging
|
|
27
27
|
import re
|
|
28
|
+
import uuid
|
|
28
29
|
|
|
29
30
|
import pandas as pd
|
|
30
31
|
from garf_core import query_editor, report
|
|
@@ -95,7 +96,7 @@ class SqlAlchemyQueryExecutor(
|
|
|
95
96
|
conn.connection.executescript(query_text)
|
|
96
97
|
results = report.GarfReport()
|
|
97
98
|
else:
|
|
98
|
-
temp_table_name = f'temp_{
|
|
99
|
+
temp_table_name = f'temp_{uuid.uuid4().hex}'
|
|
99
100
|
query_text = f'CREATE TABLE {temp_table_name} AS {query_text}'
|
|
100
101
|
conn.connection.executescript(query_text)
|
|
101
102
|
try:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: garf-executors
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Executes queries against API and writes data to local/remote storage.
|
|
5
5
|
Author-email: "Google Inc. (gTech gPS CSE team)" <no-reply@google.com>, Andrei Markin <andrey.markin.ppc@gmail.com>
|
|
6
6
|
License: Apache 2.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|