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

Python log.warning函数代码示例

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

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



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

示例1: process_oms_event

def process_oms_event():

    json_params = {}

    # oms direct request
    if request.data:
        json_params  = json_loads(str(request.data))
        log.debug('ServiceGatewayService:process_oms_event request.data:  %s', json_params)

    #validate payload
    if 'platform_id' not in json_params or 'message' not in json_params:
        log.warning('Invalid OMS event format. payload_data: %s', json_params)
        #return gateway_json_response(OMS_BAD_REQUEST_RESPONSE)

    #prepare the event information
    try:
        #create a publisher to relay OMS events into the system as DeviceEvents
        event_publisher = EventPublisher()

        event_publisher.publish_event(
            event_type='OMSDeviceStatusEvent',
            origin_type='OMS Platform',
            origin=json_params.get('platform_id', 'NOT PROVIDED'),
            sub_type='',
            description = json_params.get('message', ''),
            status_details = json_params)
    except Exception, e:
        log.error('Could not publish OMS  event: %s. Event data: %s', e.message, json_params)
开发者ID:MatthewArrott,项目名称:coi-services,代码行数:28,代码来源:service_gateway_service.py


示例2: set_task

    def set_task(self, task_time, message):

        #------------------------------------------------------------------------------------
        # get the current time. Ex: datetime.datetime(2012, 7, 12, 14, 30, 6, 769776)
        #------------------------------------------------------------------------------------

        current_time = datetime.datetime.today()

        #------------------------------------------------------------------------------------
        # Calculate the time to wait
        #------------------------------------------------------------------------------------
        wait_time = datetime.timedelta( days = task_time.day - current_time.day,
                                        hours = task_time.hour - current_time.hour,
                                        minutes = task_time.minute - current_time.minute,
                                        seconds = task_time.second - current_time.second)

        log.info("Fake scheduler calculated wait_time = %s" % wait_time)

        seconds = wait_time.total_seconds()

        if seconds < 0:
            log.warning("Calculated wait time: %s seconds. Publishing immediately.")
            seconds = 0

        log.info("Total seconds of wait time = %s" % seconds)

        # this has to be replaced by something better
        gevent.sleep(seconds)

        self.event_publisher.publish_event(origin='Scheduler', description = message)
        log.info("Fake scheduler published a SchedulerEvent")
开发者ID:pombredanne,项目名称:coi-services,代码行数:31,代码来源:uns_utility_methods.py


示例3: write

	def write(self, text):
		log.debug("TelnetServer.write(): text = " + str(text))
		if self.fileobj:
			self.fileobj.write(text)
			self.fileobj.flush()
		else:
			log.warning("TelnetServer.write(): no connection yet, can not write text")			
开发者ID:seman,项目名称:coi-services,代码行数:7,代码来源:ion_telnet_server.py


示例4: build_service_map

 def build_service_map(self):
     """
     Adds all known service definitions to service registry.
     @todo: May be a bit fragile due to using BaseService.__subclasses__
     """
     for cls in BaseService.__subclasses__():
         assert hasattr(cls, 'name'), 'Service class must define name value. Service class in error: %s' % cls
         if cls.name:
             self.services_by_name[cls.name] = cls
             self.add_servicedef_entry(cls.name, "base", cls)
             try:
                 self.add_servicedef_entry(cls.name, "schema", json.loads(cls.SCHEMA_JSON))
             except Exception as ex:
                 log.exception("Cannot parse service schema " + cls.name)
             interfaces = list(implementedBy(cls))
             if interfaces:
                 self.add_servicedef_entry(cls.name, "interface", interfaces[0])
             if cls.__name__.startswith("Base"):
                 try:
                     client = "%s.%sProcessClient" % (cls.__module__, cls.__name__[4:])
                     self.add_servicedef_entry(cls.name, "client", named_any(client))
                     sclient = "%s.%sClient" % (cls.__module__, cls.__name__[4:])
                     self.add_servicedef_entry(cls.name, "simple_client", named_any(sclient))
                 except Exception, ex:
                     log.warning("Cannot find client for service %s" % (cls.name))
开发者ID:edwardhunter,项目名称:scioncc,代码行数:25,代码来源:service.py


