Commit 81bcdeea authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

read generate_graph's standard output to save having to create a temporary file

parent 794d1805
......@@ -102,21 +102,13 @@ def generate_dot_diagram(pipeconfig_content):
print >> pipeconfig_fh, pipeconfig_template % (package_name, pipeconfig_content)
# A temporary file for the dot output
dotoutput_fh = tempfile.NamedTemporaryFile(suffix = '.dot', dir = os.getcwd(), delete = False, mode="r+")
# Run generate_graph
# Run generate_graph and read the content of the dot file
graph_path = os.path.join(os.environ["EHIVE_ROOT_DIR"], "scripts", "")
subprocess.check_call([graph_path, "-pipeconfig",, "-output",, "-config_file", default_config_file, "-config_file",], stdout=sys.stdout, stderr=sys.stderr)
# Read the content of the dot file
dotcontent =
dotcontent = subprocess.check_output([graph_path, "-pipeconfig",, "--format", "dot", "-config_file", default_config_file, "-config_file",], stderr=sys.stderr)
# Remove the temporary files
return dotcontent
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment