Search in sources :

Example 1 with RunCommandWriterSlurm

use of de.dagere.peass.measurement.utils.RunCommandWriterSlurm 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 RunCommandWriterSlurm

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

the class FindWrong method main.

public static void main(final String[] args) throws JsonParseException, JsonMappingException, IOException {
    final File executeCommands = new File("execute-wrong.sh");
    final PrintStream goal = new PrintStream(new FileOutputStream(executeCommands));
    final File folder = new File("/home/reichelt/daten3/diss/repos/properties/classification");
    int index = 0;
    for (final File project : folder.listFiles()) {
        if (project.getName().endsWith(".json")) {
            final String projectName = project.getName().substring(0, project.getName().indexOf('.'));
            final String url = Constants.defaultUrls.get(projectName);
            RunCommandWriter writer = new RunCommandWriterSlurm(goal, "wrong_rerun", projectName, url);
            if (url != null) {
                final Classification data = Constants.OBJECTMAPPER.readValue(project, Classification.class);
                for (final Map.Entry<String, VersionClass> version : data.getVersions().entrySet()) {
                    for (final Map.Entry<ChangedEntity, TestcaseClass> method : version.getValue().getTestcases().entrySet()) {
                        if (method.getValue().getTypes().contains("WRONG") || method.getValue().getTypes().contains("WRONGTEST")) {
                            // System.out.println(version.getKey() + " " + method.getKey());
                            writer.createSingleMethodCommand(index, version.getKey(), method.getKey().toString());
                            index++;
                        }
                    }
                }
            } else {
                System.err.println("Missing url: " + projectName);
            }
        }
    }
}
Also used : PrintStream(java.io.PrintStream) VersionClass(de.dagere.peass.analysis.groups.VersionClass) RunCommandWriterSlurm(de.dagere.peass.measurement.utils.RunCommandWriterSlurm) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) FileOutputStream(java.io.FileOutputStream) Classification(de.dagere.peass.analysis.groups.Classification) RunCommandWriter(de.dagere.peass.measurement.utils.RunCommandWriter) File(java.io.File) Map(java.util.Map) TestcaseClass(de.dagere.peass.analysis.groups.TestcaseClass)

Aggregations

RunCommandWriter (de.dagere.peass.measurement.utils.RunCommandWriter)2 RunCommandWriterSlurm (de.dagere.peass.measurement.utils.RunCommandWriterSlurm)2 File (java.io.File)2 PrintStream (java.io.PrintStream)2 RepoFolders (de.dagere.peass.analysis.all.RepoFolders)1 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)1 Classification (de.dagere.peass.analysis.groups.Classification)1 TestcaseClass (de.dagere.peass.analysis.groups.TestcaseClass)1 VersionClass (de.dagere.peass.analysis.groups.VersionClass)1 VersionChangeProperties (de.dagere.peass.analysis.properties.VersionChangeProperties)1 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)1 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)1 RunCommandWriterRCA (de.dagere.peass.measurement.utils.RunCommandWriterRCA)1 FileOutputStream (java.io.FileOutputStream)1 Map (java.util.Map)1