示例5: _cov2granule

    def _cov2granule(cls, coverage, start_time=None, end_time=None, stride_time=None, stream_def_id=None, parameters=None, tdoa=None):

        if tdoa is None:
            if start_time is not None:
                start_time = cls.convert_time(coverage, start_time)
            if end_time is not None:
                end_time = cls.convert_time(coverage, end_time)
            slice_ = slice(start_time, end_time, stride_time)
        
        if stream_def_id:
            rdt = RecordDictionaryTool(stream_definition_id=stream_def_id)
        else:
            rdt = RecordDictionaryTool(param_dictionary=coverage.parameter_dictionary)
        if tdoa:
            vdict = coverage.get_value_dictionary(parameters or rdt.fields, domain_slice=tdoa)
        else:
            vdict = coverage.get_value_dictionary(parameters or rdt.fields, temporal_slice=slice_)
        if not vdict:
            log.warning('Retrieve returning empty set')
            return rdt
        rdt[coverage.temporal_parameter_name] = vdict[coverage.temporal_parameter_name]
        for k,v in vdict.iteritems():
            if k == coverage.temporal_parameter_name:
                continue
            # The values have already been inside a coverage so we know they're safe and they exist, so they can be inserted directly.
            rdt._rd[k] = v
            #rdt[k] = v

        return rdt
开发者ID:MatthewArrott,项目名称:coi-services,代码行数:29,代码来源:replay_process.py


示例6: __init__

	def __init__(self, input_callback=None):
		log.debug("TelnetServer.__init__()")
		if not input_callback:
			log.warning("TelnetServer.__init__(): callback not specified")
			raise ServerError("callback not specified")
		self.parent_input_callback = input_callback
		
		# TODO: get username and password dynamically
		self.username = 'admin'
		self.password = '123'
	
		# TODO: get ip_address & port number dynamically
		# TODO: ensure that port is not already in use
		self.port = self.PORT_RANGE_LOWER
		self.ip_address = 'localhost'
		#self.ip_address = '67.58.49.202'
			
		# create telnet server object and start the server process
		self.server_socket = socket.socket()
		self.server_socket.allow_reuse_address = True
		while True:
			try:
				self.server_socket.bind((self.ip_address, self.port))
				break
			except:
				self.port = self.port + 1
				log.debug("trying to bind to port " + str(self.port))
				if self.port > self.PORT_RANGE_UPPER:
					log.warning("TelnetServer.server_greenlet(): no available ports for server")
					self.close_connection()
					return
		gevent.spawn(self.server_greenlet)
开发者ID:daf,项目名称:coi-services,代码行数:32,代码来源:ion_telnet_server.py


示例7: validate_compatibility

 def validate_compatibility(self, data_process_definition_id='', in_data_product_ids=None, out_data_product_ids=None, routes=None):
     '''
     Validates compatibility between input and output data products
     routes are in this form:
     { (in_data_product_id, out_data_product_id) : actor }
         if actor is None then the data process is assumed to use parameter functions.
         if actor is a TransformFunction, the validation is done at runtime
     '''
     if data_process_definition_id:
         input_stream_def_ids, _ = self.clients.resource_registry.find_objects(subject=data_process_definition_id, predicate=PRED.hasInputStreamDefinition, id_only=True)
         output_stream_def_ids, _ = self.clients.resource_registry.find_objects(subject=data_process_definition_id, predicate=PRED.hasStreamDefinition, id_only=True)
         for in_data_product_id in in_data_product_ids:
             input_stream_def = self.stream_def_from_data_product(in_data_product_id)
             if input_stream_def not in input_stream_def_ids:
                 log.warning('Creating a data process with an unmatched stream definition input')
         for out_data_product_id in out_data_product_ids:
             output_stream_def = self.stream_def_from_data_product(out_data_product_id)
             if output_stream_def not in output_stream_def_ids:
                 log.warning('Creating a data process with an unmatched stream definition output')
     
     if not out_data_product_ids and data_process_definition_id:
         return True
     if len(out_data_product_ids)>1 and not routes and not data_process_definition_id:
         raise BadRequest('Multiple output data products but no routes defined')
     if len(out_data_product_ids)==1:
         return all( [self._validator(i, out_data_product_ids[0]) for i in in_data_product_ids] )
     elif len(out_data_product_ids)>1:
         for in_dp_id,out in routes.iteritems():
             for out_dp_id, actor in out.iteritems():
                 if not self._validator(in_dp_id, out_dp_id):
                     return False
         return True
     else:
         raise BadRequest('No input data products specified')
