garf-executors 0.2.3__py3-none-any.whl → 1.0.2__py3-none-any.whl

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.
Files changed (44) hide show
  1. garf/executors/__init__.py +60 -0
  2. garf/executors/api_executor.py +143 -0
  3. garf/executors/bq_executor.py +177 -0
  4. garf/executors/config.py +52 -0
  5. garf/executors/entrypoints/__init__.py +0 -0
  6. garf/executors/entrypoints/cli.py +177 -0
  7. {garf_executors → garf/executors}/entrypoints/grpc_server.py +5 -6
  8. garf/executors/entrypoints/server.py +117 -0
  9. garf/executors/entrypoints/tracer.py +57 -0
  10. garf/executors/entrypoints/utils.py +140 -0
  11. garf/executors/exceptions.py +17 -0
  12. garf/executors/execution_context.py +117 -0
  13. garf/executors/executor.py +124 -0
  14. garf/executors/fetchers.py +78 -0
  15. garf/executors/query_processor.py +61 -0
  16. garf/executors/sql_executor.py +142 -0
  17. garf/executors/telemetry.py +20 -0
  18. garf/executors/workflow.py +109 -0
  19. garf_executors/__init__.py +9 -44
  20. garf_executors/api_executor.py +9 -121
  21. garf_executors/bq_executor.py +9 -161
  22. garf_executors/config.py +9 -37
  23. garf_executors/entrypoints/__init__.py +25 -0
  24. garf_executors/entrypoints/cli.py +9 -148
  25. garf_executors/entrypoints/grcp_server.py +25 -0
  26. garf_executors/entrypoints/server.py +9 -102
  27. garf_executors/entrypoints/tracer.py +8 -40
  28. garf_executors/entrypoints/utils.py +9 -124
  29. garf_executors/exceptions.py +11 -3
  30. garf_executors/execution_context.py +9 -100
  31. garf_executors/executor.py +9 -108
  32. garf_executors/fetchers.py +9 -63
  33. garf_executors/sql_executor.py +9 -125
  34. garf_executors/telemetry.py +10 -5
  35. garf_executors/workflow.py +8 -79
  36. {garf_executors-0.2.3.dist-info → garf_executors-1.0.2.dist-info}/METADATA +11 -5
  37. garf_executors-1.0.2.dist-info/RECORD +42 -0
  38. garf_executors-1.0.2.dist-info/entry_points.txt +2 -0
  39. {garf_executors-0.2.3.dist-info → garf_executors-1.0.2.dist-info}/top_level.txt +1 -0
  40. garf_executors-0.2.3.dist-info/RECORD +0 -24
  41. garf_executors-0.2.3.dist-info/entry_points.txt +0 -2
  42. {garf_executors → garf/executors}/garf_pb2.py +0 -0
  43. {garf_executors → garf/executors}/garf_pb2_grpc.py +0 -0
  44. {garf_executors-0.2.3.dist-info → garf_executors-1.0.2.dist-info}/WHEEL +0 -0
@@ -11,86 +11,15 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
- from __future__ import annotations
15
14
 
16
- import os
17
- import pathlib
18
15
 
19
- import pydantic
20
- import smart_open
21
- import yaml
16
+ import warnings
22
17
 
23
- from garf_executors.execution_context import ExecutionContext
18
+ from garf.executors.workflow import *
24
19
 
