From 4fcb71b90c83678dbbdf442f8ad046a49d476c76 Mon Sep 17 00:00:00 2001 From: "Hieber, Felix" Date: Fri, 3 Nov 2017 11:14:27 +0100 Subject: [PATCH] Rename --chunk-size from translate_remote to --aws-batch-chunk-size to avoid conflict with newly introduced --chunk-size flag from translate.py cr https://cr.amazon.com/r/7923132/ --- sockeye/translate_remote.py | 6 +++--- sockeye/utils_remote.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sockeye/translate_remote.py b/sockeye/translate_remote.py index 060c774b6..147495a17 100644 --- a/sockeye/translate_remote.py +++ b/sockeye/translate_remote.py @@ -47,7 +47,7 @@ def main(): command = sys.argv[1:] - if args.chunk_size > 0: + if args.aws_batch_chunk_size > 0: _batch_translation(args, command) else: command = 'python3 -m sockeye.translate ' + sockeye.utils_remote.remove_aws_args(command) @@ -121,8 +121,8 @@ def _batch_translation(args, command): def _start_jobs(args, batch_client, command, input_arg_index, job_ids, logger, output_arg_index, source_data, temp_dir, temp_job_def_name): - for i, input_chunk in enumerate(_input_chunks(source_data, args.chunk_size)): - logger.info("Splitting input -- line %d", i * args.chunk_size) + for i, input_chunk in enumerate(_input_chunks(source_data, args.aws_batch_chunk_size)): + logger.info("Splitting input -- line %d", i * args.aws_batch_chunk_size) with sockeye.data_io.smart_open(_chunk_file_name(temp_dir, "input", i), mode="w") as input_chunk_file: for line in input_chunk: input_chunk_file.write(line) diff --git a/sockeye/utils_remote.py b/sockeye/utils_remote.py index 2ff285b58..2c5de6597 100644 --- a/sockeye/utils_remote.py +++ b/sockeye/utils_remote.py @@ -205,7 +205,7 @@ def add_aws_args(params): def add_aws_translation_args(params): aws_args = params.add_argument_group("AWS Batch Translation Parameters") - aws_args.add_argument('--chunk-size', + aws_args.add_argument('--aws-batch-chunk-size', default=0, type=int, help='x>0: Number of input sentences per chunk. ' @@ -224,7 +224,7 @@ def remove_aws_args(command: List[str]) -> str: _remove_argument("--job-queue-name", command) _remove_argument("--efs-name", command) _remove_argument("--temp-dir", command) - _remove_argument("--chunk-size", command) + _remove_argument("--aws-batch-chunk-size", command) _remove_argument("--notify-topic-arn", command) _remove_argument("--notify-task-name", command) return " ".join(command)