Commit a984715a authored by WorkflowPlanning's avatar WorkflowPlanning Committed by GitHub

Add files via upload

1. update the string of "u"
2. generate the output with the new json format with Huan
parent bb6dd32e
...@@ -49,9 +49,9 @@ def handleDelivery(message): ...@@ -49,9 +49,9 @@ def handleDelivery(message):
for j in json1: for j in json1:
if not json1[j]['type'] == "Switch.nodes.Application.Connection": if not json1[j]['type'] == "Switch.nodes.Application.Connection":
print j, json1[j] print j, json1[j]
nodeDic[j] = i nodeDic[j] = i
nodeDic1[i] = j nodeDic1[i] = j
i = i + 1 i = i + 1
#get the links from the json #get the links from the json
links = [] links = []
...@@ -105,8 +105,10 @@ def handleDelivery(message): ...@@ -105,8 +105,10 @@ def handleDelivery(message):
# convert the json to the file required # convert the json to the file required
res1 = {} res1 = {}
for key, value in sorted_nodeDic: for key, value in sorted_nodeDic:
print value, res[str(value)] res1_value = {}
res1[nodeDic1[value]] = res[str(value)] res1_value["size"] = res[str(value)]
res1_value["docker"] = json1[nodeDic1[value]].get('artifacts').get('docker_image').get('file')
res1[str(nodeDic1[value])] = res1_value
print res1 print res1
# generate the json files in the corresponding format as the # generate the json files in the corresponding format as the
outcontent = {} outcontent = {}
......
...@@ -33,7 +33,7 @@ def main(argv): ...@@ -33,7 +33,7 @@ def main(argv):
SDI_file = arg SDI_file = arg
data = {} data = {}
print workflow_file #print workflow_file
with open(workflow_file) as data_file: with open(workflow_file) as data_file:
data = json.load(data_file) data = json.load(data_file)
#print data #print data
...@@ -58,13 +58,14 @@ def main(argv): ...@@ -58,13 +58,14 @@ def main(argv):
#get the nodes from the json #get the nodes from the json
nodeDic = {} nodeDic = {}
nodeDic1 = {} nodeDic1 = {}
i = 1 i = 1
for j in json1: for j in json1:
if not json1[j]['type'] == "Switch.nodes.Application.Connection": if not json1[j]['type'] == "Switch.nodes.Application.Connection":
print j, json1[j] print j, json1[j]
nodeDic[j] = i nodeDic[j] = i
nodeDic1[i] = j nodeDic1[i] = j
i = i + 1 i = i + 1
#get the links from the json #get the links from the json
links = [] links = []
...@@ -118,7 +119,11 @@ def main(argv): ...@@ -118,7 +119,11 @@ def main(argv):
res1 = {} res1 = {}
for key, value in sorted_nodeDic: for key, value in sorted_nodeDic:
print value, res[str(value)] print value, res[str(value)]
res1[nodeDic1[value]] = res[str(value)]
res1_value = {}
res1_value["size"] = res[str(value)]
res1_value["docker"] = json1[nodeDic1[value]].get('artifacts').get('docker_image').get('file')
res1[str(nodeDic1[value])] = res1_value
print res1 print res1
# generate the json files in the corresponding format as the # generate the json files in the corresponding format as the
outcontent = {} outcontent = {}
...@@ -130,6 +135,7 @@ def main(argv): ...@@ -130,6 +135,7 @@ def main(argv):
par1["value"] = res1 par1["value"] = res1
par1["attributes"] = "null" par1["attributes"] = "null"
outcontent["parameters"].append(par1) outcontent["parameters"].append(par1)
#print outcontent
return 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