Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
151cb09f
Commit
151cb09f
authored
Aug 02, 2018
by
Stefan Schuhbaeck
Browse files
add new sub command to VadereConsole.java to allow ci script to run single scenario files
parent
ff1c7a9f
Pipeline
#64355
failed with stages
in 2 minutes and 21 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Tools/ContinuousIntegration/run_vadere_console_with_all_scenario_files.py
View file @
151cb09f
...
...
@@ -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
=
subprocess
.
run
(
args
=
[
"java"
,
"-enableassertions"
,
"-jar"
,
vadere_console
,
scenario_file
,
output_dir
],
completed_process
=
subprocess
.
run
(
args
=
[
"java"
,
"-enableassertions"
,
"-jar"
,
vadere_console
,
"scenario-run"
,
"-f"
,
scenario_file
,
" -o"
,
output_dir
],
timeout
=
scenario_timeout_in_sec
,
check
=
True
,
stdout
=
subprocess
.
PIPE
,
...
...
@@ -89,4 +89,3 @@ if __name__ == "__main__":
exit
(
1
)
else
:
exit
(
0
)
VadereSimulator/src/org/vadere/simulator/entrypoints/ScenarioRunSubCommand.java
0 → 100644
View file @
151cb09f
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
);
@Override
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
());
System
.
exit
(-
1
);
}
else
{
logger
.
info
(
"Created output directory: "
+
outputDir
.
toAbsolutePath
().
toFile
().
toString
());
}
}
else
{
logger
.
info
(
"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
());
System
.
exit
(-
1
);
}
try
{
Scenario
scenario
=
ScenarioFactory
.
createScenarioWithScenarioFilePath
(
scenarioFile
);
new
ScenarioRun
(
scenario
,
outputDir
.
toFile
().
toString
()
,
null
).
run
();
}
catch
(
Exception
e
){
logger
.
error
(
e
);
System
.
exit
(-
1
);
}
}
}
VadereSimulator/src/org/vadere/simulator/entrypoints/VadereConsole.java
View file @
151cb09f
...
...
@@ -67,6 +67,23 @@ public class VadereConsole {
.
dest
(
"scenario-file"
)
.
help
(
"Name of Scenario file"
);
// Run Scenario
Subparser
scenarioRun
=
subparsers
.
addParser
(
"scenario-run"
)
.
help
(
"Run scenario without a project"
)
.
setDefault
(
"func"
,
new
ScenarioRunSubCommand
());
scenarioRun
.
addArgument
(
"--output-dir"
,
"-o"
)
.
required
(
false
)
.
setDefault
(
"output"
)
.
dest
(
"output-dir"
)
// set name in namespace
.
type
(
String
.
class
)
.
help
(
"Supply differernt output directory path to use."
);
scenarioRun
.
addArgument
(
"--scenario-file"
,
"-f"
)
.
required
(
true
)
.
type
(
String
.
class
)
.
dest
(
"scenario-file"
)
.
help
(
"Scenario files to run"
);
// Run SUQ
Subparser
suqRun
=
subparsers
...
...
@@ -85,7 +102,7 @@ public class VadereConsole {
.
required
(
true
)
.
type
(
String
.
class
)
.
dest
(
"scenario-file"
)
.
help
(
"
List of s
cenario files to run"
);
.
help
(
"
S
cenario files to run"
);
// Run Migration Assistant
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment