• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ComputedValue.ComputedValueGateway类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ufora.BackendGateway.ComputedValue.ComputedValueGateway的典型用法代码示例。如果您正苦于以下问题:Python ComputedValueGateway类的具体用法?Python ComputedValueGateway怎么用?Python ComputedValueGateway使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: trigger

    def trigger(self):
        if self.successOrError is not None:
            return

        if self.computedValue.valueIVC is None:
            self.successOrError={'success':False, 'message': "Tried to trigger write before calculation was finished."}
            return

        if not self.computedValue.valueIVC.isVectorOfChar():
            self.successOrError={'success':False, 'message': "Result should have been a string."}
            return
        if self.computedValue.isException:
            self.successOrError={'success':False, 'message': "Result should have been a string. Got an exception instead."}
            return

        def callback(result):
            if result.isSuccess():
                self.successOrError={'success':True}
            else:
                self.successOrError={'success':False, 'message': str(result)}

        ComputedValueGateway.getGateway().createExternalIoTask(
            CumulusNative.ExternalIoTask.WriteCharBigvecToS3(
                self.computedValue.valueIVC.getVectorBigvecGuid(),
                CumulusNative.S3KeyAndCredentials(
                    self.bucketname,
                    self.keyname,
                    "",
                    "",
                    ""
                    )
                ),
            callback
            )
开发者ID:Sandy4321,项目名称:ufora,代码行数:34,代码来源:WriteToS3Task.py


示例2: extractVectorDataAsNumpyArrayInChunks

    def extractVectorDataAsNumpyArrayInChunks(self, stepSize = 100000):
        """Return the data as a sequence of numpy arrays each of which is no larger than 'stepSize'.

        This is used to prevent us from creating memory fragmentation when we are loading
        lots of arrays of different sizes.
        """
        if self.computedValueVector.vectorImplVal is None:
            return None
        
        if len(self.vectorDataIds) > 0 and not self.isLoaded:
            return None

        if not self.vdmThinksIsLoaded():
            return None

        result = []
        index = self.lowIndex
        while index < self.highIndex and result is not None:
            tailResult = ComputedValueGateway.getGateway().extractVectorDataAsNumpyArray(
                self.computedValueVector,
                index,
                min(self.highIndex, index+stepSize)
                )
            index += stepSize
            if tailResult is not None:
                result.append(tailResult)
            else:
                result = None

        if result is None and not self.vdmThinksIsLoaded():
            logging.info("CumulusClient: %s was marked loaded but returned None", self)
            self.isLoaded = False
            ComputedValueGateway.getGateway().reloadVector(self)

        return result
开发者ID:WantonSoup,项目名称:ufora,代码行数:35,代码来源:ComputedValue.py


示例3: update

 def update(self):
     if ComputedValueGateway.getGateway().getPersistentCacheIndex() is None:
         return
     
     self.totalBytesInCache = ComputedValueGateway.getGateway().getPersistentCacheIndex().totalBytesInCache()
     self.totalObjectsInCache = ComputedValueGateway.getGateway().getPersistentCacheIndex().totalObjectsInCache()
     self.totalComputationsInCache = ComputedValueGateway.getGateway().getPersistentCacheIndex().totalComputationsInCache()
     self.totalReachableComputationsInCache = ComputedValueGateway.getGateway().getPersistentCacheIndex().totalReachableComputationsInCache()
开发者ID:WantonSoup,项目名称:ufora,代码行数:8,代码来源:PersistentCacheIndex.py


示例4: extractVectorItemAsIVC

    def extractVectorItemAsIVC(self, ct):
        if self.computedValueVector.vectorImplVal is None:
            return None
        
        if len(self.vectorDataIds) > 0 and not self.isLoaded:
            return None

        result = ComputedValueGateway.getGateway().extractVectorItem(self.computedValueVector, ct)

        if result is None:
            logging.info("CumulusClient: %s was marked loaded but returned None", self)
            self.isLoaded = False
            ComputedValueGateway.getGateway().reloadVector(self)

        return result
