@@ -15,22 +15,16 @@ import com.github.dockerjava.api.exception.DockerException
1515import io.fabric8.kubernetes.client.KubernetesClientException
1616import org.slf4j.LoggerFactory
1717import org.springframework.http.HttpStatus
18- import org.springframework.http.MediaType
1918import org.springframework.http.ResponseEntity
20- import org.springframework.http.codec.multipart.FilePart
2119import org.springframework.web.bind.annotation.PostMapping
2220import org.springframework.web.bind.annotation.RequestBody
2321import org.springframework.web.bind.annotation.RequestParam
24- import org.springframework.web.bind.annotation.RequestPart
2522import org.springframework.web.bind.annotation.RestController
2623import org.springframework.web.reactive.function.client.WebClientResponseException
2724import org.springframework.web.server.ResponseStatusException
2825import reactor.core.publisher.Mono
2926import reactor.kotlin.core.publisher.doOnError
3027
31- import java.io.File
32- import java.io.FileOutputStream
33-
3428/* *
3529 * Controller used to start agents with needed information
3630 */
@@ -108,38 +102,6 @@ class AgentsController(
108102 dockerService.stopAgents(agentIds)
109103 }
110104
111- /* *
112- * @param executionLogs ExecutionLogs
113- */
114- @PostMapping(" /executionLogs" , consumes = [MediaType .MULTIPART_FORM_DATA_VALUE ])
115- fun saveAgentsLog (@RequestPart(required = true ) executionLogs : FilePart ) {
116- // File name is equals to agent id
117- val agentId = executionLogs.filename()
118- val logDir = File (configProperties.executionLogs)
119- if (! logDir.exists()) {
120- log.info(" Folder to store logs from agents was created: ${logDir.name} " )
121- logDir.mkdirs()
122- }
123- val logFile = File (logDir.path + File .separator + " $agentId .log" )
124- if (! logFile.exists()) {
125- logFile.createNewFile()
126- log.info(" Log file for $agentId agent was created" )
127- }
128- executionLogs.content()
129- .map { dtBuffer ->
130- FileOutputStream (logFile, true ).use { os ->
131- dtBuffer.asInputStream().use {
132- it.copyTo(os)
133- }
134- }
135- }
136- .collectList()
137- .doOnSuccess {
138- log.info(" Logs of agent with id = $agentId were written" )
139- }
140- .subscribe()
141- }
142-
143105 /* *
144106 * Delete containers and images associated with execution [executionId]
145107 *
0 commit comments