Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore FileAlreadyExistsException when caching script #567

Merged
merged 1 commit into from Apr 23, 2017

Conversation

Projects
None yet
2 participants
@armanbilge
Copy link
Contributor

armanbilge commented Feb 10, 2017

When running the same script in parallel, often several instances fail due to a FileAlreadyExistsException (e.g. see below).

This PR wraps the relevant code in a try/catch that ignores this exception. Thanks for your consideration.

Exception in thread "main" java.nio.file.FileAlreadyExistsException: /home/abilge/.ammonite/cache/0.8.1/scriptCaches/$file.proposals/f322036cad9afef1f1b0c6ce46b2d2f6/classFilesOrder.json
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:88)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
        at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
        at java.nio.file.Files.newOutputStream(Files.java:216)
        at ammonite.ops.write$.write(FileOps.scala:280)
        at ammonite.ops.write$.apply(FileOps.scala:298)
        at ammonite.runtime.Storage$Folder.classFilesListSave(Storage.scala:157)
        at ammonite.interp.Interpreter.processModule(Interpreter.scala:392)
        at ammonite.main.Scripts$.runScript(Scripts.scala:34)
        at ammonite.Main.runScript(Main.scala:122)
        ...

@armanbilge armanbilge force-pushed the armanbilge:ignore-filealreadyexists branch from 4f7efe1 to 69b6ddd Feb 10, 2017

@armanbilge armanbilge force-pushed the armanbilge:ignore-filealreadyexists branch from 69b6ddd to 1a8903a Feb 10, 2017

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented Apr 23, 2017

Looks fine

@lihaoyi lihaoyi merged commit d8b32a3 into lihaoyi:master Apr 23, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

jhnsmth added a commit to jhnsmth/Ammonite that referenced this pull request May 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.