From 51168f4c6486769c8c2e05ddecc734575e8b9050 Mon Sep 17 00:00:00 2001 From: rakow Date: Mon, 10 Jun 2024 17:10:05 +0200 Subject: [PATCH] fix linting --- matsim/calibration/run_create_csv.py | 1 + matsim/calibration/run_simulations.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/matsim/calibration/run_create_csv.py b/matsim/calibration/run_create_csv.py index ce6d1d0..c4a89e3 100644 --- a/matsim/calibration/run_create_csv.py +++ b/matsim/calibration/run_create_csv.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- import argparse +import traceback METADATA = "create-csv", "Create plots and csv from calibration study." diff --git a/matsim/calibration/run_simulations.py b/matsim/calibration/run_simulations.py index 30b88db..4b09093 100644 --- a/matsim/calibration/run_simulations.py +++ b/matsim/calibration/run_simulations.py @@ -50,6 +50,9 @@ def run(jar: Union[str, os.PathLike], if not os.access(config, os.R_OK): raise ValueError("Can not access config File: %s" % config) + if worker_id >= workers: + raise ValueError("Worker ID must be smaller than number of workers (starts at 0).") + if not os.path.exists("eval-runs"): makedirs("eval-runs") @@ -63,11 +66,11 @@ def run(jar: Union[str, os.PathLike], print("Run %s already exists, skipping." % run_dir) continue - run_args = args(completed) if callable(args) else args + run_args = args(i) if callable(args) else args - # Same custom cli interface as calibration + # Similar custom cli interface as calibration if custom_cli: - cmd = custom_cli(jvm_args, jar, config, params_path, run_dir, trial.number, run_args) + cmd = custom_cli(jvm_args, jar, config, run_dir, i, seed + i, run_args) else: cmd = "java %s -jar %s run --config %s --output %s --runId %03d --config:global.randomSeed=%d %s" \ % (jvm_args, jar, config, run_dir, i, seed + i, run_args)