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


Python IonObject.reason方法代码示例

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


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

示例1: get_parameters

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_parameters(self, data_product_id=''):
        # The set of Parameter objects describing each variable in this data product
        ret = IonObject(OT.ComputedListValue)
        ret.value = []
        try:
            stream_id = self._get_stream_id(data_product_id)
            if not stream_id:
                ret.status = ComputedValueAvailability.NOTAVAILABLE
                ret.reason = "There is no Stream associated with this DataProduct"
            else:
                stream_def_ids, _ = self.clients.resource_registry.find_objects(subject=stream_id, predicate=PRED.hasStreamDefinition, id_only=True)
                if not stream_def_ids:
                    ret.status = ComputedValueAvailability.NOTAVAILABLE
                    ret.reason = "There is no StreamDefinition associated with this DataProduct"
                else:
                    param_dict_ids, _ = self.clients.resource_registry.find_objects(subject=stream_def_ids[0], predicate=PRED.hasParameterDictionary, id_only=True)
                    if not param_dict_ids:
                        ret.status = ComputedValueAvailability.NOTAVAILABLE
                        ret.reason = "There is no ParameterDictionary associated with this DataProduct"
                    else:
                        ret.status = ComputedValueAvailability.PROVIDED
                        ret.value = self.clients.dataset_management.read_parameter_contexts(param_dict_ids[0])
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "FIXME: this message should say why the calculation couldn't be done"
        except Exception as e:
            raise e

        return ret
开发者ID:blazetopher,项目名称:coi-services,代码行数:31,代码来源:data_product_management_service.py

示例2: get_data_ingestion_datetime

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_data_ingestion_datetime(self, data_product_id=''):
        # Returns a temporal bounds object of the earliest/most recent values ingested into in the data product
        ret = IonObject(OT.ComputedStringValue)
        ret.value = ""
        ret.status = ComputedValueAvailability.NOTAVAILABLE
        ret.reason = "FIXME. also, should datetime be stored as a string?"

        return ret
开发者ID:tomoreilly,项目名称:coi-services,代码行数:10,代码来源:data_product_management_service.py

示例3: get_data_datetime

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_data_datetime(self, data_product_id=''):
        # Returns a temporal bounds object of the span of data product life span (may exist without getting a granule)
        ret = IonObject(OT.ComputedStringValue)
        ret.value = ""
        ret.status = ComputedValueAvailability.NOTAVAILABLE
        ret.reason = "FIXME. also, should datetime be stored as a string?"

        return ret
开发者ID:tomoreilly,项目名称:coi-services,代码行数:10,代码来源:data_product_management_service.py

示例4: get_data_contents_updated

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_data_contents_updated(self, data_product_id=''):
        # the datetime when the contents of the data were last modified in any way.
        # This is distinct from modifications to the data product attributes
        ret = IonObject(OT.ComputedStringValue)
        ret.value = ""
        ret.status = ComputedValueAvailability.NOTAVAILABLE
        ret.reason = "FIXME. also, should datetime be stored as a string?"

        return ret
开发者ID:blazetopher,项目名称:coi-services,代码行数:11,代码来源:data_product_management_service.py

示例5: get_data_url

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_data_url(self, data_product_id=''):
        # The unique pointer to this set of data
        ret = IonObject(OT.ComputedStringValue)
        ret.value  = ""
        ret.status = ComputedValueAvailability.NOTAVAILABLE
        ret.reason = "FIXME."


        return ret
开发者ID:tomoreilly,项目名称:coi-services,代码行数:11,代码来源:data_product_management_service.py

示例6: get_last_granule

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_last_granule(self, data_product_id=''):
        # Provides information for users who have in the past acquired this data product, but for which that acquisition was terminated
        ret = IonObject(OT.ComputedDictValue)
        ret.value = {}
        try:
            dataset_ids, _ = self.clients.resource_registry.find_objects(subject=data_product_id, predicate=PRED.hasDataset, id_only=True)
            if not dataset_ids:
                ret.status = ComputedValueAvailability.NOTAVAILABLE
                ret.reason = "No dataset associated with this data product"
            else:
                replay_granule = self.clients.data_retriever.retrieve_last_data_points(dataset_ids[0], number_of_points=1)
                #replay_granule = self.clients.data_retriever.retrieve_last_granule(dataset_ids[0])
                rdt = RecordDictionaryTool.load_from_granule(replay_granule)
                ret.value =  {k : rdt[k].tolist() for k,v in rdt.iteritems()}
                ret.status = ComputedValueAvailability.PROVIDED
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "FIXME: this message should say why the calculation couldn't be done"
        except Exception as e:
            raise e

        return ret
开发者ID:tomoreilly,项目名称:coi-services,代码行数:24,代码来源:data_product_management_service.py

示例7: get_active_user_subscriptions

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_active_user_subscriptions(self, data_product_id=''):
        # The UserSubscription objects for this data product
        ret = IonObject(OT.ComputedListValue)
        ret.value = []
        try:
            ret.value = self.clients.user_notification.get_subscriptions(resource_id=data_product_id, include_nonactive=True)
            ret.status = ComputedValueAvailability.PROVIDED
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "Product subscription infromation not provided by UserNotificationService"
        except Exception as e:
            raise e

        return ret
开发者ID:blazetopher,项目名称:coi-services,代码行数:16,代码来源:data_product_management_service.py

