当前位置: 首页>>代码示例>>Python>>正文


Python Library.getEmulationList方法代码示例

本文整理汇总了Python中Library.getEmulationList方法的典型用法代码示例。如果您正苦于以下问题:Python Library.getEmulationList方法的具体用法?Python Library.getEmulationList怎么用?Python Library.getEmulationList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Library的用法示例。


在下文中一共展示了Library.getEmulationList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: show_all_results

# 需要导入模块: import Library [as 别名]
# 或者: from Library import getEmulationList [as 别名]
def show_all_results():
    '''
    Show summary of emulations results
    '''
    #curl -k -i http://10.55.164.232:8050/distributions/linear
    
    ET.register_namespace("test", "http://127.0.0.1/cocoma")
    response.set_header('Content-Type', 'application/vnd.bonfire+xml')
    response.set_header('Accept', '*/*')
    response.set_header('Allow', 'GET, HEAD') 
    emuList=Library.getEmulationList("all")
    
    #root element
    resultsCollection = ET.Element('collection', { 'xmlns':'http://127.0.0.1/cocoma','href':'/results'})
    items =ET.SubElement(resultsCollection,'items', { 'offset':'0','total':str(len(emuList))})
        
        
    for elem in emuList :
        failedRunsInfo=elem["failedRunsInfo"]
        
        
        #print "---->\nID: "+str(elem["ID"])+"\nName: "+str(elem["Name"])+"\nState: "+str(elem["State"])+"\nTotal Runs: "+str(elem["runsTotal"])+"\nExecuted Runs: "+str(elem["runsExecuted"])+"\nFailed Runs: "+str(len(failedRunsInfo))
        
        emuResults = ET.SubElement(items,'results', { 'href':'/results/'+str(elem["Name"]),'failedRuns':str(len(failedRunsInfo)),'name':str(elem["Name"]),'state':str(elem["State"])})


        
    
    #<link href="/" rel="parent" type="application/vnd.cocoma+xml"/>
    lk = ET.SubElement(resultsCollection, 'link', {'rel':'parent', 'href':'/', 'type':'application/vnd.bonfire+xml'})
    
    

    return prettify(resultsCollection)   
开发者ID:cragusa,项目名称:cocoma,代码行数:36,代码来源:ccmshAPI.py

示例2: get_emulations

# 需要导入模块: import Library [as 别名]
# 或者: from Library import getEmulationList [as 别名]
def get_emulations():
    '''
    Displays list of emulations that were created/scheduled
    '''
    
    
    response.set_header('Allow', 'GET, HEAD, POST')
    response.set_header('Accept', '*/*')
    emuList=Library.getEmulationList("all")
    response.set_header('Content-Type', 'application/vnd.bonfire+xml')
    
    '''
    XML namespaces are used for providing uniquely named elements and attributes in an XML document.
    '''
    
    ET.register_namespace("test", "http://127.0.0.1/cocoma")
    
    #building the XML we will return
    emulations = ET.Element('collection', { 'xmlns':'http://127.0.0.1/cocoma','href':'/emulations'})
    #<items offset="0" total="2">
    items =ET.SubElement(emulations,'items', { 'offset':'0','total':str(len(emuList))})
    
    #<emulator href="/emulations/1" name="Emu1"/>
    
    for elem in emuList :
        emulation = ET.SubElement(items,'emulation', { 'href':'/emulations/'+str(elem["Name"]),'id':str(elem["ID"]),'name':str(elem["Name"]),'state':str(elem["State"])})
        
    
    #<link href="/" rel="parent" type="application/vnd.cocoma+xml"/>
    lk = ET.SubElement(emulations, 'link', {'rel':'parent', 'href':'/', 'type':'application/vnd.bonfire+xml'})
    
    

    return prettify(emulations)
开发者ID:cragusa,项目名称:cocoma,代码行数:36,代码来源:ccmshAPI.py

示例3: len

