Commit ba513cf7 authored by Suzhi Bi's avatar Suzhi Bi

Update auto_2.py

parent cd803213
......@@ -5,7 +5,6 @@ import os
import struct
import numpy as np
import time
#import json
def allocation(workload, cpu_per_core, core_num, arrival):
fixed_cpu = 7.5 * 10 ** 8
......@@ -39,11 +38,8 @@ def deal_data(conn, addr):
if buf:
if buf.decode('utf-8', 'ignore').isdigit() and len(buf.decode('utf-8', 'ignore')) < 5:
global time_max
# auxiliary_list = json.loads(buf.decode('utf-8'))
time_max = int(buf.decode('utf-8'))
print('The maximum time (seconds) allowed for picture(s) is %d.' %time_max)
# img_num = auxiliary_list[1]
# print(img_num)
flag = 1
else:
global filesize
......@@ -131,7 +127,6 @@ while 1:
os.system(cmd2)
cmd3 = "rm -f result_" + str(addr[0]) + "_" + str(os.path.split(new_image[k])[-1]).split('.')[0] + ".txt"
os.system(cmd3)
# os.system("rm -f " + str(new_image[k]))
os.system("echo No free computing resources. >> time.txt")
continue
......@@ -144,7 +139,6 @@ while 1:
os.system(cmd2)
cmd3 = "rm -f result_" + str(addr[0]) + "_" + str(os.path.split(new_image[k])[-1]).split('.')[0] + ".txt"
os.system(cmd3)
# os.system("rm -f " + str(new_image[k]))
os.system("echo Error receiving. >> time.txt")
continue
......@@ -159,6 +153,5 @@ while 1:
cmd5 = "docker rm " + str(name[k])
cmd6 = "python3 result_return.py " + str(addr[0]) + " " + str(os.path.split(new_image[k])[-1]).split('.')[0] + ".txt"
cmd7 = "rm -f result_" + str(addr[0]) + "_" + str(os.path.split(new_image[k])[-1]).split('.')[0] + ".txt"
# cmd8 = "rm -f " + str(new_image[k])
cmd = cmd1 + " && " + cmd2 + " && " + cmd3 + " && " + cmd4 + " && " + cmd4_1 + " && " + cmd5 + " && " + cmd6 + " && " + cmd7 # + " && " + cmd8
p = subprocess.Popen(cmd, shell = True, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
p = subprocess.Popen(cmd, shell = True, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
\ No newline at end of file
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