示例8: get_data_datetime

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_data_datetime(self, data_product_id=''):
        # Returns a temporal bounds object of the span of data product life span (may exist without getting a granule)
        ret = IonObject(OT.ComputedListValue)
        ret.value = []
        ret.status = ComputedValueAvailability.NOTAVAILABLE

        try:
            dataset_id = self._get_dataset_id(data_product_id)
            bounds = self.clients.dataset_management.dataset_bounds(dataset_id)
            if 'time' in bounds and len(bounds['time']) == 2 :
                log.debug("get_data_datetime bounds['time']: %s"  % str(dataset_id))
                timeStart = IonTime(bounds['time'][0]  -  IonTime.JAN_1970)
                timeEnd = IonTime(bounds['time'][1]  -  IonTime.JAN_1970)
                ret.value = [str(timeStart), str(timeEnd)]
                ret.status = ComputedValueAvailability.PROVIDED
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "Dataset for this Data Product could not be located"
        except Exception as e:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "Could not calculate time range for this data product"

        return ret
开发者ID:blazetopher,项目名称:coi-services,代码行数:25,代码来源:data_product_management_service.py

示例9: get_past_user_subscriptions

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_past_user_subscriptions(self, data_product_id=''):
        # Provides information for users who have in the past acquired this data product, but for which that acquisition was terminated
        ret = IonObject(OT.ComputedListValue)
        ret.value = []
        try:
            ret.status = ComputedValueAvailability.PROVIDED
            raise NotFound #todo: ret.value = ???
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "FIXME: this message should say why the calculation couldn't be done"
        except Exception as e:
            raise e

        return ret
开发者ID:tomoreilly,项目名称:coi-services,代码行数:16,代码来源:data_product_management_service.py

示例10: get_active_user_subscriptions

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_active_user_subscriptions(self, data_product_id=''):
        # The UserSubscription objects for this data product
        ret = IonObject(OT.ComputedListValue)
        ret.value = []
        try:
            ret.status = ComputedValueAvailability.PROVIDED
            raise NotFound #todo: ret.value = ???
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "FIXME: this message should say why the calculation couldn't be done"
        except Exception as e:
            raise e

        return ret
开发者ID:tomoreilly,项目名称:coi-services,代码行数:16,代码来源:data_product_management_service.py

示例11: get_number_active_subscriptions

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_number_active_subscriptions(self, data_product_id=''):
        # The number of current subscriptions to the data
        # Returns the storage size occupied by the data content of the resource, in bytes.
        ret = IonObject(OT.ComputedIntValue)
        ret.value = 0
        try:
            ret.status = ComputedValueAvailability.PROVIDED
            raise NotFound #todo: ret.value = ???
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "FIXME: this message should say why the calculation couldn't be done"
        except Exception as e:
            raise e

        return ret
开发者ID:blazetopher,项目名称:coi-services,代码行数:17,代码来源:data_product_management_service.py

示例12: get_provenance

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_provenance(self, data_product_id=''):
        # Provides an audit trail for modifications to the original data

        ret = IonObject(OT.ComputedDictValue)

        try:
            ret.value = self.get_data_product_provenance(data_product_id)
            ret.status = ComputedValueAvailability.PROVIDED
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "Error in DataProuctMgmtService:get_data_product_provenance"
        except Exception as e:
            raise e

        return ret
开发者ID:blazetopher,项目名称:coi-services,代码行数:17,代码来源:data_product_management_service.py

示例13: get_stored_data_size

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_stored_data_size(self, data_product_id=''):
        # Returns the storage size occupied by the data content of the resource, in bytes.
        ret = IonObject(OT.ComputedIntValue)
        ret.value = 0
        try:
            dataset_id = self._get_dataset_id(data_product_id)
            size_in_bytes = self.clients.dataset_management.dataset_size(dataset_id, in_bytes=True)
            ret.status = ComputedValueAvailability.PROVIDED
            ret.value = size_in_bytes
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "Dataset for this Data Product could not be located"
        except Exception as e:
            raise e

        return ret
开发者ID:blazetopher,项目名称:coi-services,代码行数:18,代码来源:data_product_management_service.py

示例14: get_product_download_size_estimated

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_product_download_size_estimated(self, data_product_id=''):
        # Returns the size of the full data product if downloaded/presented in a given presentation form
        ret = IonObject(OT.ComputedIntValue)
        ret.value = 0
        try:
            dataset_id = self._get_dataset_id(data_product_id)
            size_in_bytes = self.clients.dataset_management.dataset_size(dataset_id, in_bytes=False)
            ret.status = ComputedValueAvailability.PROVIDED
            ret.value = size_in_bytes
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "Dataset for this Data Product could not be located"
        except Exception as e:
            raise e

        return ret
开发者ID:blazetopher,项目名称:coi-services,代码行数:18,代码来源:data_product_management_service.py

示例15: get_data_url

# 需要导入模块: from pyon.public import IonObject [as 别名]
# 或者: from pyon.public.IonObject import reason [as 别名]
    def get_data_url(self, data_product_id=''):
        # The unique pointer to this set of data
        ret = IonObject(OT.ComputedStringValue)
        ret.value  = ""

        erddap_host = CFG.get_safe('server.erddap.host','localhost')
        errdap_port = CFG.get_safe('server.erddap.port','8080')
        try:
            dataset_id = self._get_dataset_id(data_product_id)
            ret.value  = string.join( ["http://", erddap_host, ":", str(errdap_port),"/erddap/griddap/", str(dataset_id), "_0.html"],'')
            ret.status = ComputedValueAvailability.PROVIDED
            log.debug("get_data_url: data_url: %s", ret.value)
        except NotFound:
            ret.status = ComputedValueAvailability.NOTAVAILABLE
            ret.reason = "Dataset for this Data Product could not be located"

        return ret
开发者ID:blazetopher,项目名称:coi-services,代码行数:19,代码来源:data_product_management_service.py


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