# 需要导入模块: import Library [as 别名]
# 或者: from Library import getEmulationList [as 别名]
     if len(arguments)>0:
         try:
             Library.writeInterfaceData(arguments[0],"backfuzz_path")
             print "backfuzz_path updated to: ", arguments[0]
         except Exception, e:
             print "unable to update backfuzz_path"
             sys.exit(0)
     else:
         print "backfuzz_path = " + Library.readBackfuzzPath()
         sys.exit(0)
 
 if options.resAll:
     noExtraOptions(options, "resAll")
     if len(arguments)>0:
         try:
             emuList=Library.getEmulationList(arguments[0])
             for elem in emuList :
                 failedRunsInfo=elem["failedRunsInfo"]
                 totalFailedRuns = int(elem["runsTotal"])-int(elem["runsExecuted"])
                 #check if the emulation was completed already
                 if str(elem["State"]) == "inactive":
                     print "---->\nID: "+str(elem["ID"])+"\nName: "+str(elem["Name"])+"\nState: "+str(elem["State"])+"\nTotal Runs: "+str(elem["runsTotal"])+"\nExecuted Runs: "+str(elem["runsExecuted"])+"\nFailed Runs: "+str(totalFailedRuns)
                 else:
                     print "---->\nID: "+str(elem["ID"])+"\nName: "+str(elem["Name"])+"\nState: "+str(elem["State"])+"\nTotal Runs: "+str(elem["runsTotal"])+"\nExecuted Runs: "+str(elem["runsExecuted"])+"\nFailed Runs: "+str(len(failedRunsInfo)) 
                 
             if failedRunsInfo:
                 print "###Failed Runs Info###"
                 for Runs in failedRunsInfo:
                     print "#\nRun No: ", Runs["runNo"]
                     print "Distribution ID: ",Runs["distributionID"]
                     print "Distribution Name: ",Runs["distributionName"]
开发者ID:cragusa,项目名称:cocoma,代码行数:33,代码来源:ccmsh.py

示例4: show_results

# 需要导入模块: import Library [as 别名]
# 或者: from Library import getEmulationList [as 别名]
def show_results(name=""):
    '''
    Show emulation results. The amount of total runs and the amount of failed runs.
    '''
    
    #curl -k -i http://10.55.164.232:8050/distributions/linear
    
    ET.register_namespace("test", "http://127.0.0.1/cocoma")
    response.set_header('Content-Type', 'application/vnd.bonfire+xml')
    response.set_header('Accept', '*/*')
    response.set_header('Allow', 'GET, HEAD') 
    
    
    try:    
        emuList=Library.getEmulationList(name)
        
        
        for elem in emuList :
            failedRunsInfo=elem["failedRunsInfo"]
            
            resultsEmulation = ET.Element('results', { 'xmlns':'http://127.0.0.1/cocoma','href':'/results/'+str(elem["Name"])})
            
            emuName= ET.SubElement(resultsEmulation,'emulationName')
            emuName.text = str(elem["Name"])
            
            totalRuns= ET.SubElement(resultsEmulation,'totalRuns')
            totalRuns.text=str(elem["runsTotal"])
            
            executedRuns=ET.SubElement(resultsEmulation,'executedRuns')
            executedRuns.text=str(elem["runsExecuted"])
            
            failedRuns=ET.SubElement(resultsEmulation,'failedRuns')
            
            #checking if emulation was already executed
            if str(elem["State"]) == "inactive":
                totalFailedRuns = int(elem["runsTotal"])-int(elem["runsExecuted"])
                failedRuns.text=str(totalFailedRuns)
            else:
                failedRuns.text=str(len(failedRunsInfo))
            
            
            
            emuState= ET.SubElement(resultsEmulation,'emuState')
            emuState.text=str(elem["State"])
            
            if failedRunsInfo:
            
                failedRunsDetails= ET.SubElement(resultsEmulation,'failedRunsDetails')
            
                #print "###Failed Runs Info###"
                for Runs in failedRunsInfo:
                    runNo= ET.SubElement(failedRunsDetails,'runNo',{'runNo':str(Runs["runNo"])})
                    #runNo.text=str(Runs["runNo"])
                    
                    distributionID= ET.SubElement(runNo,'distributionID')
                    distributionID.text=str(Runs["distributionID"])
                                   
                    distributionName= ET.SubElement(runNo,'distributionName')
                    distributionName.text=str(Runs["distributionName"])
                    
                    stressValue= ET.SubElement(runNo,'stressValue')
                    stressValue.text=str(Runs["stressValue"])
                    
                    message= ET.SubElement(runNo,'message')
                    message.text=str(Runs["message"])
                    
                    #print "#\nRun No: ", Runs["runNo"]
                    #print "Distribution ID: ",Runs["distributionID"]
                    #print "Distribution Name: ",Runs["distributionName"]
                    
                    #print "Stress Value: ", Runs["stressValue"]
                    #print "Error Message: ", Runs["message"]
        
            return prettify(resultsEmulation)
        
            
    except Exception,e:
        response.status = 400
        print "\nEmulation ID:"+str(name)+" not found.\nError:"+str(e)
        return "<error>Emulation ID:"+str(name)+" not found.\nError:"+str(e)+"</error>"
开发者ID:cragusa,项目名称:cocoma,代码行数:82,代码来源:ccmshAPI.py


注:本文中的Library.getEmulationList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。