alan-turing-institute / AIrsenal

Machine learning Fantasy Premier League team
MIT License
296 stars 86 forks source link

Running AIrsenal with nohup but still getting some output in terminal #690

Closed Zonkil9 closed 2 months ago

Zonkil9 commented 3 months ago

I ran the following script:

nohup airsenal_update_db >> file.out &
nohup airsenal_run_prediction --weeks_ahead 3 >> file.out &
nohup airsenal_run_optimization --weeks_ahead 3 >>  file.out &

A few moments later, progress bars appeared on my screen, which interrupted other things I was doing.

sample: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1500/1500 [00:07<00:00, 212.08it/s, 63 steps of size 5.13e-02. acc. prob=0.91]

and:

Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 21/21 [01:43<00:00,  4.94s/it]
  0%|                                                                                                                                                                                      | 0/100 [01:43<?, ?it/s]
strategy: 2-1-2: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉| 99.99999999999976/100 [01:43<00:00,  1.04s/it]
  0%|                                                                                                                                                                                      | 0/100 [01:43<?, ?it/s]
  0%|                                                                                                                                                                                      | 0/100 [01:43<?, ?it/s]
  0%|                                                                                                                                                                                      | 0/100 [01:46<?, ?it/s]
  0%|                                                                                                                                                                                      | 0/100 [01:46<?, ?it/s]
  0%|                                                                                                                                                                                      | 0/100 [01:47<?, ?it/s]
Total progress:   5%|███████▌                                                                                                                                                      | 1/21 [01:48<36:18, 108.93s/it]

Shouldn't all contents of the output be redirected to file.out? Everything else besides progress bars is redirected to file.out as intended.

jack89roberts commented 3 months ago

I didn't see this myself in a quick test but this is to do with the behaviour of tqdm. These might be helpful: https://github.com/tqdm/tqdm/issues/506 (suggests piping stderr to /dev/null), or https://stackoverflow.com/questions/37091673/silence-tqdms-output-while-running-tests-or-running-the-code-via-cron (suggests using TQDM_DISABLE).

Zonkil9 commented 2 months ago

I decided to use the second solution and executed this line before the script:

export TQDM_DISABLE=1

Now everything is computing in the background. Thank you.