Skip to content
Permalink
Browse files

Add engine option to graph generation (#476)

  • Loading branch information
aarontp committed Dec 9, 2019
1 parent 598898c commit 37fbc9930f73b4dca12a788ef794714660352414
Showing with 23 additions and 3 deletions.
  1. +23 −3 tools/turbinia_job_graph.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python -v
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 Google Inc.
#
@@ -54,16 +54,36 @@ def create_graph():
description='Create Turbinia evidence graph.')
parser.add_argument(
'-f', '--format', default='png',
help='The format of the output file you wish to generate. Supported '
'types are here: http://www.graphviz.org/doc/info/output.html')
help='The format of the output file you wish to generate. Specify '
'"list" to list out the available output types. More info is here: '
'http://www.graphviz.org/doc/info/output.html')
parser.add_argument(
'-e', '--engine', default='dot',
help='The graphviz engine used to generate the graph layout. Specify '
'"list" to list out the available engines.')
parser.add_argument('filename', type=unicode, help='where to save the file')
args = parser.parse_args()

if args.format == 'list':
formats = ' '.join(graphviz.FORMATS)
print('Available format types: {0:s}'.format(formats))
sys.exit(0)

if args.format not in graphviz.FORMATS:
print('Format type {0:s} is not supported'.format(args.format))
sys.exit(1)

if args.engine == 'list':
engines = ' '.join(graphviz.ENGINES)
print('Available graph layout engines: {0:s}'.format(engines))
sys.exit(0)

if args.engine not in graphviz.ENGINES:
print('Layout engine type {0:s} is not supported'.format(args.engine))
sys.exit(1)

graph = create_graph()
graph.engine = args.engine
output_file = args.filename.replace('.png', '')

try:

0 comments on commit 37fbc99

Please sign in to comment.
You can’t perform that action at this time.