diff --git a/pulsar/daemon.py b/pulsar/daemon.py index 33d936d20587200fdc1339bd55e1ac11dd9b88d1..af486e64852d7e5e882530a421a596696fa65f04 100644 --- a/pulsar/daemon.py +++ b/pulsar/daemon.py @@ -44,7 +44,7 @@ DEFAULT_VERBOSE = True DESCRIPTION = "Daemonized entry point for LWR services." -def load_lwr_app( +def load_pulsar_app( config_builder, config_env=False, log=None, @@ -73,8 +73,8 @@ def load_lwr_app( config.update(kwds) import pulsar.core - lwr_app = pulsar.core.LwrApp(**config) - return lwr_app + pulsar_app = pulsar.core.LwrApp(**config) + return pulsar_app def __setup_logging(ini_path): @@ -97,7 +97,7 @@ def __app_config(ini_path, app_name): def app_loop(args): try: config_builder = LwrConfigBuilder(args) - lwr_app = load_lwr_app( + pulsar_app = load_pulsar_app( config_builder, config_env=True, log=log, @@ -112,7 +112,7 @@ def app_loop(args): except Exception: pass try: - lwr_app.shutdown() + pulsar_app.shutdown() except Exception: log.exception("Failed to shutdown LWR application") raise diff --git a/pulsar/scripts/mesos_executor.py b/pulsar/scripts/mesos_executor.py index adab228f38d20589d9bc92e698b4b0016b0b13fb..aa871d69bff8747bedbde3e0732a4dd33b0b65af 100644 --- a/pulsar/scripts/mesos_executor.py +++ b/pulsar/scripts/mesos_executor.py @@ -49,13 +49,13 @@ class LwrExecutor(Executor): task_data = from_base64_json(task.data) manager_options = task_data["manager"] config_builder = LwrManagerConfigBuilder(**manager_options) - manager, lwr_app = manager_from_args(config_builder) + manager, pulsar_app = manager_from_args(config_builder) job_config = task_data["job"] submit_job(manager, job_config) self.__task_update(driver, task, mesos_pb2.TASK_RUNNING) wait_for_job(manager, job_config) self.__task_update(driver, task, mesos_pb2.TASK_FINISHED) - lwr_app.shutdown() + pulsar_app.shutdown() except Exception: log.exception("Failed to run, update, or monitor task %s" % task) raise diff --git a/pulsar/scripts/submit.py b/pulsar/scripts/submit.py index 73051378f96847fa27a35a4ffc4b1a6bd4abb4b9..e23ea8d2a5e68d61bfb3cbf3ba3253af1afa10fe 100644 --- a/pulsar/scripts/submit.py +++ b/pulsar/scripts/submit.py @@ -4,7 +4,7 @@ import json from pulsar.daemon import ArgumentParser from pulsar.client.util import from_base64_json from pulsar.daemon import ( - load_lwr_app, + load_pulsar_app, LwrManagerConfigBuilder ) from pulsar.manager_endpoint_util import submit_job @@ -57,15 +57,15 @@ def __load_job_config(args): def manager_from_args(config_builder): manager_name = config_builder.manager - lwr_app = load_lwr_app( + pulsar_app = load_pulsar_app( config_builder, # Set message_queue_consume so this LWR app doesn't try to consume # setup/kill messages and only publishes status updates to configured # queue. message_queue_consume=False, ) - manager = lwr_app.managers[manager_name] - return manager, lwr_app + manager = pulsar_app.managers[manager_name] + return manager, pulsar_app if __name__ == "__main__": main() diff --git a/pulsar/web/wsgi.py b/pulsar/web/wsgi.py index 01a6c1d874cc4483bc9c04abf831496eab3edf50..d164882a321d3eb3bc6b238a65397e16efda9be2 100644 --- a/pulsar/web/wsgi.py +++ b/pulsar/web/wsgi.py @@ -11,8 +11,8 @@ def app_factory(global_conf, **local_conf): """ Returns the LWR WSGI application. """ - lwr_app = LwrApp(global_conf=global_conf, **local_conf) - webapp = LwrWebApp(lwr_app=lwr_app) + pulsar_app = LwrApp(global_conf=global_conf, **local_conf) + webapp = LwrWebApp(pulsar_app=pulsar_app) atexit.register(webapp.shutdown) return webapp @@ -22,9 +22,9 @@ class LwrWebApp(RoutingApp): Web application for LWR web server. """ - def __init__(self, lwr_app): + def __init__(self, pulsar_app): super(LwrWebApp, self).__init__() - self.lwr_app = lwr_app + self.pulsar_app = pulsar_app self.__setup_routes() def __setup_routes(self): @@ -44,4 +44,4 @@ class LwrWebApp(RoutingApp): self.add_route(named_manager_route, method, function) def __getattr__(self, name): - return getattr(self.lwr_app, name) + return getattr(self.pulsar_app, name) diff --git a/test/app_test.py b/test/app_test.py index 9f85d17d6552bfaed711c4b74daa07b87d738166..fa133c7433d21d5bc0c44ed925428c784d281b90 100644 --- a/test/app_test.py +++ b/test/app_test.py @@ -8,9 +8,9 @@ def test_standard_requests(): """ Tests app controller methods. These tests should be compartmentalized. Also these methods should be made to not retest the behavior of the associated Manager class. """ - from .test_utils import test_lwr_app + from .test_utils import test_pulsar_app - with test_lwr_app(test_conf={"extra_environ": {"REMOTE_ADDR": "127.101.101.98"}}) as app: + with test_pulsar_app(test_conf={"extra_environ": {"REMOTE_ADDR": "127.101.101.98"}}) as app: staging_directory = app.app.staging_directory setup_response = app.post("/jobs?job_id=12345") setup_config = json.loads(setup_response.body) diff --git a/test/integration_test.py b/test/integration_test.py index 98b343bef3b5d9918f244adf177063fc7b5cb01e..03f9b81957e6725ada3c528dce4ff24b178636ff 100644 --- a/test/integration_test.py +++ b/test/integration_test.py @@ -4,7 +4,7 @@ from six import next, itervalues from six.moves import configparser from .test_utils import TempDirectoryTestCase, skipUnlessExecutable, skipUnlessModule -from .test_utils import test_lwr_app +from .test_utils import test_pulsar_app from .test_utils import test_lwr_server from .test_utils import files_server @@ -45,7 +45,7 @@ class BaseIntegrationTest(TempDirectoryTestCase): run(options) def _run_direct(self, app_conf, **kwds): - with test_lwr_app({}, app_conf, {}) as app: + with test_pulsar_app({}, app_conf, {}) as app: options = Bunch(job_manager=next(itervalues(app.app.managers)), file_cache=app.app.file_cache, **kwds) self._update_options_for_app(options, app.app, **kwds) run(options) diff --git a/test/test_utils.py b/test/test_utils.py index 6cb080417437003f0765e6287286b5fcec6fc62f..ec9de7ceb02c40fe7a614c9b8a8b371bb9be859e 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -137,14 +137,14 @@ def server_for_test_app(app): @nottest @contextmanager def test_lwr_server(global_conf={}, app_conf={}, test_conf={}): - with test_lwr_app(global_conf, app_conf, test_conf) as app: + with test_pulsar_app(global_conf, app_conf, test_conf) as app: with server_for_test_app(app) as test_lwr_server: yield test_lwr_server @nottest @contextmanager -def test_lwr_app(global_conf={}, app_conf={}, test_conf={}): +def test_pulsar_app(global_conf={}, app_conf={}, test_conf={}): staging_directory = mkdtemp() # Make staging directory world executable for run as user tests. mode = stat(staging_directory).st_mode