25
-
26
- class QueryPath(pydantic.BaseModel):
27
- """Path file with query."""
28
-
29
- path: str
30
-
31
-
32
- class QueryDefinition(pydantic.BaseModel):
33
- """Definition of a query."""
34
-
35
- query: Query
36
-
37
-
38
- class Query(pydantic.BaseModel):
39
- """Query elements.
40
-
41
- Attributes:
42
- text: Query text.
43
- title: Name of the query.
44
- """
45
-
46
- text: str
47
- title: str
48
-
49
-
50
- class ExecutionStep(ExecutionContext):
51
- """Common context for executing one or more queries.
52
-
53
- Attributes:
54
- fetcher: Name of a fetcher to get data from API.
55
- alias: Optional alias to identify execution step.
56
- queries: Queries to run for a particular fetcher.
57
- context: Execution context for queries and fetcher.
58
- """
59
-
60
- fetcher: str | None = None
61
- alias: str | None = None
62
- queries: list[QueryPath | QueryDefinition] | None = None
63
-
64
- @property
65
- def context(self) -> ExecutionContext:
66
- return ExecutionContext(
67
- writer=self.writer,
68
- writer_parameters=self.writer_parameters,
69
- query_parameters=self.query_parameters,
70
- fetcher_parameters=self.fetcher_parameters,
71
- )
72
-
73
-
74
- class Workflow(pydantic.BaseModel):
75
- """Orchestrates execution of queries for multiple fetchers.
76
-
77
- Attributes:
78
- steps: Contains one or several fetcher executions.
79
- """
80
-
81
- steps: list[ExecutionStep]
82
-
83
- @classmethod
84
- def from_file(cls, path: str | pathlib.Path | os.PathLike[str]) -> Workflow:
85
- """Builds workflow from local or remote yaml file."""
86
- with smart_open.open(path, 'r', encoding='utf-8') as f:
87
- data = yaml.safe_load(f)
88
- return Workflow(steps=data.get('steps'))
89
-
90
- def save(self, path: str | pathlib.Path | os.PathLike[str]) -> str:
91
- """Saves workflow to local or remote yaml file."""
92
- with smart_open.open(path, 'w', encoding='utf-8') as f:
93
- yaml.dump(
94
- self.model_dump(exclude_none=True).get('steps'), f, encoding='utf-8'
95
- )
96
- return f'Workflow is saved to {str(path)}'
20
+ warnings.warn(
21
+ "The 'garf_executors' namespace is deprecated. "
22
+ "Please use 'garf.executors' instead.",
23
+ DeprecationWarning,
24
+ stacklevel=2,
25
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: garf-executors
3
- Version: 0.2.3
3
+ Version: 1.0.2
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
@@ -17,8 +17,8 @@ Classifier: Operating System :: OS Independent
17
17
  Classifier: License :: OSI Approved :: Apache Software License
18
18
  Requires-Python: >=3.9
19
19
  Description-Content-Type: text/markdown
20
- Requires-Dist: garf-core
21
- Requires-Dist: garf-io
20
+ Requires-Dist: garf-core>=1.0.0
21
+ Requires-Dist: garf-io>=1.0.0
22
22
  Requires-Dist: pyyaml
23
23
  Requires-Dist: pydantic
24
24
  Requires-Dist: opentelemetry-api
@@ -68,8 +68,14 @@ garf <QUERIES> --source <API_SOURCE> \
68
68
  where
69
69
 
70
70
  * `<QUERIES>`- local or remote path(s) to files with queries.
71
- * `<API_SOURCE>`- type of API to use. Based on that the appropriate report fetcher will be initialized.
72
- * `<OUTPUT_TYPE>` - output supported by [`garf-io` library](../garf_io/README.md).
71
+ * `source`- type of API to use. Based on that the appropriate report fetcher will be initialized. Explore supported APIs [here](https://google.github.io/garf/fetchers/overview/)
72
+ * `output` - output supported by [`garf-io` library](https://google.github.io/garf/usage/writers/).
73
73
 
74
74
  If your report fetcher requires additional parameters you can pass them via key value pairs under `--source.` argument, i.e.`--source.regionCode='US'` - to get data only from *US*.
75
75
  > Concrete `--source` parameters are dependent on a particular report fetcher and should be looked up in a documentation for this fetcher.
76
+
77
+ ## Documentation
78
+
79
+ Explore full documentation working with `garf-executors`
80
+
81
+ * [Documentation](https://google.github.io/garf/usage/executors/)
@@ -0,0 +1,42 @@
1
+ garf/executors/__init__.py,sha256=dO6T9Z9Q5zc3BszqaTQE8fK5weyV_RTmj8ElV0mUFhQ,1941
2
+ garf/executors/api_executor.py,sha256=bLhG9FLgAfdO16BW22YhAq0SXY8c-WuNW13e6bUu_VE,4380
3
+ garf/executors/bq_executor.py,sha256=f5jQllFAE3b_ajQlosZfecovnrIDfyOAO-k8_AjzRqQ,5774
4
+ garf/executors/config.py,sha256=w5g9EYabPtK-6CPl3G87owUvBiqi0_r_aeAwISpK-zw,1720
5
+ garf/executors/exceptions.py,sha256=U_7Q2ZMOUf89gzZd2pw7y3g7i1NeByPPKfpZ3q7p3ZU,662
6
+ garf/executors/execution_context.py,sha256=us_S-x2jsJOBo4Vm78DhCgcgnu_HPc-f9-q_XI_eowU,3840
7
+ garf/executors/executor.py,sha256=SpPONsYHO49WbZ2HRjTKujrNH64BbrSfKcZSn4Dcd6o,3830
8
+ garf/executors/fetchers.py,sha256=Jtdl9A2G4xEM-pnUg_fWv3cltcMpM7JjdTcLeJK5AVY,2604
9
+ garf/executors/garf_pb2.py,sha256=mYvBYcAnZtyDflXGN2GZLM2KM0Nv9hoJs55zfQU_l1o,2564
10
+ garf/executors/garf_pb2_grpc.py,sha256=w8D_r3wpj1ZZstkIFogY679-lSCcL2iZQ4QLO8IfToY,3359
11
+ garf/executors/query_processor.py,sha256=xCTkm2V0iMfsjJ0ydwyVRFFiZh1ilhJKzglYlReRKAk,2250
12
+ garf/executors/sql_executor.py,sha256=Z1E7aL9HiYcqfUJMuESlu4iZjVy5hNMvplu2hLotK9I,4780
13
+ garf/executors/telemetry.py,sha256=wLWAdJZmGinffIMv5FZNKaAUusgACTvokwhMFz2UCQ0,747
14
+ garf/executors/workflow.py,sha256=WFsTV916mw_DsWttrLc8tNnDl0vwJAQwVlIHRdNaNDw,3007
15
+ garf/executors/entrypoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ garf/executors/entrypoints/cli.py,sha256=8vk8jElesqqn0q2Te3v6W1V-kts-28N5sncovaZqq3o,6699
17
+ garf/executors/entrypoints/grpc_server.py,sha256=__y2uR2pwlnYy1YFm-2EjFYxBKZmN1a9XY9MNsfrhag,2295
18
+ garf/executors/entrypoints/server.py,sha256=vXGz-f7C1aweaMNJTJEjZLIg42d0T01HPG_lxlj-FPs,3472
19
+ garf/executors/entrypoints/tracer.py,sha256=-UM1RNtW90jFsQiavVzhIWzB3cOCTcCwc6v7YIVflDk,1912
20
+ garf/executors/entrypoints/utils.py,sha256=5XiGR2IOxdzAOY0lEWUeUV7tIpKBGRnQaIwBYvzQB7c,4337
21
+ garf_executors/__init__.py,sha256=5Ol67ktUcC0q5d5pGblYfdlAsraJC-Gcr2U0uCN6rSs,772
22
+ garf_executors/api_executor.py,sha256=lmrPn6aheryM2jLRL2enU8GuKVUod3kEVkMYgjXn5EM,785
23
+ garf_executors/bq_executor.py,sha256=wQ8pd4d6dMByHtYl_i-FbebPKO5WRcvC_y9asG8H3Zk,784
24
+ garf_executors/config.py,sha256=3MXFdB3HAAdiBM58GmFA6HM6LcaA28mskUd5XUvJ5QM,779
25
+ garf_executors/exceptions.py,sha256=iBnO93AZRlmy_lo67ufQ67kv2FpBemu9VgDbwZx5b_s,783
26
+ garf_executors/execution_context.py,sha256=l5l5q8gPFNppOJ8q8TZfaaIEXmashTDu4denoGwMkpU,790
27
+ garf_executors/executor.py,sha256=0OPHePl_UG5k5o8UDid0HPu5QBCHnKFKvKv7vyx0LwE,781
28
+ garf_executors/fetchers.py,sha256=ayRzEp2-JvRhdkEmec10IKwX5SF25t6o03H1b9t5K3U,781
29
+ garf_executors/sql_executor.py,sha256=qhk5nZEq2a8QBvriiMWCE18xTQ29CSBQ7YPZ4Mr5DNA,785
30
+ garf_executors/telemetry.py,sha256=ncQ39dAE1tG0xKcyPAgEW8__0MhCSiBphZhisXeWp9k,782
31
+ garf_executors/workflow.py,sha256=vsxfjJVePu1NtWnVhCitMP_IZ-fcc9_H4fZS818_b70,781
32
+ garf_executors/entrypoints/__init__.py,sha256=DNA_m3MeyN10t8iSvhWjdlksR1GgIr-Wmy4Yuba5S3M,808
33
+ garf_executors/entrypoints/cli.py,sha256=Jaq46VnzltGMqJq9U6_3E3e_sC21VOon52gPYIrI8nY,812
34
+ garf_executors/entrypoints/grcp_server.py,sha256=HiYsfk31OgkPA4jcED3htJGidkRZH5NQIpkncVMCStk,820
35
+ garf_executors/entrypoints/server.py,sha256=JZCklhqx74PIhc4GIoOr2nNZz9n7QCfIm_vGyd3Q3dQ,815
36
+ garf_executors/entrypoints/tracer.py,sha256=JlDSgeDP0Q5Lk_pZLASDXPgZCPaKkWqZgaWOQ7JB-Bs,815
37
+ garf_executors/entrypoints/utils.py,sha256=iF-LBfKjrAhEW6HShh69RCPWVPC4Rf8iV5JEYSMhsx0,814
38
+ garf_executors-1.0.2.dist-info/METADATA,sha256=zNOfNeIWJiEoaWz2ONVf0gQeVRc5q6DM8CxnUxmoB90,3303
39
+ garf_executors-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
40
+ garf_executors-1.0.2.dist-info/entry_points.txt,sha256=0IBZun3_hC4HYU-1krlbjTArZym3phu4jxYXs809ilw,61
41
+ garf_executors-1.0.2.dist-info/top_level.txt,sha256=UaHdWdgQhbiHyRzpYC-vW3Q7pdgbxXvTTBvDA655Jq4,20
42
+ garf_executors-1.0.2.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ garf = garf.executors.entrypoints.cli:main
@@ -1,24 +0,0 @@
1
- garf_executors/__init__.py,sha256=wZdLw0WyAGEK1y0Fdagvdd5xOWNKaPvL95yuaYziIWE,1941
2
- garf_executors/api_executor.py,sha256=IKYI1TK2HI2njxw7_X9n78wAQ1briAXxbA15Ybmt6nA,4295
3
- garf_executors/bq_executor.py,sha256=HKFBg4PhIaKM_SvjQy-ZbP7AsrsAF1FIj_w9gRqdICA,5756
4
- garf_executors/config.py,sha256=rZTAuBEa-Loi3DSamXFTjFQXHdeYJv71WOEbLLeo3l4,1721
5
- garf_executors/exceptions.py,sha256=U_7Q2ZMOUf89gzZd2pw7y3g7i1NeByPPKfpZ3q7p3ZU,662
6
- garf_executors/execution_context.py,sha256=WhHoN60vyeBUJbdjtOEZC1vUEyLwnIzBHbhT8co3yhs,3850
7
- garf_executors/executor.py,sha256=tobjdlOaAsc-nKLFSW-3qib5-ca6aHs5iw3Gn0sD72Y,3762
8
- garf_executors/fetchers.py,sha256=0bYurZs5jzxfGP9BgDnifdM6yRFvyCtKO-i3hFb5T5A,2605
9
- garf_executors/garf_pb2.py,sha256=mYvBYcAnZtyDflXGN2GZLM2KM0Nv9hoJs55zfQU_l1o,2564
10
- garf_executors/garf_pb2_grpc.py,sha256=w8D_r3wpj1ZZstkIFogY679-lSCcL2iZQ4QLO8IfToY,3359
11
- garf_executors/sql_executor.py,sha256=80WiuNBBWQz1y19LmWrzSk6auFFqh6YHBPTkFAGIhMs,4681
12
- garf_executors/telemetry.py,sha256=P75klGEoYgJ_-pR-izUIQ7B88ufskQ4vmW1rETg63Nc,747
13
- garf_executors/workflow.py,sha256=9Hkv0NgNyV5_xkkCTS6nsDVqtCmHfbqLQvdaIzFBrLU,2614
14
- garf_executors/entrypoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- garf_executors/entrypoints/cli.py,sha256=Kei2Tqdw1syPKhbeK5u-1G72hXgmo1arXmxio150jPE,6006
16
- garf_executors/entrypoints/grpc_server.py,sha256=zP9C-dStbElWkb0T_IcIAcBxmA9Wl4GTWytUcrC_7Xg,2296
17
- garf_executors/entrypoints/server.py,sha256=FbemRjrGDgpr51iAMXdvTXlP1OG7Rc5i5M55Prw0wXg,3473
18
- garf_executors/entrypoints/tracer.py,sha256=VylQMIXOsRLuT3UlFwjRy8GJiPUI6zohUXiGX_DcE4g,1912
19
- garf_executors/entrypoints/utils.py,sha256=5XiGR2IOxdzAOY0lEWUeUV7tIpKBGRnQaIwBYvzQB7c,4337
20
- garf_executors-0.2.3.dist-info/METADATA,sha256=96n_J13NrBFbfz2-fVYo0KlD5p9r7qO8AQ3R_K2V710,3055
21
- garf_executors-0.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- garf_executors-0.2.3.dist-info/entry_points.txt,sha256=LskWNFIw8j0WJuI18-32OZrlASXAMg1XtrRYwsKBz2E,61
23
- garf_executors-0.2.3.dist-info/top_level.txt,sha256=sP4dCXOENPn1hDFAunjMV8Js4NND_KGeO_gQWuaT0EY,15
24
- garf_executors-0.2.3.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- garf = garf_executors.entrypoints.cli:main
File without changes
File without changes