Hi,
I am new into this world, so please accept my apologies if my question is dumb. I have a dash app set up on pythonAnywhere. The app has to do a lot of processing on the dataset when it starts - which is alright as long as it stays "on".
Today I visited the app after a day without any visit, but the page took more than 1 min to load, and I can see in the server log that it had to do all the data processing again, meaning that the python script ran again when I accessed the page.
Why isn't my app staying active ? I don't want to have to wait for the python script to be executed to be able to visit the website after some time without any visit.
Here is the log for my connection this afternoon :
2022-11-22 08:35:55 announcing my loyalty to the Emperor...
2022-11-23 10:36:03 workers have been inactive for more than 93600 seconds (1669199757-1669106156)
2022-11-23 10:36:03 cheap mode enabled: waiting for socket connection...
2022-11-23 13:48:20 *** Starting uWSGI 2.0.20 (64bit) on [Wed Nov 23 13:46:21 2022] ***
2022-11-23 13:48:20 compiled with version: 9.4.0 on 22 July 2022 18:35:26
2022-11-23 13:48:20 os: Linux-5.15.0-1015-aws #19~20.04.1-Ubuntu SMP Wed Jun 22 19:07:51 UTC 2022
2022-11-23 13:48:20 nodename: blue-euweb2
2022-11-23 13:48:20 machine: x86_64
2022-11-23 13:48:20 clock source: unix
2022-11-23 13:48:20 pcre jit disabled
2022-11-23 13:48:20 detected number of CPU cores: 4
2022-11-23 13:48:20 current working directory: /home/albanpuech
2022-11-23 13:48:20 detected binary path: /usr/local/bin/uwsgi
2022-11-23 13:48:20 *** dumping internal routing table ***
2022-11-23 13:48:20 [rule: 0] subject: path_info regexp: \.svgz$ action: addheader:Content-Encoding:gzip
2022-11-23 13:48:20 *** end of the internal routing table ***
2022-11-23 13:48:20 chdir() to /home/albanpuech/
2022-11-23 13:48:20 your processes number limit is 256
2022-11-23 13:48:20 your memory page size is 4096 bytes
2022-11-23 13:48:20 detected max file descriptor number: 123456
2022-11-23 13:48:20 building mime-types dictionary from file /etc/mime.types...
2022-11-23 13:48:20 567 entry found
2022-11-23 13:48:20 lock engine: pthread robust mutexes
2022-11-23 13:48:20 thunder lock: disabled (you can enable it with --thunder-lock)
2022-11-23 13:48:20 uwsgi socket 0 bound to UNIX address /var/sockets/albanpuech.eu.pythonanywhere.com/socket fd 3
2022-11-23 13:48:20 Python version: 3.10.5 (main, Jul 22 2022, 17:09:35) [GCC 9.4.0]
2022-11-23 13:48:20 PEP 405 virtualenv detected: /home/albanpuech/.virtualenvs/dashappenv/
2022-11-23 13:48:20 Set PythonHome to /home/albanpuech/.virtualenvs/dashappenv/
2022-11-23 13:48:20 *** Python threads support is disabled. You can enable it with --enable-threads ***
2022-11-23 13:48:20 Python main interpreter initialized at 0x55cb62db8e70
2022-11-23 13:48:20 your server socket listen backlog is limited to 100 connections
2022-11-23 13:48:20 your mercy for graceful operations on workers is 60 seconds
2022-11-23 13:48:20 setting request body buffering size to 65536 bytes
2022-11-23 13:48:20 mapped 501384 bytes (489 KB) for 2 cores
2022-11-23 13:48:20 *** Operational MODE: preforking ***
2022-11-23 13:48:20 initialized 54 metrics
2022-11-23 13:48:20 /home/albanpuech/dashboard.py:73: FutureWarning: The default value of numeric_only in DataFrameGroupBy.mean is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function.#012 df_daily_cp = df_daily_cp[["country", "day", "capacity_factor", "timestamp"]].groupby(["country", "timestamp"]).mean().reset_index()
2022-11-23 13:48:20 /home/albanpuech/dashboard.py:81: FutureWarning: The default value of numeric_only in DataFrameGroupBy.mean is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function.#012 daily_cp_eu = df_daily_cp.groupby("timestamp").mean().reset_index()
2022-11-23 13:48:20 WSGI app 0 (mountpoint='') ready in 118 seconds on interpreter 0x55cb62db8e70 pid: 1 (default app)
2022-11-23 13:48:20 *** uWSGI is running in multiple interpreter mode ***
2022-11-23 13:48:20 gracefully (RE)spawned uWSGI master process (pid: 1)
2022-11-23 13:48:20 spawned uWSGI worker 1 (pid: 5, cores: 1)
2022-11-23 13:48:20 spawned 2 offload threads for uWSGI worker 1
2022-11-23 13:48:20 spawned uWSGI worker 2 (pid: 8, cores: 1)
2022-11-23 13:48:20 metrics collector thread started
2022-11-23 13:48:20 spawned 2 offload threads for uWSGI worker 2
2022-11-23 13:48:21 Wed Nov 23 13:48:21 2022 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request / (ip 10.0.0.49) !!!
2022-11-23 13:48:21 Wed Nov 23 13:48:21 2022 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 306] during GET / (10.0.0.49)
2022-11-23 13:48:21 announcing my loyalty to the Emperor...
2022-11-23 13:48:21 Wed Nov 23 13:48:21 2022 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request / (ip 10.0.0.49) !!!
2022-11-23 13:48:21 Wed Nov 23 13:48:21 2022 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 306] during GET / (10.0.0.49)
2022-11-23 13:48:21 announcing my loyalty to the Emperor...
Can you please help me to make sure that the app always stays active and that I don't need to wait for it to load when I visit the page after a period of inactivity ?
Thank you very much in advance.
Alban