garf-executors 0.0.11__py3-none-any.whl → 0.0.12__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.

Potentially problematic release.


This version of garf-executors might be problematic. Click here for more details.

@@ -11,7 +11,7 @@
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
- """Executors to fetch data from various APIS and postprocess them."""
14
+ """Executors to fetch data from various APIs."""
15
15
 
16
16
  from __future__ import annotations
17
17
 
@@ -48,4 +48,4 @@ __all__ = [
48
48
  'ApiExecutionContext',
49
49
  ]
50
50
 
51
- __version__ = '0.0.11'
51
+ __version__ = '0.0.12'
@@ -20,6 +20,7 @@ storage.
20
20
  from __future__ import annotations
21
21
 
22
22
  import argparse
23
+ import logging
23
24
  import sys
24
25
 
25
26
  from garf_io import reader
@@ -38,6 +39,7 @@ def main():
38
39
  parser.add_argument('--input', dest='input', default='file')
39
40
  parser.add_argument('--log', '--loglevel', dest='loglevel', default='info')
40
41
  parser.add_argument('--logger', dest='logger', default='local')
42
+ parser.add_argument('--log-name', dest='log_name', default='garf')
41
43
  parser.add_argument(
42
44
  '--parallel-queries', dest='parallel_queries', action='store_true'
43
45
  )
@@ -57,7 +59,7 @@ def main():
57
59
  print(garf_executors.__version__)
58
60
  sys.exit()
59
61
  logger = utils.init_logging(
60
- loglevel=args.loglevel.upper(), logger_type=args.logger
62
+ loglevel=args.loglevel.upper(), logger_type=args.logger, name=args.log_name
61
63
  )
62
64
  if not args.query:
63
65
  logger.error('Please provide one or more queries to run')
@@ -102,6 +104,7 @@ def main():
102
104
  logger.info('Running queries sequentially')
103
105
  for query in args.query:
104
106
  query_executor.execute(reader_client.read(query), query, context)
107
+ logging.shutdown()
105
108
 
106
109
 
107
110
  if __name__ == '__main__':
@@ -93,6 +93,7 @@ class GarfParamsException(Exception):
93
93
  class LoggerEnum(str, enum.Enum):
94
94
  local = 'local'
95
95
  rich = 'rich'
96
+ gcloud = 'gcloud'
96
97
 
97
98
 
