Skip to content

Commit

Permalink
Merge changes I1dcf7f33,I6f9bf56a,I3487cefb into main
Browse files Browse the repository at this point in the history
* changes:
  [gaarf-py] Bump gaarf to 1.15.1
  [gaarf-py] Ensure that parallel-threshold is always parsed as int in CLI tools
  Revert "[gaarf-py] Add lazy initialization for GoogleAdsApiClient.ads_service"
  • Loading branch information
AVMarkin authored and Gerrit Code Review committed Sep 12, 2024
2 parents 43fcf1c + 5398fec commit 28b9650
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
10 changes: 1 addition & 9 deletions py/gaarf/api_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
f'google.ads.googleads.{GOOGLE_ADS_API_VERSION}.'
'services.types.google_ads_service'
)
google_ads_service_client = importlib.import_module(
f'google.ads.googleads.{GOOGLE_ADS_API_VERSION}.'
'services.services.google_ads_service.client'
)


@dataclasses.dataclass(frozen=True)
Expand Down Expand Up @@ -285,11 +281,7 @@ def __init__(
path=path_to_config, config_dict=config_dict, yaml_str=yaml_str
)
self.client.use_proto_plus = use_proto_plus

@property
def ads_service(self) -> google_ads_service_client.GoogleAdsServiceClient_:
"""Service for issuing SearchStream requests."""
return self.client.get_service('GoogleAdsService')
self.ads_service = self.client.get_service('GoogleAdsService')

@tenacity.retry(
stop=tenacity.stop_after_attempt(3),
Expand Down
5 changes: 3 additions & 2 deletions py/gaarf/cli/bq.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import argparse
import functools
import sys
from concurrent import futures

from gaarf import bq_executor
Expand Down Expand Up @@ -52,7 +53,7 @@ def main():
'--no-parallel-queries', dest='parallel_queries', action='store_false'
)
parser.add_argument(
'--parallel-threshold', dest='parallel_threshold', default=None
'--parallel-threshold', dest='parallel_threshold', default=None, type=int
)
parser.set_defaults(save_config=False)
parser.set_defaults(dry_run=False)
Expand All @@ -68,7 +69,7 @@ def main():
if main_args.save_config and not main_args.gaarf_config:
utils.ConfigSaver(main_args.save_config_dest).save(config)
if main_args.dry_run:
exit()
sys.exit()

config = utils.initialize_runtime_parameters(config)
logger.debug('initialized config: %s', config)
Expand Down
9 changes: 5 additions & 4 deletions py/gaarf/cli/gaarf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import argparse
import functools
import sys
from collections.abc import MutableSequence
from concurrent import futures
from pathlib import Path
Expand Down Expand Up @@ -75,7 +76,7 @@ def main():
)
parser.add_argument('-v', '--version', dest='version', action='store_true')
parser.add_argument(
'--parallel-threshold', dest='parallel_threshold', default=None
'--parallel-threshold', dest='parallel_threshold', default=None, type=int
)
parser.set_defaults(save_config=False)
parser.set_defaults(parallel_queries=True)
Expand All @@ -89,7 +90,7 @@ def main():

version = pkg_resources.require('google-ads-api-report-fetcher')[0].version
print(f'gaarf version {version}')
exit()
sys.exit()

logger = utils.init_logging(
loglevel=main_args.loglevel.upper(), logger_type=main_args.logger
Expand Down Expand Up @@ -117,7 +118,7 @@ def main():
if main_args.save_config and not main_args.gaarf_config:
utils.ConfigSaver(main_args.save_config_dest).save(config)
if main_args.dry_run:
exit()
sys.exit()

if config.params:
config = utils.initialize_runtime_parameters(config)
Expand Down Expand Up @@ -161,7 +162,7 @@ def main():
config.account,
customer_ids_query,
)
exit()
sys.exit()
writer_client = writer.WriterFactory().create_writer(
config.output, **config.writer_params
)
Expand Down
5 changes: 3 additions & 2 deletions py/gaarf/cli/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import argparse
import functools
import sys
from concurrent import futures

import sqlalchemy
Expand Down Expand Up @@ -51,7 +52,7 @@ def main():
'--no-parallel-queries', dest='parallel_queries', action='store_false'
)
parser.add_argument(
'--parallel-threshold', dest='parallel_threshold', default=None
'--parallel-threshold', dest='parallel_threshold', default=None, type=int
)
parser.set_defaults(save_config=False)
parser.set_defaults(dry_run=False)
Expand All @@ -68,7 +69,7 @@ def main():
if main_args.save_config and not main_args.gaarf_config:
utils.ConfigSaver(main_args.save_config_dest).save(config)
if main_args.dry_run:
exit()
sys.exit()

config = utils.initialize_runtime_parameters(config)
logger.debug('initialized config: %s', config)
Expand Down
2 changes: 1 addition & 1 deletion py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

setuptools.setup(
name='google-ads-api-report-fetcher',
version='1.15.0',
version='1.15.1',
python_requires='>3.8',
description=(
'Library for fetching reports from Google Ads API '
Expand Down

0 comments on commit 28b9650

Please sign in to comment.