From 47e1fbadd7ba6a13f3ba6e0280d5b0fda1b9f781 Mon Sep 17 00:00:00 2001 From: Dmitry Nikishov Date: Fri, 30 Sep 2016 11:12:54 +0300 Subject: [PATCH] Graph execution on specific nodes This commit allows to execute graphs on specific nodes. It also adds the ability to upload graphs to specific environment (seed/orig) instead of allowing to upload to both at the same time. Change-Id: I560cfed850d356e2fde86f44cc68c200cf693958 --- octane/tests/test_util_deployment.py | 2 +- octane/util/deployment.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/octane/tests/test_util_deployment.py b/octane/tests/test_util_deployment.py index 012c3f20..98861166 100644 --- a/octane/tests/test_util_deployment.py +++ b/octane/tests/test_util_deployment.py @@ -110,7 +110,7 @@ def test_execute_graph_and_wait(mocker, statuses, graph_name, env_id, is_error, else: execute_graph() mock_graph.return_value.execute.assert_called_once_with( - env_id, graph_types=[graph_name]) + env_id, graph_types=[graph_name], nodes=None) assert mock_status.call_count == attempts diff --git a/octane/util/deployment.py b/octane/util/deployment.py index 8d6f95ce..7e0e82f6 100644 --- a/octane/util/deployment.py +++ b/octane/util/deployment.py @@ -37,12 +37,15 @@ def upload_graphs(orig_id, seed_id): """ # Upload command graphs to original environment - orig_graph_dir = os.path.join(magic_consts.DEPLOYMENT_GRAPH_DIR, "orig") - upload_graphs_to_env(orig_graph_dir, orig_id) + upload_graph(orig_id, "orig") # Upload command graphs to seed environment - seed_graph_dir = os.path.join(magic_consts.DEPLOYMENT_GRAPH_DIR, "seed") - upload_graphs_to_env(seed_graph_dir, seed_id) + upload_graph(seed_id, "seed") + + +def upload_graph(env_id, subdirectory): + graph_path = os.path.join(magic_consts.DEPLOYMENT_GRAPH_DIR, subdirectory) + upload_graphs_to_env(graph_path, env_id) def upload_graphs_to_env(directory, env_id): @@ -70,12 +73,12 @@ def upload_graph_file_to_env(graph_file_path, env_id): graph_name, env_id) -def execute_graph_and_wait(graph_name, env_id, +def execute_graph_and_wait(graph_name, env_id, nodes=None, attempts=120, attempt_delay=30): """Execute graph with fuelclient and wait until finished.""" client = graph.GraphClient() - graph_task = client.execute(env_id, graph_types=[graph_name]) + graph_task = client.execute(env_id, graph_types=[graph_name], nodes=nodes) for i in xrange(attempts): status = graph_task.status if status == 'ready':