예제 #1
0
  def post(self):
    """ Adds information about one or more instances to the Datastore, for
    later viewing.
    """
    encoded_data = self.request.body
    data = json.loads(encoded_data)

    for instance in data:
      # TODO(cgb): Consider only doing a put if it doesn't exist
      instance = InstanceInfo(id = instance['appid'] + instance['host'] + str(instance['port']),
        appid = instance['appid'],
        host = instance['host'],
        port = instance['port'],
        language = instance['language'])
      instance.put()

    self.response.out.write('put completed successfully!')
예제 #2
0
  def post(self):
    """ Adds information about one or more instances to the Datastore, for
    later viewing.
    """
    encoded_data = self.request.body
    data = json.loads(encoded_data)

    for instance in data:
      # TODO(cgb): Consider only doing a put if it doesn't exist
      instance = InstanceInfo(id = instance['appid'] + instance['host'] + str(instance['port']),
        appid = instance['appid'],
        host = instance['host'],
        port = instance['port'],
        language = instance['language'])
      instance.put()

    self.response.out.write('put completed successfully!')
예제 #3
0
  def delete(self):
    """ Removes information about one or more instances from the Datastore. """
    encoded_data = self.request.body
    data = json.loads(encoded_data)

    for instance in data:
      instance = InstanceInfo.get_by_id(instance['appid'] + instance['host'] + str(instance['port']))
      instance.key.delete()

    self.response.out.write('delete completed successfully!')
예제 #4
0
  def delete(self):
    """ Removes information about one or more instances from the Datastore. """
    encoded_data = self.request.body
    data = json.loads(encoded_data)

    for instance in data:
      instance = InstanceInfo.get_by_id(instance['appid'] + instance['host'] + str(instance['port']))
      instance.key.delete()

    self.response.out.write('delete completed successfully!')
예제 #5
0
    def fetch_request_info(appid):
        """ Retrieves information about the AppServer processes running the
    application associated with the named application.

    Args:
      appid: A str, the application identifier.
    Returns:
      A list of dicts, where each dict has information about a single AppServer
      process running the named application.
    """
        query = InstanceInfo.query(InstanceInfo.appid == appid)
        instances = query.fetch()
        return [{"host": instance.host, "port": instance.port, "language": instance.language} for instance in instances]
예제 #6
0
    def fetch_request_info(appid):
        """ Retrieves information about the AppServer processes running the
    application associated with the named application.

    Args:
      appid: A str, the application identifier.
    Returns:
      A list of dicts, where each dict has information about a single AppServer
      process running the named application.
    """
        query = InstanceInfo.query(InstanceInfo.appid == appid)
        instances = query.fetch()
        return [{
            'host': instance.host,
            'port': instance.port,
            'language': instance.language
        } for instance in instances]