Skip to content

Commit 0b6d763

Browse files
author
cnavarro
committed
Further cleanup
1 parent 39e2bcf commit 0b6d763

10 files changed

+3
-445
lines changed

src/main/scala/orchestrator/Orchestrator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import java.io.{BufferedWriter, File, FileWriter}
44

55
import com.typesafe.config.{Config, ConfigFactory}
66
import org.slf4j.LoggerFactory
7-
import services.{ServiceFactory, NotsFilter, DockerService, RESTService}
7+
import services.{ServiceFactory, DockerService, RESTService}
88
import utilities.{ElasticsearchPersistor, MarathonDiscoveryService}
99

1010

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package services
22

3-
import scala.util.parsing.json.JSON
4-
53
import utilities.{RequestExecutor, ExecutableServiceConf, DiscoveryService, MarathonDiscoveryService}
64

75

@@ -13,38 +11,3 @@ extends ExecutableService(serviceId, serviceConf, requestExecutor ){
1311
}
1412

1513
}
16-
17-
18-
object DockerService {
19-
20-
/*def main(args: Array[String]) {
21-
22-
val inputs = Array("{\"text\": \"I hate western movies with John Wayne\", \"nots\": [\"hola\"], \"lang\": \"en\"}",
23-
"{ \"text\": \"Really nice car\", \"nots\": [\"hola\"], \"lang\": \"en\"}",
24-
"{ \"text\": \"The new Star Wars film is really nasty. You will not enjoy it anyway\", \"nots\": [\"hola\"], \"lang\": \"en\"}",
25-
"{ \"text\": \"The new Star Wars film is awesome, but maybe it is just for fans. You will not enjoy it anyway\", \"nots\": [\"hola\"], \"lang\": \"en\"}",
26-
"{ \"text\": \"Hola ke ace?\", \"nots\": [\"hola\"], \"lang\": \"es\"}",
27-
"{ \"text\": \"La nueva de Star Wars está muy bien. Me encantó el robot pelota.\", \"nots\": [\"hola\"], \"lang\": \"es\"}",
28-
"{ \"text\": \"El jefe se va a Endesa.\", \"nots\": [\"hola\"], \"lang\": \"es\"}"
29-
)
30-
//val inputs = Array("{\"text\": \"I hate western movies with John Wayne\", \"nots\": [\"hola\"], \"lang\": \"en\", \"videoUrl\":\"http://tv-download.dw.com/dwtv_video/flv/wikoe/wikioe20151114_wiruebli_sd_avc.mp4\"}",
31-
// "{\"text\": \"I hate western movies with John Wayne\", \"nots\": [\"hola\"], \"lang\": \"en\", \"videoUrl\":\"http://tv-download.dw.com/dwtv_video/flv/wikoe/wikioe20151114_wiruebli_sd_avc.mp4\"}")
32-
33-
val discovery = new MarathonDiscoveryService("localhost",32770)
34-
val confPath = "/home/cnavarro/projectManager/conf/dockerServices/spanish_topic_service.conf"
35-
//val confPath = "/home/cnavarro/projectManager/conf/dockerServices/audioemotion_service.conf"
36-
//val confPath = "/home/cnavarro/workspace/mixedemotions/me_extractors/BRMDemoReview/src/main/resources/dockerServices/spanish_topic_service.conf"
37-
println(s"ConfPath:${confPath}")
38-
val dockerService = ServiceFactory.dockerServiceFromConfFile(confPath, discovery)
39-
40-
41-
for(input<-inputs){
42-
val inputMap = JSON.parseFull(input).asInstanceOf[Some[Map[String,Any]]].getOrElse(Map[String,Any]())
43-
val result = dockerService.executeService(inputMap)
44-
println(result)
45-
}
46-
47-
}*/
48-
49-
50-
}

src/main/scala/services/ExecutableService.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ abstract class ExecutableService(serviceName: String, serviceConf: ExecutableSer
137137

138138
}
139139

