IRC Logs for #circuits Monday, 2014-09-08

*** cfarmer_ has quit IRC00:10
*** cfarmer_ has joined #circuits00:11
prologicI see what? :)00:12
prologicwe’re here to help in any way we can :)00:12
*** cfarmer_ has quit IRC00:22
*** cfarmer_ has joined #circuits00:23
*** cfarmer_ has quit IRC00:25
*** cfarmer__ has joined #circuits00:25
*** cfarmer__ has quit IRC00:30
*** cfarmer_ has joined #circuits00:56
*** cfarmer_ has quit IRC01:02
xMopxShelloh im just trying out a few different frameworks01:50
xMopxShellalways been a cherrypy guy but figured i'd try something new01:50
*** Osso_ has quit IRC01:51
prologicahh right :)01:55
prologicwell we’d personalyl love it if you found a new love in circutis.web01:55
prologicI guess one of the main selling points behind circuits and circuits.web if you decide to use it’s web framework is it’a asynchornous02:00
prologicthe only other web frameworks that are that I know of are twisted.web some gevent based ones (monkey patching) and fapws02:00
prologicalso if you’re looking for something super fast in terms of raw performance (a crappy benchmark at best) — that’s not circuits.web unfortuantely02:01
prologicit’s event-driven and comonent architecture is quite powerful and flexible but does cost a bit in terms of raw performance obviously02:01
xMopxShellyeah, async is what drew me in haha02:10
prologicahh :)02:23
prologicgoody :)02:23
prologicjust kidding02:24
prologicif you’re after more real-world examples of circuits.web02:24
prologictalk to Justin G (he’s sometimes here)02:24
prologiche’s done a lot of commercial free-lance work for clients with circuits.web pwoered app02:24
prologicI’ve got
prologicand more recently (at Griffith University) and
prologicNB: sahriswiki which powers a lot of my own websites including those of circuitsframework and circuitsweb itself has not been ugpraded to circuits 3.0 yet02:26
prologicbut the ccav project I did at GU uses circuits 3.002:26
prologicand obviously there are heaps of examples in examples/web :)02:26
xMopxShellHey, how do I have something like this work asynchronously?
prologicone sec04:58
prologicLike this:
prologicin general it will either be a CPU or I/O bound function04:59
prologicin practice because of the Python GIL something that is meant to be and is typically I/O bound ends up blocking anyway04:59
prologicso you’re best to use a processpool regardless04:59
prologicSo at ytour application startup you’ll want to do something like:05:00
prologicfrom circuits import Worker05:00
prologicand fire task() events at it like in my example above05:00
prologicmake sense?05:00
prologicyou can probably just use teh default channel as -is “woekr"05:02
prologicbut be sure to pass process=True05:02
xMopxShellhmm makes sense05:02
prologicthe other option is to use call/wait05:03
prologicwhich is used there anyway :)05:04
prologicbut that involves turning your “work” into a generator or a coroutine as it’s called05:04
prologicyield(ing) at every step of teh process05:04
prologicwhich is fine05:04
prologicbut be aware of the nature of the Python GIL and blocking calls05:04
xMopxShelli dont think i understand the relationship between things like Controller, Worker, Server, etc05:16
prologicwhat’s your current understanding?05:16
xMopxShellUhh about as far as that pastebin code from a little early05:17
xMopxShellearlier *05:17
prologicok maybe I can start with the lowest-level component05:18
prologicso circuits.web.Server is actually comprised of several compoents05:19
prologicand a circuits.core.pollers.Select (default) poller05:19
prologicit also then adds the circuits.web.http.HTTP component to actually handle the HTTP server protocol side of things05:20
prologicto dispatch request, response and stream events to connecting clients05:20
prologicwhere Controller(s) come in to play are with the default circuits.web.dispatchers.Dispatcher05:20
prologicwhich understands what Controlelr(s) are whent ehy’re regsitered05:20
prologicif you for example use05:20
prologicfrom circuits.web import BaseServer05:20
prologicthen you get no controllers05:20
prologicyou have to do your own dispatching05:21
prologicit’s helpful to see the relationships grpahically or textually via
prologicalso try adding in Debugger() to the mix05:21
prologicand you’ll be able to watch the stream of events coming in and out05:21
prologicwhich is also helpful for both debugging and understanding05:22
xMopxShellHmmm alright05:22
xMopxShellthat graph thing is neat05:48
xMopxShellim reading some of the examples05:49
xMopxShellthey make sense just I completely dont understand how things are architected05:49
prologictypically the archtecture (components) is meant to be loosely coupled05:56
prologicwehre it isn’t it’s either deliberate or a mistake/laziness ;)05:56
xMopxShellprologic: trying out a worker and tasks and events and stuff06:42
xMopxShellthis just hangs when I try to do dowork():
xMopxShellnot really sure why?06:42
prologicxMopxShell: you can’t mix yield and return06:53
xMopxShellit what context?06:53
prologicalso put your dowork() in a non component06:53
prologicor as a plain function at the module level06:53
prologicI think multiprocessing will spit chips otherwise due to pickling errors06:54
xMopxShellwhy can't it be in the class?06:54
prologicpotential PicklingError(s)06:54
prologicand in general with Python06:54
prologicyou cannot mix yield and return06:54
prologicit either returns06:54
prologicor is a generator06:54
prologicthe only exception to this is a plain return;06:54
xMopxShellso I can't pass anything that can't be pickled to something running in a worker?07:00
xMopxShellfiles, sockets, etc07:00
xMopxShellAlso, what if I wanted to spawn a background task and retrieve (for example) progress data as it chugs along in the background?07:03
prologiceven'n all08:25
prologicxMopxShell, correct08:25
prologiccircuits.core.workers.Worker wraps around python's multiprocessing lib08:25
prologicre progress -- you'd have to code that up :)08:26
prologicor alternatively (maybe better?) write an integration layer/component for something like celery which is more suited to "task management"08:27
prologicif that makes sense08:27
prologicxMopxShell, on the other hand if you'd like to build a set of components better suited to "jobs and tasks" with "process and monitoring" in circuits -- that'd be quite neat :)08:33
prologiccircuits.contrib.taskq ? :)08:33
*** leozeng has joined #circuits14:03
*** leozeng has left #circuits ()14:04
*** cfarmer_ has joined #circuits14:08
*** cfarmer_ has quit IRC14:13
*** tariq786 has joined #circuits16:38
*** Osso has joined #circuits19:59
prologicmorn’n all22:38
pdurbinprologic: my co-presenter is coming after all! I don't have to give the talk alone!22:51
prologicpdurbin: oh good :)22:52
prologicthat’s a bit of a relief :)22:52
pdurbingonna be a much better talk this way. it was his idea. and design. and implementation22:53
prologicgood luck with it :)22:57
prologicwhen is it again?22:57
pdurbinthey put us in a room that holds 260 people22:57
prologichaha that’s alright ;) I was in the main presentation room too22:57
prologicI think it holds ~300 or so22:57
prologicone thing I noticed though in most of the presentations is the sheer no. of people just surfing the web on their smartphone, tablet, laptop22:58
prologicand not actually paying attention to the presenter at all in the least bit22:58
prologicquite sad how attached we’ve become to our devices and the web22:58
prologicbit rude to say the least22:58
pdurbinthe talk is 3 weeks from tomorrow22:59

Generated by 2.11.0 by Marius Gedminas - find it at!