prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  fatal: Not a git repository: '/homes/vvikraman/anaconda3/lib/python3.6/site-packages/.git
  Hi 
  When I try to run parsl I am getting the following issue:
  
  fatal: Not a git repository: '/homes/vvikraman/anaconda3/lib/python3.6/site-packages/.git
  
  Is it a real issue?
  
  I am using python3 and jupyter but run parsl in a terminal. 
  Issue in parsl.log
  I tried to run a simple script given in the parsl documentation 
  
  ```
  import parsl
  from parsl import *
  import time
  
  workers = ThreadPoolExecutor(max_workers=4)
  dfk = DataFlowKernel(executors=[workers])
  print(1)
  @App('python', dfk)
  def hello ():
      import time
      time.sleep(5)
      return 'Hello World!'
  print(2)
  app_future = hello()
  print ('Done: %s' % app_future.done())
  print ('Result: %s' % app_future.result())
  print ('Done: %s' % app_future.done())
  ```
  However, in the parsl.log shows this issue
  
  2018-06-07 21:45:37 parsl.utils:24 [ERROR]  Unable to determine code state
  Traceback (most recent call last):
    File "/homes/vvikraman/anaconda3/lib/python3.6/site-packages/parsl/utils.py", line 19, in get_version
      head = subprocess.check_output(cmd, env=env).strip().decode('utf-8')
    File "/homes/vvikraman/anaconda3/lib/python3.6/subprocess.py", line 336, in check_output
      **kwargs).stdout
    File "/homes/vvikraman/anaconda3/lib/python3.6/subprocess.py", line 418, in run
      output=stdout, stderr=stderr)
  subprocess.CalledProcessError: Command '['git', 'rev-parse', '--short', 'HEAD']' returned non-zero exit status 128.
  
  
  </issue>
  <code>
  [start of parsl/utils.py]
  1 import logging
  2 import os
  3 import shlex
  4 import subprocess
  5 import threading
  6 import time
  7 from contextlib import contextmanager
  8 from functools import wraps
  9 
  10 import parsl
  11 from parsl.version import VERSION
  12 
  13 logger = logging.getLogger(__name__)
  14 
  15 
  16 def get_version():
  17     version = parsl.__version__
  18     work_tree = os.path.dirname(os.path.dirname(__file__))
  19     git_dir = os.path.join(work_tree, '.git')
  20     env = {'GIT_WORK_TREE': work_tree, 'GIT_DIR': git_dir}
  21     try:
  22         cmd = shlex.split('git rev-parse --short HEAD')
  23         head = subprocess.check_output(cmd, env=env).strip().decode('utf-8')
  24         diff = subprocess.check_output(shlex.split('git diff HEAD'), env=env)
  25         status = 'dirty' if diff else 'clean'
  26         version = '{v}-{head}-{status}'.format(v=VERSION, head=head, status=status)
  27     except Exception as e:
  28         logger.exception("Unable to determine code state")
  29 
  30     return version
  31 
  32 
  33 def get_all_checkpoints(rundir="runinfo"):
  34     """Finds the checkpoints from all last runs.
  35 
  36     Note that checkpoints are incremental, and this helper will not find
  37     previous checkpoints from earlier than the most recent run. It probably
  38     should be made to do so.
  39 
  40     Kwargs:
  41        - rundir(str) : Path to the runinfo directory
  42 
  43     Returns:
  44        - a list suitable for the checkpointFiles parameter of DataFlowKernel
  45          constructor
  46 
  47     """
  48 
  49     if(not(os.path.isdir(rundir))):
  50         return []
  51 
  52     dirs = sorted(os.listdir(rundir))
  53 
  54     checkpoints = []
  55 
  56     for runid in dirs:
  57 
  58         checkpoint = os.path.abspath('{}/{}/checkpoint'.format(rundir, runid))
  59 
  60         if(os.path.isdir(checkpoint)):
  61             checkpoints.append(checkpoint)
  62 
  63     return checkpoints
  64 
  65 
  66 def get_last_checkpoint(rundir="runinfo"):
  67     """Finds the checkpoint from the last run, if one exists.
  68 
  69     Note that checkpoints are incremental, and this helper will not find
  70     previous checkpoints from earlier than the most recent run. It probably
  71     should be made to do so.
  72 
  73     Kwargs:
  74        - rundir(str) : Path to the runinfo directory
  75 
  76     Returns:
  77      - a list suitable for checkpointFiles parameter of DataFlowKernel
  78        constructor, with 0 or 1 elements
  79 
  80     """
  81 
  82     if(not(os.path.isdir(rundir))):
  83         return []
  84 
  85     dirs = sorted(os.listdir(rundir))
  86 
  87     if(len(dirs) == 0):
  88         return []
  89 
  90     last_runid = dirs[-1]
  91     last_checkpoint = os.path.abspath('{}/{}/checkpoint'.format(rundir, last_runid))
  92 
  93     if(not(os.path.isdir(last_checkpoint))):
  94         return []
  95 
  96     return [last_checkpoint]
  97 
  98 
  99 def timeout(seconds=None):
  100     def decorator(func, *args, **kwargs):
  101         @wraps(func)
  102         def wrapper(*args, **kwargs):
  103             t = threading.Thread(target=func, args=args, kwargs=kwargs)
  104             t.start()
  105             result = t.join(seconds)
  106             if t.is_alive():
  107                 raise RuntimeError('timed out in {}'.format(func))
  108             return result
  109         return wrapper
  110     return decorator
  111 
  112 
  113 @contextmanager
  114 def time_limited_open(path, mode, seconds=1):
  115     @timeout(seconds)
  116     def check_path(path):
  117         while not os.path.exists(path):
  118             time.sleep(0.1)
  119     check_path(path)
  120     f = open(path, mode)
  121     yield f
  122     f.close()
  123
  [end of parsl/utils.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/parsl/utils.py b/parsl/utils.py
  --- a/parsl/utils.py
  +++ b/parsl/utils.py
  @@ -25,7 +25,7 @@
           status = 'dirty' if diff else 'clean'
           version = '{v}-{head}-{status}'.format(v=VERSION, head=head, status=status)
       except Exception as e:
  -        logger.exception("Unable to determine code state")
  +        pass
   
       return version
  
verification_info: {"golden_diff": "diff --git a/parsl/utils.py b/parsl/utils.py\n--- a/parsl/utils.py\n+++ b/parsl/utils.py\n@@ -25,7 +25,7 @@\n         status = 'dirty' if diff else 'clean'\n         version = '{v}-{head}-{status}'.format(v=VERSION, head=head, status=status)\n     except Exception as e:\n-        logger.exception(\"Unable to determine code state\")\n+        pass\n \n     return version\n", "issue": "fatal: Not a git repository: '/homes/vvikraman/anaconda3/lib/python3.6/site-packages/.git\nHi \r\nWhen I try to run parsl I am getting the following issue:\r\n\r\nfatal: Not a git repository: '/homes/vvikraman/anaconda3/lib/python3.6/site-packages/.git\r\n\r\nIs it a real issue?\r\n\r\nI am using python3 and jupyter but run parsl in a terminal. \nIssue in parsl.log\nI tried to run a simple script given in the parsl documentation \r\n\r\n```\r\nimport parsl\r\nfrom parsl import *\r\nimport time\r\n\r\nworkers = ThreadPoolExecutor(max_workers=4)\r\ndfk = DataFlowKernel(executors=[workers])\r\nprint(1)\r\n@App('python', dfk)\r\ndef hello ():\r\n    import time\r\n    time.sleep(5)\r\n    return 'Hello World!'\r\nprint(2)\r\napp_future = hello()\r\nprint ('Done: %s' % app_future.done())\r\nprint ('Result: %s' % app_future.result())\r\nprint ('Done: %s' % app_future.done())\r\n```\r\nHowever, in the parsl.log shows this issue\r\n\r\n2018-06-07 21:45:37 parsl.utils:24 [ERROR]  Unable to determine code state\r\nTraceback (most recent call last):\r\n  File \"/homes/vvikraman/anaconda3/lib/python3.6/site-packages/parsl/utils.py\", line 19, in get_version\r\n    head = subprocess.check_output(cmd, env=env).strip().decode('utf-8')\r\n  File \"/homes/vvikraman/anaconda3/lib/python3.6/subprocess.py\", line 336, in check_output\r\n    **kwargs).stdout\r\n  File \"/homes/vvikraman/anaconda3/lib/python3.6/subprocess.py\", line 418, in run\r\n    output=stdout, stderr=stderr)\r\nsubprocess.CalledProcessError: Command '['git', 'rev-parse', '--short', 'HEAD']' returned non-zero exit status 128.\r\n\n", "before_files": [{"content": "import logging\nimport os\nimport shlex\nimport subprocess\nimport threading\nimport time\nfrom contextlib import contextmanager\nfrom functools import wraps\n\nimport parsl\nfrom parsl.version import VERSION\n\nlogger = logging.getLogger(__name__)\n\n\ndef get_version():\n    version = parsl.__version__\n    work_tree = os.path.dirname(os.path.dirname(__file__))\n    git_dir = os.path.join(work_tree, '.git')\n    env = {'GIT_WORK_TREE': work_tree, 'GIT_DIR': git_dir}\n    try:\n        cmd = shlex.split('git rev-parse --short HEAD')\n        head = subprocess.check_output(cmd, env=env).strip().decode('utf-8')\n        diff = subprocess.check_output(shlex.split('git diff HEAD'), env=env)\n        status = 'dirty' if diff else 'clean'\n        version = '{v}-{head}-{status}'.format(v=VERSION, head=head, status=status)\n    except Exception as e:\n        logger.exception(\"Unable to determine code state\")\n\n    return version\n\n\ndef get_all_checkpoints(rundir=\"runinfo\"):\n    \"\"\"Finds the checkpoints from all last runs.\n\n    Note that checkpoints are incremental, and this helper will not find\n    previous checkpoints from earlier than the most recent run. It probably\n    should be made to do so.\n\n    Kwargs:\n       - rundir(str) : Path to the runinfo directory\n\n    Returns:\n       - a list suitable for the checkpointFiles parameter of DataFlowKernel\n         constructor\n\n    \"\"\"\n\n    if(not(os.path.isdir(rundir))):\n        return []\n\n    dirs = sorted(os.listdir(rundir))\n\n    checkpoints = []\n\n    for runid in dirs:\n\n        checkpoint = os.path.abspath('{}/{}/checkpoint'.format(rundir, runid))\n\n        if(os.path.isdir(checkpoint)):\n            checkpoints.append(checkpoint)\n\n    return checkpoints\n\n\ndef get_last_checkpoint(rundir=\"runinfo\"):\n    \"\"\"Finds the checkpoint from the last run, if one exists.\n\n    Note that checkpoints are incremental, and this helper will not find\n    previous checkpoints from earlier than the most recent run. It probably\n    should be made to do so.\n\n    Kwargs:\n       - rundir(str) : Path to the runinfo directory\n\n    Returns:\n     - a list suitable for checkpointFiles parameter of DataFlowKernel\n       constructor, with 0 or 1 elements\n\n    \"\"\"\n\n    if(not(os.path.isdir(rundir))):\n        return []\n\n    dirs = sorted(os.listdir(rundir))\n\n    if(len(dirs) == 0):\n        return []\n\n    last_runid = dirs[-1]\n    last_checkpoint = os.path.abspath('{}/{}/checkpoint'.format(rundir, last_runid))\n\n    if(not(os.path.isdir(last_checkpoint))):\n        return []\n\n    return [last_checkpoint]\n\n\ndef timeout(seconds=None):\n    def decorator(func, *args, **kwargs):\n        @wraps(func)\n        def wrapper(*args, **kwargs):\n            t = threading.Thread(target=func, args=args, kwargs=kwargs)\n            t.start()\n            result = t.join(seconds)\n            if t.is_alive():\n                raise RuntimeError('timed out in {}'.format(func))\n            return result\n        return wrapper\n    return decorator\n\n\n@contextmanager\ndef time_limited_open(path, mode, seconds=1):\n    @timeout(seconds)\n    def check_path(path):\n        while not os.path.exists(path):\n            time.sleep(0.1)\n    check_path(path)\n    f = open(path, mode)\n    yield f\n    f.close()\n", "path": "parsl/utils.py"}]}