prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  turbinia_job_graph.py doesn't support new job manager
  turbinia_job_graph.py needs to be updated to support the new job manager (from #257).
  
  </issue>
  <code>
  [start of tools/turbinia_job_graph.py]
  1 # -*- coding: utf-8 -*-
  2 # Copyright 2018 Google Inc.
  3 #
  4 # Licensed under the Apache License, Version 2.0 (the "License");
  5 # you may not use this file except in compliance with the License.
  6 # You may obtain a copy of the License at
  7 #
  8 #      http://www.apache.org/licenses/LICENSE-2.0
  9 #
  10 # Unless required by applicable law or agreed to in writing, software
  11 # distributed under the License is distributed on an "AS IS" BASIS,
  12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 # See the License for the specific language governing permissions and
  14 # limitations under the License.
  15 """Graph to visualise job/evidence relationships."""
  16 
  17 from __future__ import unicode_literals
  18 
  19 import argparse
  20 import graphviz
  21 
  22 from turbinia.jobs import get_jobs as turbinia_jobs
  23 
  24 
  25 def create_graph():
  26   """Create graph of relationships between Turbinia jobs and evidence.
  27 
  28   Returns:
  29     Instance of graphviz.dot.Digraph
  30   """
  31   dot = graphviz.Digraph(comment='Turbinia Evidence graph', format='png')
  32   for job in turbinia_jobs():
  33     dot.node(job.name)
  34     for evidence in job.evidence_input:
  35       dot.node(evidence.__name__, shape='box')
  36       dot.edge(evidence.__name__, job.name)
  37 
  38     for evidence in job.evidence_output:
  39       dot.node(evidence.__name__, shape='box')
  40       dot.edge(job.name, evidence.__name__)
  41   return dot
  42 
  43 
  44 if __name__ == '__main__':
  45   parser = argparse.ArgumentParser(
  46       description='Create Turbinia evidence graph.')
  47   parser.add_argument('filename', type=unicode, help='where to save the file')
  48   args = parser.parse_args()
  49 
  50   graph = create_graph()
  51   output_file = args.filename.replace('.png', '')
  52 
  53   try:
  54     rendered_graph = graph.render(filename=output_file, cleanup=True)
  55     print('Graph generated and saved to: {0}'.format(rendered_graph))
  56   except graphviz.ExecutableNotFound:
  57     print('Graphviz is not installed - Run: apt-get install graphviz')
  58
  [end of tools/turbinia_job_graph.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/tools/turbinia_job_graph.py b/tools/turbinia_job_graph.py
  --- a/tools/turbinia_job_graph.py
  +++ b/tools/turbinia_job_graph.py
  @@ -19,7 +19,7 @@
   import argparse
   import graphviz
   
  -from turbinia.jobs import get_jobs as turbinia_jobs
  +from turbinia.jobs import manager as jobs_manager
   
   
   def create_graph():
  @@ -29,15 +29,15 @@
       Instance of graphviz.dot.Digraph
     """
     dot = graphviz.Digraph(comment='Turbinia Evidence graph', format='png')
  -  for job in turbinia_jobs():
  -    dot.node(job.name)
  +  for _, job in jobs_manager.JobsManager.GetJobs():
  +    dot.node(job.NAME)
       for evidence in job.evidence_input:
         dot.node(evidence.__name__, shape='box')
  -      dot.edge(evidence.__name__, job.name)
  +      dot.edge(evidence.__name__, job.NAME)
   
       for evidence in job.evidence_output:
         dot.node(evidence.__name__, shape='box')
  -      dot.edge(job.name, evidence.__name__)
  +      dot.edge(job.NAME, evidence.__name__)
     return dot
  
verification_info: {"golden_diff": "diff --git a/tools/turbinia_job_graph.py b/tools/turbinia_job_graph.py\n--- a/tools/turbinia_job_graph.py\n+++ b/tools/turbinia_job_graph.py\n@@ -19,7 +19,7 @@\n import argparse\n import graphviz\n \n-from turbinia.jobs import get_jobs as turbinia_jobs\n+from turbinia.jobs import manager as jobs_manager\n \n \n def create_graph():\n@@ -29,15 +29,15 @@\n     Instance of graphviz.dot.Digraph\n   \"\"\"\n   dot = graphviz.Digraph(comment='Turbinia Evidence graph', format='png')\n-  for job in turbinia_jobs():\n-    dot.node(job.name)\n+  for _, job in jobs_manager.JobsManager.GetJobs():\n+    dot.node(job.NAME)\n     for evidence in job.evidence_input:\n       dot.node(evidence.__name__, shape='box')\n-      dot.edge(evidence.__name__, job.name)\n+      dot.edge(evidence.__name__, job.NAME)\n \n     for evidence in job.evidence_output:\n       dot.node(evidence.__name__, shape='box')\n-      dot.edge(job.name, evidence.__name__)\n+      dot.edge(job.NAME, evidence.__name__)\n   return dot\n", "issue": "turbinia_job_graph.py doesn't support new job manager\nturbinia_job_graph.py needs to be updated to support the new job manager (from #257).\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2018 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Graph to visualise job/evidence relationships.\"\"\"\n\nfrom __future__ import unicode_literals\n\nimport argparse\nimport graphviz\n\nfrom turbinia.jobs import get_jobs as turbinia_jobs\n\n\ndef create_graph():\n  \"\"\"Create graph of relationships between Turbinia jobs and evidence.\n\n  Returns:\n    Instance of graphviz.dot.Digraph\n  \"\"\"\n  dot = graphviz.Digraph(comment='Turbinia Evidence graph', format='png')\n  for job in turbinia_jobs():\n    dot.node(job.name)\n    for evidence in job.evidence_input:\n      dot.node(evidence.__name__, shape='box')\n      dot.edge(evidence.__name__, job.name)\n\n    for evidence in job.evidence_output:\n      dot.node(evidence.__name__, shape='box')\n      dot.edge(job.name, evidence.__name__)\n  return dot\n\n\nif __name__ == '__main__':\n  parser = argparse.ArgumentParser(\n      description='Create Turbinia evidence graph.')\n  parser.add_argument('filename', type=unicode, help='where to save the file')\n  args = parser.parse_args()\n\n  graph = create_graph()\n  output_file = args.filename.replace('.png', '')\n\n  try:\n    rendered_graph = graph.render(filename=output_file, cleanup=True)\n    print('Graph generated and saved to: {0}'.format(rendered_graph))\n  except graphviz.ExecutableNotFound:\n    print('Graphviz is not installed - Run: apt-get install graphviz')\n", "path": "tools/turbinia_job_graph.py"}]}