added serial mode flag
This commit is contained in:
parent
c898d1f163
commit
1e8704cebf
@ -47,6 +47,7 @@ def main():
|
|||||||
# Directory mode
|
# Directory mode
|
||||||
parser.add_argument("--input-dir", help="Input directory")
|
parser.add_argument("--input-dir", help="Input directory")
|
||||||
parser.add_argument("--output-dir", help="Output directory")
|
parser.add_argument("--output-dir", help="Output directory")
|
||||||
|
parser.add_argument("-s", help="Serial mode", action="store_true")
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-t", "--type",
|
"-t", "--type",
|
||||||
@ -58,7 +59,7 @@ def main():
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.v:
|
if args.v:
|
||||||
print("1.1")
|
print("1.2")
|
||||||
return
|
return
|
||||||
if not args.type:
|
if not args.type:
|
||||||
parser.error("The --type argument is required.")
|
parser.error("The --type argument is required.")
|
||||||
@ -85,7 +86,7 @@ def main():
|
|||||||
|
|
||||||
tasks.append((input_path, output_path, args.type))
|
tasks.append((input_path, output_path, args.type))
|
||||||
|
|
||||||
max_workers = os.cpu_count() or 1
|
max_workers = os.cpu_count() or 1 if not args.s else 1
|
||||||
logger.info(f"Processing {len(tasks)} files using {max_workers} workers")
|
logger.info(f"Processing {len(tasks)} files using {max_workers} workers")
|
||||||
|
|
||||||
with ProcessPoolExecutor(max_workers=max_workers) as executor:
|
with ProcessPoolExecutor(max_workers=max_workers) as executor:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user