Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
d45e9d4b
Commit
d45e9d4b
authored
Sep 17, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added timeout
parent
80c0c3f6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
105 deletions
+131
-105
docker-compose-test.yml
docker-compose/docker-compose-test.yml
+25
-25
docker-compose.yml
docker-compose/docker-compose.yml
+32
-32
mongo-express-deployment.yaml.template
k8s/CONF/mongo-express-deployment.yaml.template
+0
-0
PlannerApiController.java
...c/main/java/nl/uva/sne/drip/api/PlannerApiController.java
+13
-8
ToscaTemplateApiController.java
.../java/nl/uva/sne/drip/api/ToscaTemplateApiController.java
+40
-38
DRIPCaller.java
manager/src/main/java/nl/uva/sne/drip/rpc/DRIPCaller.java
+21
-2
No files found.
docker-compose/docker-compose-test.yml
View file @
d45e9d4b
version
:
'
3'
services
:
#
nginx:
#
image: nginx
#
volumes:
#
- ./nginx.conf:/etc/nginx/nginx.conf
#
- ./cert.pem:/etc/nginx/cert.pem
#
- ./privkey.pem:/etc/nginx/privkey.pem
#
#
- ./www:/data/www
#
ports:
#
- "80:80"
#
- "443:443"
nginx
:
image
:
nginx
volumes
:
-
./nginx.conf:/etc/nginx/nginx.conf
-
./cert.pem:/etc/nginx/cert.pem
-
./privkey.pem:/etc/nginx/privkey.pem
#- ./www:/data/www
ports
:
-
"
80:80"
-
"
443:443"
#
rabbit:
#
image: rabbitmq:3.8-management
#
ports:
#
- "5671-5672:5671-5672"
#
- "15672:15672"
#
- "4369:4369"
#
- "15671:15671"
rabbit
:
image
:
rabbitmq:3.8-management
ports
:
-
"
5671-5672:5671-5672"
-
"
15672:15672"
-
"
4369:4369"
-
"
15671:15671"
mysql
:
image
:
mysql:5.7
...
...
@@ -49,18 +49,18 @@ services:
depends_on
:
-
mysql
#
mongo:
#
image: mongo:4
#
ports:
#
- "27017:27017"
mongo
:
image
:
mongo:4
ports
:
-
"
27017:27017"
#
sure-tosca:
#
image: qcdis/sure-tosca
#
ports:
#
- "8081:8081"
sure-tosca
:
image
:
qcdis/sure-tosca
ports
:
-
"
8081:8081"
...
...
docker-compose/docker-compose.yml
View file @
d45e9d4b
...
...
@@ -12,25 +12,25 @@ services:
-
"
80:80"
-
"
443:443"
#rabbit:
#image: rabbitmq:3.8-management
rabbit
:
image
:
rabbitmq:3.8-management
ports
:
-
"
5671-5672:5671-5672"
-
"
15672:15672"
-
"
4369:4369"
-
"
15671:15671"
mysql
:
image
:
mysql:5.7
volumes
:
-
./mysql.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf
environment
:
MYSQL_RANDOM_ROOT_PASSWORD
:
'
yes'
MYSQL_DATABASE
:
semaphore
MYSQL_USER
:
semaphore
MYSQL_PASSWORD
:
semaphore
#ports:
#- "5671-5672:5671-5672"
#- "15672:15672"
#- "4369:4369"
#- "15671:15671"
#mysql:
#image: mysql:5.7
#volumes:
#- ./mysql.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf
#environment:
#MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
#MYSQL_DATABASE: semaphore
#MYSQL_USER: semaphore
#MYSQL_PASSWORD: semaphore
##ports:
##- "3306:3306"
#- "3306:3306"
semaphore
:
image
:
qcdis/docker_ansible_semaphore
...
...
@@ -83,19 +83,19 @@ services:
manager
:
depends_on
:
-
rabbit
-
mongo
-
sure-tosca
image
:
qcdis/manager
environment
:
RABBITMQ_HOST
:
rabbit
MONGO_HOST
:
mongo
SURE_TOSCA_BASE_PATH
:
http://sure-tosca:8081/tosca-sure/1.0.0
CREDENTIAL_SECRET
:
top_secret
ports
:
-
"
8080:8080"
#
manager:
#
depends_on:
#
- rabbit
#
- mongo
#
- sure-tosca
#
image: qcdis/manager
#
environment:
#
RABBITMQ_HOST: rabbit
#
MONGO_HOST: mongo
#
SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
#
CREDENTIAL_SECRET: top_secret
#
ports:
#
- "8080:8080"
sure-tosca
:
image
:
qcdis/sure-tosca
...
...
k8s/CONF/mongo-express-deployment.
template.yaml
→
k8s/CONF/mongo-express-deployment.
yaml.template
View file @
d45e9d4b
File moved
manager/src/main/java/nl/uva/sne/drip/api/PlannerApiController.java
View file @
d45e9d4b
...
...
@@ -46,7 +46,13 @@ public class PlannerApiController implements PlannerApi {
try
{
String
planedYemplateId
=
dripService
.
plan
(
id
);
return
new
ResponseEntity
<>(
planedYemplateId
,
HttpStatus
.
OK
);
}
catch
(
ApiException
|
NotFoundException
|
IOException
|
TimeoutException
|
InterruptedException
ex
)
{
}
catch
(
NotFoundException
|
java
.
util
.
NoSuchElementException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
WARNING
,
null
,
ex
);
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_FOUND
);
}
catch
(
TimeoutException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
PlannerApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
return
new
ResponseEntity
<>(
HttpStatus
.
GATEWAY_TIMEOUT
);
}
catch
(
ApiException
|
IOException
|
InterruptedException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
PlannerApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
...
...
@@ -54,7 +60,6 @@ public class PlannerApiController implements PlannerApi {
// } else {
// return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
// }
}
}
manager/src/main/java/nl/uva/sne/drip/api/ToscaTemplateApiController.java
View file @
d45e9d4b
...
...
@@ -77,7 +77,10 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Requestsed ID: {0}"
,
id
);
String
ymlStr
=
toscaTemplateService
.
findByID
(
id
);
return
new
ResponseEntity
<>(
ymlStr
,
HttpStatus
.
OK
);
}
catch
(
JsonProcessingException
|
NotFoundException
ex
)
{
}
catch
(
NotFoundException
|
java
.
util
.
NoSuchElementException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
WARNING
,
null
,
ex
);
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_FOUND
);
}
catch
(
JsonProcessingException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
ToscaTemplateApiController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
...
...
@@ -85,7 +88,6 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
// } else {
// return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
// }
}
@Override
...
...
manager/src/main/java/nl/uva/sne/drip/rpc/DRIPCaller.java
View file @
d45e9d4b
...
...
@@ -9,9 +9,12 @@ import com.rabbitmq.client.ConnectionFactory;
import
com.rabbitmq.client.DefaultConsumer
;
import
com.rabbitmq.client.Envelope
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.concurrent.ArrayBlockingQueue
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
...
...
@@ -64,7 +67,11 @@ public class DRIPCaller implements AutoCloseable {
connection
=
factory
.
newConnection
();
channel
=
connection
.
createChannel
();
// create a single callback queue per client not per requests.
// Map<String, Object> args = new HashMap<String, Object>();
// args.put("x-message-ttl", 60000);
// channel.queueDeclare("myqueue", false, false, false, args);
replyQueueName
=
channel
.
queueDeclare
().
getQueue
();
}
}
...
...
@@ -107,9 +114,11 @@ public class DRIPCaller implements AutoCloseable {
final
String
corrId
=
UUID
.
randomUUID
().
toString
();
AMQP
.
BasicProperties
props
=
new
AMQP
.
BasicProperties
.
Builder
()
.
correlationId
(
corrId
)
.
expiration
(
"10000"
)
.
replyTo
(
getReplyQueueName
())
.
build
();
Logger
.
getLogger
(
DRIPCaller
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Sending: {0} to queue: {1}"
,
new
Object
[]{
jsonInString
,
getRequestQeueName
()});
getChannel
().
basicPublish
(
""
,
getRequestQeueName
(),
props
,
jsonInString
.
getBytes
(
"UTF-8"
));
final
BlockingQueue
<
String
>
response
=
new
ArrayBlockingQueue
(
1
);
...
...
@@ -122,9 +131,19 @@ public class DRIPCaller implements AutoCloseable {
}
}
});
String
resp
=
response
.
take
();
// String resp = response.take();
int
timeOut
=
25
;
if
(
getRequestQeueName
().
equals
(
"planner"
))
{
timeOut
=
5
;
}
if
(
getRequestQeueName
().
equals
(
"provisioner"
))
{
timeOut
=
10
;
}
String
resp
=
response
.
poll
(
timeOut
,
TimeUnit
.
MINUTES
);
Logger
.
getLogger
(
DRIPCaller
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Got: {0}"
,
resp
);
if
(
resp
==
null
)
{
throw
new
TimeoutException
(
"Timeout on qeue: "
+
getRequestQeueName
());
}
return
mapper
.
readValue
(
resp
,
Message
.
class
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment