Browse Source

Merge "Graph execution on specific nodes"

changes/20/386620/1
Jenkins 2 years ago
parent
commit
2c1ee4127f
2 changed files with 10 additions and 7 deletions
  1. 1
    1
      octane/tests/test_util_deployment.py
  2. 9
    6
      octane/util/deployment.py

+ 1
- 1
octane/tests/test_util_deployment.py View File

@@ -110,7 +110,7 @@ def test_execute_graph_and_wait(mocker, statuses, graph_name, env_id, is_error,
110 110
     else:
111 111
         execute_graph()
112 112
     mock_graph.return_value.execute.assert_called_once_with(
113
-        env_id, graph_types=[graph_name])
113
+        env_id, graph_types=[graph_name], nodes=None)
114 114
     assert mock_status.call_count == attempts
115 115
 
116 116
 

+ 9
- 6
octane/util/deployment.py View File

@@ -37,12 +37,15 @@ def upload_graphs(orig_id, seed_id):
37 37
     """
38 38
 
39 39
     # Upload command graphs to original environment
40
-    orig_graph_dir = os.path.join(magic_consts.DEPLOYMENT_GRAPH_DIR, "orig")
41
-    upload_graphs_to_env(orig_graph_dir, orig_id)
40
+    upload_graph(orig_id, "orig")
42 41
 
43 42
     # Upload command graphs to seed environment
44
-    seed_graph_dir = os.path.join(magic_consts.DEPLOYMENT_GRAPH_DIR, "seed")
45
-    upload_graphs_to_env(seed_graph_dir, seed_id)
43
+    upload_graph(seed_id, "seed")
44
+
45
+
46
+def upload_graph(env_id, subdirectory):
47
+    graph_path = os.path.join(magic_consts.DEPLOYMENT_GRAPH_DIR, subdirectory)
48
+    upload_graphs_to_env(graph_path, env_id)
46 49
 
47 50
 
48 51
 def upload_graphs_to_env(directory, env_id):
@@ -70,12 +73,12 @@ def upload_graph_file_to_env(graph_file_path, env_id):
70 73
              graph_name, env_id)
71 74
 
72 75
 
73
-def execute_graph_and_wait(graph_name, env_id,
76
+def execute_graph_and_wait(graph_name, env_id, nodes=None,
74 77
                            attempts=120, attempt_delay=30):
75 78
     """Execute graph with fuelclient and wait until finished."""
76 79
 
77 80
     client = graph.GraphClient()
78
-    graph_task = client.execute(env_id, graph_types=[graph_name])
81
+    graph_task = client.execute(env_id, graph_types=[graph_name], nodes=nodes)
79 82
     for i in xrange(attempts):
80 83
         status = graph_task.status
81 84
         if status == 'ready':

Loading…
Cancel
Save