Class ExecutorSeals
java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_eval.ExecutorSeals
This executor can run SEALS matchers.
Please note that as of 2020, SEALS Client 7.0.5 requires JDK 1.8!
If you have a newer JDK installed and you run into trouble, you can install an additional JDK and use
- Author:
- Jan Portisch
-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
If true, deletes files in tmp folder which starts with "alignment" before running a matcherprivate static final boolean
private String
The command to start java in the terminal.The parameters that appear between java [parameters] -jar.private static final org.slf4j.Logger
Default logger.private static final Pattern
Regex pattern to get the matcher name from the SEALSdescriptor.xml
file.private static final String
private File
The directory where the results shall be written to.private File
Path to the JAR of the SEALS client.private File
Path to the SEALS home directory.private long
Time out for the external seals process.private TimeUnit
Time unit for the process time out. -
Constructor Summary
ConstructorDescriptionExecutorSeals
(File sealsClientJar, File sealsHome) Constructor The default timeout of 12 hours will be used.ExecutorSeals
(File sealsClientJar, File sealsHome, long timeout, TimeUnit timeoutTimeUnit) ConstructorExecutorSeals
(File sealsClientJar, File sealsHome, File resultsDirectory, List<String> javaRuntimeParameters, long timeout, TimeUnit timeoutTimeUnit, boolean deleteTempFiles) ConstructorExecutorSeals
(File sealsClientJar, File sealsHome, List<String> javaRuntimeParameters) Constructor The default timeout of 12 hours will be used.ExecutorSeals
(File sealsClientJar, File sealsHome, List<String> javaRuntimeParameters, long timeout, TimeUnit timeoutTimeUnit) ConstructorExecutorSeals
(String javaCommand, File sealsClientJar, File sealsHome) Constructor The default timeout of 12 hours will be used.ExecutorSeals
(String javaCommand, File sealsClientJar, File sealsHome, File resultsDirectory, List<String> javaRuntimeParameters, long timeout, TimeUnit timeoutTimeUnit, boolean deleteTempFiles) ConstructorExecutorSeals
(String javaCommand, File sealsClientJar, File sealsHome, List<String> javaRuntimeParameters) Constructor The default timeout of 12 hours will be used.ExecutorSeals
(String javaCommand, File sealsClientJar, File sealsHome, List<String> javaRuntimeParameters, long timeout, TimeUnit timeoutTimeUnit) ConstructorExecutorSeals
(String sealsClientJarPath, String sealsHomePath) ConstructorExecutorSeals
(String javaCommand, String sealsClientJarPath, String sealsHomePath) Constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic File
getFirstSubDirectoryRunnableInSeals
(File rootDir) This method visits all folders below the starting directory and returns the first directory which is runnable in seals.getMatcherDirectories
(File matcher) Returns all possible matcher directories for a given file or directory.static String
Returns the matcher name in the seals descriptor.static String
private static Long
Obtains the process ID given a process.long
static boolean
isDirectoryRunnableInSeals
(File directory) Determines whether the specified directory is runnable in seals.static boolean
isDirectoryRunnableInSeals
(String directory) Determines whether the specified directory is runnable in seals.private static void
private static void
Evaluate matcher(s) using the local SEALS client.Evaluate matcher(s) using the local SEALS client.Evaluate matcher(s) using the local SEALS client.Evaluate matcher(s) using the local SEALS client.Evaluate matcher(s) using the local SEALS client.protected ExecutionResult
runUnzippedMatcher
(TestCase testCase, File matcherDirectory) Evaluate a single matcher using the local SEALS client.protected ExecutionResult
runUnzippedMatcher
(TestCase testCase, File matcherDirectory, String matcherName) Evaluate a single matcher using the local SEALS client.void
setJavaCommand
(String javaCommand) If in your system, the "java" command links to a jdk > 8, issues might occur.void
setJavaRuntimeParameters
(List<String> javaRuntimeParameters) void
setSealsClientJar
(File sealsClientJar) void
setSealsHome
(File sealsHome) void
setTimeout
(long timeout, TimeUnit timeoutTimeUnit) private static void
terminateProcess
(Process process) private static File
Unzips a zip-file in the directory where the zip file resides.
-
Field Details
-
OS_NAME
-
isLinux
private static final boolean isLinux -
sealsClientJar
Path to the JAR of the SEALS client. -
sealsHome
Path to the SEALS home directory. -
LOGGER
private static final org.slf4j.Logger LOGGERDefault logger. -
timeout
private long timeoutTime out for the external seals process. The timeout is applied for each testcase and not track. -
timeoutTimeUnit
Time unit for the process time out. -
javaRuntimeParameters
The parameters that appear between java [parameters] -jar. Example: ("-Xmx25g", "-Xms15g"). -
resultsDirectory
The directory where the results shall be written to. -
deleteTempFiles
private boolean deleteTempFilesIf true, deletes files in tmp folder which starts with "alignment" before running a matcher -
javaCommand
The command to start java in the terminal. Typically, this is "java" -
matcherNamePattern
Regex pattern to get the matcher name from the SEALSdescriptor.xml
file.
-
-
Constructor Details
-
ExecutorSeals
public ExecutorSeals(File sealsClientJar, File sealsHome, File resultsDirectory, List<String> javaRuntimeParameters, long timeout, TimeUnit timeoutTimeUnit, boolean deleteTempFiles) Constructor- Parameters:
sealsClientJar
- The path to the local SEALS client JAR file.sealsHome
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).resultsDirectory
- Results folder where the SEALS results will be copied tojavaRuntimeParameters
- Runtime parameters such as ("-Xmx25g", "-Xms15g").timeout
- Timeout for one testcase as long.timeoutTimeUnit
- The unit of the timeout.deleteTempFiles
- If true, deletes files in tmp folder which starts with "alignment" before running a matcher
-
ExecutorSeals
public ExecutorSeals(String javaCommand, File sealsClientJar, File sealsHome, File resultsDirectory, List<String> javaRuntimeParameters, long timeout, TimeUnit timeoutTimeUnit, boolean deleteTempFiles) Constructor- Parameters:
javaCommand
- Command to start java.sealsClientJar
- The path to the local SEALS client JAR file.sealsHome
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).resultsDirectory
- Results folder where the SEALS results will be copied tojavaRuntimeParameters
- Runtime parameters such as ("-Xmx25g", "-Xms15g").timeout
- Timeout for one testcase as long.timeoutTimeUnit
- The unit of the timeout.deleteTempFiles
- If true, deletes files in tmp folder which starts with "alignment" before running a matcher
-
ExecutorSeals
public ExecutorSeals(File sealsClientJar, File sealsHome, List<String> javaRuntimeParameters, long timeout, TimeUnit timeoutTimeUnit) Constructor- Parameters:
sealsClientJar
- The path to the local SEALS client JAR file.sealsHome
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).javaRuntimeParameters
- Runtime parameters such as ("-Xmx25g", "-Xms15g").timeout
- Timeout for one testcase as long.timeoutTimeUnit
- The unit of the timeout.
-
ExecutorSeals
public ExecutorSeals(String javaCommand, File sealsClientJar, File sealsHome, List<String> javaRuntimeParameters, long timeout, TimeUnit timeoutTimeUnit) Constructor- Parameters:
javaCommand
- Command to start java.sealsClientJar
- The path to the local SEALS client JAR file.sealsHome
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).javaRuntimeParameters
- Runtime parameters such as ("-Xmx25g", "-Xms15g").timeout
- Timeout for one testcase as long.timeoutTimeUnit
- The unit of the timeout.
-
ExecutorSeals
Constructor The default timeout of 12 hours will be used.- Parameters:
sealsClientJar
- The path to the local SEALS client JAR file.sealsHome
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).javaRuntimeParameters
- Runtime parameters such as ("-Xmx25g", "-Xms15g").
-
ExecutorSeals
public ExecutorSeals(String javaCommand, File sealsClientJar, File sealsHome, List<String> javaRuntimeParameters) Constructor The default timeout of 12 hours will be used.- Parameters:
javaCommand
- Command to start java.sealsClientJar
- The path to the local SEALS client JAR file.sealsHome
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).javaRuntimeParameters
- Runtime parameters such as ("-Xmx25g", "-Xms15g").
-
ExecutorSeals
Constructor The default timeout of 12 hours will be used.- Parameters:
sealsClientJar
- The file to the local SEALS client JAR file.sealsHome
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).
-
ExecutorSeals
Constructor The default timeout of 12 hours will be used.- Parameters:
javaCommand
- Command to start java.sealsClientJar
- The file to the local SEALS client JAR file.sealsHome
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).
-
ExecutorSeals
Constructor- Parameters:
sealsClientJarPath
- The path to the local SEALS client JAR file.sealsHomePath
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).
-
ExecutorSeals
Constructor- Parameters:
javaCommand
- Command to start java.sealsClientJarPath
- The path to the local SEALS client JAR file.sealsHomePath
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).
-
ExecutorSeals
Constructor- Parameters:
sealsClientJar
- The path to the local SEALS client JAR file.sealsHome
- SEALS Home directory. ALL files in this directory will be removed (this is SEALS default behaviour).timeout
- Timeout as long.timeoutTimeUnit
- The unit of the timeout.
-
-
Method Details
-
run
Evaluate matcher(s) using the local SEALS client. The file parameter can be a zip file or a directory. If it is a directory and the directory represents a matcher, it will be executed. Otherwise the directory will be scanned for matcher subdirectories and/or zip files (which are unzipped). The unzipping happens with every execution to ensure that the matcher is executed as submitted (in case some files are not closed corrected due to a previous run).- Parameters:
track
- The track on which the matcher shall be run.matcher
- The directory containing the matcher(s).- Returns:
- Execution Result Set instance for the matcher on the track.
-
run
Evaluate matcher(s) using the local SEALS client. The file parameter can be a zip file or a directory. If it is a directory and the directory represents a matcher, it will be executed. Otherwise the directory will be scaned for matcher subdirectories and/or zip files (which are unzipped). The unzipping happens with every execution to ensure that the matcher is executed as submitted (in case some files are not closed corrected due to a previous run).- Parameters:
testcase
- The testcase on which the matcher shall be run.matcher
- The directory containing the matcher(s).- Returns:
- Execution Result Set instance for the matcher on the track.
-
run
Evaluate matcher(s) using the local SEALS client. The file parameter can be a zip file or a directory. If it is a directory and the directory represents a matcher, it will be executed. Otherwise the directory will be scaned for matcher subdirectories and/or zip files (which are unzipped). The unzipping happens with every execution to ensure that the matcher is executed as submitted (in case some files are not closed corrected due to a previous run).- Parameters:
track
- The track on which the matcher shall be run.matcherDirectory
- The directory containing the matcher(s).- Returns:
- Execution Result Set instance for the matcher on the track.
-
run
Evaluate matcher(s) using the local SEALS client. The file parameter can be a zip file or a directory. If it is a directory and the directory represents a matcher, it will be executed. Otherwise the directory will be scaned for matcher subdirectories and/or zip files (which are unzipped). The unzipping happens with every execution to ensure that the matcher is executed as submitted (in case some files are not closed corrected due to a previous run).- Parameters:
testCases
- The testcases on which the matcher shall be run.matcherDirectory
- The directory containing the matcher(s).- Returns:
- Execution Result Set instance for the matcher on the track.
-
run
Evaluate matcher(s) using the local SEALS client. The file parameter can be a zip file or a directory. If it is a directory and the directory represents a matcher, it will be executed. Otherwise the directory will be scaned for matcher subdirectories and/or zip files (which are unzipped). The unzipping happens with every execution to ensure that the matcher is executed as submitted (in case some files are not closed corrected due to a previous run).- Parameters:
testCase
- The testcase on which the matcher shall be run.matcher
- The directory containing the matcher(s).- Returns:
- Execution Result Set instance for the matcher on the track.
-
getMatcherDirectories
Returns all possible matcher directories for a given file or directory. If it is a file with zip extension, it will unzip it. If it is a directory, it will check if this directory is a matcher. If not, it will inspect the whole directory for matchers.- Parameters:
matcher
- the directoroy or file which represents a matcher or a directory of matchers.- Returns:
- a map of the matcher directory and corresponding matcher name(file name)
-
runUnzippedMatcher
Evaluate a single matcher using the local SEALS client.- Parameters:
matcherDirectory
- The directory containing the matchertestCase
- The testCase on which the matcher shall be run.- Returns:
- ExecutionResult
-
runUnzippedMatcher
protected ExecutionResult runUnzippedMatcher(TestCase testCase, File matcherDirectory, String matcherName) Evaluate a single matcher using the local SEALS client.- Parameters:
matcherDirectory
- The directory containing the matchertestCase
- The testCase on which the matcher shall be run.matcherName
- Matcher name- Returns:
- ExecutionResult
-
terminateProcess
-
killProcessWithJava
-
killAllProcessesWithSameSessionId
-
getPid
Obtains the process ID given a process.- Parameters:
process
- The process for which the ID shall be determined.- Returns:
- Process ID as Long of a given process.
-
getMatcherNameFromSealsDescriptor
Returns the matcher name in the seals descriptor.- Parameters:
file
- File instance which points to a descriptor file or a matcher directory.- Returns:
- name of the matcher or empty string if not available.
-
getMatcherNameFromSealsDescriptor
-
unzip
Unzips a zip-file in the directory where the zip file resides. A new directory will be created with the name of the zip file (without .zip ending) and the zipped contents will be found therein.- Parameters:
fileToBeUnzipped
- The file that shall be unzipped.- Returns:
- The path to the extracted file.
-
getFirstSubDirectoryRunnableInSeals
This method visits all folders below the starting directory and returns the first directory which is runnable in seals. The traversing strategy is breadth first search.- Parameters:
rootDir
- Path to the starting directory.- Returns:
- The first directory which is runnable in seals or null if such a folder does not exist
-
isDirectoryRunnableInSeals
Determines whether the specified directory is runnable in seals.- Parameters:
directory
- Path to the directory.- Returns:
- True if runnable, else false.
-
isDirectoryRunnableInSeals
Determines whether the specified directory is runnable in seals.- Parameters:
directory
- Path to the directory.- Returns:
- True if runnable, else false.
-
setTimeout
-
getTimeout
public long getTimeout() -
getTimeoutTimeUnit
-
getTimeoutAsText
-
getSealsClientJar
-
setSealsClientJar
-
getSealsHome
-
setSealsHome
-
getJavaRuntimeParameters
-
setJavaRuntimeParameters
-
getJavaCommand
-
setJavaCommand
If in your system, the "java" command links to a jdk > 8, issues might occur. Therefore, you can use this command to point to a jdk 8 executable.- Parameters:
javaCommand
- The command to start the desired java version such as a file path to the executable.
-