IRC Logs for #circuits Wednesday, 2013-12-18

*** litzomatic has quit IRC00:52
SXwhat do you mean "does not handle"?02:54
SXthe ticking of waitEvent stops as soon, as the event is done02:55
SXnot a tick after02:55
prologicyes that's true02:56
prologicsorry I lost context :)02:56
prologicwhat did I say? :)02:56
SXso if u set timeout>0 for call, _on_tick handler is removed right after the event is done02:56
SX<@prologic> it doesn't handle timeout > 002:57
SX<@prologic> SX, seems to be too many unwanted changes in your version02:58
SXwhat do you mean by unwanted?02:59
SXi'll check the diffs at work03:00
SX<@prologic> what editor are you using? :)03:00
prologicdo you use UNIX mode?03:03
prologicor CRLF/Windows mode?03:03
prologicjust that your version compared to what's in the repo had lots of whitespace changes :)03:03
prologicand we _have_ to make timeout > 0 work03:04
prologicotherwise it's pretty useless a parameter03:04
prologicI'll have another go tonight03:04
prologicand study your changes compared to mine more closely03:04
SXno no no, it works03:13
SXit's just the simple call of sinchronous event is done in one tick03:14
SXand in the next one manager processes the report task03:15
prologichang on03:17
SXi just eliminated the situation, where there's two tasks generated from waitEvent. first in _on_done and _on_tick03:17
prologicthe purpose of timeout is so you can say03:17
prologicwait for this event03:17
prologicand timeout after n cyclces03:17
prologicnot timeout immediately03:17
SXit waits for event to be done03:17
prologicwhat if it takes many cycles for an event to complete?03:17
SXnot the tick after that03:17
SXthen it works well03:17
SXi said it03:17
prologicso you can do03:18, timeout=10)?03:18
SXyour call with timeout >0 does not work simply because of it is done in one cycle03:18
prologicand call multiple03:18
prologicand they all work indepenently?03:18
SXI haven't changed the behavior that much, so yes03:19
prologicI'll do some testing toinght03:19
prologicand write a few unit tests for this03:19
prologicthe following test cases need to pass03:19, timeout=0)03:19, timeout=10)03:20
prologictwo or more simultaneous calls to
SXlike that? works well03:22
prologicif that works as expected03:22
prologicwrite a unit test for that03:23
prologicand send me a pull request with your changes :)03:23
SXthe only thing I did is handling of exception generator as a task, and generate an exception task in _on_tick()03:24
SXthen in processTask we check the type of task's value, and if it's an exception, throw it to parent03:24
SXif parent does not have a handler, then internal handler in processTask would catch it03:25
SXoh, and changed the behavior of waitEvent slightly, of course03:26
prologicconvert your sample to a unit test03:32
prologicand send me a pull request :)03:32
SXnot so fast =)03:41
SXi forgot to handle the return value of parent.throw()03:41
prologicin case the parent catches the excpetion03:43
prologicand returns something different?03:43
prologicrock on! :)03:43
*** clixxIO has joined #circuits04:16
clixxIOHi prologic04:18
clixxIOhave you had any thoughts on how to add gpio events?04:19
clixxIOactually, I don't think they would be any different than any other callback04:19
clixxIOjust that there are a few potential types04:20
clixxIOie Pin-rising, Pin-Lowering, data, adc data etc04:20
prologicif I were to do this myself04:20
prologicI was hoping you would :)04:20
prologicI'd just wrap some existing gpio python library04:20
prologicand write the necessary bits and pieces to make it async04:21
clixxIOthat would be necessary04:21
prologiccircuits has very powerful (fixed an edge case last night) synchronization and messaging semantics and primitives :)04:21
clixxIObut portions of the events can be themselves generic04:21
prologicyeah that's fine04:21
prologicI'd wrap a pre-existing gpio library04:21
prologicjust like I've done with04:21
prologicto name two in the current circuits component library04:22
clixxIOit's decided :-)04:22
clixxIOI'm still learning/coming-to-grips with the framework04:23
clixxIOthat means perhaps using it in something unimportant like a day-job/production-environment04:24
clixxIOwell, I will check out your encapsulation of pyserial04:25
clixxIOoh btw, I have some errors running the examples04:26
clixxIOfrom import TCPServer, Write04:27
clixxIOImportError: cannot import name Write04:27
clixxIO  File "", line 12, in <module>04:27
prologicare you running 2.1.0 examples against dev? :)04:29
prologicevents in the circuits component library were changed in 3.004:30
prologicfrom class FooBarBaz(Event): --> @handler("foo_bar_baz")04:30
prologicwhich we discovered is/ws confusing for new users04:30
prologicto simply04:30
prologicclass foobarbaz(Event): --> @handler("foobarbaz")04:30
prologicso be sure you _are_ in fact using dev04:31
prologicand don't have a mix of dev and 2.1.0 :)04:31
prologicI'm 99.998% sure I fixed all examples in dev04:31
prologicthere is only one failing test at present04:31
clixxIOI'm quite sure I have only dev04:31
prologicthe error above would indicate otherwise04:31
prologicunless I missed an example!04:31
prologicwhich example btw?04:31
prologicmake sure if you're reading docs too04:32
prologicthat you're reading dev docs :)04:32
clixxIOexample is chatserver.py04:32
clixxIO~/circuits-dev/circuits/net$ grep TCPServer *.py04:37
clixxIOgives: TCPServer(Server):04:37
clixxIOand : TCP6Server(TCPServer):04:37
clixxIOmeaning TCPServer exists04:38
clixxIO~/circuits-dev/circuits/net$ grep Write *.py04:38
clixxIOgives only :            self._poller.addWriter(self, self._sock)04:38
clixxIOand there is no Writer class04:39
prologicyes ok04:41
prologicmy bad :)04:41
prologiclet me fix that example04:41
ircnotifier1 commit(s) pushed to circuits-dev04:42
ircnotifierb60a5f6a8525 by prologic: Fixed chatserver example04:42
clixxIObtw: import stdout, File, Write04:44 has the same problem04:45 import Close, Connect, Write04:46 also has the same problem04:46
prologicahh ffs :)04:48
prologicI'll go through and review them all tonight04:48 also references Close04:48
clixxIOImportError: cannot import name Close04:48
clixxIOno problem04:48
clixxIObtw, where is the encapsulation for pyserial?04:49
clixxIOif you can remember?04:53
clixxIOThanks for fixing that example. That was the only one that I was interested in04:54
clixxIOI just used grep to identify any other files that might have had the same problem04:54
clixxIOthank you04:55
ircnotifier1 commit(s) pushed to circuits-dev04:57
ircnotifier8e306bc86673 by prologic: Fixed cat and portforward examples04:57
clixxIOso I would imagine that a '' handler would sit inside the io directory05:06
clixxIOI'm wondering, is there an example for serial? ie pyserial? or serial port encapsulation?05:09
prologicgood place I think :)05:20
prologicexample of
prologicafaird not :/05:20
prologica) I have no serial ports on anything remotely useful at home05:20
prologicb) it's bloody difficult to unit tests without mocking out the pyserial part05:21
prologicbe nice to fix both issues :)05:21
clixxIOa is not essential, but it would be nice. Yes I know what you mean about the tests05:24
clixxIOwith the gpio, it might be possible just to extend - ie there's just a few more events05:25
clixxIOor better to define them seperately in
clixxIOI wouldn't want to write any new generic gpio handler - but it would only make sense to use existing platform (python) modules05:26
prologicyeah you could create a sub-acpagek05:27
prologicin circuits/io/gpio/05:27
clixxIOthis page has an example of typical gpio on the rasbpi :
clixxIObut it looks so -horrible- compared to your code05:29
clixxIOI hope Phil isn't online here atm05:29
clixxIOThe events that are needed are basically - PinRise, PinFall, PinChange05:34
clixxIOthen as a parameter, the Pin #05:35
clixxIOthis would be universal to all platforms05:35
clixxIOOn the raspberry-pi and others, there are then user-choosable modules for a user to choose how they want to read/write to the pins05:37
clixxIObut I suggest not to encapsulate those05:38
clixxIOtime to go home05:48
prologicyeah me too soon05:48
prologicyour design you describe brave sounds perfect05:48
prologicI like it :)05:48
prologicwhy don't you starts writing the package already ?05:48
prologicand at least :)05:48
clixxIOI am happy to help do it05:48
prologiclay it out :)05:49
clixxIOok - I will soon, maybe tomorow05:49
prologicyou're the one with the hw to test05:49
prologicI wouldn't be much good here :/05:49
prologichave fun!05:49
clixxIOyou have the gpio, you probably don't know how to use it05:49
clixxIOevery hdmi port has enough, so does usb05:50
clixxIObut anyway, tomorow I will try do some05:50
*** clixxIO has quit IRC05:50
*** SimpleX91 has joined #circuits05:51
prologicg'night :)06:08
prologichey SimpleX9106:08
SimpleX91I have some code duplication here06:10
SimpleX91the problem is, I can't just create a task with the generator I got from gen.throw()06:11
SimpleX91I should process it and extract task info06:11
SimpleX91                    if isinstance(value, GeneratorType):06:13
SimpleX91                        task_state = next(value)06:13
SimpleX91                        task_state['task_event'] = event06:13
SimpleX91                        task_state['task'] = value06:13
SimpleX91                        task_state['parent'] = parent06:13
prologicjust do it :)06:45
prologicwe'll refactor the duplicate code later06:45
prologicthere are tools to analyze code to detect dupliacates06:46
prologicand complexity06:46
*** Osso has quit IRC07:51
prologicSX, hey :)08:49
prologicsaw you in #circuits-dev for the moment08:49
prologicnot too heavily in use that channel these days08:50
prologicoh well :)08:50
SimpleX91I think it's done (timeout exception)11:19
prologicoh awesome :)11:24
prologicsend me a pull request11:24
prologicor I'll give you write access to the dev repo :)11:24
prologicsorry very tired tonight11:25
prologic2x 2am late nights :/11:25
SimpleX91to make a pull request should I fork the repo?11:36
prologicfork on bb or github11:54
prologicmake your changes, commit, push11:54
prologicsubmit pull request11:54
prologicNB: haven't tried github sycning yet11:54
prologicthe repos are primarily maintained on bitbucket11:54
prologicbut I do mirror them to github11:54
ircnotifier1 commit(s) pushed to circuits-dev13:05
ircnotifierac3d646ec8df by SimpleX: Implement an internal exception raising and handling in manager for call/wait events13:05
*** SimpleX91 has quit IRC13:22
*** litzomatic has joined #circuits19:49
litzomaticHey guys.  I'm still having trouble getting a Worker to work with Server.  The request is hanging.20:03
litzomaticHere is the debug output:20:06
litzomatic        <_read[web] (<socket.socket object, fd=24, family=2, type=1, proto=0> )>20:06
litzomatic        <read[web] (<socket.socket object, fd=24, family=2, type=1, proto=0>, b'GET /sleep_worker HTTP/1.1\r\nHost: localhost:9000\r\nConnection: keep-alive\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36\r\nAccept-Encoding: gzip,deflate,sdch\r\nAccept-Language: en-20:06
litzomaticUS,en;q=0.8\r\n\r\n' )>20:06
litzomatic        <request[web] (<Request GET /sleep_worker HTTP/1.1>, <Response 200 OK None (0)> )>20:06
litzomatic        <sleep_worker[/] (<Request GET /sleep_worker HTTP/1.1>, <Response 200 OK None (0)> )>20:06
litzomatic        <request_success[web] (<request[web] (<Request GET /sleep_worker HTTP/1.1>, <Response 200 OK None (0)> )>, None )>20:06
litzomatic        <request_complete[web] (<request[web] (<Request GET /sleep_worker HTTP/1.1>, <Response 200 OK None (0)> )>, None )>20:06
litzomatic        <_read[web] (<socket.socket object, fd=23, family=2, type=1, proto=0> )>20:06
litzomatic        <disconnect[web] (<socket.socket object, fd=23, family=2, type=1, proto=0> )>20:06
litzomatic        <task[worker] (<function complicated_task at 0x100c894d0> )>20:06
litzomatic        <task_done[worker] (None )>20:06
litzomatic        <task_success[worker] (<task[worker] (<function complicated_task at 0x100c894d0> )>, None )>20:06
litzomatic        <request_value_changed[<Dispatcher/web 3775:MainThread (queued=0) [S]>] (<Value () result: False errors: False for <request[web] (<Request GET /sleep_worker HTTP/1.1>, <Response 200 OK None (0)> )> )>20:06
*** litzomatic has quit IRC20:38
*** litzomatic has joined #circuits20:39
*** litzomatic has quit IRC20:43
prologicSX, I found a bug:
prologicSample code:
*** litzomatic has joined #circuits21:34
*** litzomatic has quit IRC21:41
*** litzomatic has joined #circuits22:30
*** litzomatic has quit IRC22:41
*** clixxIO_ has joined #circuits23:19
*** litzomatic has joined #circuits23:31
*** litzomatic has quit IRC23:44

Generated by 2.11.0 by Marius Gedminas - find it at!