Il giorno 29/ago/2012, alle ore 06:10, [email protected] ha scritto:

> Hello uWSGI,
> 
>  I'am  trying to read file in async mode, and getting some errors. do
>  I do something wrong?
> 
>  fp = open('somefile', 'a')
>  uwsgi.wait_fd_write(fp.fileno(), 1)
>  uwsgi.suspend()
>  fp.write(msg+'\n')
> 
>  uwsgi.wait_fd_write(fp.fileno(), 1)
>  uwsgi.suspend()
>  fp.flush()
> 
> #  some other code
> 
>  fp.close()
> 
> 
> also should I suspend before flush() and close() ?
> 
> P.S.: errors I'am getting now are
> 
> epoll_ctl(): Operation not permitted [event.c line 244]
> epoll_ctl(): Operation not permitted [event.c line 228]
> 
> ugreen/async mode
> 
> _

Hi, non-blocking i/o on disks is practically non-existent, you will always get 
readyness even if the operation will block.

The 'correct' approach (on linux) would be using the io_submit infrastructure 
(or the aio_ posix functions) but currently
there is no support in uWSGI (nor in the other common python libraries).

Currently you could try to offload files read/writes to a thread (this is what 
node.js for example, does)

--
Roberto De Ioris
http://unbit.it
JID: [email protected]

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to