开发者ID:jamie-cyber1,项目名称:coi-services,代码行数:34,代码来源:data_process_management_service.py


示例8: log_message

def log_message(prefix="MESSAGE", msg=None, headers=None, recv=None, delivery_tag=None, is_send=True):
    """
    Utility function to print an legible comprehensive summary of a received message.
    @NOTE: This is an expensive operation
    """
    try:
        headers = headers or {}
        _sender = headers.get('sender', '?') + "(" + headers.get('sender-name', '') + ")"
        _send_hl, _recv_hl = ("###", "") if is_send else ("", "###")

        if recv and getattr(recv, '__iter__', False):
            recv = ".".join(str(item) for item in recv if item)
        _recv = headers.get('receiver', '?')
        _opstat = "op=%s"%headers.get('op', '') if 'op' in headers else "status=%s"%headers.get('status_code', '')
        try:
            import msgpack
            _msg = msgpack.unpackb(msg)
            _msg = str(_msg)
        except Exception:
            _msg = str(msg)
        _msg = _msg[0:400]+"..." if len(_msg) > 400 else _msg
        _delivery = "\nDELIVERY: tag=%s"%delivery_tag if delivery_tag else ""
        log.info("%s: %s%s%s -> %s%s%s %s:\nHEADERS: %s\nCONTENT: %s%s",
            prefix, _send_hl, _sender, _send_hl, _recv_hl, _recv, _recv_hl, _opstat, str(headers), _msg, _delivery)
    except Exception as ex:
        log.warning("%s log error: %s", prefix, str(ex))
开发者ID:swarbhanu,项目名称:pyon,代码行数:26,代码来源:endpoint.py


示例9: __init__

	def __init__(self, inputCallback=None):
		# use globals to pass configuration to telnet handler when it is started by
		# TCP socket server
		global username, password, child_connection
		
		#log.getLogger('').setLevel(log.DEBUG)
		log.debug("TelnetServer.__init__()")
		if not inputCallback:
			log.warning("TelnetServer.__init__(): callback not specified")
			raise ServerError("callback not specified")
		self.parentInputCallback = inputCallback
		
		# TODO: get username and password dynamically
		username = 'admin'
		password = '123'
	
		# TODO: get ip_address & port number dynamically
		# TODO: ensure that port is not already in use
		self.port = 8000
		#self.ip_address = 'localhost'
		self.ip_address = '67.58.49.202'
		
		# setup a pipe to allow telnet server process to communicate with callbackProxy
		self.parent_connection, child_connection = multiprocessing.Pipe()
		
		# create telnet server object and start the server process
		self.tns = TcpSocketServer((self.ip_address, self.port), TelnetHandler)
		self.serverProcess = multiprocessing.Process(target=self.runServer)
		self.serverProcess.start()
		
		# start the callbackProxy thread to receive client input from telnet server process
		self.callbackProxyThread = threading.Thread(target=self.runCallbackProxy)
		#log.debug("TelnetHandler.setup(): starting callbackProxy thread")
		self.callbackProxyThread.setDaemon(True)
		self.callbackProxyThread.start()
开发者ID:daf,项目名称:coi-services,代码行数:35,代码来源:telnet_server.py