开发者ID:vishnur,项目名称:ufora,代码行数:15,代码来源:ComputedValue.py


示例5: submittedComputationId

    def submittedComputationId(self):
        computationId = ComputedValueGateway.getGateway().submittedComputationId(self.cumulusComputationDefinition)

        if computationId is None:
            return

        return computationId.toSimple()
开发者ID:vishnur,项目名称:ufora,代码行数:7,代码来源:ComputedValue.py


示例6: slicesByPage

    def slicesByPage(self):
        if self.vectorImplVal is None:
            return []

        return [self.getMappableSlice(low,high) for low,high in
                    self.vectorImplVal.getVectorPageSliceRanges(
                        ComputedValueGateway.getGateway().vdm
                        )]
开发者ID:vishnur,项目名称:ufora,代码行数:8,代码来源:ComputedValue.py


示例7: vectorDataIds

    def vectorDataIds(self):
        if self.computedValueVector.vectorImplVal is None:
            return []

        return self.computedValueVector.vectorImplVal.getVectorDataIdsForSlice(
            self.lowIndex,
            self.highIndex,
            ComputedValueGateway.getGateway().vdm
            )
开发者ID:vishnur,项目名称:ufora,代码行数:9,代码来源:ComputedValue.py


示例8: totalVectorBytesReferenced

    def totalVectorBytesReferenced(self):
        if self.checkpointStatus is None:
            return 0

        stats = self.checkpointStatus.statistics
        
        return ComputedValueGateway.getGateway().bytecountForBigvecs(
                        self.checkpointStatus.bigvecsReferenced
                        )
开发者ID:vishnur,项目名称:ufora,代码行数:9,代码来源:ComputedValue.py


示例9: extractVectorDataAsPythonArray

    def extractVectorDataAsPythonArray(self):
        if self.computedValueVector.vectorImplVal is None:
            return None

        if len(self.vectorDataIds) > 0 and not self.isLoaded:
            return None

        result = ComputedValueGateway.getGateway().extractVectorDataAsPythonArray(
            self.computedValueVector,
            self.lowIndex,
            self.highIndex
            )

        if result is None and not self.vdmThinksIsLoaded():
            logging.info("CumulusClient: %s was marked loaded but returned None. reloading", self)
            self.isLoaded = False
            ComputedValueGateway.getGateway().reloadVector(self)

        return result
开发者ID:vishnur,项目名称:ufora,代码行数:19,代码来源:ComputedValue.py


