If I'm reading include_from_node1 correctly, we convert path passed to include to an absolute path on the current worker, and then fetch the source from node 1. This makes include inside packages work, since the absolute path is relative to the path to the required file on node 1. However, this behavior seems more questionable for a bare include not inside a file that was reloaded or required (e.g. @spawnat 2 include("mycode.jl")), since in this case the absolute path is relative to the worker's current working directory, which might not exist on node 1. In that case, I think we should either:
include relative to the current working directory on node 1. (This is not so weird, since require and reload search the current working directory on node 1.)
include the file from the local file system. But this may be ill-advised. If you include a local file and it calls include, that should naturally refer to a local file. But if you include a local file and it calls require or using, do you load local code or code from node 1?
If I'm reading include_from_node1 correctly, we convert path passed to
include
to an absolute path on the current worker, and then fetch the source from node 1. This makesinclude
inside packages work, since the absolute path is relative to the path to therequire
d file on node 1. However, this behavior seems more questionable for a bareinclude
not inside a file that wasreload
ed orrequire
d (e.g.@spawnat 2 include("mycode.jl")
), since in this case the absolute path is relative to the worker's current working directory, which might not exist on node 1. In that case, I think we should either:include
relative to the current working directory on node 1. (This is not so weird, sincerequire
andreload
search the current working directory on node 1.)include
the file from the local file system. But this may be ill-advised. If youinclude
a local file and it callsinclude
, that should naturally refer to a local file. But if youinclude
a local file and it callsrequire
orusing
, do you load local code or code from node 1?