Add more newlines before classes and functions
@@ -129,6 +129,7 @@ class BadConfigurationException(Exception):
def __str__(self):
return repr(self.value)
+
class NoRedirection(urllib2.HTTPErrorProcessor):
""" A url opener that does not automatically redirect. """
def http_response(self, request, response):
@@ -375,6 +376,7 @@ def start_app(version_key, config):
logging.error("Error while setting up log rotation for application: {}".
format(project_id))
+
def setup_logrotate(app_name, log_size):
""" Creates a logrotate script for the logs that the given application
will create.
@@ -411,6 +413,7 @@ def setup_logrotate(app_name, log_size):
return True
+
def unmonitor(process_name, retries=5):
""" Unmonitors a process.
@@ -436,6 +439,7 @@ def unmonitor(process_name, retries=5):
raise
+
@gen.coroutine
def clean_old_sources():
""" Removes source code for obsolete revisions. """
@@ -455,6 +459,7 @@ def clean_old_sources():
source_manager.clean_old_revisions(active_revisions=active_revisions)
+
@gen.coroutine
def unmonitor_and_terminate(watch):
""" Unmonitors an instance and terminates it.
@@ -479,6 +484,7 @@ def unmonitor_and_terminate(watch):
IOLoop.current().spawn_callback(stop_instance, watch,
MAX_INSTANCE_RESPONSE_TIME)
+
@gen.coroutine
def stop_app_instance(version_key, port):
""" Stops a Google App Engine application process instance on current
@@ -521,6 +527,7 @@ def stop_app_instance(version_key, port):
yield monit_operator.reload()
yield clean_old_sources()
+
@gen.coroutine
def stop_app(version_key):
""" Stops all process instances of a version on this machine.
@@ -559,6 +566,7 @@ def stop_app(version_key):
yield monit_operator.reload()
yield clean_old_sources()
+
def remove_logrotate(app_name):
""" Removes logrotate script for the given application.
@@ -579,6 +587,7 @@ def remove_logrotate(app_name):
return True
+
############################################
# Private Functions (but public for testing)
############################################
@@ -611,6 +620,7 @@ def wait_on_app(port):
format(url, START_APP_TIMEOUT))
return False
+
def create_python_app_env(public_ip, app_name):
""" Returns the environment variables the python application server uses.
@@ -628,6 +638,7 @@ def create_python_app_env(public_ip, app_name):
env_vars['PYTHON_LIB'] = "{0}/AppServer/".format(constants.APPSCALE_HOME)
return env_vars
+
def create_java_app_env(app_name):
""" Returns the environment variables Java application servers uses.
@@ -649,6 +660,7 @@ def create_java_app_env(app_name):
return env_vars
+
def create_python27_start_cmd(app_name, login_ip, port, pidfile, revision_key,
api_server_port):
""" Creates the start command to run the python application server.
@@ -693,6 +705,7 @@ def create_python27_start_cmd(app_name, login_ip, port, pidfile, revision_key,
return ' '.join(cmd)
+
def locate_dir(path, dir_name):
""" Locates a directory inside the given path.
@@ -723,6 +736,7 @@ def locate_dir(path, dir_name):
else:
return None
+
def create_java_start_cmd(app_name, port, load_balancer_host, max_heap,
pidfile, revision_key):
""" Creates the start command to run the java application server.
