Beispiel #1
0
 def get_queue_file_location(self, app_id):
   """ Gets the location of the queue.yaml or queue.xml file
       of a given application.
   Args:
     app_id: The application ID.
   Returns:
     The location of the queue.yaml or queue.xml file, and 
     an empty string if it could not be found.
   """
   queue_yaml = appscale_info.get_app_path(app_id) + 'queue.yaml'
   queue_xml = appscale_info.get_app_path(app_id) + '/war/queue.xml' 
   if file_io.exists(queue_yaml):
     return queue_yaml
   elif file_io.exists(queue_xml):
     return queue_xml
   else:
     return ""
Beispiel #2
0
 def get_queue_file_location(self, app_id):
   """ Gets the location of the queue.yaml or queue.xml file
       of a given application.
   Args:
     app_id: The application ID.
   Returns:
     The location of the queue.yaml or queue.xml file, and 
     an empty string if it could not be found.
   """
   queue_yaml = appscale_info.get_app_path(app_id) + 'queue.yaml'
   queue_xml = appscale_info.get_app_path(app_id) + '/war/WEB-INF/queue.xml'
   if file_io.exists(queue_yaml):
     return queue_yaml
   elif file_io.exists(queue_xml):
     return queue_xml
   else:
     return ""
Beispiel #3
0
  def get_queue_file_location(self, app_id):
    """ Gets the location of the queue.yaml or queue.xml file of a given
    application.

    Args:
      app_id: The application ID.
    Returns:
      The location of the queue.yaml or queue.xml file, and 
      an empty string if it could not be found.
    Raises:
      apiproxy_errors.ApplicationError if multiple invalid files are found.
    """
    app_dir = appscale_info.get_app_path(app_id)

    queue_yaml = 'queue.yaml'
    queue_xml = 'queue.xml'
    
    paths = []
    queue_yaml_detected = False
    queue_xml_detected = False
    for root, sub_dirs, files in os.walk(app_dir):
      for file in files:
        if file == queue_yaml:
          queue_yaml_detected = True
          paths.append(os.path.abspath(os.path.join(root, file)))
        if file == queue_xml:
          queue_xml_detected = True
          paths.append(os.path.abspath(os.path.join(root, file)))

    if not paths:
      return ""

    paths = sorted(paths, key = lambda k : len(k.split(os.sep)))
    if len(paths) == 1:
      return paths[0]

    # If multiple files were detected and it's Python, return
    # the shortest path.
    if queue_yaml_detected:
      return paths[0]
    
    # If multiple files were detected and it's Java, return
    # the first path that contains WEB-INF.
    for path in paths:
      if queue_xml in path and "WEB-INF" in path and queue_xml_detected:
        return path
    
    raise apiproxy_errors.\
      ApplicationError("Multiple unusable queue configuration files detected")