示例10: find_events

    def find_events(self, origin='', type='', min_datetime=0, max_datetime=0, limit= -1, descending=False):
        """
        This method leverages couchdb view and simple filters. It does not use elastic search.

        Returns a list of events that match the specified search criteria. Will throw a not NotFound exception
        if no events exist for the given parameters.

        @param origin         str
        @param event_type     str
        @param min_datetime   int  seconds
        @param max_datetime   int  seconds
        @param limit          int         (integer limiting the number of results (0 means unlimited))
        @param descending     boolean     (if True, reverse order (of production time) is applied, e.g. most recent first)
        @retval event_list    []
        @throws NotFound    object with specified parameters does not exist
        @throws NotFound    object with specified parameters does not exist
        """
        event_tuples = []

        try:
            event_tuples = self.container.event_repository.find_events(event_type=type, origin=origin, start_ts=min_datetime, end_ts=max_datetime, limit=limit, descending=descending)
        except Exception as exc:
            log.warning("The UNS find_events operation for event origin = %s and type = %s failed. Error message = %s", origin, type, exc.message)

        events = [item[2] for item in event_tuples]
        log.debug("(find_events) UNS found the following relevant events: %s", events)

        return events
开发者ID:shenrie,项目名称:coi-services,代码行数:28,代码来源:user_notification_service.py


示例11: channel

    def channel(self, ch_type, transport=None):
        """
        Creates a Channel object with an underlying transport callback and returns it.

        @type ch_type   BaseChannel
        """
        #log.debug("NodeB.channel")
        with self._lock:
            # having _queue_auto_delete on is a pre-req to being able to pool.
            if ch_type == channel.BidirClientChannel and not ch_type._queue_auto_delete:

                # only attempt this 5 times - somewhat arbitrary but we can't have an infinite loop here
                attempts = 5
                while attempts > 0:
                    attempts -= 1

                    chid = self._pool.get_id()
                    if chid in self._bidir_pool:
                        log.debug("BidirClientChannel requested, pulling from pool (%d)", chid)
                        assert not chid in self._pool_map.values()

                        # we need to check the health of this bidir channel
                        ch = self._bidir_pool[chid]
                        if not self._check_pooled_channel_health(ch):
                            log.warning("Channel (%d) failed health check, removing from pool", ch.get_channel_id())

                            # return chid to the id pool
                            self._pool.release_id(chid)

                            # remove this channel from the pool, put into dead pool
                            self._dead_pool.append(ch)
                            del self._bidir_pool[chid]

                            # now close the channel (must remove our close callback which returns it to the pool)
                            assert ch._close_callback == self.on_channel_request_close
                            ch._close_callback = None
                            ch.close()

                            # resume the loop to attempt to get one again
                            continue

                        self._pool_map[ch.get_channel_id()] = chid
                    else:
                        log.debug("BidirClientChannel requested, no pool items available, creating new (%d)", chid)
                        ch = self._new_channel(ch_type, transport=transport)
                        ch.set_close_callback(self.on_channel_request_close)
                        self._bidir_pool[chid] = ch
                        self._pool_map[ch.get_channel_id()] = chid

                    # channel here is valid, exit out of attempts loop
                    break
                else:    # while loop didn't get a valid channel in X attempts
                    raise StandardError("Could not get a valid channel")

            else:
                ch = self._new_channel(ch_type, transport=transport)
            assert ch

        return ch
开发者ID:j2project,项目名称:pyon,代码行数:59,代码来源:messaging.py


示例12: create_dataset

    def create_dataset(self, dataset=None, parameter_dict=None, parameter_dictionary_id=''):
        
        if parameter_dict is not None:
            log.warning("Creating a parameter dictionary raw with coverage objects will soon be deprecated")
        
        if parameter_dictionary_id:
            parameter_dict = self._coverage_parameter_dictionary(parameter_dictionary_id)
            parameter_dict = parameter_dict.dump() # Serialize it

        
        dataset.coverage_version = 'UNSET'
        dataset_id, rev = self.clients.resource_registry.create(dataset)
        try:
            if dataset.coverage_type == CoverageTypeEnum.SIMPLEX:
                cov = self._create_coverage(dataset_id, dataset.description or dataset_id, parameter_dict)
                self._save_coverage(cov)
                cov.close()
            elif dataset.coverage_type == CoverageTypeEnum.COMPLEX:
                cov = self._create_complex_coverage(dataset_id, dataset.description or dataset_id, parameter_dict)
                cov.close()
            else:
                raise BadRequest("Unknown Coverage Type")

        except Exception:
            # Clean up dangling resource if there's no coverage
            self.delete_dataset(dataset_id)
            raise

        dataset.coverage_version = "TODO"
        dataset._id = dataset_id
        dataset._rev = rev
        self.update_dataset(dataset)

        log.debug('creating dataset: %s', dataset_id)

        #table loader create resource
        if dataset.visibility == ResourceVisibilityEnum.PUBLIC:
            log.debug('dataset visible: %s', dataset_id)
            if self._get_eoi_service_available() and parameter_dictionary_id:

                params = self.read_parameter_contexts(parameter_dictionary_id)
                param_defs = {}

                for p in params:                
                    param_defs[p.name] = {
                        "value_encoding" : p.value_encoding,
                        "parameter_type" : p.parameter_type,
                        "units" : p.units,
                        "standard_name" : p.name,
                        "display_name" : p.display_name,
                        "description" : p.description,
                        "fill_value" : p.fill_value
                    }

                self._create_single_resource(dataset_id, param_defs)

        self.clients.resource_registry.create_association(dataset_id, PRED.hasParameterDictionary, parameter_dictionary_id)

        return dataset_id