140-
//this is the real service
141140
def executeServiceAsList(jsonString: String): List[String] = {
142141
val temp = JSON.parseFull(jsonString).asInstanceOf[Option[Map[String,Any]]]
143142
temp match {

src/main/scala/services/NotsFilter.scala

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/main/scala/services/RESTService.scala

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -19,73 +19,3 @@ class RESTService(serviceName: String, ip: String, port:Int, serviceConf: Execut
1919
}
2020

2121
}
22-
23-
object RESTService {
24-
val logger = LoggerFactory.getLogger(RESTService.getClass)
25-
26-
27-
/*
28-
def main(args: Array[String]) {
29-
30-
31-
/*val inputs = Array(
32-
"{ \"text\": \"The new Star Wars film is awesome, but maybe it is just for fans. You will not enjoy it anyway\", \"nots\": [\"hola\"], \"lang\": \"en\"}"
33-
)
34-
35-
val confPath = "/home/cnavarro/workspace/mixedemotions/MixedEmotions/orchestrator/src/main/resources/restServices/upm_emotion.conf"
36-
37-
val restService = ServiceFactory.restServiceFromConfFile(confPath)
38-
39-
40-
for(input<-inputs){
41-
val inputMap = JSON.parseFull(input).asInstanceOf[Some[Map[String,Any]]].getOrElse(Map[String,Any]())
42-
val result = restService.executeService(inputMap)
43-
println(result)
44-
}*/
45-
46-
47-
val inputs = Array(
48-
//"{ \"video_path\": \"/home/cnavarro/workspace/mixedemotions/videoScripts/videos/Moto_G4_english_review.mp4\"}"
49-
"{\"upload_path\":\"/webserverfiles/downloadedFiles/Moto_G4_english_review.mp4\"}"
50-
)
51-
/*val data = Files.readAllBytes(Paths.get("/home/cnavarro/workspace/mixedemotions/videoScripts/videos/Moto_G4_english_review.mp4"))
52-
53-
54-
val multi = MultiPart("file", "Moto_G4_english_review.mp4", "video/quicktime", data )
55-
56-
57-
58-
59-
val query = "http://mixedemotions.fim.uni-passau.de:8080/er/aer/upload"
60-
//val query = "http://localhost:32768/com.opensmile.maven/speechemotionservice/upload"
61-
62-
logger.debug("Start uploading")
63-
val response: HttpResponse[String] = Http(query).postMulti(multi).asString
64-
logger.debug("Finished uploading")
65-
66-
67-
println(s"Response: ${response.body}")
68-
*/
69-
70-
//val confPath = "/home/cnavarro/workspace/mixedemotions/MixedEmotions/orchestrator/src/main/resources/restServices/upload_to_audioextraction.conf"
71-
val confPath = "/home/cnavarro/workspace/mixedemotions/MixedEmotions/orchestrator/src/main/resources/restServices/extract_audioinfo.conf"
72-
73-
val restService = ServiceFactory.restServiceFromConfFile(confPath)
74-
75-
76-
for(input<-inputs){
77-
val inputMap = JSON.parseFull(input).asInstanceOf[Some[Map[String,Any]]].getOrElse(Map[String,Any]())
78-
val result = restService.executeService(inputMap)
79-
println(result)
80-
}
81-
//val confPath = "/home/cnavarro/workspace/mixedemotions/MixedEmotions/orchestrator/src/main/resources/restServices/upm_emotion.conf"
82-
83-
//val restService = ServiceFactory.restServiceFromConfFile(confPath)
84-
//val result = restService.parseResponse("File uploaded to : /webserverfiles/downloadedFiles/Moto_G4_english_review.mp4", None, None, Some("File uploaded to : (\\/.*)$"))
85-
//println(s"ParsedResult:${result.toString}")
86-
87-
88-
89-
}*/
90-
91-
}

src/main/scala/utilities/ElasticsearchPersistor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ object ElasticsearchPersistor {
114114

115115

116116
/*def main (args: Array[String]) {
117-
val filepath = if(args.length>0) args(0) else "/home/cnavarro/workspace/mixedemotions/MixedEmotions/orchestrator/src/test/resources/input/one.txt"
117+
val filepath = if(args.length>0) args(0) else "src/test/resources/input/one.txt"
118118
val ip = "localhost"
119119
val port = 9300
120120
val clusterName = "MixedEmotions"

src/main/scala/utilities/HttpRequestExecutor.scala

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,7 @@ import utilities.ServiceConfCompleter.completeBody
1111

1212
class HttpRequestExecutor extends RequestExecutor{
1313

14-
// Each query is delivered to the service and the response is stored
15-
/*def executeRestRequest(query: Iterator[String]): Iterator[String] = {
16-
17-
var queryResponse = List[String]()
18-
while (query.hasNext) {
19-
// The REST service is queried and the response (JSON format) is obtained
20-
val response: HttpResponse[String] = Http(query.next()).timeout(connTimeoutMs = 10000, readTimeoutMs = 50000)
21-
.asString
22-
// The response in JSON format is processed
23-
if (response.isNotError)
24-
queryResponse .::= (response.body)
25-
}
26-
queryResponse.iterator
27-
}*/
28-
def executeRequest(method: String, query: String, requestTimeout: Int = 50000, requestDelay: Int = 500, body: Option[String],
14+
def executeRequest(method: String, query: String, requestTimeout: Int = 50000, requestDelay: Int = 500, body: Option[String],
2915
fileUploadData: Option[Map[String,String]]=None, contentType: String): String = {
3016
HttpRequestExecutor.executeRequest(method, query, requestTimeout, requestDelay, body, fileUploadData, contentType)
3117
}
@@ -124,7 +110,6 @@ object HttpRequestExecutor {
124110
logger.debug(s"Query: ${query}")
125111
Http(query).postMulti(multi).timeout(connTimeoutMs = 100000, readTimeoutMs = requestTimeoutMs).asString
126112
}else {
127-
//Http(query).postData(postBody.getOrElse("")).header("content-type", contentType).timeout(connTimeoutMs = 10000, readTimeoutMs = requestTimeoutMs).asString
128113
Http(query).postData(postBody.getOrElse("")).header("content-type", contentType).timeout(connTimeoutMs = 10000, readTimeoutMs = requestTimeoutMs).asString
129114
}
130115
}

0 commit comments

Comments
 (0)