Blame view

test/functional/testLiaSoap.py 1.45 KB
9ffd72ac1   Killian   ajout du test
1
2
3
4
5
  from suds.client import Client
  import time
  import threading
  
   ### TODO : Tester en parallele x4  un million de fois pour voir ###
127210d9e   Killian   Suppression du phon
6
  url = 'http://127.0.0.1:9000/?wsdl'
9ffd72ac1   Killian   ajout du test
7
8
9
10
11
12
13
  client = Client(url)
  filename = "data.txt"
  file = open(filename, "r")
  nb_times=4
  # Exp 1
  debut =time.time()
  contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip()
127210d9e   Killian   Suppression du phon
14
15
  res =client.service.get_phon(contents)
  print(res)
9ffd72ac1   Killian   ajout du test
16
17
18
  duree= time.time()- debut
  print (" Exper 1 : " + str(duree))
  # Exp 2
127210d9e   Killian   Suppression du phon
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  #debut =time.time()
  #file.seek(0)
  #lines = file.readlines()
  #for line in lines:
  #    line = line.decode("utf8").encode("ascii", errors='ignore').rstrip() 
  #    if line is not None:
  #        try:
  #            client.service.get_phon(line)
  #        except:
  #            continue
  #duree= time.time()- debut
  #print (" Exper 2 line by line 1 corpus  : " + str(duree))
  ###Exp 3
  #debut = time.time()
  #file.seek(0)
  #contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip()
  #tabs=[]
  #i=0
  #while i <= nb_times :
  #    tabs.append(contents)
  #    i+=1
  #client.service.get_phon("".join(tabs))
  #duree= time.time()- debut
  #print ("Exper 3  2pow4  time the content in once shot " + str(duree))
9ffd72ac1   Killian   ajout du test
43
44
45
46
47
48
49
50
51
52
  # EXP 4 
  #debut = time.time()
  #contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip()
  #def envoie(datas):
  #    client.service.get_phon(datas)
  #i =0 
  #threadTab= []
  #while i <= nb_times:
  #    threadTab.append(threading.Thread(None, envoie, None,contents,None))
  #duree = time.time() - debut