98
99
  def init_logging(
@@ -100,6 +101,7 @@ def init_logging(
100
101
  logger_type: str | LoggerEnum = 'local',
101
102
  name: str = __name__,
102
103
  ) -> logging.Logger:
104
+ loglevel = getattr(logging, loglevel)
103
105
  if logger_type == 'rich':
104
106
  logging.basicConfig(
105
107
  format='%(message)s',
@@ -109,6 +111,23 @@ def init_logging(
109
111
  rich_logging.RichHandler(rich_tracebacks=True),
110
112
  ],
111
113
  )
114
+ elif logger_type == 'gcloud':
115
+ try:
116
+ import google.cloud.logging as glogging
117
+ except ImportError as e:
118
+ raise ImportError(
119
+ 'Please install garf-executors with Cloud logging support - '
120
+ '`pip install garf-executors[bq]`'
121
+ ) from e
122
+
123
+ client = glogging.Client()
124
+ handler = glogging.handlers.CloudLoggingHandler(client, name=name)
125
+ handler.close()
126
+ glogging.handlers.setup_logging(handler, log_level=loglevel)
127
+ logging.basicConfig(
128
+ level=loglevel,
129
+ handlers=[handler],
130
+ )
112
131
  else:
113
132
  logging.basicConfig(
114
133
  format='[%(asctime)s][%(name)s][%(levelname)s] %(message)s',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: garf-executors
3
- Version: 0.0.11
3
+ Version: 0.0.12
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,6 +24,7 @@ Requires-Dist: pydantic
24
24
  Provides-Extra: bq
25
25
  Requires-Dist: garf-io[bq]; extra == "bq"
26
26
  Requires-Dist: pandas; extra == "bq"
27
+ Requires-Dist: google-cloud-logging; extra == "bq"
27
28
  Provides-Extra: sql
28
29
  Requires-Dist: garf-io[sqlalchemy]; extra == "sql"
29
30
  Requires-Dist: pandas; extra == "sql"
@@ -1,4 +1,4 @@
1
- garf_executors/__init__.py,sha256=BqmHrQ1gcaI5qv9ZVhZ9CzFbZ8vEFCk3Qw2SFCy3QHI,1687
1
+ garf_executors/__init__.py,sha256=lJfw7WgJxbHoLYH-QKtaikSkXfKG6ijIhrLLnNoV72Y,1666
2
2
  garf_executors/api_executor.py,sha256=gifws1Kv-k_v3TtRQGn-WJiRQ1yWSyAdOJk38ab-nms,3573
3
3
  garf_executors/bq_executor.py,sha256=yVgncimVLST8_60JMrS5Ain21RFt7K4TR2ePOja5WNA,4858
4
4
  garf_executors/config.py,sha256=TqCzijm1PRvL4p-9Zl-kPkcC1SFKjhgTfKMJFmJW3fQ,1688
@@ -8,11 +8,11 @@ garf_executors/executor.py,sha256=bGTGlWZT5B7I_WIjhuQ0CkL7Dij_ijFCBxuC1jGVkng,16
8
8
  garf_executors/fetchers.py,sha256=Uoolh9L3Na2E6QsrnKV6Pwv5RrCKkcjds5gkDo0IxOw,2128
9
9
  garf_executors/sql_executor.py,sha256=OGUN1AaSi6jC1v4YW0ZmcYXPE5EYfNbBRXrpdf4QTk4,3699
10
10
  garf_executors/entrypoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- garf_executors/entrypoints/cli.py,sha256=eBg1QoJ9ipBIV06wVRuGJEY3a4QJC-k1S_tNB3E-2A4,3969
11
+ garf_executors/entrypoints/cli.py,sha256=JtlK-XG3hZo1G8YXlJU3Mt2BCJm10ehRyB9xJ_yd1M0,4094
12
12
  garf_executors/entrypoints/server.py,sha256=rdxL8uLsdRsQ3tFC3gasCsd06Pm-nZgiwcaaG1q5lHY,2872
13
- garf_executors/entrypoints/utils.py,sha256=IjAu-Q1REQPuYd-gVGKhxai4LLXvlHTmE-FEID038NM,3741
14
- garf_executors-0.0.11.dist-info/METADATA,sha256=g4N7s2psxDh6eCxfHSc7VC2g5vwuvMfSjm4tCbtPOfQ,2649
15
- garf_executors-0.0.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- garf_executors-0.0.11.dist-info/entry_points.txt,sha256=LskWNFIw8j0WJuI18-32OZrlASXAMg1XtrRYwsKBz2E,61
17
- garf_executors-0.0.11.dist-info/top_level.txt,sha256=sP4dCXOENPn1hDFAunjMV8Js4NND_KGeO_gQWuaT0EY,15
18
- garf_executors-0.0.11.dist-info/RECORD,,
13
+ garf_executors/entrypoints/utils.py,sha256=5XiGR2IOxdzAOY0lEWUeUV7tIpKBGRnQaIwBYvzQB7c,4337
14
+ garf_executors-0.0.12.dist-info/METADATA,sha256=UE4gPPj5c44YYooI3nq66yckmskMZDmXZEg1gFBXxCY,2700
15
+ garf_executors-0.0.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ garf_executors-0.0.12.dist-info/entry_points.txt,sha256=LskWNFIw8j0WJuI18-32OZrlASXAMg1XtrRYwsKBz2E,61
17
+ garf_executors-0.0.12.dist-info/top_level.txt,sha256=sP4dCXOENPn1hDFAunjMV8Js4NND_KGeO_gQWuaT0EY,15
18
+ garf_executors-0.0.12.dist-info/RECORD,,