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


Python Library.emulationNow方法代码示例

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


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

示例1: start_test

# 需要导入模块: import Library [as 别名]
# 或者: from Library import emulationNow [as 别名]
def start_test():
    '''
    Execute an existing emulation XML from "/tests" folder
    '''
    
    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, POST') 
    
    
    
    emulationID=""
    
    fileName_stream =request.files.data
    fileName_stream_body =request.body.read()
    
    
    
    
    if fileName_stream:
        try:
            filename=HOMEPATH+"/tests/"+str(fileName_stream_body)
            #check if file exists maybe?
        except Exception,e:
            print e
            response.status = 400
            return "<error>"+str(e)+"</error>"
        
        #print "File data detected:\n",fileName_stream
        #return fileName_stream
        try:
             
            (emulationName,emulationType,emulationLog,emulationLogFrequency,emulationLogLevel, resourceTypeEmulation, startTimeEmu,stopTimeEmu, distroList,xmlData, MQproducerValues) = XmlParser.xmlFileParser(filename, True)
            if startTimeEmu.lower() =="now":
                startTimeEmu = Library.emulationNow(2)
                emulationID=EmulationManager.createEmulation(emulationName,emulationType,emulationLog,emulationLogFrequency,emulationLogLevel, resourceTypeEmulation, startTimeEmu,stopTimeEmu, distroList,xmlData, MQproducerValues)
            else:
                
                emulationID=EmulationManager.createEmulation(emulationName,emulationType,emulationLog,emulationLogFrequency,emulationLogLevel, resourceTypeEmulation, startTimeEmu,stopTimeEmu, distroList,xmlData, MQproducerValues)
        
        except Exception,e:
            print e
            response.status = 400
            return "<error>Cannot parse:"+str(e)+"</error>"
开发者ID:cragusa,项目名称:cocoma,代码行数:47,代码来源:ccmshAPI.py

示例2: noExtraOptions

# 需要导入模块: import Library [as 别名]
# 或者: from Library import emulationNow [as 别名]
                    try:
                        if options.emuForce:
                            noExtraOptions(options, "xml", "emuForce")
                            (emulationName,emulationType,emulationLog,emulationLogFrequency,emulationLogLevel, resourceTypeEmulation, startTimeEmu,stopTimeEmu, distroList,xmlData,MQproducerValues) = XmlParser.xmlFileParser(arguments[0], True)
                            if (type(distroList[0]) == str): #Print forceErrors
                                for distroItem in distroList: print distroItem + "\n"
                                sys.exit()
                        elif not options.emuForce:
                            noExtraOptions(options, "xml")
                            (emulationName,emulationType,emulationLog,emulationLogFrequency,emulationLogLevel, resourceTypeEmulation, startTimeEmu,stopTimeEmu, distroList,xmlData,MQproducerValues) = XmlParser.xmlFileParser(arguments[0], False)
                            if (type(distroList[0]) == str):
                                for distroItem in distroList: print distroItem + "\n" #Print forceErrors
                                sys.exit()
                        if startTimeEmu.lower() =="now":

                            startTimeEmu1 = Library.emulationNow(2)
                            #producer.sendmsg(myName,"USER REQUEST: "+sys._getframe().f_code.co_name+" create "+arguments[0])
                            msg = {"Action":"USER REQUEST Create Emulation","File":arguments[0]}
                            producer.sendmsg(myName,msg)
                            messageReturn = EmulationManager.createEmulation(emulationName,emulationType,emulationLog,emulationLogFrequency,emulationLogLevel, resourceTypeEmulation, startTimeEmu1,stopTimeEmu, distroList,xmlData, MQproducerValues)

                            print messageReturn
                        else:
                            messageReturn = EmulationManager.createEmulation(emulationName,emulationType,emulationLog,emulationLogFrequency,emulationLogLevel, resourceTypeEmulation, startTimeEmu,stopTimeEmu, distroList,xmlData, MQproducerValues)
                            print messageReturn
                    except Exception, e:
                        print e
                        error = XmlParser.xmlFileParser(arguments[0], False)
                        print error
            else:
                print "Specify XML file location. See help for details"
开发者ID:cragusa,项目名称:cocoma,代码行数:33,代码来源:ccmsh.py


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