Пример #1
0
    def _get_parameter_value(self, name):
        """ handle getting value of a single parameter 

        Args:
            (str) name: name of parameter value to be got.
        Returns:
            response of parameter's get_value method.
        Raises:
            ParameterGetValueError: raised if we catch some generic error in 
                the get_value process.
        """
        value = None
        try:
            _ti = time.time()
            parameter = self._get_parameter(name,
                                            initialize=True,
                                            generic=True)
            value = parameter._get_value()
            _tf = time.time()
            if (_tf - _ti > 0.001) and self.verbose:
                print name, _tf - _ti
            # test if we will be able to flatten to json


#            value_json = json.dumps({name: value})
        except:
            raise ParameterGetValueError(name)
        return value
Пример #2
0
    def _get_next_parameter_value(self, name):
        """ handle getting next value of a single parameter 

        Args:
            (str) name: name of parameter next_value to be got.
        Returns:
            response of parameter's get_next_value method.
        Raises:
            ParameterGetValueError: raised if we catch some generic error in 
                the get_value process.
        """
        value = None
        try:
            parameter = self._get_parameter(name, initialize=True, generic=True)
            value = parameter._get_next_value()
            # test if we will be able to flatten to json
            value_json = json.dumps({name: value})
        except:
            raise ParameterGetValueError(name)
        return value
Пример #3
0
 def _get_value(self):
     try:
         return self.get_value()
     except:
         raise ParameterGetValueError(self.name)
Пример #4
0
 def _get_next_value(self):
     try:
         return self.get_next_value()
     except:
         traceback.print_exc()
         raise ParameterGetValueError(self.name)