-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add JuliaRunner to support Dash.jl integration tests #1239
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
Conversation
dash/testing/application_runners.py
Outdated
self.proc = None | ||
|
||
# pylint: disable=arguments-differ | ||
def start(self, app, start_timeout=4, cwd=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The start_timeout
needs to be slightly longer than that used for R, since Julia takes a little longer to launch. This should be adequate, but we could always increase to 5 seconds if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not have to think about this timeout causing problems, especially as we never know what hardware we're on for CI and whether we have its full attention. If 4 "should be adequate" I'd probably give it 5 or 6 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was being incredibly optimistic -- 5 or 6 seconds is sufficient for a local run, but within CircleCI it can take 10-12 seconds for Julia to start, and another 5-7 seconds for the HTTP.jl server to respond. I've set the timeouts to 30 seconds, since this seems to provide for consistently passing tests.
We could use 25 seconds, but there are occasional failures. I've tried to add code during the unit test run that triggers the precompilation there rather than within the integration test cycle, but it doesn't really help all that much. I'm not sure why it's slower within CircleCI, for now the conservative defaults will get the tests running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof. We don't need to address this now, this is fine for a POC and for running a few tests. But if we get to the point of running lots of integration tests we'll want to see if there's anything we can do to improve the startup time. Either speeding Julia startup in CI, or maybe there's a way we can start one Julia session and reuse it for multiple tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcjohnson Yeah, I'd like to see HTTP.jl start up a bit faster -- Julia is often faster than R or Python once the relevant code is loaded, but it does take more time to get going, and some of that is probably unavoidable. But 20-30 seconds for each integration test is going to eventually be problematic. I've wondered why we launch R repeatedly for integration testing, then kill the process.
Is there a reason we don't launch a single process, and then send an interrupt to the Dash server? Even if this itself returns an error, I feel that we should be able to muffle it so the chain of integration tests continues. That would have benefits for all backends, rather than just Julia, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it can be as simple as interrupting the server, though this is what we do for the threaded runner in Python by adding an extra "stop" route. We'll also want to ensure that the environment gets cleaned out so tests don't depend on each other. So I think the solution is going to be different in each language, but anyway it doesn't seem like this overhead is that bothersome in R, whereas in Julia it's a much higher priority.
Great that this has such an easy analog to |
Not new here, but are we cleaning up the temp dirs we create for |
Yes! Great idea. I've added an issue for that here so we can address this in a subsequent PR, as we discussed offline: #1242. |
@alexcjohnson fixed in 62600db, log message added when in debug mode in 46a0cb8:
|
dash/testing/application_runners.py
Outdated
# try copying all valid sub folders (i.e. assets) in cwd to tmp | ||
# note that the R assets folder name can be any valid folder name | ||
assets = [ | ||
os.path.join(cwd, _) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this applies to R as well) does this whole asset-copying business belong in the if cwd
block above? If we get here with no cwd
it will be None
, and interestingly os.listdir(None)
succeeds (using the current dir I guess) but os.path.join(None, name)
fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 4c4d089
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just one minor comment that could be deferred to #1242 if you prefer.
💃
This PR proposes to add a Julia application runner for Dash.jl, which will enable the contribution of integration tests for new and existing features for this implementation of the framework.
Here's a simple "smoke" test, replicating the same basic application currently in the R repository:
The test passes and works within a development branch of Dash.jl.
@waralex @alexcjohnson