-
Notifications
You must be signed in to change notification settings - Fork 769
Expand file tree
/
Copy pathbenchmark.py
More file actions
42 lines (29 loc) · 715 Bytes
/
benchmark.py
File metadata and controls
42 lines (29 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
import requests
import gevent
from Queue import Queue
q=Queue()
import commands
from gevent import monkey
monkey.patch_all()
import os
out=commands.getoutput('find . -type f')
lines=out.split("\n")
for i in lines:
q.put(i)
def task():
while True:
name=q.get(block=False)
if name=="":
break
url = 'http://10.1.5.20:8080/group1/upload'
files = {'file': open(name, 'rb')}
options = {'output': 'json', 'path': '', 'scene': ''}
try:
r = requests.post(url, files=files)
except Exception as er:
print(er)
th=[]
for i in range(200):
th.append(gevent.spawn(task))
gevent.joinall(th)