?????嵥 3. ?????????????????

import time?? threading?? Queue?? csv
 
# deploy the images for performance throughput
class waitfor(threading.Thread):
    def __init__(self?? system?? log_q):
        self.system = system
        self.log_q = log_q
        threading.Thread.__init__(self)
          
    def run(self):
        start = time.clock()
        self.system.waitFor()
        finish = time.clock()         
        self.log_q.put_nowait([time.strftime("%m/%d/%Y")?? time.strftime("%H:%M:%S")??
                              self.system.name??self.system.currentstatus??(finish-start)])
  
def run_test(instances?? fname):
    log_q = Queue.Queue()
    threads = []
    for instance in range (int(instances)):
        virtualsystem = None
        sysName = '%s-%s-%s-%d' % (pfx?? time.strftime("%Y%m%d")??time.strftime("%H%M5%S")??
                                   instance+1)
        print 'deploying virtual system: %s' % sysName
      
        createParms['name'] = sysName
        virtualsystem = deployer.virtualsystems << createParms
        sys = waitfor(virtualsystem?? log_q)
        sys.start()
        threads.append(sys)
  
    #wait until all are done
    for thd in threads:
        thd.join()
  
    # write out the results
    fname = csv.writer(open(fname?? 'w'))
    fname.writerow(['date'?? 'time'?? 'system_name'??'status'??'duration'])
    for xx in range(log_q.qsize()):
        data = log_q.get()
        fname.writerow(data)

#################################################################
# select pattern to deploy
instances = raw_input('number of instances to create: ')
pfx = raw_input('prefix for created systems: ')
output = raw_input('results file (** will be overwritten **): ')
createParms = {}

# default parameters
createParms['*.script-4.CHEF_NODE'] = 'devops_default'
createParms['*.script-4.DEPS_FILE_URL'] = '/tmp/devops_install/media/Deps-devops_services'
createParms['*.script-4.CHEF_NODE_ATTR'] =
    '"devops_server":
    {"app_source":"file:///tmp/devops_install/media/devops_services_app.zip"}??
    "ram":{"server_url":
    "http://devops.rtp.raleigh.ibm.com/downloads/RAM-Server-7.5.1.1-Linux64.zip"??
    "persist_url"
    :"http://devops.rtp.raleigh.ibm.com/downloads/RAM-Data-7.5.1.1.tar.gz"??
    /"database_url":
    "http://devops.rtp.raleigh.ibm.com/downloads/RAM-Database-7.5.1.1.tar.gz"}??
    "db2":{
    "host_server_url":"http://devops.rtp.raleigh.ibm.com/downloads"}??
    "jruby":{"download_url":"http://devops.rtp.raleigh.ibm.com/downloads/"}'
createParms['cloud'] = deployer.clouds[0]

# select the performance pattern to deploy
pattern = None
while not pattern:
    i = 1
    for p in deployer.patterns:
        print '%d. %s' % (i?? p.name)
        i = i + 1
    x = raw_input('select the test pattern to deploy: ')
    try:
        pattern = deployer.patterns[int(x) - 1]
    except:
        # try again
        pass
createParms['pattern'] = pattern

#start deploying
started = time.strftime("%m/%d/%Y at %H:%M:%S")
run_test(instances?? output)  
completed = time.strftime("%m/%d/%Y at %H:%M:%S")

print '#############   test summary  #######################'
print 'Started on: %s Completed on: %s' % (started?? completed)
print 'Images deployed: %s' % instances

?????????? 3?????????

??????????е??????????????? RQM ??????????й??? (Command Line Execution Tool)?????????????? RQM ???????? Jazz.net ???????????????ο???????????????

????RQM ????????й??????????????????в??????? RQM RESTAPI ?????????м?? (Test Execution Record) ?????С??????в?????????????????????

?????? RQM url – https://hostname:9443/qm

?????? ??????????? -- ?????????????????????????????м??

?????? ???– ????????????? RQM ?е???????

?????? ??????м???? id

?????? ??????м???????????? id

?????? ????????? (Adapter) ?? id

?????????? ??????????? RQM ??????????????????????????????????????????????? Rational Functional Tester??Rational Performance Tester??Rational Build Forge ?????????????????????????????????????????????????д????????

?????? ????????????

????????????е??ú???н???????????????е?????????????????????????????????