Skip to content

Commit

Permalink
Add search window size to API
Browse files Browse the repository at this point in the history
  • Loading branch information
franksn90 committed May 11, 2024
1 parent a20aeab commit aeaa6fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.springframework.stereotype.Service
@Service
class SearchRunningService {

fun runSearch(inputFiles: Multimap<String, String>, id: String) {
fun runSearch(inputFiles: Multimap<String, String>, id: String, searchWindowSize: Double) {
val monitoringDataPathCollection = inputFiles["monitoring-data"]
val mtlPathCollection = inputFiles["mtl"]
if (monitoringDataPathCollection.isEmpty()) {
Expand All @@ -29,7 +29,7 @@ class SearchRunningService {
val mtlPath = mtlPathCollection.iterator().next()
val monitoringDataPath = monitoringDataPathCollection.iterator().next()

val config = SearchConfiguration(id = id)
val config = SearchConfiguration(id = id, searchWindowSize = searchWindowSize)

val orchestrator = StimuliSearchOrchestrator(
DefaultMetricsAnalyzer(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ class SimulationRunningController @Autowired constructor(private var simulationR
fun handleMultipleFilesUpload(
@RequestParam("mtls") mtls: Array<MultipartFile>,
@RequestParam("monitoring_data") monitoringData: Array<MultipartFile>,
@RequestParam("simulation_id") id: String
@RequestParam("simulation_id") id: String,
@RequestParam("search_window_size") searchWindowSize: Double
): ResponseEntity<String?> {
return runSearch(mtls, monitoringData, id)
return runSearch(mtls, monitoringData, id, searchWindowSize)
}

// TODO: Handle this call in a non-blocking manner, taking into account that this implementation is not
// client friendly as it can time-out the request due to the long processing time.
@Throws(IOException::class)
private fun runSearch(
mtls: Array<MultipartFile>, monitoringData: Array<MultipartFile>, id: String
mtls: Array<MultipartFile>, monitoringData: Array<MultipartFile>, id: String, searchWindowSize: Double
): ResponseEntity<String?> {
return try {
if (TempFileUtils.existsSimulationId(id)) {
Expand All @@ -52,7 +53,7 @@ class SimulationRunningController @Autowired constructor(private var simulationR
prepareOutputFolder(id)
val savedFiles = prepareFiles(mtls, monitoringData, tmpFolder)

simulationRunningService.runSearch(savedFiles, id)
simulationRunningService.runSearch(savedFiles, id, searchWindowSize)
if (!TempFileUtils.existsSimulationId(id)) {
return ResponseEntity(
String.format(
Expand Down

0 comments on commit aeaa6fb

Please sign in to comment.