Skip to content

Commit

Permalink
[gaarf-py] Ensure that parallel-threshold is always parsed as int in …
Browse files Browse the repository at this point in the history
…CLI tools

Change-Id: I6f9bf56a8d94597a02be4a8463b5b28c63412335
  • Loading branch information
AVMarkin committed Sep 12, 2024
1 parent 062168c commit 1221053
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
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

0 comments on commit 1221053

Please sign in to comment.