开发者ID:ednad,项目名称:coi-services,代码行数:59,代码来源:dataset_management_service.py


示例13: create_stream

    def create_stream(self, name='', exchange_point='', topic_ids=None, credentials=None, stream_definition_id='', description='', stream_name='', stream_type=''):
        # Argument Validation
        if name and self.clients.resource_registry.find_resources(restype=RT.Stream, name=name, id_only=True)[0]:
            raise Conflict("The named stream '%s' already exists on XP '%s'" % (name, exchange_point))
        validate_true(exchange_point, 'An exchange point must be specified')

        exchange_point_id = None
        if re.match(r'[0-9a-f]{32}', exchange_point):  # It's a uuid
            xp_obj = self.clients.exchange_management.read_exchange_point(exchange_point)
            exchange_point_id = exchange_point
            exchange_point = xp_obj.name
        else:
            self.container.ex_manager.create_xp(exchange_point)
            xp_objs, _ = self.clients.resource_registry.find_resources(restype=RT.ExchangePoint, name=exchange_point, id_only=True)
            if not xp_objs:
                raise BadRequest('failed to create an ExchangePoint: ' + exchange_point)
            exchange_point_id = xp_objs[0]

        topic_ids = topic_ids or []

        if not name: name = create_unique_identifier()

        # Get topic names and topics
        topic_names = []
        associated_topics = []
        for topic_id in topic_ids:
            topic = self.read_topic(topic_id)
            if topic.exchange_point == exchange_point:
                topic_names.append(self._sanitize(topic.name))
                associated_topics.append(topic_id)
            else:
                log.warning('Attempted to attach stream %s to topic %s with different exchange points', name, topic.name)

        stream = Stream(name=name, description=description)
        routing_key = '.'.join([self._sanitize(name)] + topic_names + ['stream'])
        if len(routing_key) > 255:
            raise BadRequest('There are too many topics for this.')

        stream.stream_route.exchange_point = exchange_point
        stream.stream_route.routing_key = routing_key
        #@todo: validate credentials
        stream.stream_route.credentials = credentials
        stream.stream_name = stream_name
        stream.stream_type = stream_type

        stream_id, rev = self.clients.resource_registry.create(stream)

        self._associate_stream_with_exchange_point(stream_id,exchange_point_id)

        if stream_definition_id: #@Todo: what if the stream has no definition?!
            self._associate_stream_with_definition(stream_id, stream_definition_id)

        for topic_id in associated_topics:
            self._associate_topic_with_stream(topic_id, stream_id)

        log.info('Stream %s: %s', name, routing_key)

        return stream_id, stream.stream_route
开发者ID:birdage,项目名称:coi-services,代码行数:58,代码来源:pubsub_management_service.py


示例14: list_objects

 def list_objects(self, datastore_name=""):
     if not datastore_name:
         datastore_name = self.datastore_name
     log.warning('Listing all objects in data store %s' % datastore_name)
     try:
         objs = [obj for obj in self.server[datastore_name]]
     except ValueError:
         raise BadRequest("Data store name %s invalid" % datastore_name)
     log.debug('Objects: %s' % str(objs))
     return objs
