![]() ![]() ![]() Instead, I believe what you are looking for is simply something akin to the following example: # Random SLURM_JOBID valueĮxport SLURM_JOBID=$(python3 -c "import random print(random.randint(0, 1_000_000))") the command will have to complete until your prompt is returned to you. Using will not work either as that is simply a command separator, i.e. You cannot use wait in this particular way, as wait requires parent-child relationship between processes. Related: How does one authenticate with a command that requires your password in linux? But that is just to add context to the final part of my script. Instead what I want is to run that wait command inside of tmux (to not block me) and once the python script is done to kill the tmux session entirely. command outside of tmux and block my main terminal. I think it won't work because once it runs tmux detach & it will go out of the tmux session and run the wait. I tried that at the end but I suspect it won't work. "īut the above won't work because: once the python script is running and been dispatched with &, what I want is to kill the tmux session when that job is done. # - wait for pid from python to be done, if done kill this tmux sessĮcho "Done with bash script (experiment or dispatched daemon experiments). Python -u ~/diversity-for-predictive-success-of-meta-learning/div_src/diversity_src/experiment_mains/main_sl_with_ddp.py -manual_loads_name sl_hdb1_5cnn_adam_cl_filter_size -filter_size 4 > $OUT_FILE 2> $ERR_FILE & # echo 'totally secret password' | kinit to see reauth running # echo 'Secret' | /afs/cs/software/bin/reauth # /afs/cs/software/bin/krbtmux new -s $SLURM_JOBIDĮcho $SU_PASSWORD | /afs/cs/software/bin/reauth # - CAREFUL, if a job is already running it could do damage to it, rm reauth process, qian doesn't do it so skip it This is my full attempt: # - get a job id for this tmux sessionĮxport SLURM_JOBID=$(python -c "import random print(random.randint(0, 1_000_000))")Įxport OUT_FILE=$PWD/main.sh.o$SLURM_JOBIDĮxport ERR_FILE=$PWD/main.sh.e$SLURM_JOBID My main issue right now is that I want to kill the tmux session once my real python script running in the background is done. My attempt is here (and it has several issues as outlined the beginning of it won't work but it's a seperate question, this question is about the last part of the script). I am trying to "re-implement" nohup inside of tmux (so dispatching a job without blocking me and then killing the tmux command acting as nohup). ![]()
0 Comments
Leave a Reply. |