예제 #1
0
파일: pub.py 프로젝트: gburd/mod_pubsub
        def __init__(self, myID, numEvents, size, delay, pubUrl, verbosity, outputFile=None ):
                print "initializing thread"
                urlbase = pubUrl + "?do_method=notify&kn_expires=%2b3600&kn_perfzzyyxx=1" + \
                        "&pubID=" + str(myID) + "&kn_blah=1&kn_payload="
                payload = "x" * size
                self.user = '******'
                self.numEvents = numEvents
                self.myID = str(myID)
                self.delay = delay
                self.verbosity = verbosity
                self.startTime = None
                self.endTime = None
                self.threadTimes = threadTimes
                self.outputFile = outputFile
                
                self.url = urlbase + payload
                print "URL is " + self.url

                self._lock = threading.Lock()

                self.curlhandle = pycurl.init()
                self.curlhandle.setopt( pycurl.URL, pubUrl);
                self.curlhandle.setopt( pycurl.USERPWD, self.user )

                #
                # Uncommenting this out crashes the program.  Wanted to uncomment
                # it so that we do not write to stdout the response.
                #
                # self.curlhandle.setopt( pycurl.WRITEFUNCTION, self.writeFunction )
                threading.Thread.__init__(self)
예제 #2
0
파일: sub.py 프로젝트: kragen/mod_pubsub
 def performSubscribe(self):
         print 'Testing curl version', pycurl.version
         c = pycurl.init()
         c.setopt(pycurl.URL, url)
         c.setopt(pycurl.WRITEFUNCTION, body_callback)
         c.perform()
         c.cleanup()
예제 #3
0
 def performSubscribe(self):
     print 'Testing curl version', pycurl.version
     c = pycurl.init()
     c.setopt(pycurl.URL, url)
     c.setopt(pycurl.WRITEFUNCTION, body_callback)
     c.perform()
     c.cleanup()
예제 #4
0
파일: sub.py 프로젝트: kragen/mod_pubsub
 def __init__(self, myID, numEvents, url, verbose):
         print "initializing thread" + str( myID )
         self.numEvents = numEvents
         self.myID = str(myID)
         self.url = url
         self.count = 0
         self.verbose = verbose
         self.curlhandle = pycurl.init()
         self.curlhandle.setopt( pycurl.URL, self.url);
         self.curlhandle.setopt( pycurl.WRITEFUNCTION, self.body_callback )
         threading.Thread.__init__(self)
예제 #5
0
 def __init__(self, myID, numEvents, url, verbose):
     print "initializing thread" + str(myID)
     self.numEvents = numEvents
     self.myID = str(myID)
     self.url = url
     self.count = 0
     self.verbose = verbose
     self.curlhandle = pycurl.init()
     self.curlhandle.setopt(pycurl.URL, self.url)
     self.curlhandle.setopt(pycurl.WRITEFUNCTION, self.body_callback)
     threading.Thread.__init__(self)
예제 #6
0
    # subscribers.

    i = 0
    tmpStartNum = startNum
    tmpEndNum = 0
    pubUrl = pubUrlBase
    incrementPerPublisher = ((endNum - startNum) + 1) / numPub
    if (incrementPerPublisher > 1000):
        print "Error! Error! Error!"
        print "THe number of subscribers is divvied up against the "
        print " number of publishers.  But, there can only be upto "
        print "1000 subscribers per publisher in this test suite."
        print "Parameters passed to this program set number of subscribers"
        print "per publisher to " + str(incrementPerPublisher)

    curlhandle = pycurl.init()
    curlhandle.setopt(pycurl.WRITEFUNCTION, body)
    curlhandle.setopt(pycurl.HEADERFUNCTION, header)

    while i < numPub:
        if (numPub != 1):
            tmpStartNum = incrementPerPublisher * i
            tmpEndNum = tmpStartNum + (incrementPerPublisher - 1)
        else:
            tmpEndNum = endNum

        #  Beware: this is tightly coupled to pub.py

        pubUrl = pubUrlBase + str(i)
        print "--------------------------------------------------"
        print "Iteration for makeroutes"
예제 #7
0
        # subscribers.

        i = 0
        tmpStartNum = startNum
        tmpEndNum = 0
        pubUrl = pubUrlBase
        incrementPerPublisher = ((endNum - startNum) + 1)/numPub
        if (incrementPerPublisher > 1000 ):
                print "Error! Error! Error!"
                print "THe number of subscribers is divvied up against the "
                print " number of publishers.  But, there can only be upto "
                print "1000 subscribers per publisher in this test suite."
                print "Parameters passed to this program set number of subscribers"
                print "per publisher to " + str(incrementPerPublisher)
        
        curlhandle = pycurl.init()
        curlhandle.setopt( pycurl.WRITEFUNCTION, body )
        curlhandle.setopt( pycurl.HEADERFUNCTION, header )
        
        while i < numPub:
                if( numPub != 1 ):
                        tmpStartNum = incrementPerPublisher * i
                        tmpEndNum = tmpStartNum + (incrementPerPublisher - 1)
                else:
                        tmpEndNum = endNum

                #  Beware: this is tightly coupled to pub.py

                pubUrl = pubUrlBase + str(i)
                print "--------------------------------------------------"
                print "Iteration for makeroutes"