forked from Waikato/weka-3.8
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
35 lines (27 loc) · 919 Bytes
/
Copy pathscript.py
File metadata and controls
35 lines (27 loc) · 919 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
from threading import Thread
import sys
from queue import Queue
import time
import subprocess
def do_work():
while True:
url = q.get()
get_status()
q.task_done()
def get_status():
subprocess.call('curl -X POST "http://0.0.0.0:80/algorithm/BayesNet" -H "accept: text/uri-list" -H '
'"Content-Type: multipart/form-data" -F "estimator=SimpleEstimator" -F "estimatorParams=0.5" -F '
'"searchAlgorithm=local.K2" -F "useADTree=" -F "validationNum=10" -F "searchParams=-P 1 -S BAYES" '
'-F "datasetUri=" -F "validation=CrossValidation" -F "file=@dataset_100.arff"', shell=True)
q = Queue(0)
t = Thread(target=do_work)
t.daemon = True
t.start()
request_per_second = 20
try:
while True:
for i in range(0, request_per_second):
q.put("task")
time.sleep(1)
except KeyboardInterrupt:
sys.exit(1)