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


Python FORA.initialize方法代码示例

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


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

示例1: main

# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import initialize [as 别名]
def main(parsedArguments):
    isLocalEvaluator = True
    with createViewFactory():
        FORA.initialize(useLocalEvaluator=isLocalEvaluator)

    locals = {}
    try:
        for code in parsedArguments.expressionsToEvaluate:
            eval_expression(code, locals, parsedArguments.shouldPrintEvaluationTime)

        for a in parsedArguments.files:
            with open(a) as f:
                code = f.read()
            eval_expression(code, locals, parsedArguments.shouldPrintEvaluationTime)

        if parsedArguments.repeaters:
            while True:
                for r in parsedArguments.repeaters:
                    eval_expression(r, locals, parsedArguments.shouldPrintEvaluationTime)

                Evaluator.evaluator().flush()

        if parsedArguments.alwaysRunInterpreted or (
                not parsedArguments.expressionsToEvaluate and
                not parsedArguments.files and
                not parsedArguments.repeaters
                ):
            for code, index in interactive_expressions():
                try:
                    eval_expression(code, locals, parsedArguments.shouldPrintEvaluationTime, index)
                except KeyboardInterrupt:
                    print "\n\n\t[Interrupted]\n"


    except KeyboardInterrupt:
        print "\n\n\t[Interrupted]\n"

    except Exceptions.FatalException as ex:
        print "\nERROR: " + ex.message
        print "Exiting FORA."
        import os
        os._exit(os.EX_UNAVAILABLE)


    time.sleep(.5)
开发者ID:Sandy4321,项目名称:ufora,代码行数:47,代码来源:fora_interpreter.py

示例2: setUpClass

# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import initialize [as 别名]
    def setUpClass(cls):
        cls.numWorkers = 2
        cls.simulator = ClusterSimulation.Simulator.createGlobalSimulator()
        cls.simulator.startService()
        cls.simulator.verifySharedStateRunning()

        cls.desirePublisher = cls.simulator.desirePublisher

        cls.desirePublisher.desireNumberOfWorkers(cls.numWorkers)

        FORA.initialize()

        cls.temporaryDirectoryName = tempfile.mkdtemp()
        cls.temporaryFileName = os.path.join(cls.temporaryDirectoryName, "temp.dat")
        cls.temporaryFileName2 = os.path.join(cls.temporaryDirectoryName, "temp2.dat")

        logging.info("CumulusServiceTests: getting remote gateway")
        cls.gateway = cls.simulator.createCumulusGateway(cls.simulator.callbackScheduler)
        logging.info("CumulusServiceTests: waiting for cumulus")
        CumulusSimulationUtils.waitCumulusReady(cls.gateway, cls.numWorkers)
        logging.info("CumulusServiceTests: cumulus is ready")
开发者ID:vishnur,项目名称:ufora,代码行数:23,代码来源:testCumulus.py

示例3: set

# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import initialize [as 别名]
            foraModule = FORA.importModule(os.path.join(testPath, filename))
            moduleMembersAndMetadataDict = FORA.objectMembers(foraModule)

            for memberName, memberMetadata in moduleMembersAndMetadataDict.iteritems():
                if self.isPerfTestCase(memberMetadata):
                    if filename not in perfTestCases:
                        perfTestCases[filename] = set()
                    perfTestCases[filename].add(memberName)
                    metadataForPerfTestCases[(filename, memberName)] = memberMetadata.outer

        return perfTestCases, metadataForPerfTestCases

if __name__ == "__main__":
    setup = Setup.defaultSetup()
    with Setup.PushSetup(setup):
        Setup.config().configureLoggingForUserProgram()

        FORA.initialize()

        langfilter = None
        listOnly = False

        try:
            result = test()
        except:
            logging.critical(traceback.format_exc())
            result = 1



开发者ID:Sandy4321,项目名称:ufora,代码行数:29,代码来源:localperf.py

示例4: executeTests

# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import initialize [as 别名]
def executeTests(args):
    anyFailed = False

    if args.profile is not None:
        ufora.native.TCMalloc.cpuProfilerStart(args.profile)

    #TODO FIX
    if not args.list:
        print "UFORA root is " + ufora.rootPythonPath
        print "Test arguments: ", args
        print
        print

    if args.py or args.lang or args.native or args.localperf:
        FORA.initialize()

    if args.native and not args.list:
        print "Running C++ unit tests:"
        t0 = time.time()

        #see if native args had an optinal filter specified
        native_args = []
        if args.native is not True:
            native_args.append("--run_test=" + args.native)

        if ufora.native.Tests.test( (["--log_level=test_suite"] if args.testHarnessVerbose else []) + native_args ):
            anyFailed = True

        print "took ", time.time() - t0
        print "\n\n"


    if args.py:
        filterFunc = None

        if args.modpair is not None:
            def testFilterFunc(tests):
                result = []
                for t in tests:
                    hashval = hexToInt(hashlib.sha1(repr(t)).hexdigest())
                    if hashval % args.modpair[1] == args.modpair[0]:
                        result.append(t)
                return result
            filterFunc = testFilterFunc

        if not args.list:
            print "Running python unit tests."
            print "nose version: ", nose.__version__
            print time.ctime(time.time())

        if runPythonUnitTests(args, filterFunc):
            anyFailed = True

        print "\n\n\n"

    if args.localperf:
        print "Running FORA local performance unit tests:"
        if LocalPerfTest.test(args.list, makeSemanticsTestFilter(args)):
            anyFailed = True
        print "\n\n\n"

    if args.lang:
        print "Running FORA language semantics unit tests:"
        if FORASemanticsTest.test(args.testHarnessVerbose, makeSemanticsTestFilter(args)):
            anyFailed = True
        print "\n\n\n"

    if args.multibox:
        print "Running multibox tests"
        testRunner = MultiMachineTestRunner.createTestRunner(
            testDir=args.scriptPath or 'test_scripts/multibox',
            timeout=args.timeout[0]
            )
        if not testRunner.run():
            anyFailed = True
        print "\n\n\n"

    if args.scripts:
        print "Running script unit tests:", args.timeout[0]
        scriptRunner = TestScriptRunner(testRoot=args.scriptPath or "test_scripts",
                                        defaultTimeout=args.timeout[0])
        if CodeCoverage.is_enabled():
            print 'With code coverage'
            if not scriptRunner.runWithCodeCoverage():
                anyFailed = True
        elif not scriptRunner.run():
            anyFailed = True
        print "\n\n\n"

    if args.node:
        print "Running node.js tests:"
        anyFailed = not runNodeTests() or anyFailed

    if args.browser:
        print "Running browser end-to-end test"
        browserRunner = TestScriptRunner(testRoot='ufora/web/relay/test/e2e')
        if not browserRunner.run():
            anyFailed = True
        print "\n\n\n"

#.........这里部分代码省略.........
开发者ID:nkhuyu,项目名称:ufora,代码行数:103,代码来源:test.py

示例5: setUpClass

# 需要导入模块: from ufora.FORA.python import FORA [as 别名]
# 或者: from ufora.FORA.python.FORA import initialize [as 别名]
 def setUpClass(cls):
     FORA.initialize()
开发者ID:Sandy4321,项目名称:ufora,代码行数:4,代码来源:testExampleThoughput.py


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