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

Refactor environments and scoping #37

Closed
wlandau-lilly opened this issue May 1, 2017 · 3 comments
Closed

Refactor environments and scoping #37

wlandau-lilly opened this issue May 1, 2017 · 3 comments

Comments

@wlandau-lilly
Copy link
Collaborator

wlandau-lilly commented May 1, 2017

#35 is an example of unexpected behavior in an edge case due to drake's policy on environments and scoping. To make behavior more predictable in the next major version (3.0.0), drake will stop micromanaging environments. Targets will be evaluated in and assigned to the user's actual environment, not an isolated deep copy, and the enclosing environments of functions will no longer be reassigned. By default, your workspace will be vulnerable to side effects of make(), but you can always use the envir argument of make() to impose protection.

@wlandau-lilly
Copy link
Collaborator Author

wlandau-lilly commented May 1, 2017

The actual change is implemented in the closed-source repo. It doesn't quite work yet on a big internal project, so I have more debugging to do.

@wlandau-lilly
Copy link
Collaborator Author

wlandau-lilly commented May 2, 2017

This is much harder than I thought. Right now, I am working with a version of drake that takes the user's environment and imported functions as-is. make(..., envir = some_envir, parallelism = "parLapply", jobs = 2) stops in error if some_envir is the global environment, but it works great if some_envir is a custom environment. I think it has to do with the way parLapply() creates separate global environments for each "node" on the "cluster".

This is my highest-priority issue for drake, but it could still take a long time to fix.

@wlandau-lilly
Copy link
Collaborator Author

Now fixed in the closed-source version. For global environments, I just had to export more things to parLapply() nodes and save/load the workspace for Makefile execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant