<commit_before>﻿<#

.SYNOPSIS
Runs the evaluation tasks on selected tools for the 30sec results.

#>

[CmdletBinding()]

Param(
  [int] $From = 1,
  [int] $To = 10,
  [string[]] $Tools = @("catg", "evosuite", "jpet", "randoop", "spf"),
  [string[]] $Tasks = @("parser", "test-generator", "test-runner", "export-csv"),
  [string] $JavaHeapMemory = "4G",
  [boolean] $SkipExisting = $true,
  [boolean] $ExportCsvBatch = $true
)

$SNIPPET_PROJECT = "sette-snippets"
$SNIPPET_PROJECT_DIR = "sette-snippets/java/sette-snippets"
$LOG_DIR = "explog"

$tags = @()
for ($i = $From; $i -le $To; $i++) {  
  $tags += "run-{0:D2}-30sec" -f $i
}

mkdir $LOG_DIR -f > $null

foreach ($tool in $Tools) {
  foreach ($tag in $tags) {
    $dir = "${SNIPPET_PROJECT}___${tool}___${tag}"
    
    if ($SkipExisting -and (Test-Path "../sette-results/$dir/sette-evaluation.csv")) {
      Write-Warning "Skipping $tool $tag"
    } else {
      $i = 3
      foreach ($task in $tasks) {
        Write-Progress -Activity $tool -Status $tag -CurrentOperation $task
        java "-Xmx$JavaHeapMemory" -jar sette-all.jar --snippet-project-dir $SNIPPET_PROJECT_DIR --tool $tool --task $task --runner-project-tag $tag > "$LOG_DIR/${tool}_${tag}_${i}_${task}.log" 2>&1
        $i++
      }
    }
  }
}

if ($ExportCsvBatch){
  $tag = $tags -join ','
  java -jar sette-all.jar --snippet-project-dir $SNIPPET_PROJECT_DIR --task "export-csv-batch" --runner-project-tag $tag
}<commit_msg>Fixed task number in log file name when not all tasks are executed<commit_after>﻿<#

.SYNOPSIS
Runs the evaluation tasks on selected tools for the 30sec results.

#>

[CmdletBinding()]

Param(
  [int] $From = 1,
  [int] $To = 10,
  [string[]] $Tools = @("catg", "evosuite", "jpet", "randoop", "spf"),
  [string[]] $Tasks = @("parser", "test-generator", "test-runner", "export-csv"),
  [string] $JavaHeapMemory = "4G",
  [boolean] $SkipExisting = $true,
  [boolean] $ExportCsvBatch = $true
)

$SNIPPET_PROJECT = "sette-snippets"
$SNIPPET_PROJECT_DIR = "sette-snippets/java/sette-snippets"
$LOG_DIR = "explog"

$TASK_NUMBERS = @{ "generator" = 1; "runner" = 2; "parser" = 3; "test-generator" = 4; "test-runner" = 5; "export-csv" = 6}

$tags = @()
for ($i = $From; $i -le $To; $i++) {  
  $tags += "run-{0:D2}-30sec" -f $i
}

mkdir $LOG_DIR -f > $null

foreach ($tool in $Tools) {
  foreach ($tag in $tags) {
    $dir = "${SNIPPET_PROJECT}___${tool}___${tag}"
    
    if ($SkipExisting -and (Test-Path "../sette-results/$dir/sette-evaluation.csv")) {
      Write-Warning "Skipping $tool $tag"
    } else {
      foreach ($task in $tasks) {
        Write-Progress -Activity $tool -Status $tag -CurrentOperation $task
        java "-Xmx$JavaHeapMemory" -jar sette-all.jar --snippet-project-dir $SNIPPET_PROJECT_DIR --tool $tool --task $task --runner-project-tag $tag > "$LOG_DIR/${tool}_${tag}_$($TASK_NUMBERS.$task)_${task}.log" 2>&1
      }
    }
  }
}

if ($ExportCsvBatch){
  $tag = $tags -join ','
  java -jar sette-all.jar --snippet-project-dir $SNIPPET_PROJECT_DIR --task "export-csv-batch" --runner-project-tag $tag
}
{'fraction_non_alphanumeric': 0.1975268467295802, 'fraction_numerical': 0.010087862024080702, 'mean_word_length': 3.527245949926362, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2063268', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1202, 'n_words': 276}