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

run_get_good_pae.sh, pdb_analyser.py :: /tmp/root usage #469

Open
EricDeveaud opened this issue Nov 27, 2024 · 3 comments
Open

run_get_good_pae.sh, pdb_analyser.py :: /tmp/root usage #469

EricDeveaud opened this issue Nov 27, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@EricDeveaud
Copy link

EricDeveaud commented Nov 27, 2024

Hello,

as far as I understand hard coded /tmp/root is generated but not used by this 2 tools

run_get_good_pae.sh does create, chmod and later rm it

pdb_analyser.py called by get_good_inter_pae.py lanched by run_get_good_pae.sh does create it but does not use it.

            with tempfile.TemporaryDirectory() as temp_dir:
                # Use temp_dir for temporary storage
                # Set environment variables
                env = os.environ.copy()
                env["TMPDIR"] = temp_dir
                env["PISA_TMPDIR"] = temp_dir
                env["PISA_SESSIONDIR"] = temp_dir
                env["SC_TMPDIR"] = temp_dir
                env["SC_SESSIONDIR"] = temp_dir
                env["HOME"] = temp_dir  # Some utilities may use HOME
                # Ensure /tmp/root exists and is writable (alternative to setting envs)
                os.makedirs('/tmp/root', exist_ok=True)
                os.chmod('/tmp/root', 0o777)

and latter only temp_dir is used

My fear is when we have some concurent jobs that runs one same host with host /tmpavailable on the container to have conflicts//race conditions.

is /tmp/root still necessary as CPP4 was removed ?

regards

Eric

@DimaMolod
Copy link
Collaborator

Hi Eric and thanks for your question!
That's right, /tmp/root is not used by run_get_good_pae.py and pdb_analyser.py, but it's used by CCP4 (and potentially by piscore_wc.py for older AP versions). You are also right that we removed CCP4, but it's still possible to install it into the singularity container and get related scores, where the path is hardcoded...therefore I don't see how we can get around /tmp/root.
Have you already stumbled upon the issue you described, when there are many conflicting jobs accessing the same /tmp/? I think singularity containers are not writable by default and I set up env variables in a way that they use unique external temp directories, but can't remember for sure.

Cheers,
Dima

@EricDeveaud
Copy link
Author

thanks for the fast answer.

as we don't have yet installed AlphaPulldown/2.0.1 we did not face the problem. ;-)
it was just me giving a look at the code that came accross this potential problem.

I must admit that I don't know what is cpp4 nor how it works. sorry for that
is /tmp/root used for scratch files generated by ccpa
if yes a quick google search leads me to

# CCP4_SCR: a per-user directory for run-time-generated scratch files.
export CCP4_SCR="/tmp/`whoami | tr ' \\\\' _`"
``

will reduce the collision risk, but still be race condition risky 

after some grep in alphapulldown code. 

let me know if I understood correctly.
cpp4 need a directory that can be referenced via `CCP4_SCR` 
python code that use ccp4 needs to know this value. for the shake of comodity you set it to `/tmp/root`
problem is how to dynamicaly tell cpp4 AND python the value of `CCP4_SCR`
right ? 

what about settings CPP4_SCR env var in `pdb_analyser.py` eg: `env["CCP4_SCR"] = temp_dir`

again ccp4 is unknown to me. sorry if the above sugestion sound dumb ;-)

regards

Eric

@truatpasteurdotfr
Copy link

I would just use something like:

export CCP4_SCR=`mktemp -d`

to avoir the race condition issue, ymmv.

@jkosinski jkosinski added the enhancement New feature or request label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants