Commit 6db574fa authored by Spiros Koulouzis's avatar Spiros Koulouzis

Fixed bug of deadline with new tosca file

parent 99e78372
......@@ -15,39 +15,19 @@
*/
package nl.uva.sne.drip.api.v1.rest;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.security.RolesAllowed;
import nl.uva.sne.drip.api.exception.BadRequestException;
import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.commons.v1.types.Message;
import nl.uva.sne.drip.commons.v1.types.MessageParameter;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import nl.uva.sne.drip.api.rpc.DRIPCaller;
import nl.uva.sne.drip.api.rpc.DeployerCaller;
import nl.uva.sne.drip.api.service.CloudCredentialsService;
import nl.uva.sne.drip.api.service.DeployClusterService;
import nl.uva.sne.drip.api.service.ProvisionService;
import nl.uva.sne.drip.api.service.UserService;
import nl.uva.sne.drip.commons.v1.types.CloudCredentials;
import nl.uva.sne.drip.commons.v1.types.ClusterCredentials;
import nl.uva.sne.drip.commons.v1.types.DeployParameter;
import nl.uva.sne.drip.commons.v1.types.LoginKey;
import nl.uva.sne.drip.commons.v1.types.ProvisionInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
......
54.236.54.229 ubuntu /tmp/1 master
54.236.54.229 ubuntu /tmp/2 slave
54.236.37.228 ubuntu /tmp/1 master
54.236.8.78 ubuntu /tmp/2 slave
......@@ -47,7 +47,7 @@ class Workflow():
if key == 'links' :
for link in value:
self.G.add_weighted_edges_from([(link['source'], link['target'], link['weight'])])
print self.G.nodes
#print self.G.nodes
#parse the performance matrix
p = []
......@@ -58,7 +58,7 @@ class Workflow():
for i in value.split(','):
row.append(int(i))
row.append(0)
print row
#print row
p.append(row)
self.p_table = np.matrix(p)
#parse the price vector
......
No preview for this file type
......@@ -38,9 +38,17 @@ def handleDelivery(message):
deadline = 0
for j in json1:
print json1[j]['type']
if not json1[j]['type'] == "Switch.nodes.Application.Connection":
deadline = int(re.search(r'\d+', json1[j]['properties']['QoS']['response_time']).group())
if "Switch.nodes.Application.Container.Docker." in json1[j]['type'] and "QoS" in str(json1[j]['properties']) and "response_time" in str(json1[j]['properties']):
response_time = json1[j]['properties']['QoS']['response_time']
reg_ex = re.search(r'\d+', str(response_time))
gr = reg_ex.group()
deadline = int(gr)
#if json[j]['type'] == "Switch.nodes.Application.Container.Docker.MOG_ProxyTranscoder" or json[j]['type']== "Switch.nodes.Application.Container.Docker.MOG_InputDistributor":
#response_time = json1[j]['properties']['QoS']['response_time']
#reg_ex = re.search(r'\d+', response_time)
#gr = reg_ex.group();
#deadline = int(gr)
#get the nodes from the json
nodeDic = {}
......@@ -87,7 +95,6 @@ def handleDelivery(message):
for key, value in sorted_nodeDic:
performance[str(value)] = "1,2,3"
wfJson['performance'] = performance
#print wfJson
#send request to the server
......@@ -121,10 +128,10 @@ def handleDelivery(message):
res1["docker"] = str(docker)
par["value"] = res1
par["attributes"] = "null"
print ("Parameter: %s" % par)
##print ("Parameter: %s" % par)
outcontent["parameters"].append(par)
print ("Output message: %s" % outcontent)
#print ("Output message: %s" % outcontent)
return outcontent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment