From e2d33522d202838748eb1134fe8e1596bd8c8c0b Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 12 May 2014 14:42:57 -0400 Subject: [PATCH] Fix issue #AC-1269 - Only enable graphviz task graph generation in debug mode - Define an appropriate place for the tower cycle file Conflicts: awx/settings/production.py --- awx/main/management/commands/run_task_system.py | 4 ++-- awx/main/tasks.py | 6 +++--- awx/settings/defaults.py | 3 +++ awx/settings/production.py | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/awx/main/management/commands/run_task_system.py b/awx/main/management/commands/run_task_system.py index 18bb7d5795..40eccaf1b3 100644 --- a/awx/main/management/commands/run_task_system.py +++ b/awx/main/management/commands/run_task_system.py @@ -210,9 +210,9 @@ def rebuild_graph(message): graph.add_node(wait_task) for dependency in node_dependencies: graph.add_edge(wait_task, dependency) - #if settings.DEBUG: print("Graph Edges: %s" % str(graph.edges)) - graph.generate_graphviz_plot() + if settings.DEBUG: + graph.generate_graphviz_plot() return graph def process_graph(graph, task_capacity): diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 5604112b00..f961b1143d 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -50,16 +50,16 @@ logger = logging.getLogger('awx.main.tasks') @task(bind=True) def tower_periodic_scheduler(self): def get_last_run(): - if not os.path.exists('/tmp/.tower_cycle'): + if not os.path.exists(settings.SCHEDULE_METADATA_LOCATION): return None - fd = open('/tmp/.tower_cycle') + fd = open(settings.SCHEDULE_METADATA_LOCATION) try: last_run = dateutil.parser.parse(fd.read()) return last_run except Exception, e: return None def write_last_run(last_run): - fd = open('/tmp/.tower_cycle', 'w') + fd = open(settings.SCHEDULE_METADATA_LOCATION, 'w') fd.write(last_run.isoformat()) fd.close() diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index f2f437aef2..7d98320716 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -90,6 +90,9 @@ PROJECTS_ROOT = os.path.join(BASE_DIR, 'projects') # directory should not be web-accessible JOBOUTPUT_ROOT = os.path.join(BASE_DIR, 'job_output') +# The heartbeat file for the tower scheduler +SCHEDULE_METADATA_LOCATION = os.path.join(BASE_DIR, '.tower_cycle') + SITE_ID = 1 # Make this unique, and don't share it with anybody. diff --git a/awx/settings/production.py b/awx/settings/production.py index 3f811db5f7..01d24380c0 100644 --- a/awx/settings/production.py +++ b/awx/settings/production.py @@ -40,6 +40,8 @@ INTERNAL_API_URL = 'http://127.0.0.1:80' # This directory should not be web-accessible JOBOUTPUT_ROOT = '/var/lib/awx/job_status/' + The heartbeat file for the tower scheduler +SCHEDULE_METADATA_LOCATION = '/var/lib/awx/.tower_cycle' LOGGING['handlers']['rotating_file'] = { 'level': 'WARNING',