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

ipcluster touching ~/.ipython even though --ipython-dir is specified #454

Open
mforbes opened this issue Apr 29, 2021 · 2 comments
Open

Comments

@mforbes
Copy link

mforbes commented Apr 29, 2021

When trying to run ipcluster for testing in a temporary directory, ~/.ipython still gets created.

rm -rf ~/.ipython
mkdir /tmp/tmp5aa3_zqu
ipcluster start --profile=testing1 --n=2 --ipython-dir=/tmp/tmp5aa3_zqu
$ tree ~/.ipython/
/home/mforbes/.ipython/
`-- profile_default
    |-- db
    |-- log
    |-- pid
    |-- security
    `-- startup
        `-- README

Shouldn't --ipython-dir prevent this? (I don't want my tests creating files in someones home directory).

Note, this is very minor: /tmp/tmp5aa3_zqu is used for all the important stuff.

@mforbes
Copy link
Author

mforbes commented Apr 30, 2021

Related probably is that if one locks ~/.ipython then starting a cluster populates many tempdirs instead, which do not get cleaned up.

mkdir ~/.ipython /tmp/tmp5aa3_zqu
chmod a-rwx ~/.ipython
ipcluster start --profile=testing1 --n=2 --ipython-dir=/tmp/tmp5aa3_zqu
$ tree /tmp
/tmp
...
|-- tmp5aa3_zqu                      # This is expected
|   |-- extensions
|   |-- nbextensions
|   `-- profile_testing1
|       |-- log
|       |-- pid
|       |   |-- ipcluster.pid
|       |   `-- ipcontroller.pid
|       |-- security
|       `-- startup
|           `-- README
|-- tmp60l8kd6o                      # This should not be created
|   `-- profile_default
|       |-- db
|       |-- log
|       |-- pid
|       |-- security
|       `-- startup
|           `-- README
|-- tmpup6dmrce                      # Neither should this...
|   `-- profile_default
|       |-- db
|       |-- log
|       |-- pid
|       |-- security
|       `-- startup
|           `-- README
...

@minrk
Copy link
Member

minrk commented May 6, 2021

Will have to investigate exactly what's the cause, but my guess sis that something is following IPython's default initialization machinery before the ipython-dir cli option is handled. Does it work if you set the IPYTHONDIR env instead of the command-line arg?

The separate temp directories are presumably the same thing - something is not getting passed the ipython-dir option and/or getting it after some initialization step has already done what it was going to do.

The temp directory is presumably this logic in get_ipython_dir(), which would fire if get_ipython_dir() is ever called. My guess is it's in one or more places for defaults, and maybe called even if not ultimately used. I think if we used the ipython-dir cli arg to set IPYTHONDIR env as soon as possible, it might be fixed.

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

No branches or pull requests

2 participants