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
dd0fedf3
Commit
dd0fedf3
authored
Feb 23, 2017
by
WorkflowPlanning
Committed by
GitHub
Feb 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add files via upload
parent
1f8ca025
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
17 deletions
+35
-17
rpc_server.py
python/panner/rpc_server.py
+28
-15
server.py
python/panner/server.py
+7
-2
No files found.
python/panner/rpc_server.py
View file @
dd0fedf3
...
@@ -17,19 +17,27 @@ import json
...
@@ -17,19 +17,27 @@ import json
connection
=
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
'172.17.0.
3
'
))
connection
=
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
'172.17.0.
2
'
))
channel
=
connection
.
channel
()
channel
=
connection
.
channel
()
channel
.
queue_declare
(
queue
=
'planner_queue'
)
channel
.
queue_declare
(
queue
=
'planner_queue'
)
def
on_request
(
ch
,
method
,
props
,
body
):
def
handleDelivery
(
message
):
parsed_message
=
json
.
loads
(
body
)
parsed_json
=
json
.
loads
(
message
)
value
=
parsed_message
.
get
(
'parameters'
)[
0
]
.
get
(
'value'
)
params
=
parsed_json
[
"parameters"
]
parsed_value
=
json
.
loads
(
value
)
for
param
in
params
:
name
=
param
[
"name"
]
json1
=
parsed_value
.
get
(
'topology_template'
)
.
get
(
'node_templates'
)
value
=
param
[
"value"
]
def
on_request
(
ch
,
method
,
props
,
body
):
handleDelivery
(
body
)
print
(
" Message
%
s"
%
body
)
response
=
"AAAAAAAAAAAAAAAAAAAAAA"
json1
=
response
.
get
(
'parameters'
)[
0
]
.
get
(
'value'
)
.
get
(
'topology_template'
)
.
get
(
'node_templates'
)
deadline
=
0
deadline
=
0
for
j
in
json1
:
for
j
in
json1
:
...
@@ -93,24 +101,29 @@ def on_request(ch, method, props, body):
...
@@ -93,24 +101,29 @@ def on_request(ch, method, props, body):
#print content['workflow']
#print content['workflow']
#return
#return
res
=
wf
.
generateJSON
()
res
=
wf
.
generateJSON
()
end
=
time
.
time
()
end
=
time
.
time
()
print
(
end
-
start
)
print
(
end
-
start
)
# convert the json to the file required
res1
=
{}
for
key
,
value
in
sorted_nodeDic
:
print
value
,
res
[
str
(
value
)]
res1
[
nodeDic1
[
value
]]
=
res
[
str
(
value
)]
print
res1
# generate the json files in the corresponding format as the
# generate the json files in the corresponding format as the
outcontent
=
{}
outcontent
=
{}
current_milli_time
=
lambda
:
int
(
round
(
time
.
time
()
*
1000
))
outcontent
[
"creationDate"
]
=
1487002029722
outcontent
[
"creationDate"
]
=
current_milli_time
()
outcontent
[
"parameters"
]
=
[]
outcontent
[
"parameters"
]
=
[]
par1
=
{}
par1
=
{}
par1
[
"url"
]
=
'null'
par1
[
"url"
]
=
"null"
par1
[
"encoding"
]
=
"UTF-8"
par1
[
"encoding"
]
=
"UTF-8"
par1
[
"name"
]
=
"plan"
par1
[
"value"
]
=
res1
par1
[
"value"
]
=
res
par1
[
"attributes"
]
=
"null"
par1
[
"attributes"
]
=
'null'
outcontent
[
"parameters"
]
.
append
(
par1
)
outcontent
[
"parameters"
]
.
append
(
par1
)
return
outcontent
response
=
outcontent
response
=
outcontent
print
(
response
)
ch
.
basic_publish
(
exchange
=
''
,
ch
.
basic_publish
(
exchange
=
''
,
routing_key
=
props
.
reply_to
,
routing_key
=
props
.
reply_to
,
properties
=
pika
.
BasicProperties
(
correlation_id
=
\
properties
=
pika
.
BasicProperties
(
correlation_id
=
\
...
...
python/panner/server.py
View file @
dd0fedf3
...
@@ -114,7 +114,12 @@ def main(argv):
...
@@ -114,7 +114,12 @@ def main(argv):
end
=
time
.
time
()
end
=
time
.
time
()
print
(
end
-
start
)
print
(
end
-
start
)
# convert the json to the file required
res1
=
{}
for
key
,
value
in
sorted_nodeDic
:
print
value
,
res
[
str
(
value
)]
res1
[
nodeDic1
[
value
]]
=
res
[
str
(
value
)]
print
res1
# generate the json files in the corresponding format as the
# generate the json files in the corresponding format as the
outcontent
=
{}
outcontent
=
{}
outcontent
[
"creationDate"
]
=
1487002029722
outcontent
[
"creationDate"
]
=
1487002029722
...
@@ -122,7 +127,7 @@ def main(argv):
...
@@ -122,7 +127,7 @@ def main(argv):
par1
=
{}
par1
=
{}
par1
[
"url"
]
=
"null"
par1
[
"url"
]
=
"null"
par1
[
"encoding"
]
=
"UTF-8"
par1
[
"encoding"
]
=
"UTF-8"
par1
[
"value"
]
=
res
par1
[
"value"
]
=
res
1
par1
[
"attributes"
]
=
"null"
par1
[
"attributes"
]
=
"null"
outcontent
[
"parameters"
]
.
append
(
par1
)
outcontent
[
"parameters"
]
.
append
(
par1
)
return
outcontent
return
outcontent
...
...
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