Re: Python loop and web server (bottle) in the same script (Posting On Python-List Prohibited)

2017-11-29 Thread zljubisic
Processing is I/O and CPU bound. :(
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python loop and web server (bottle) in the same script (Posting On Python-List Prohibited)

2017-11-24 Thread Gregory Ewing

Lawrence D’Oliveiro wrote:

I naturally concluded that you didn’t care about
updates being momentarily held up by a web request in progress--which would
happen anyway if you used threads, at least with CPython.


Not necessarily -- the web processing is probably I/O bound,
in which case the GIL will likely be released a lot of the time.

But if you want to be sure the GIL won't get in the way,
you would need to run the web and update tasks in separate
processes.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python loop and web server (bottle) in the same script (Posting On Python-List Prohibited)

2017-11-24 Thread zljubisic
That's right. Update task has precedence.
Looks like it is not an easy task.

Regards.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python loop and web server (bottle) in the same script (Posting On Python-List Prohibited)

2017-11-24 Thread Gregory Ewing

Lawrence D’Oliveiro wrote:

On Friday, November 24, 2017 at 3:27:17 AM UTC+13, zlju...@gmail.com wrote:


Looks like I need some sort of parallelization.


This is why coroutines were added to Python. Threading is notoriously 
bug-prone, and is best avoided in most situations.


The OP claimed that the timing of the update task is critical,
and needs to take priority over serving web pages. Coroutines
won't be able to achieve that.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list