는 내가 3400 기계 흑연하는 데이터를 전송하는 니트,하지만 내 스크립트 내가최대 3400 대의 컴퓨터에서 스크립트를 빠르게 수행하는 방법은 무엇입니까?
def sendmsg(hostname,metric):
a = mntdir + hostname + '/' + metric + '_median'
with settings(hide('running'), warn_only=True):
valueMedian = local(("cat %s|grep %s|awk '{print $2}'") % (a,now),capture=True)
local(("echo %s.%s_Median_90days %s %s >/dev/udp/20.26.2.18/2001 ") % (hostname,metric,valueMedian,unixdate))
if __name__=='__main__':
while True:
localtime = time.asctime(time.localtime(time.time()))
date = datetime.datetime.now()
now1 = date.strftime("%H:%M")
print now1
now2 = date.strftime("%M")
with settings(hide('running'), warn_only=True):
unixdate = local("date +%s",capture=True)
if int(now2) % 5 == 0:
now = now1 + ':00'
p=Pool(100)
print now
for hostname in host:
for metric in metrics:
p.apply_async(sendmsg, args=(hostname,metric))
starttime = time.asctime(time.localtime(time.time()))
print('Waiting for all job done...%s' % starttime)
p.close()
p.join()
stoptime = time.asctime(time.localtime(time.time()))
print('sending completed...%s ' % stoptime)
time.sleep(60)
* local * 기능은 무엇을 수행합니까? – volcano