Revise not getting loaded in Julia Test Process, inside VS Code container

I’m exploring a Julia workflow in VS Code where I’m running a Julia Docker container and attaching VS Code to that container. Things were generally going quite well, but I’ve noticed that Revise isn’t getting loaded into the Julia Test Process.

I have Revise installed in the container in the global environment and also the project environment, and it seems to be working right from the REPL, just not when running tests in the Julia Test Process (i.e. running @testitem tests from the testing pane). When changes are made to the module, the test output clearly shows that the module is not getting reloaded.

I’ve added the usual code to the ~/.julia/config/startup.jl file:

try
  @eval using Revise
catch e
  @warn "Revise init" exception=(e, catch_backtrace())
end

Outside of the container, I have no issues with Revise; I can make changes to my module and the running Julia Test Process picks them up as soon as tests are run again from the testing pane.

I’m a bit confused about what else to try - could somebody please advise?

Correction, Revise does not seem to be working at all in VS Code attached to a Docker container.

I have a simple package TestPkg:

module TestPkg

export foobar

foobar() = 4

end

Running in the container, I see Revise has been loaded into the Julia environment. I run using TestPkg and foobar() and I get the output 4. But if I change the 4 to a 3 in the module source file, and run foobar() again, there’s no precompilation delay and I still get 4.

Outside of the container on the same package, I get the expected result where Revise automatically recompiles for me and the new module behaviour is immediately reflected in the REPL.

How can I figure out what is different about my environment inside the container vs. on my host machine?

I’ve found the issue, with some help from this answer on a similar post from 2019:

Also a few related links:

Basically, Revise relies on getting notified when files change, but that doesn’t work properly inside a Docker container, for files which are actually on the Windows host machine and accessed via a bind volume mount inside the container.

I found two workarounds:

  1. Use the Revise polling mode by setting JULIA_REVISE_POLL=1 in the environment before loading Revise. This checks files every several seconds for changes, and it does work although it’s frustrating to have to wait.
  2. Use Revise within the container only for files within the “native” Unix filesystem, not files mounted from the host system. E.g. clone the package repo into the home directory inside the container and just work there. Revise works perfectly with that setup. The only downside is you can’t quickly work with the same filetree in the host system, but in practice that’s not an issue.

Hope this helps someone else who comes across the same issue!

2 Likes