perfsonar-dev - perfsonar: r5372 - in branches/new-structure-with-base2/ps-mdm-ls: contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/functionalTests contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests src/main/java/org/perfsonar/service/lookupservice/dls/schedulerActions
Subject: perfsonar development work
List archive
perfsonar: r5372 - in branches/new-structure-with-base2/ps-mdm-ls: contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/functionalTests contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests src/main/java/org/perfsonar/service/lookupservice/dls/schedulerActions
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5372 - in branches/new-structure-with-base2/ps-mdm-ls: contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/functionalTests contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests src/main/java/org/perfsonar/service/lookupservice/dls/schedulerActions
- Date: Thu, 3 Dec 2009 10:34:03 -0500
Author: trzaszcz
Date: 2009-12-03 10:34:03 -0500 (Thu, 03 Dec 2009)
New Revision: 5372
Modified:
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/functionalTests/RegistrationTest.py
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/Main.py
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/RegistrationThread.py
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/TestThread.py
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/dls/schedulerActions/GLSRegistrationAction.java
Log:
multithreading tests improvement;
Modified:
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/functionalTests/RegistrationTest.py
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/functionalTests/RegistrationTest.py
2009-12-03 12:42:28 UTC (rev 5371)
+++
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/functionalTests/RegistrationTest.py
2009-12-03 15:34:03 UTC (rev 5372)
@@ -17,7 +17,7 @@
message=soap_template_content.replace("LS_REGISTRATION_ACCESS_POINT","http://localhost:8180/"+str(c))
messages.append(message)
- testService=TestService("127.0.0.1:8080",
"/geant2-java-xml-ls/services/LookupService",
"../../../../../results/result-ls2-exist.txt")
+ testService=TestService("127.0.0.1:8080",
"/perfsonar-java-xml-ls/services/LookupService",
"../../../../../results/result-ls2-exist.txt")
strResult=testService.runTest(messages)
print "--------------------------"
Modified:
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/Main.py
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/Main.py
2009-12-03 12:42:28 UTC (rev 5371)
+++
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/Main.py
2009-12-03 15:34:03 UTC (rev 5372)
@@ -18,11 +18,16 @@
r_list=[]
# free ids prepared for registration
f_list=range(1,1000)
-
startTime=time.time()
- endTime=300
+ endTime=120
+ resultDir="/home/czacha/Desktop"
- regThread=RegistrationThread("Registration", startTime, 0, endTime, 3,
host, url_path, "../../../../../inputs/LSRegistrationRequest100.xml", r_list,
f_list)
+ regThread1=RegistrationThread("Registration I", startTime, 0, endTime,
0.05, host, url_path,
"../../../../../inputs/LSRegistrationRequest1000.xml",resultDir, r_list,
f_list)
+ regThread2=RegistrationThread("Registration II", startTime, 0, endTime,
0.05, host, url_path,
"../../../../../inputs/LSRegistrationRequest1000.xml",resultDir, r_list,
f_list)
+ regThread1.start()
+ regThread2.start();
+ print "GO !";
- pass
\ No newline at end of file
+
+
\ No newline at end of file
Modified:
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/RegistrationThread.py
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/RegistrationThread.py
2009-12-03 12:42:28 UTC (rev 5371)
+++
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/RegistrationThread.py
2009-12-03 15:34:03 UTC (rev 5372)
@@ -11,22 +11,22 @@
classdocs
'''
- def
__init__(self,name,start_time,start_delay,end_time,delay,host,url_path,file_url,r_list,f_list):
+ def
__init__(self,name,start_time,start_delay,end_time,delay,host,url_path,sourceFile,resultDir,r_list,f_list):
'''
Constructor
'''
-
TestThread.__init__(self,name,start_time,start_delay,end_time,delay,host,url_path,file_url,r_list,f_list)
+
TestThread.__init__(self,name,start_time,start_delay,end_time,delay,host,url_path,sourceFile,resultDir,r_list,f_list)
def getElementFromList(self):
- if len(self.r_list) > 0:
+ if len(self.f_list) > 0:
id=self.f_list[0]
self.registerElement(id)
return id
else :
return None
- """
+
def getMessage(self,template,value):
- return
template.replace("LS_REGISTRATION_ACCESS_POINT","http://localhost:8180/"+str(id));
- """
+ return
template.replace("LS_REGISTRATION_ACCESS_POINT","http://localhost:8180/"+str(value));
+
\ No newline at end of file
Modified:
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/TestThread.py
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/TestThread.py
2009-12-03 12:42:28 UTC (rev 5371)
+++
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests/TestThread.py
2009-12-03 15:34:03 UTC (rev 5372)
@@ -15,7 +15,7 @@
'''
- def
__init__(self,name,start_time,start_delay,end_time,delay,host,url_path,file_url,r_list,f_list):
+ def
__init__(self,name,start_time,start_delay,end_time,delay,host,url_path,sourceFile,resultDir,r_list,f_list):
'''
Constructor
'''
@@ -27,9 +27,12 @@
self.delay=delay
self.host=host
self.url_path=url_path
- self.file_url=file_url
+ self.sourceFile=sourceFile
+ self.resultDir=resultDir
self.r_list=r_list
self.f_list=f_list
+ self.result=[]
+ self.avg=0
def getConnection(self):
@@ -38,7 +41,7 @@
return sender
def getMessageTemplate(self):
- f=open(self.file_url,"r")
+ f=open(self.sourceFile,"r")
return f.read()
def freeElement(self,element_value):
@@ -60,24 +63,50 @@
raise Exception('method not implemented - override this method in
superclass')
def run(self):
- timeToEnd=self.end_time
- result=None
+ print self.name," started"
+
connection=self.getConnection()
template=self.getMessageTemplate()
time.sleep(self.start_delay)
+ end_time=time.time()+self.end_time
+ timeToEnd=1
while(timeToEnd>0):
- element = getElementFromList()
+ element = self.getElementFromList()
if element is not None :
soap_message=self.getMessage(template,str(element))
t1=time.time()
connection.send(self.url_path, soap_message)
t2=time.time()
currentTime=t1-self.start_time
- timeToEnd=self.end_time-currentTime
- result=result,(currentTime,t2-t1)
+ duration=t2-t1
+ self.result.append((round(currentTime,2),duration))
+ self.avg=self.avg+duration
time.sleep(self.delay)
+ timeToEnd=end_time-time.time()
- print self.name,"-",result
+ print self.name," finished"
+ self.avg=self.avg/len(self.result)
+ self.writeResultToFile()
-
+
+ def getFormatedResult(self):
+ strResult=""
+ for element in self.result:
+ strResult=strResult+'%(time)f;%(processingTime)f \n' %
{"time":element[0],"processingTime":element[1]}
+
+ return strResult
+
+ def writeResultToFile(self):
+
fileName=self.resultDir+"/"+self.name+"-"+str(self.start_time)+".perf"
+ f=file(fileName,"w+")
+ content="""
+startDelay:%(startDelay)f
+delay:%(delay)f
+nr of iteration: %(iteration)d
+avg:%{avg}f
+---------------------------
+""" %
{"startDelay":self.start_delay,"delay":self.delay,"iteration":len(self.result),"avg":self.avg}
+ content=content + self.getFormatedResult()
+ f.write(content);
+ f.close()
\ No newline at end of file
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/dls/schedulerActions/GLSRegistrationAction.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/dls/schedulerActions/GLSRegistrationAction.java
2009-12-03 12:42:28 UTC (rev 5371)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/dls/schedulerActions/GLSRegistrationAction.java
2009-12-03 15:34:03 UTC (rev 5372)
@@ -135,10 +135,6 @@
}
}
- for (URL url : glsAddresses) {
- System.out.println(url);
- }
-
if (registeredKey == null) {
logger.warn("Registration to GLS failed !!");
} else {
- perfsonar: r5372 - in branches/new-structure-with-base2/ps-mdm-ls: contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/functionalTests contrib/SOAPRequestAuxilary/src/pl/psnc/trzaszczka/multiThreadingTests src/main/java/org/perfsonar/service/lookupservice/dls/schedulerActions, svnlog, 12/03/2009
Archive powered by MHonArc 2.6.16.