IRC Logs for #circuits Friday, 2015-05-29

*** my_chiguai has joined #circuits00:01
prologichttps://gist.github.com/prologic/f95e2fe451b5a8eccfa901:19
*** robert_ has quit IRC01:37
prologichttps://github.com/circuits/circuits/pull/6202:13
*** robert_ has joined #circuits02:28
*** robert_ has quit IRC02:28
*** robert_ has joined #circuits02:28
prologichi robert_02:34
y0noHi prologic, spaceone o/06:05
prologichi y0no06:05
y0nonice commits on async_sleep branch :)06:22
prologichaha06:22
prologicyou like? :)06:22
prologicI have an issue now though06:22
prologicperhaps you could look in to it?06:22
prologicwhere tests/core/test_coroutine.py fails randomly it seems06:22
prologicwell if you do find . -type f -name "*.pyc" -delete06:22
prologicthen re-tun the test it passes06:22
prologicrun it a 2nd time and it fails06:22
prologicwtf06:22
y0nocurrently when i launch the tests on my machine every test seems to fail... It's strange, I have not this problem on my VM...06:24
y0noI will take a look on your test to see if I can find a solution =)06:25
*** my_chiguai has quit IRC07:16
*** pdurbin has quit IRC07:44
*** pdurbin has joined #circuits07:44
*** ninkotech__ has joined #circuits07:55
prologicy0no, are you testing in a virtualenv?08:19
prologicYou should be using a virtualenv if you're not08:19
y0noprologic, yep I'm on virtualenv, I have found what was the problem. I currently work on fix some test. It seems to be really few things08:20
prologickk08:44
prologicgood o :)08:44
prologicthey all pass here08:44
prologicbut yeah we need to get all tests passing on Travis CI going forward08:44
prologicand defiantely before we release :)08:44
prologicwe're 99.98% there :)08:44
y0nothe stop() method don't seems to pass test here08:46
y0noI have to put "with pytest.raises(SystemExit):" on top of each stop08:47
y0noprologic, not you ?08:51
spaceoney0no: did you see that last commit of prologic08:52
spaceone?08:52
spaceoneit adds except SystemExit: pass to the pytest-manager08:52
y0nospaceone, don't seems to work here08:53
spaceoneokay, then i don't know ;)08:54
y0noprologic, spaceone: for example: http://pastebin.com/Rr1e2KMM08:55
prologicy0no, ahh yeah no wait :)09:02
prologicI have a fix for that09:02
prologicI'll commit it shortly09:02
y0nookay nice09:02
y0noumask(077) seems to don't be compatible with python309:03
prologicactually I already committed that fix to master09:03
prologicdoes it now work for you?09:03
prologicy0no, ahh re umask; got a pr?09:03
y0noa pr ?09:03
prologicpull request09:04
prologicahh09:04
prologicwe *do* have some tests that aren't in the new style manager, watcher fixtures09:04
prologicand so have a m.stop()09:04
y0noprologic, yep09:04
prologicyeah09:04
prologicspaceone, can we do something like09:04
prologicdef stop(code=None):09:04
prologicif code is not None:09:05
prologic    raise SystemExit(code)09:05
prologic?09:05
prologicso that .stop() behaves as it did before09:05
prologicbut can also take an exist code bubbled up09:05
prologicor "string" as you say09:05
y0noprologic, why don't use:09:07
y0nowith pytest.raises(SystemExit):09:07
y0no            m.stop()09:07
y0noon test ?09:07
prologicwell we could09:09
prologicbut I'd rather fix the broken behaviour09:09
prologicbecause of this:09:10
spaceoneprologic: probably yes09:10
prologic(circuits)09:10
prologicprologic@daisy09:10
prologicFri May 29 19:13:5809:10
prologic~/circuits09:10
prologic$ python09:10
prologicPython 2.7.9 (default, Mar 19 2015, 22:32:11)09:10
prologic[GCC 4.8.4] on linux209:10
prologicType "help", "copyright", "credits" or "license" for more information.09:10
prologic>>> from circuits import Manager, Debugger, Event09:11
prologic>>> m = Manager() + Debugger()09:11
prologic>>> m.start()09:11
prologic<registered[*] (<Debugger/* 3182:Manager (queued=0) [S]>, <Manager/ 3182:Manager (queued=2) [R]> )>(<Thread(Manager, started daemon 139947644393216)>, None)09:11
prologic>>> <started[*] (<Manager/ 3182:Manager (queued=1) [R]> )>09:11
prologic>>> e = m.fire(Event.create("foo"))09:11
prologic>>> <foo[*] ( )>09:11
prologic>>> e09:11
prologic<Value () result: False errors: False for <foo[*] ( )>09:11
prologic>>> m.stop()09:11
prologic(circuits)09:11
prologicprologic@daisy09:11
prologicFri May 29 19:14:2109:11
prologic~/circuits09:11
prologic$09:11
prologicWe broke existing behaviour here09:11
prologicm.stop( should not raise SystemExit(0) in this case09:11
prologicspaceone, kk09:11
prologicI'll fix it in master now09:11
y0noconcerning umask any idea to make it compatible python2 and 309:13
y0noI have multiple solution but I don't what is the cleanest: umask(0o077) pass on python3, and umask(int('077', 8)) seems to pass too09:14
prologicisn't there a .six function for this?09:21
y0noprologic, I will take a look09:22
y0noprologic, thanks for the patch, it's good on my side09:22
spaceoney0no: 0o077 !09:23
prologicthat's for Python 3.x only09:24
prologicthey introduced a new literal09:24
prologic0o09:24
prologicbut in Python 2.x it's just 0 perfixed09:24
spaceoneprologic: no, it is also python2 syntayx09:25
spaceoneAt least py2.709:26
y0noprologic, yep, python2.7 handle it09:26
y0noI don't know for python2.609:26
spaceonePython 2.6.8 (unknown, Sep 24 2014, 18:52:24)09:28
spaceone[GCC 4.7.2] on linux209:28
spaceoneType "help", "copyright", "credits" or "license" for more information.09:28
spaceone>>> 0o07709:28
spaceone6309:28
y0nospaceone, so it's ok09:28
spaceoneyes09:30
prologicPython 2.6.9 (unknown, Aug 14 2014, 19:44:18)09:30
prologic[GCC 4.8.3] on linux309:30
prologicType "help", "copyright", "credits" or "license" for more information.09:30
prologic>>> x = 0o77709:30
prologic>>> x09:30
prologic51109:30
prologicI guess we're good09:30
prologicokay09:30
prologicsubmit a PR with that fix :)09:30
prologicalso latest pytest has some breaking API changes09:30
prologicso I'm fixing the test suite a bit to match09:31
prologicDo we have any other umask() incompatibilites btw?09:38
y0noprologic, the only other use is on daemon.py09:39
y0noumask(0)09:39
y0nohttps://drone.io/github.com/y0no/circuits/7 only coroutine test seems to crash =)09:40
prologicahh k09:40
prologicbut that one is okay :)09:40
prologicso all good09:40
prologicy0no, yeah I know :)09:40
prologicsadly09:40
prologic*trying* to fix!09:40
y0noprologic, it's better than yesterday, and it will be tomorow :)09:41
prologicy0no, it will be tonight :)09:44
prologichaha09:44
y0nohttps://travis-ci.org/circuits/circuits/jobs/64545103#L95609:49
y0noconcerning this issue09:49
prologicwe're almost there09:49
y0noassert p.stderr.read() == six.b("foobar\n") ?09:49
prologicahh yeah09:50
prologicpython 3/2 compat issue there09:50
prologicp.stderr.read() will be bytes in Python 309:50
prologicand yeah09:50
prologicb("foobar\n") should work09:50
prologicjust check how some of the other tests do similar things09:50
prologicbut it's from circuits.six import b09:50
prologicbtw09:50
*** Osso has joined #circuits09:58
prologicDoes this make sense: https://gist.github.com/d74d3b6bfea2f39afa3e10:35
prologicSpecifically this bit:10:35
prologic    xs = list(imap(abs, starmap(sub, izip(app.timestamps, app.timestamps[1:]))))10:35
prologic    avg = sum(xs) / len(xs)10:35
prologic 10:35
prologic    assert round(avg, abs(exponent)) == interval10:35
prologicSo in this test we setup a persistent timer10:36
prologicfrom self.fire(persistent(interval))10:36
prologicthat event handler creates the persistent timer for the given interval10:36
prologicand pauses for a time using the new async sleep10:36
prologicwhich should also be calculated to be 10x interval10:37
prologicthen we subtract each recorded timestamp from each other10:37
prologicand compute their average difference10:37
prologicif the rounded averaged to the exponent of the interval equals interval10:37
prologicthe tests passes10:37
prologicit not only tests the persistent nature of the time10:37
prologicbut also ensures that we don't break "timing"10:38
prologictiming in circuits can be as accurate as 1-2ms in my tests :)10:38
prologicoh10:38
prologicand good news10:38
prologicall tests pass locally10:38
prologicgoing to push up all the fixes10:38
y0noprologic, Amazing10:47
y0noi've got just an error on python 3.4.310:47
y0notests/core/test_timers.py:15: in <module>10:47
y0no    from itertools import imap, starmap, izip10:47
y0noE   ImportError: cannot import name 'imap'10:47
prologicahh10:49
prologicyes of course10:49
prologiclet me quickly fix that10:49
y0noI have the fix if you want10:50
prologicgimme a few mins10:54
prologicI'll have em all passing :)10:54
prologicfrom circuits.six.moves import imap, izip10:54
prologicyeah I have the same fix :)10:54
prologicjust running: tox -r10:54
prologic:)10:54
prologiclet's talk futures and thread pools10:55
prologicdo we want/need em?10:55
y0noI think thread pools can be cool10:58
prologicok cool is one thing11:00
prologicbut we're not discussing it's coolness :)11:00
prologichaha11:00
prologicso far we've just not had support for threading really11:00
prologicunless you do it yourself11:00
prologicso we have Worker()11:00
prologicand task() events11:00
prologicthe use-case is typically for CPU bound work11:00
prologicx = yield self.call(task())11:01
prologic# do something with x11:01
prologicwell11:01
prologicx = yield self.call(task(f, *args))11:01
prologicand f is called with args in a process pool11:01
prologicnow it's also *technically* possible to use the task/Worker in a threadpool mannaer11:01
prologicwhich is actually it's default bahaviour I believe11:01
prologicWorker().register(app)11:02
prologicin which case is wraps around the multiprocessing.pool.ThreadPool implemtnation11:02
prologicmultiprocessing has a process and thread pool implemtnation9s)11:02
prologic:)11:02
prologicso it's not like we *don't* have support for running blocking functions in threads11:03
prologicbut what I think would be useful (and yes cool) is:11:03
prologic@handler("foo")11:03
prologicdef on_foo(self):11:03
prologic    x = yield future(f, *args)11:03
prologic    print x11:03
prologicfor example11:03
prologicwhere f is a blocking call11:03
y0noIn python3 it will be easy to implement (IMO) but the compatibility with Python2 will be more difficult11:05
prologicyou mean with concurrent?11:06
y0noyep11:07
prologicyeah I just don't see that happening tbqh11:07
prologicthe reason being some of the things in Python 3's async and concurrent stuff in the std. lib aren't really all that compatible with circuits11:07
prologicthe same is true of other frameworks that do similar things like Twisted and Tornado11:07
prologicwe *may* (possibly) easily be able to intergrate with asyncio apps and libraries11:08
prologicsomeone could try this as an experiment :)11:08
prologiclike I did with integrating circuits with twisted a while back (but never published it really)11:08
prologicI'm not even really sure we'll ever be able to take full advantage of the new yield from either11:09
prologicsince it would change some of the semantics in circuits and how coroutines behave in general for us11:09
prologicour coroutines generally work in a way that gives control back to the event loop11:09
prologicand the event loop trampolines the coros11:09
prologicusing yield from would mean the event loop would have to change significantly I think11:10
prologicto yield from several or more corors11:10
prologicwe just don't do that; we trampoline them11:10
prologicI actually wonder if we can take our coro impl a step further11:11
prologicadn optimize it a  bit11:12
prologicso we don't have to hit each coro on every tick cycle11:12
prologica classic example11:12
prologicyield sleep(5)11:12
prologicwe know we don't have to hit that every tick (say 100ms)11:12
prologicwe can hit it at 4.9s and again at 5.0s11:13
prologicbut not 50 times11:13
y0noYep, I think it could be great to consider a refacotr of our event loop. I agree with you.11:14
y0no(I come back soon ;))11:15
prologicwe can try :)11:27
prologicI'm just saying it might not be possible without breaking what it is to be circuits :)11:27
prologici.e: the component and event architecture11:27
prologicasyncio is all about generators and coroutines using generatores11:27
prologicyield and yield from11:27
y0nowoops13:27
y0nodon't if my pull request need to be on master or on async_sleep branch XD13:28
*** Limb has left #circuits ("Leaving")13:41
*** ninkotech__ has quit IRC13:49
spaceoney0no: where do you come from?14:00
y0nospaceone, from France, and you ?14:03
spaceoney0no: germany14:05
spaceone;)14:05
y0nookay :)14:12
prologichaha14:25
prologicAustralia, Germany, France14:26
prologicnice :)14:26
prologickeep up the good work guys :)14:26
*** my_chiguai has joined #circuits14:54
riotmmh, this looks nice, i wonder if it'll play nicely with circuits: https://github.com/spatialaudio/jackclient-python/blob/master/examples/midi_chords.py20:11
riotprobably not :/20:11
*** Coldblackice has joined #circuits20:27
prologicriot, yeah why not21:31
prologicyou can integrate that with circuits easily21:31
y0noThx for the merge prologic =)21:37
prologicy0no, oh you're welcome :)21:43
prologicand good morning all :)21:43
y0noprologic, aha only good morning for you. It's time to sleep for me :p21:44
*** Osso has quit IRC22:38
*** Osso has joined #circuits22:58

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