示例10: extractVectorContents

            def extractVectorContents(vectorIVC):
                if len(vectorIVC) == 0:
                    return {'listContents': []}

                #if this is an unpaged vector we can handle it without callback
                vdm = ComputedValueGateway.getGateway().vdm
                if vdm.vectorDataIsLoaded(vectorIVC, 0, len(vectorIVC)) and vectorIVC.isVectorEntirelyUnpaged():
                    #see if it's a string. This is the only way to be holding a Vector of char
                    if vectorIVC.isVectorOfChar():
                        res = vdm.extractVectorContentsAsNumpyArray(vectorIVC, 0, len(vectorIVC))
                        assert res is not None
                        return {'string': res.tostring()}

                    #see if it's simple enough to transmit as numpy data
                    if len(vectorIVC.getVectorElementsJOR()) == 1 and len(vectorIVC) > 1:
                        res = vdm.extractVectorContentsAsNumpyArray(vectorIVC, 0, len(vectorIVC))

                        if res is not None:
                            assert len(res) == len(vectorIVC)
                            firstElement = vdm.extractVectorItem(vectorIVC, 0)
                            return {'firstElement': firstElement, 'contentsAsNumpyArrays': [res]}

                    #see if we can extract the data as a regular pythonlist
                    res = vdm.extractVectorContentsAsPythonArray(vectorIVC, 0, len(vectorIVC)) 
                    assert res is not None
                    return {'listContents': res}

                vec = ComputedValue.ComputedValueVector(vectorImplVal=vectorIVC)
                vecSlice = vec.entireSlice

                res = None
                preventPythonArrayExtraction = False

                #see if it's a string. This is the only way to be holding a Vector of char
                if vectorIVC.isVectorOfChar():
                    res = vecSlice.extractVectorDataAsNumpyArray()
                    if res is not None:
                        res = {'string': res.tostring()}

                #see if it's simple enough to transmit as numpy data
                if res is None and len(vectorIVC.getVectorElementsJOR()) == 1 and len(vectorIVC) > 1:
                    res = vecSlice.extractVectorDataAsNumpyArrayInChunks()

                    if res is not None:
                        firstElement = vecSlice.extractVectorItemAsIVC(0)
                        if firstElement is None:
                            #note we can't import this at the top of the file because this file gets imported
                            #during the build process, which doesn't have pyfora installed.
                            import pyfora.Exceptions as Exceptions
                            raise Exceptions.ForaToPythonConversionError(
                                "Shouldn't be possible to download data as numpy, and then not get the first value"
                                )

                        res = {'firstElement': firstElement, 'contentsAsNumpyArrays': res}
                    else:
                        if not vecSlice.vdmThinksIsLoaded():
                            #there's a race condition where the data could be loaded between now and
                            #the call to 'extractVectorDataAsPythonArray'. This prevents it.
                            preventPythonArrayExtraction = True

                #see if we can extract the data as a regular pythonlist
                if not preventPythonArrayExtraction and res is None:
                    res = vecSlice.extractVectorDataAsPythonArray()
                    if res is not None:
                        res = {'listContents': res}

                if res is None:
                    vecSlice.increaseRequestCount()
                    return None

                return res
开发者ID:Sandy4321,项目名称:ufora,代码行数:71,代码来源:PyforaComputedValue.py


示例11: decreaseRequestCount

 def decreaseRequestCount(self, *args):
     ComputedValueGateway.getGateway().decreaseRequestCount(self, self.cumulusComputationDefinition)
开发者ID:vishnur,项目名称:ufora,代码行数:2,代码来源:ComputedValue.py


示例12: requestComputationCheckpoint

 def requestComputationCheckpoint(self, *args):
     ComputedValueGateway.getGateway().requestComputationCheckpoint(self, self.cumulusComputationDefinition)
开发者ID:vishnur,项目名称:ufora,代码行数:2,代码来源:ComputedValue.py


示例13: cancel

 def cancel(self, *args):
     ComputedValueGateway.getGateway().cancelComputation(self, self.cumulusComputationDefinition)
开发者ID:vishnur,项目名称:ufora,代码行数:2,代码来源:ComputedValue.py


