Blame view

test/functional/testLiaSoap.py 1.42 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 ###
f8f94203e   Killian   Correction du uni...
6
  url = 'http://194.57.216.156:8181/?wsdl'
9ffd72ac1   Killian   ajout du test
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
42
43
44
45
46
47
48
49
50
51
  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()
  client.service.get_phon(contents)
  duree= time.time()- debut
  print (" Exper 1 : " + str(duree))
  # Exp 2
  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))
  # 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