Skip to content

Commit

Permalink
Add debug statements for failed copies
Browse files Browse the repository at this point in the history
This seems to be the underlying issue when two processes attempt
to build Loihi models at the same time. Reproducing the error and
fully debugging it is time consuming, so we're adding these print
statements in for now so that if the tests randomly fail again we
can get some more insight for further debugging.
  • Loading branch information
drasmuss authored and tbekolay committed Jun 21, 2019
1 parent 3779848 commit 09053af
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nengo_loihi/hardware/nxsdk_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,20 @@ def createProcess(self, name, cFilePath, includeDir, *args, **kwargs):
tmp_path = os.path.join(
tmp.name, name, os.path.basename(cFilePath))
shutil.copyfile(cFilePath, tmp_path)
with open(cFilePath) as f0, open(tmp_path) as f1:
src = f0.read()
dst = f1.read()
if src != dst:
print("=== SOURCE: %s" % (cFilePath,))
print(src)
print("\n=== DEST: %s" % (tmp_path,))
print(dst)
raise ValueError("Snip file not copied correctly")

# Also copy all the include files
include_path = os.path.join(tmp.name, name, "include")
shutil.copytree(includeDir, include_path)
assert os.path.isdir(include_path), "Copy failed %s" % include_path

return super().createProcess(
name, tmp_path, include_path, *args, **kwargs)
Expand Down

0 comments on commit 09053af

Please sign in to comment.