Ejemplo n.º 1
0
 def createJobSpec(self):
     jobSpec = JobSpec()
     jobSpec.profile = JobSpec.JobProfile.HAMMER
     jobSpec.requests = { "http://localhost:80/foo": { "method": "GET", "postdata": None, "cookies": {}} }
     jobSpec.duration = 60
     jobSpec.transferLimit = 1024**3
     jobSpec.statsInterval = 1
     jobSpec.timeout = 10
     jobSpec.clientFunction = "100"
     return jobSpec
Ejemplo n.º 2
0
 def createJobSpec(self):
     jobSpec = JobSpec()
     jobSpec.profile = JobSpec.JobProfile.HAMMER
     jobSpec.requests = {
         "http://localhost:80/foo": {
             "method": "GET",
             "postdata": None,
             "cookies": {}
         }
     }
     jobSpec.duration = 60
     jobSpec.transferLimit = 1024**3
     jobSpec.statsInterval = 1
     jobSpec.timeout = 10
     jobSpec.clientFunction = "100"
     return jobSpec
Ejemplo n.º 3
0
def runClient(options):
    
    @inlineCallbacks
    def results():
        r = client.results()
        yield r
        print r.result
        print "Length of result is %.2fKB" % (len(str(r.result))/1024)
        reactor.stop()
    
    print "Running client"

    jobSpec = JobSpec()
    jobSpec.requests = {
        options.target: {
            "method": "GET",
            "postdata": None,
            "cookies": {},
        },
    }
    jobSpec.duration = options.duration
    jobSpec.transferLimit = 1024**3
    jobSpec.profile = options.profile
    jobSpec.clientFunction = options.function
    jobSpec.statsInterval = 1
    jobSpec.timeout = 10
    print jobSpec
    
    client = BasicClient(options.url, 
                         jobSpec, 
                         username=options.username, 
                         password=options.password, 
                         callback=results, 
                         errback=reactor.stop)
    try:
        r = client.create()
        yield r
        r = client.start()
        yield r
        r = client.poll()
        yield r 
    except:
        reactor.stop()
Ejemplo n.º 4
0
def runClient(options):
    @inlineCallbacks
    def results():
        r = client.results()
        yield r
        print r.result
        print "Length of result is %.2fKB" % (len(str(r.result)) / 1024)
        reactor.stop()

    print "Running client"

    jobSpec = JobSpec()
    jobSpec.requests = {
        options.target: {
            "method": "GET",
            "postdata": None,
            "cookies": {},
        },
    }
    jobSpec.duration = options.duration
    jobSpec.transferLimit = 1024**3
    jobSpec.profile = options.profile
    jobSpec.clientFunction = options.function
    jobSpec.statsInterval = 1
    jobSpec.timeout = 10
    print jobSpec

    client = BasicClient(options.url,
                         jobSpec,
                         username=options.username,
                         password=options.password,
                         callback=results,
                         errback=reactor.stop)
    try:
        r = client.create()
        yield r
        r = client.start()
        yield r
        r = client.poll()
        yield r
    except:
        reactor.stop()