开发者ID:wfrench,项目名称:pyon,代码行数:10,代码来源:couchdb_datastore.py


示例15: update_resource_access_policy

    def update_resource_access_policy(self, resource_id):
        if self.policy_decision_point_manager is not None:

            try:
                policy_rules = self.policy_client.get_active_resource_access_policy_rules(resource_id)
                self.policy_decision_point_manager.load_resource_policy_rules(resource_id, policy_rules)
            except NotFound, e:
                #If the resource does not exist, just ignore it - but log a warning.
                log.warning("The resource %s is not found, so can't apply access policy" % resource_id)
                pass
开发者ID:swarbhanu,项目名称:pyon,代码行数:10,代码来源:governance_controller.py


示例16: _coverage_to_granule

    def _coverage_to_granule(cls, coverage, start_time=None, end_time=None, stride_time=None, fuzzy_stride=True, parameters=None, stream_def_id=None, tdoa=None):
        slice_ = slice(None) # Defaults to all values


        # Validations
        if start_time is not None:
            validate_is_instance(start_time, Number, 'start_time must be a number for striding.')
        if end_time is not None:
            validate_is_instance(end_time, Number, 'end_time must be a number for striding.')
        if stride_time is not None:
            validate_is_instance(stride_time, Number, 'stride_time must be a number for striding.')

        if tdoa is not None and isinstance(tdoa,slice):
            slice_ = tdoa
        
        elif stride_time is not None and not fuzzy_stride: # SLOW 
            ugly_range = np.arange(start_time, end_time, stride_time)
            idx_values = [cls.get_time_idx(coverage,i) for i in ugly_range]
            idx_values = list(set(idx_values)) # Removing duplicates - also mixes the order of the list!!!
            idx_values.sort()
            slice_ = [idx_values]


        elif not (start_time is None and end_time is None):
            if start_time is not None:
                start_time = cls.get_time_idx(coverage,start_time)
            if end_time is not None:
                end_time = cls.get_time_idx(coverage,end_time)

            slice_ = slice(start_time,end_time,stride_time)
            log.info('Slice: %s', slice_)

        if stream_def_id:
            rdt = RecordDictionaryTool(stream_definition_id=stream_def_id)
        else:
            rdt = RecordDictionaryTool(param_dictionary=coverage.parameter_dictionary)
        if parameters is not None:
            # TODO: Improve efficiency here
            fields = list(set(parameters).intersection(rdt.fields))
        else:
            fields = rdt.fields

        if slice_.start == slice_.stop and slice_.start is not None:
            log.warning('Requested empty set of data.  %s', slice_)
            return rdt
        
        # Do time first
        tname = coverage.temporal_parameter_name
        cls.map_cov_rdt(coverage,rdt,tname, slice_)

        for field in fields:
            if field == tname:
                continue
            cls.map_cov_rdt(coverage,rdt,field, slice_)
        return rdt
开发者ID:MatthewArrott,项目名称:coi-services,代码行数:55,代码来源:replay_process.py


示例17: process_gateway_agent_request

def process_gateway_agent_request(resource_id, operation):

    try:

        if not resource_id:
            raise BadRequest("Am agent resource_id was not found in the URL")

        if operation == '':
            raise BadRequest("An agent operation was not specified in the URL")


        #Ensure there is no unicode
        resource_id = str(resource_id)
        operation = str(operation)

        #Retrieve json data from HTTP Post payload
        json_params = None
        if request.method == "POST":
            payload = request.form['payload']

            json_params = json_loads(str(payload))

            if not json_params.has_key('agentRequest'):
                raise Inconsistent("The JSON request is missing the 'agentRequest' key in the request")

            if not json_params['agentRequest'].has_key('agentId'):
                raise Inconsistent("The JSON request is missing the 'agentRequest' key in the request")

            if not json_params['agentRequest'].has_key('agentOp'):
                raise Inconsistent("The JSON request is missing the 'agentOp' key in the request")

            if json_params['agentRequest']['agentId'] != resource_id:
                raise Inconsistent("Target agent id in the JSON request (%s) does not match agent id in URL (%s)" % (str(json_params['agentRequest']['agentId']), resource_id) )

            if json_params['agentRequest']['agentOp'] != operation:
                raise Inconsistent("Target agent operation in the JSON request (%s) does not match agent operation in URL (%s)" % ( str(json_params['agentRequest']['agentOp']), operation ) )

        resource_agent = ResourceAgentClient(resource_id, node=Container.instance.node, process=service_gateway_instance)

        param_list = create_parameter_list('agentRequest', 'resource_agent', ResourceAgentProcessClient, operation, json_params)

        #Validate requesting user and expiry and add governance headers
        ion_actor_id, expiry = get_governance_info_from_request('agentRequest', json_params)
        ion_actor_id, expiry = validate_request(ion_actor_id, expiry)
        param_list['headers'] = build_message_headers(ion_actor_id, expiry)

        methodToCall = getattr(resource_agent, operation)
        result = methodToCall(**param_list)

        return gateway_json_response(result)

    except Exception, e:
        if e is NotFound:
            log.warning('The agent instance for id %s is not found.' % resource_id)
        return build_error_response(e)
