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

@__FILE__ not available on workers #17500

Closed
artas360 opened this issue Jul 19, 2016 · 6 comments
Closed

@__FILE__ not available on workers #17500

artas360 opened this issue Jul 19, 2016 · 6 comments
Labels
needs tests Unit tests are required for this change parallelism Parallel or distributed computation

Comments

@artas360
Copy link

Hi all,
it seems that the @__FILE__ macro doesn't not return the expected result when evaluated by workers.
To illustrate this issue you can create a test.jl script containing the following code:

@everywhere f = @__FILE__;
println(pmap(x->f, workers()));

Which, when running julia test.jl prints Any["/tmp/test.jl"] as expected. However with julia -p2 the result is Any["",""], which leads to some issues when trying to reliably access files across workers.

The tests were ran with:

Julia Version 0.4.6
Commit 2e358ce (2016-06-19 17:16 UTC)

and

Julia Version 0.5.0-dev+5504
Commit c7ca319 (2016-07-19 12:45 UTC)
@tkelman tkelman added the parallelism Parallel or distributed computation label Jul 19, 2016
@amitmurthy
Copy link
Contributor

A workaround for this is

foo = @__FILE__
@eval @everywhere f = $foo

The expression f=@__FILE__ on workers cannot really return a pathname as @__FILE__ on the worker does not not point to test.jl, in fact it is not even loaded on the workers.

I am inclined to close this issue as a wont-fix

@tkelman
Copy link
Contributor

tkelman commented Jul 21, 2016

could at least use a note in @__FILE__'s documentation

@vtjnash
Copy link
Member

vtjnash commented Jul 21, 2016

could also mention Base.source_path() too

@artas360
Copy link
Author

@amitmurthy Thanks a lot for the work around! :) I'll be using it.

@vtjnash
Copy link
Member

vtjnash commented Jun 28, 2017

fixed by #21746

@vtjnash vtjnash closed this as completed Jun 28, 2017
@tkelman tkelman added the needs tests Unit tests are required for this change label Jun 28, 2017
@tkelman
Copy link
Contributor

tkelman commented Jun 28, 2017

likely to regress if it doesn't get tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs tests Unit tests are required for this change parallelism Parallel or distributed computation
Projects
None yet
Development

No branches or pull requests

4 participants