IRC Logs for #circuits Sunday, 2013-10-27

*** koobs` has joined #circuits01:00
*** koobs has quit IRC01:08
An_Ony_Moosebut they can run concurrently right?05:48
spaceonehmm, no?!06:17
spaceoneafaik not06:17
*** ircnotifier__ has quit IRC06:19
*** ircnotifier__ has joined #circuits06:21
prologicAn_Ony_Moose, no06:24
prologiccircuits is not a concurrent framework06:24
prologicit's more a component framework06:24
prologicwith powerful message passing06:24
prologicyou can only achieve concurrency by using multi-threading or multi-processing06:24
prologiceven then Python's multi-threading is not concurrent06:24
prologicthere are various Async I/O components in circutis06:25
prologicand the message passing is all async as well06:25
prologicbut no 2 events ever run concurrently06:25
*** ninkotech has joined #circuits06:25
prologichttps://pypi.python.org/pypi/mio-lang/0.0.406:33
An_Ony_Mooseoh ok06:33
An_Ony_Moosebut it could theoretically be made concurrent with a little C, couldn't it?06:34
An_Ony_Moosewell, "a little"07:06
An_Ony_Moose:P07:06
prologicwell08:43
prologicconcurreny is a difficult problem08:43
prologicyou can only truly get concurrent if you have multiple cpus or cpu cores08:43
prologicand separate os level threads08:43
prologicPython with it's GIL doesn't cater for this very well08:44
prologicwhich is why multiprocessing library exists08:44
prologicnow circuits _can_08:44
prologicutilize the multiprocessing library08:44
prologicand provides a Worker component08:44
prologicwhich you can use to fire Task events at08:44
prologicto compute CPU bound work08:44
prologicbut the rest of the framework is meant ot be async08:44
An_Ony_Moosehm ok.12:05
An_Ony_MooseAlso, what exactly happens when a handler yields (None)?12:06
prologicnothing afaik13:25
prologicthe handler's task should only finish when it sees StopIteration13:25
prologicif you yield inside a handler13:25
prologicor use call/wait13:25
prologicthe handler is turned into a coroutine13:26
prologicusing python generators13:26
An_Ony_Mooseand when does execution go back to ti?14:03
pdurbinprologic: ok on the Mio vs. mio thing19:06
pdurbinconfusing, but ok :)19:13
An_Ony_MooseOk, last question I think! Is there a way to insert a delay somewhere to avoid a circuits program from eating the CPU?20:13
*** FSX has quit IRC21:44
prologicAn_Ony_Moose, when it's seen the event you were after22:02
prologicNB:22:02
prologicwait wait for an event by name22:02
prologiccall is equivilent to22:02
prologicfire22:02
prologicthen wait22:02
prologicAn_Ony_Moose, yes22:02
prologicuse the dev branch :)22:02
prologicit has a default generate_events handler (event source)22:03
prologicwhereby if there are no other event sources in the system22:03
prologicit will sleep until something happens in the system22:03
prologici.e:22:03
prologica fire call was made22:03
An_Ony_Mooseprologic: but I have my own event source...22:06
prologicare you using generate_events?22:06
prologicif not then circuits default won't kick in22:06
prologicoh22:06
prologicand if you are22:06
prologicthen you need to handle the delay/sleep yourself22:06
prologicif your event source is eating too much CPU22:06
prologicthen you're looping too quickly22:07
prologicif you event source is trying to eat pygame events22:07
prologicyou should do something like this22:07
prologic@handler("generate_events")22:07
prologicdef _on_generate_events(...):22:07
prologic... rough pseduo code follows ...22:07
prologicif there are events to be procsssed22:07
prologicprocess them22:07
prologicand filter the event22:08
prologicif not22:08
prologiclet the generate_events pass to the deault22:08
prologichave a look at circuits/io/process.py22:09
prologicwhich is mostly correct22:09
prologicexcept for the filtering part22:09
prologicneeds to be22:09
prologicevent.stop()22:09
prologicnor return True22:09
An_Ony_Mooseummm22:09
ircnotifier__cc51531fe570 by prologic: Fixed event filtering in circuits.io.Process's generate_events handler22:10
An_Ony_Moosehttps://gist.github.com/Anonymooseable/c2dcbfda290857674cd722:10
An_Ony_Mooseor is poller != event source?22:11
prologicyes22:11
prologicthat will happen too quickly22:11
prologicyou need to check if there are any events22:11
prologicif there are, process them22:11
prologicand call event.stop()22:11
prologicif not, let it pass to the default22:11
prologicpollers are event sources yes22:11
prologiclook at how they work as well22:12
prologicthey all work the same way22:12
prologicso as not to eat CPU22:12
prologicgotta get ready for work22:12
prologicbbs22:12
An_Ony_Mooseok... thanks22:12
An_Ony_Moosesee you!22:12
An_Ony_MooseThanks for *all* the help you've given me22:12
An_Ony_MooseBeen very useful22:13
prologicnos22:31
prologici just hope we can nake circuits useful fir tou too,22:31
prologicAkso id love for tou to clntribute tour oygame component ;)22:32
prologicthe event source22:32
prologicnps22:32
*** FSX has joined #circuits23:45

Generated by irclog2html.py 2.11.0 by Marius Gedminas - find it at mg.pov.lt!