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
This commit is contained in:
parent
66e7a8c493
commit
47e1fbadd7
|
@ -110,7 +110,7 @@ def test_execute_graph_and_wait(mocker, statuses, graph_name, env_id, is_error,
|
||||||
else:
|
else:
|
||||||
execute_graph()
|
execute_graph()
|
||||||
mock_graph.return_value.execute.assert_called_once_with(
|
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
|
assert mock_status.call_count == attempts
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,12 +37,15 @@ def upload_graphs(orig_id, seed_id):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Upload command graphs to original environment
|
# Upload command graphs to original environment
|
||||||
orig_graph_dir = os.path.join(magic_consts.DEPLOYMENT_GRAPH_DIR, "orig")
|
upload_graph(orig_id, "orig")
|
||||||
upload_graphs_to_env(orig_graph_dir, orig_id)
|
|
||||||
|
|
||||||
# Upload command graphs to seed environment
|
# Upload command graphs to seed environment
|
||||||
seed_graph_dir = os.path.join(magic_consts.DEPLOYMENT_GRAPH_DIR, "seed")
|
upload_graph(seed_id, "seed")
|
||||||
upload_graphs_to_env(seed_graph_dir, seed_id)
|
|
||||||
|
|
||||||
|
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):
|
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)
|
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):
|
attempts=120, attempt_delay=30):
|
||||||
"""Execute graph with fuelclient and wait until finished."""
|
"""Execute graph with fuelclient and wait until finished."""
|
||||||
|
|
||||||
client = graph.GraphClient()
|
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):
|
for i in xrange(attempts):
|
||||||
status = graph_task.status
|
status = graph_task.status
|
||||||
if status == 'ready':
|
if status == 'ready':
|
||||||
|
|
Loading…
Reference in New Issue