示例14: initialize

    def initialize(self, purePythonMDSAsJson):
        """Initialize the converter assuming a set of pyfora builtins"""
        try:
            import pyfora.ObjectRegistry as ObjectRegistry
            import ufora.FORA.python.PurePython.Converter as Converter
            import ufora.FORA.python.PurePython.PyforaSingletonAndExceptionConverter as PyforaSingletonAndExceptionConverter
            import ufora.native.FORA as ForaNative
            import ufora.FORA.python.ModuleImporter as ModuleImporter


            logging.info("Initializing the PyforaObjectConverter")

            objectRegistry_[0] = ObjectRegistry.ObjectRegistry()

            if purePythonMDSAsJson is None:
                converter_[0] = Converter.Converter()
            else:
                purePythonModuleImplval = ModuleImporter.importModuleFromMDS(
                    ModuleDirectoryStructure.ModuleDirectoryStructure.fromJson(purePythonMDSAsJson),
                    "fora",
                    "purePython",
                    searchForFreeVariables=True
                    )

                singletonAndExceptionConverter = \
                    PyforaSingletonAndExceptionConverter.PyforaSingletonAndExceptionConverter(
                        purePythonModuleImplval
                        )

                primitiveTypeMapping = {
                    bool: purePythonModuleImplval.getObjectMember("PyBool"),
                    str: purePythonModuleImplval.getObjectMember("PyString"),
                    int: purePythonModuleImplval.getObjectMember("PyInt"),
                    float: purePythonModuleImplval.getObjectMember("PyFloat"),
                    type(None): purePythonModuleImplval.getObjectMember("PyNone"),
                    }


                nativeConstantConverter = ForaNative.PythonConstantConverter(
                    primitiveTypeMapping
                    )

                nativeListConverter = ForaNative.makePythonListConverter(
                    purePythonModuleImplval.getObjectMember("PyList")
                    )

                nativeTupleConverter = ForaNative.makePythonTupleConverter(
                    purePythonModuleImplval.getObjectMember("PyTuple")
                    )

                nativeDictConverter = ForaNative.makePythonDictConverter(
                    purePythonModuleImplval.getObjectMember("PyDict")
                    )

                foraBuiltinsImplVal = ModuleImporter.builtinModuleImplVal()

                converter_[0] = Converter.Converter(
                    nativeListConverter=nativeListConverter,
                    nativeTupleConverter=nativeTupleConverter,
                    nativeDictConverter=nativeDictConverter,
                    nativeConstantConverter=nativeConstantConverter,
                    singletonAndExceptionConverter=singletonAndExceptionConverter,
                    vdmOverride=ComputedValueGateway.getGateway().vdm,
                    purePythonModuleImplVal=purePythonModuleImplval,
                    foraBuiltinsImplVal=foraBuiltinsImplVal
                    )
        except:
            logging.critical("Failed to initialize the PyforaObjectConverter: %s", traceback.format_exc())
            raise
开发者ID:Sandy4321,项目名称:ufora,代码行数:69,代码来源:PyforaObjectConverter.py


示例15: increaseRequestCount

 def increaseRequestCount(self, *args):
     """request the data in the leaf of this vector"""
     ComputedValueGateway.getGateway().increaseVectorRequestCount(self)
开发者ID:vishnur,项目名称:ufora,代码行数:3,代码来源:ComputedValue.py


示例16: triggerGarbageCollectionImmediately

 def triggerGarbageCollectionImmediately(self, completePurge):
     ComputedValueGateway.getGateway().triggerPerstistentCacheGarbageCollection(True if completePurge else False)
开发者ID:WantonSoup,项目名称:ufora,代码行数:2,代码来源:PersistentCacheIndex.py


示例17: vdmThinksIsLoaded

 def vdmThinksIsLoaded(self):
     return ComputedValueGateway.getGateway().vectorDataIsLoaded(
             self.computedValueVector,
             self.lowIndex,
             self.highIndex
             )
开发者ID:vishnur,项目名称:ufora,代码行数:6,代码来源:ComputedValue.py


示例18: setMaxBytesInCache

 def setMaxBytesInCache(self, *args):
     ComputedValueGateway.getGateway().getPersistentCacheIndex().setMaxBytesInCache(args[0])
开发者ID:WantonSoup,项目名称:ufora,代码行数:2,代码来源:PersistentCacheIndex.py


示例19: maxBytesInCache

    def maxBytesInCache(self):
        if ComputedValueGateway.getGateway().getPersistentCacheIndex() is None:
            return 0

        return ComputedValueGateway.getGateway().getPersistentCacheIndex().getMaxBytesInCache()
开发者ID:WantonSoup,项目名称:ufora,代码行数:5,代码来源:PersistentCacheIndex.py


示例20: getClusterStatus

 def getClusterStatus(self, args):
     gateway = ComputedValueGateway.getGateway().cumulusGateway
     return gateway.getClusterStatus()
开发者ID:Sandy4321,项目名称:ufora,代码行数:3,代码来源:PyforaCluster.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python python.FORA类代码示例发布时间:2022-05-27
下一篇:
Python log.error函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap