Skip to content

Commit

Permalink
Only create output directory when there are results
Browse files Browse the repository at this point in the history
  • Loading branch information
franksn90 committed Aug 25, 2024
1 parent 1aff528 commit e85a8e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import java.io.IOException
import java.nio.file.Path

@RestController
class SimulationRunningController @Autowired constructor(private var simulationRunningService: SearchRunningService) {
class SearchRunningController @Autowired constructor(private var simulationRunningService: SearchRunningService) {

private var logger = LoggerFactory.getLogger(SimulationRunningController::class.java)
private var logger = LoggerFactory.getLogger(SearchRunningController::class.java)

@PostMapping("/search/upload")
@Throws(IOException::class)
Expand Down Expand Up @@ -50,7 +50,6 @@ class SimulationRunningController @Autowired constructor(private var simulationR
}

val tmpFolder = prepareTmpFolder()
prepareOutputFolder(id)
val savedFiles = prepareFiles(mtls, monitoringData, tmpFolder)

simulationRunningService.runSearch(savedFiles, id, searchWindowSize)
Expand All @@ -72,10 +71,6 @@ class SimulationRunningController @Autowired constructor(private var simulationR
}
}

private fun prepareOutputFolder(id: String): Path {
return TempFileUtils.createOutputDir(TempFileUtils.OUTPUT_DIR, id)
}

private fun prepareTmpFolder(): Path {
return TempFileUtils.createDefaultTempDir("mosim-")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class CSVFileExporter(private val monitoringCSVLoc: String, private val config:

override fun export(occurrences: List<Pair<TimeInstance, TimeInstance>>) {
val monitoringData = readMonitoringData()
if (occurrences.isNotEmpty()) {
TempFileUtils.createOutputDir(TempFileUtils.OUTPUT_DIR, config.id)
}
for (occurrence in occurrences.withIndex()) {
val startValue = occurrence.value.first.time
val endValue = occurrence.value.second.time
Expand Down
1 change: 0 additions & 1 deletion src/test/kotlin/Test.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import java.io.File
class Test {
private fun test(monitoringLoc: String, mtlLoc: String) {
val config = SearchConfiguration(id = "test")
TempFileUtils.createOutputDir(TempFileUtils.OUTPUT_DIR, config.id)

val orchestrator = StimuliSearchOrchestrator(
DefaultMetricsAnalyzer(),
Expand Down

0 comments on commit e85a8e7

Please sign in to comment.