Search in sources :

Example 1 with RunCommandWriterRCA

use of de.dagere.peass.measurement.utils.RunCommandWriterRCA in project peass by DaGeRe.

the class ExperimentSelector method selectForProject.

private void selectForProject(final File currentPropertyFile, final File currentChangeFile) throws IOException, JsonParseException, JsonMappingException, FileNotFoundException {
    final RepoFolders repoFolders = new RepoFolders();
    final VersionChangeProperties properties = Constants.OBJECTMAPPER.readValue(currentPropertyFile, VersionChangeProperties.class);
    final ProjectChanges changes;
    if (currentChangeFile != null && currentChangeFile.exists()) {
        changes = Constants.OBJECTMAPPER.readValue(currentChangeFile, ProjectChanges.class);
    } else {
        changes = null;
    }
    final String projectName = currentChangeFile != null ? currentChangeFile.getName().replace(".json", "") : currentPropertyFile.getParentFile().getName();
    final File fileSlurm = new File(repoFolders.getRCAScriptFolder(), "rca-slurm-" + projectName + ".sh");
    final File fileJava = new File(repoFolders.getRCAScriptFolder(), "rca-java-" + projectName + ".sh");
    final ExecutionData executionData = repoFolders.getExecutionData(projectName);
    final RunCommandWriter writerSlurm = new RunCommandWriterSlurm(new PrintStream(fileSlurm), "cause1", executionData, RunCommandWriterSlurm.EXECUTE_RCA);
    final RunCommandWriter writer = new RunCommandWriterRCA(new PrintStream(fileJava), "cause1", executionData);
    properties.executeProcessor((version, testcase, change, changeProperties) -> {
        all++;
    });
    if (changes != null) {
        changes.executeProcessor((version, testcase, change) -> {
            measurementAll++;
        });
    } else {
        printOnlyChanged = false;
    }
    writeExecutions(properties, changes, writerSlurm, writer);
    System.out.println("All: " + executionData.getAllExecutions());
    System.out.println("All: " + all + " No testchange: " + noTestchange + " Measurement change: " + measurementChange + " All: " + measurementAll);
}
Also used : PrintStream(java.io.PrintStream) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) RunCommandWriterSlurm(de.dagere.peass.measurement.utils.RunCommandWriterSlurm) RunCommandWriterRCA(de.dagere.peass.measurement.utils.RunCommandWriterRCA) VersionChangeProperties(de.dagere.peass.analysis.properties.VersionChangeProperties) RunCommandWriter(de.dagere.peass.measurement.utils.RunCommandWriter) File(java.io.File) RepoFolders(de.dagere.peass.analysis.all.RepoFolders) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 2 with RunCommandWriterRCA

use of de.dagere.peass.measurement.utils.RunCommandWriterRCA in project peass by DaGeRe.

the class GetChanges method createReader.

private ChangeReader createReader(final ResultsFolders resultsFolders, final SelectedTests selectedTests) throws FileNotFoundException {
    RunCommandWriterRCA runCommandWriter = null;
    RunCommandWriterSlurmRCA runCommandWriterSlurm = null;
    if (selectedTests.getUrl() != null && !selectedTests.getUrl().isEmpty()) {
        final PrintStream runCommandPrinter = new PrintStream(new File(resultsFolders.getStatisticsFile().getParentFile(), "run-rca-" + selectedTests.getName() + ".sh"));
        runCommandWriter = new RunCommandWriterRCA(runCommandPrinter, "default", selectedTests);
        final PrintStream runCommandPrinterRCA = new PrintStream(new File(resultsFolders.getStatisticsFile().getParentFile(), "run-rca-slurm-" + selectedTests.getName() + ".sh"));
        runCommandWriterSlurm = new RunCommandWriterSlurmRCA(runCommandPrinterRCA, "default", selectedTests);
    }
    final ChangeReader reader = new ChangeReader(resultsFolders, runCommandWriter, runCommandWriterSlurm, selectedTests);
    reader.setConfig(statisticConfigMixin.getStasticsConfig());
    return reader;
}
Also used : PrintStream(java.io.PrintStream) RunCommandWriterSlurmRCA(de.dagere.peass.measurement.utils.RunCommandWriterSlurmRCA) ChangeReader(de.dagere.peass.analysis.changes.ChangeReader) RunCommandWriterRCA(de.dagere.peass.measurement.utils.RunCommandWriterRCA) File(java.io.File)

Example 3 with RunCommandWriterRCA

use of de.dagere.peass.measurement.utils.RunCommandWriterRCA in project peass by DaGeRe.

the class FindChangeExecutions method findProjectExecutions.

public static void findProjectExecutions(final File reexecuteFolder, final String project, final File projectChangeFile, final File executionFile) throws FileNotFoundException, JAXBException, IOException, JsonParseException, JsonMappingException {
    System.out.println("Reading: " + project);
    final File reexecuteProject = new File(reexecuteFolder, "reexecute-change-" + project + ".sh");
    final PrintStream goal = new PrintStream(new FileOutputStream(reexecuteProject));
    final ExecutionData executions = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
    // RunCommandWriter writer = new RunCommandWriterSlurm(goal, NAME, dependencies);
    final RunCommandWriter writer = new RunCommandWriterRCA(goal, NAME, executions);
    writer.setNice(1000);
    writeExecutions(projectChangeFile, executions, writer);
}
Also used : PrintStream(java.io.PrintStream) FileOutputStream(java.io.FileOutputStream) RunCommandWriterRCA(de.dagere.peass.measurement.utils.RunCommandWriterRCA) RunCommandWriter(de.dagere.peass.measurement.utils.RunCommandWriter) File(java.io.File) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Aggregations

RunCommandWriterRCA (de.dagere.peass.measurement.utils.RunCommandWriterRCA)3 File (java.io.File)3 PrintStream (java.io.PrintStream)3 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)2 RunCommandWriter (de.dagere.peass.measurement.utils.RunCommandWriter)2 RepoFolders (de.dagere.peass.analysis.all.RepoFolders)1 ChangeReader (de.dagere.peass.analysis.changes.ChangeReader)1 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)1 VersionChangeProperties (de.dagere.peass.analysis.properties.VersionChangeProperties)1 RunCommandWriterSlurm (de.dagere.peass.measurement.utils.RunCommandWriterSlurm)1 RunCommandWriterSlurmRCA (de.dagere.peass.measurement.utils.RunCommandWriterSlurmRCA)1 FileOutputStream (java.io.FileOutputStream)1