garf-executors 0.1.2__tar.gz → 0.1.3__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.2 → garf_executors-0.1.3}/PKG-INFO +1 -1
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/__init__.py +10 -3
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/entrypoints/cli.py +18 -2
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/execution_context.py +2 -2
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors.egg-info/PKG-INFO +1 -1
- {garf_executors-0.1.2 → garf_executors-0.1.3}/README.md +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/api_executor.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/bq_executor.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/config.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/entrypoints/__init__.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/entrypoints/server.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/entrypoints/tracer.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/entrypoints/utils.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/exceptions.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/executor.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/fetchers.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/sql_executor.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors/telemetry.py +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors.egg-info/SOURCES.txt +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors.egg-info/dependency_links.txt +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors.egg-info/entry_points.txt +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors.egg-info/requires.txt +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/garf_executors.egg-info/top_level.txt +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/pyproject.toml +0 -0
- {garf_executors-0.1.2 → garf_executors-0.1.3}/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.3
|
|
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
|
|
@@ -24,7 +24,10 @@ from garf_executors.telemetry import tracer
|
|
|
24
24
|
|
|
25
25
|
@tracer.start_as_current_span('setup_executor')
|
|
26
26
|
def setup_executor(
|
|
27
|
-
source: str,
|
|
27
|
+
source: str,
|
|
28
|
+
fetcher_parameters: dict[str, str | int | bool],
|
|
29
|
+
enable_cache: bool = False,
|
|
30
|
+
cache_ttl_seconds: int = 3600,
|
|
28
31
|
) -> type[executor.Executor]:
|
|
29
32
|
"""Initializes executors based on a source and parameters."""
|
|
30
33
|
if source == 'bq':
|
|
@@ -40,7 +43,11 @@ def setup_executor(
|
|
|
40
43
|
else:
|
|
41
44
|
concrete_api_fetcher = fetchers.get_report_fetcher(source)
|
|
42
45
|
query_executor = ApiQueryExecutor(
|
|
43
|
-
concrete_api_fetcher(
|
|
46
|
+
concrete_api_fetcher(
|
|
47
|
+
**fetcher_parameters,
|
|
48
|
+
enable_cache=enable_cache,
|
|
49
|
+
cache_ttl_seconds=cache_ttl_seconds,
|
|
50
|
+
)
|
|
44
51
|
)
|
|
45
52
|
return query_executor
|
|
46
53
|
|
|
@@ -50,4 +57,4 @@ __all__ = [
|
|
|
50
57
|
'ApiExecutionContext',
|
|
51
58
|
]
|
|
52
59
|
|
|
53
|
-
__version__ = '0.1.
|
|
60
|
+
__version__ = '0.1.3'
|
|
@@ -56,7 +56,17 @@ def main():
|
|
|
56
56
|
parser.add_argument(
|
|
57
57
|
'--parallel-threshold', dest='parallel_threshold', default=10, type=int
|
|
58
58
|
)
|
|
59
|
+
parser.add_argument(
|
|
60
|
+
'--enable-cache', dest='enable_cache', action='store_true'
|
|
61
|
+
)
|
|
62
|
+
parser.add_argument(
|
|
63
|
+
'--cache-ttl-seconds',
|
|
64
|
+
dest='cache_ttl_seconds',
|
|
65
|
+
default=3600,
|
|
66
|
+
type=int,
|
|
67
|
+
)
|
|
59
68
|
parser.set_defaults(parallel_queries=True)
|
|
69
|
+
parser.set_defaults(enable_cache=False)
|
|
60
70
|
parser.set_defaults(dry_run=False)
|
|
61
71
|
args, kwargs = parser.parse_known_args()
|
|
62
72
|
|
|
@@ -79,7 +89,10 @@ def main():
|
|
|
79
89
|
f'No execution context found for source {args.source} in {config_file}'
|
|
80
90
|
)
|
|
81
91
|
query_executor = garf_executors.setup_executor(
|
|
82
|
-
args.source,
|
|
92
|
+
source=args.source,
|
|
93
|
+
fetcher_parameters=context.fetcher_parameters,
|
|
94
|
+
enable_cache=args.enable_cache,
|
|
95
|
+
cache_ttl_seconds=args.cache_ttl_seconds,
|
|
83
96
|
)
|
|
84
97
|
batch = {query: reader_client.read(query) for query in args.query}
|
|
85
98
|
query_executor.execute_batch(batch, context, args.parallel_threshold)
|
|
@@ -99,7 +112,10 @@ def main():
|
|
|
99
112
|
fetcher_parameters=source_parameters,
|
|
100
113
|
)
|
|
101
114
|
query_executor = garf_executors.setup_executor(
|
|
102
|
-
args.source,
|
|
115
|
+
source=args.source,
|
|
116
|
+
fetcher_parameters=context.fetcher_parameters,
|
|
117
|
+
enable_cache=args.enable_cache,
|
|
118
|
+
cache_ttl_seconds=args.cache_ttl_seconds,
|
|
103
119
|
)
|
|
104
120
|
if args.parallel_queries:
|
|
105
121
|
logger.info('Running queries in parallel')
|
|
@@ -42,8 +42,8 @@ class ExecutionContext(pydantic.BaseModel):
|
|
|
42
42
|
query_parameters: query_editor.GarfQueryParameters | None = pydantic.Field(
|
|
43
43
|
default_factory=dict
|
|
44
44
|
)
|
|
45
|
-
fetcher_parameters: dict[str, str | list[str | int]] | None =
|
|
46
|
-
default_factory=dict
|
|
45
|
+
fetcher_parameters: dict[str, str | bool | int | list[str | int]] | None = (
|
|
46
|
+
pydantic.Field(default_factory=dict)
|
|
47
47
|
)
|
|
48
48
|
writer: str | None = None
|
|
49
49
|
writer_parameters: dict[str, str] | None = pydantic.Field(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: garf-executors
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
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
|
|
File without changes
|
|
File without changes
|