Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at and make sure that your projects conform to the requirements.

Commit 151cb09f authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

add new sub command to to allow ci script to run single scenario files

parent ff1c7a9f
Pipeline #64355 failed with stages
in 2 minutes and 21 seconds
......@@ -55,7 +55,7 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
wall_time_start = time.time()
# Use timout feature, check return value and capture stdout/stderr to a PIPE (use completed_process.stdout to get it).
completed_process =["java", "-enableassertions", "-jar", vadere_console, scenario_file, output_dir],
completed_process =["java", "-enableassertions", "-jar", vadere_console, "scenario-run", "-f", scenario_file, " -o",output_dir],
......@@ -89,4 +89,3 @@ if __name__ == "__main__":
package org.vadere.simulator.entrypoints;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.Namespace;
import org.apache.log4j.Logger;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.ScenarioRun;
import java.nio.file.Path;
import java.nio.file.Paths;
public class ScenarioRunSubCommand implements SubCommandRunner{
private final static Logger logger = Logger.getLogger(ScenarioRunSubCommand.class);
public void run(Namespace ns, ArgumentParser parser) {
Path outputDir = Paths.get(ns.getString("output-dir"));
if (!outputDir.toFile().exists()){
if ( ! outputDir.toFile().mkdirs() ) {
logger.error("Could not create all necessary directories: " + outputDir.toFile().toString());
} else {"Created output directory: " + outputDir.toAbsolutePath().toFile().toString());
} else {"Use output directory: " + outputDir.toAbsolutePath().toFile().toString());
Path scenarioFile = Paths.get(ns.getString("scenario-file"));
if (!scenarioFile.toFile().exists() || !scenarioFile.toFile().isFile()){
logger.error("scenario-file does not exist, is not a regular file or you do not have read permissions: "
+ scenarioFile.toFile().toString());
try {
Scenario scenario = ScenarioFactory.createScenarioWithScenarioFilePath(scenarioFile);
new ScenarioRun(scenario, outputDir.toFile().toString() , null).run();
} catch (Exception e){
......@@ -67,6 +67,23 @@ public class VadereConsole {
.help("Name of Scenario file");
// Run Scenario
Subparser scenarioRun = subparsers
.help("Run scenario without a project")
.setDefault("func", new ScenarioRunSubCommand());
scenarioRun.addArgument("--output-dir", "-o")
.dest("output-dir") // set name in namespace
.help("Supply differernt output directory path to use.");
scenarioRun.addArgument("--scenario-file", "-f")
.help("Scenario files to run");
// Run SUQ
Subparser suqRun = subparsers
......@@ -85,7 +102,7 @@ public class VadereConsole {
.help("List of scenario files to run");
.help("Scenario files to run");
// Run Migration Assistant
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment