XENONnT / env_starter

Script to start the XENONnT environment and jupyter server jobs on dali/midway
1 stars 5 forks source link

Permission issue with file deletion within Jupyter environment on dali #45

Open basderonde opened 8 months ago

basderonde commented 8 months ago

Deleting a file from within the Jupyter environment can give a permission error, under certain conditions. The error is as follows: error

This happens both for deleting newly created files as well as existing files. I have checked the permissions of these files from the command line when I am logged into dali. I can delete files directly from the terminal.

I start the Jupyter environment by calling the "start_jupyter.py" script on the dali cluster. I am using the latest version from the master branch. I am calling the script from within my own folder on dali (/dali/lgrandi/bderonde) with the following command:

_python3 /dali/lgrandi/bderonde/env_starter/start_jupyter.py --tag 2023.11.1 --partition dali --cpu 6 --ram 45000 --excludenode dali001

Using the stable env_starter branch located in "/project2/lgrandi/xenonnt/development/env_starter/start_jupyter.py" gives the same problem.

Supposedly, the issue arises from the fact that the Jupyter environment tries to move a file to the dali trash folder, which I don't have permission to, rather than actually deleting the file. A similar issue is discussed here: (https://github.com/jupyter-server/jupyter_server/issues/1338).

A solution to the problem was suggested on the linked github page as well: adding the "--FileContentsManager.delete_to_trash=False" option to the line of code that calls Jupyter changes the behaviour of Jupyter, where files are now directly deleted instead of moved to a trash folder. This line of code is in the "start_notebook_dali.sh" shell script; the suggested change is highlighted in the picture below:

suggested_change

I tested this solution myself on a local copy of the scripts and this resolved the issue.

yuema137 commented 4 months ago

Is it still an issue in the current master branch? I cannot reproduce it at least

basderonde commented 4 months ago

Is it still an issue in the current master branch? I cannot reproduce it at least

It is! I just tested it with the latest version

yuema137 commented 4 months ago

Hi, @basderonde. Thanks for spotting and providing a solution! However, after debugging for a while, I found that there is an issue within the Jupyterlab configuration regarding access to file systems. If you use VSCode to connect to the server, or rm on your console, it should be fine. As this issue also affects file creation, I will hold off on implementing the delete_to_trash trick until I understand it better. In general, I would suggest using VSCode for better access management.