开发者ID:MatthewArrott,项目名称:coi-services,代码行数:55,代码来源:service_gateway_service.py


示例18: register_dataset

 def register_dataset(self, data_product_id=''):
     procs,_ = self.clients.resource_registry.find_resources(restype=RT.Process, id_only=True)
     pid = None
     for p in procs:
         if 'registration_worker' in p:
             pid = p
     if not pid: 
         log.warning('No registration worker found')
         return
     rpc_cli = RPCClient(to_name=pid)
     rpc_cli.request({'data_product_id':data_product_id}, op='register_dap_dataset')
开发者ID:edwardhunter,项目名称:coi-services,代码行数:11,代码来源:dataset_management_service.py


示例19: start

 def start(self):
     """
     Pass in a subscriber here, this will make it listen in a background greenlet.
     """
     assert not self._cbthread, "start called twice on EventSubscriber"
     gl = spawn(self.listen)
     self._cbthread = gl
     if not self._ready_event.wait(timeout=5):
         log.warning('EventSubscriber start timed out.')
     log.info("EventSubscriber started. Event pattern=%s" % self.binding)
     return gl
开发者ID:daf,项目名称:pyon,代码行数:11,代码来源:event.py


示例20: find_doc

    def find_doc(self, criteria=[], datastore_name=""):
        if not datastore_name:
            datastore_name = self.datastore_name
        try:
            db = self.server[datastore_name]
        except ValueError:
            raise BadRequest("Data store name %s is invalid" % datastore_name)

        if len(criteria) == 0:
            # Return set of all objects indexed by doc id
            map_fun =\
'''function(doc) {
    emit(doc._id, doc);
}'''
        else:
            map_fun =\
'''function(doc) {
    if ('''
            for criterion in criteria:
                if isinstance(criterion, list):
                    if len(criterion) != 3:
                        raise BadRequest("Insufficient criterion values specified.  Much match [<field>, <logical constant>, <value>]")
                    for item in criterion:
                        if not isinstance(item, str):
                            raise BadRequest("All criterion values must be strings")
                    map_fun += "doc." + criterion[0]
                    map_fun += " " + criterion[1] + " "
                    map_fun += "\"" + criterion[2] + "\""
                else:
                    if criterion == DataStore.AND:
                        map_fun += ' && '
                    else:
                        map_fun += ' || '

            map_fun +=\
''') {
        emit(doc._id, doc);
    }
}'''

        log.debug("map_fun: %s" % str(map_fun))
        try:
            queryList = list(db.query(map_fun))
        except ResourceNotFound:
            raise NotFound("Data store query for criteria %s failed" % str(criteria))
        if len(queryList) == 0:
            raise NotFound("Data store query for criteria %s returned no objects" % str(criteria))
        results = [row.value for row in queryList]

        log.debug('Find results: %s' % str(results))
        log.warning('Find is an expensive debug only function. Use a specific find function instead.')
        return results
开发者ID:blazetopher,项目名称:pyon,代码行数:52,代码来源:couchdb_datastore.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pool.IDPool类代码示例发布时间:2022-05-27
下一篇:
Python log.warn函数代码示例发布时间: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