#4785 (Optimize use_linod when supervisor not running)
by Luc Saffre · in Developers · assigned to Sharif Mehedi
Kokkuvõte
Children
Kommentaarid
- 3 aastat, 5 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : We closed it because this is basically done.
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : On [url gitlab.com/lino-framework/book/-/jobs/3660492295 Gitlab] the book test suite currently fails because 1 second is not enough.
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : Oops, now it's failing each time:
$ go noi1e & pm test Traceback (most recent call last): File "/home/luc/work/book/lino_book/projects/noi1e/manage.py", line 9, in <module> execute_from_command_line(sys.argv) File "/home/luc/work/lino/lino/core/management/__init__.py", line 132, in execute_from... - 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : I did some rewrites. @luc please test out the changes. I am putting this ticket to ready for now. Let me know after you test it out.
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : Note also #4783, which is related. The async consumer will loop over the system.Task objects and execute them.
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : Everything seems to work fine on my end. @luc Are you sure you pulled everything?
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : But when I do "go noi1e" and then "pm prep", I get:
$ pm prep Initializing worker process ... Traceback (most recent call last): File "/home/luc/work/lino/lino/core/management/__init__.py", line 41, in get_socket sock.connect(sock_file) FileNotFoundError: [Errno 2] No such file or directory
Dur... - 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : Inv prep test goes well without complaining. I think we can close this ticket now. I am putting it to ready.
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : I've pushed some other changes. This should work without trouble. Check it out.
- 3 aastat, 9 kuud ago by Sharif Mehedi in reply to Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : We can probably get rid of psutil and use os.kill or something, I will look into it.
- 3 aastat, 9 kuud ago by Luc Saffre in reply to Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : Yes, understandable. This has happened multiple times to me before...
- 3 aastat, 9 kuud ago by Sharif Mehedi in reply to Luc Saffre about #4785 (Optimize use_linod when supervisor not running) (1 reply) : I had psutil already installed. I thought it's one of the stdlib(s).
- 3 aastat, 9 kuud ago by Sharif Mehedi in reply to Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : This is not a major problem, I have a solution for this already.
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) (1 reply) : A more blocking bug: running "pm prep" in demo project ""watch" raises django.core.exceptions.ImproperlyConfigured: Requested setting SITE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) (2 replies) : There is a bug :-) ModuleNotFoundError: No module named 'psutil'. (no need to hurry, I'll install it manually.
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : inv prep fails on book.
- 3 aastat, 9 kuud ago by Luc Saffre in reply to Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : Cool! Looking forward to testing it asap. Did you run the book test suite? It has at least one unrelated failure waiting for you.
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) (1 reply) : with this, it can run without sudo and also it creates one worker process if there are multiple simultaneous dev command. When the last dev command exits, the worker process also exits.
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : @luc , check out this [url gitlab.com/lino-framework/lino/-/commit/792b87e6e10d2d650d2492d458617ad3ad5409fd implementation] .
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : There's a work around that came to my head is that, we have the names of the channels workers written in lino.ini file. We simply have to check if the socket file exists, and if so, then we can gather the channels worker names using getlino, and check if a name exists for the current site/project.
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) (1 reply) : Do we still support the case CHANNELS_TWO? I have a feeling that we can remove this code.
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : A side effect is that manage.py now needs sudo password. Can't you verify whether the socket file exists? Or more precisely add a "ping" request to the linod server and when this ping answers, then we start a non-root linod server.
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : We should probably have a list of dev commands in which case manage.py should simply run a linod consumer without checking the supervisorctl status
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : This is how the socket file looks like by default. only the root user has rwx permissions. Without root permission it (or otherwise modifying the supervisor socket file permission) it is not possible to talk to the supervisor process.
(env) blurry:>$ ll /var/run/supervisor.sock srwx------ 1 root roo... - 3 aastat, 9 kuud ago by Luc Saffre in reply to Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : Wow, great work! But i am convinced that there is another way than calling sudo supervisorctl status
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) (1 reply) : Here is the [url gitlab.com/lino-framework/lino/-/commit/a1bfcc76f4364c0f4b209801809d95e8b22bd705 code] if anyone would like to review.
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : manage.py now checks for use_linod and corresponding supervisor process, if one NOT found then it runs a linod and then runs the original command.
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : I am currently writing a lino.core.management.execute_from_command_line
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : I looked at the django code and it should not be very difficult.
- 3 aastat, 9 kuud ago by Sharif Mehedi about #4785 (Optimize use_linod when supervisor not running) : The first thing that came to my mind is that, customizing the manage.py, so instead of using django.core.management.execute_from_command_line we extend it and do pre and post work around it.
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : Idea is that when I go to noi1e on my machine, use_linod is True and I run some manual pm command while no supervisor running, the pm command should initiate the consumer. And probably stop it when it finishes.
- 3 aastat, 9 kuud ago by Luc Saffre about #4785 (Optimize use_linod when supervisor not running) : Created new Ticket #4785 (⚹ Optimize use_linod when supervisor not running).