15
15
16
16
FILES_SERVER = os .environ .get ("FILES_SERVER" , "localhost:3001" )
17
17
QUEUE_SERVER_HOST , QUEUE_SERVER_PORT = os .environ .get ("QUEUE_SERVER" , "localhost:5672" ).split (":" )
18
- Q_IN = os .environ .get ("INPUT_QUEUE_NAME" , "vad_in " )
19
- Q_OUT = os .environ .get ("OUTPUT_QUEUE_NAME" , "vad_out " )
18
+ Q_IN = os .environ .get ("INPUT_QUEUE_NAME" , "low_level_in " )
19
+ Q_OUT = os .environ .get ("OUTPUT_QUEUE_NAME" , "low_level_out " )
20
20
21
21
def callback (channel , method , properties , body , args ):
22
22
@@ -32,7 +32,7 @@ def do_work(connection, channel, delivery_tag, body):
32
32
try :
33
33
print (" [x] Received %r" % body , flush = True )
34
34
args = json .loads (body )
35
- file = download (args ['file' ], buffer = True )
35
+ file = download (args ['file' ][ 'name' ], url = "http://" + FILES_SERVER , buffer = True )
36
36
result = ast .literal_eval (file .decode ('utf-8' ))
37
37
38
38
count = 0
@@ -55,14 +55,13 @@ def do_work(connection, channel, delivery_tag, body):
55
55
56
56
payload = bytes (str (dict_result ), encoding = 'utf-8' )
57
57
58
- uploaded = upload (payload , buffer = True , mime = 'text/plain' )
58
+ uploaded = upload (payload , url = "http://" + FILES_SERVER , buffer = True , mime = 'text/plain' )
59
59
60
60
message = {
61
61
** args ,
62
62
'low-level-output' : uploaded
63
63
}
64
64
65
- # post a message on topic_segmentation queue
66
65
connection_out = pika .BlockingConnection (
67
66
pika .ConnectionParameters (host = QUEUE_SERVER_HOST , port = QUEUE_SERVER_PORT ))
68
67
channel2 = connection_out .channel ()
@@ -112,7 +111,7 @@ def consume():
112
111
threads = []
113
112
on_message_callback = functools .partial (
114
113
callback , args = (connection , threads ))
115
- channel .basic_consume (queue = 'low_level_features' ,
114
+ channel .basic_consume (queue = Q_IN ,
116
115
on_message_callback = on_message_callback )
117
116
try :
118
117
channel .start_consuming ()
0 commit comments