IRC Logs for #circuits Thursday, 2013-11-14

*** ircnotifier has quit IRC06:59
*** Aeox has joined #circuits09:15
*** ircnotifier has joined #circuits09:15
AeoxPotentially dumb question: Is there an example of a UNIXServer in use at all? Apparently there's only one howto on the rtd site and I'm having trouble understanding it with the sparse method documentation. :<09:16
prologicAeox, hey there09:17
prologicthe only example I'm afraid it eh tests09:17
prologicI've not actually used it myself :)09:17
prologicbut I'm confidient it works just fine :)09:17
prologicPS: welcome to circuits :)09:17
AeoxEr09:17
AeoxMy problem is that I can't actually get it working.09:17
prologicI'm happy to write such ane xample :009:17
AeoxThat'd be great.09:18
prologicAre you using circuits-dev?09:18
AeoxNo.09:18
prologicAhh09:18
AeoxI've grabbed it from pip, so I doubt it.09:18
prologicyou probably should09:18
AeoxHow come?09:18
prologicI can't gurantee 2.x09:18
prologicwe release slowly09:18
prologicso older versions our quite out of date09:18
prologicand dev is continually tested09:18
prologicI'd09:18
AeoxAh, oaky.09:18
Aeoxokay, even.09:18
prologicpip install -e https://bitbucket.org/circuits/circuits-dev#egg=circuits09:18
AeoxI'll swap to it in a minute.09:18
AeoxYeah.09:19
prologicsomething like that anyway09:19
prologicyeah sorry :)09:19
prologicwe don't have a large development team atm09:19
prologicor much spare time09:19
prologicso we release very infrequently09:19
prologicwe plan on a 3.0 next year sometime09:19
AeoxAh.09:19
prologicfrom 2.1.0 to 3.0 (yes breaking changes)09:19
AeoxWell, you support Py3, which is more than I can say for, say, Pants or gevent.09:19
AeoxThe whole reason I'm using Circuits is because gevent's dev team don't like Py3.09:20
prologicwe do09:20
prologicand we do CI against py3 as well09:20
AeoxYa.09:20
prologicwhich reminds me I need to fix a few things with version managemtnt still09:20
prologicgah ;)09:20
prologicso little time09:20
AeoxIf I explain what I'm trying to use circuits for, would you be able to assist?09:20
prologicyeah no we're quite happy to support Python309:20
prologicPython 2.6+ and PyPy here09:20
prologicwe dropped 2.5 a while ago09:20
prologicsure would :)09:21
prologicI am the original author afterall :009:21
prologicI ought to be able to help09:21
prologic!09:21
prologicI'll be in/out momentraily09:22
prologicjust had dinner, tv/family time09:22
prologicchatter away though I'll be back09:22
AeoxSure.09:23
AeoxAt the moment I'm building what's essentially a wrapper for an application, so it needs to take input from a Unix socket and push the relevant data to a subprocess pipe.09:23
AeoxI kind of had it working at one point in time using SocketServer (lol), but I had to quit using that and make it more modular - it was one gigantic file which was awful.09:24
prologicsure09:33
prologicso you'll need to use09:33
prologiccircuits.net.sockets.UNIXClient09:33
prologicand09:33
prologiccircuits.io.Process09:34
AeoxIn what fashion? :P09:38
AeoxI also have the caveat of needing to store the output somewhere because if a certain command comes through the socket, we need to dump the output.09:39
AeoxPreviously I stored it in a deque.09:39
prologicyeah that's fine09:49
prologicyou can do whatever you want with circuits and components09:49
prologicas you would with normal classes and objects09:49
prologicit just provides a powerful flxible architecture and message passing (and async I/O componnets)09:50
AeoxYeah09:50
prologicI'll try to write up a quick example of a UNIXClient09:50
AeoxI'm just unsure how to utilise them.09:50
AeoxSure.09:50
AeoxIs there one already regarding io.Process?09:50
ircnotifier1 commit(s) pushed to circuits-dev10:19
ircnotifier99a663b17632 by prologic: Fixed imports for py3 compatibility10:19
ircnotifier1 commit(s) pushed to circuits-dev10:21
ircnotifierd436ee776a3a by prologic: Added an example of using a UNIXServer (copy of the TCP EchoServer)10:21
AeoxCheers prologic.10:36
ircnotifier1 commit(s) pushed to circuits-dev10:36
ircnotifieraec2fdc5d4f1 by prologic: Added a simple example of using circuits.io.Process -- A ping clone that wraps /bin/ping10:36
AeoxWow nice timing.10:36
prologicthere you go10:36
AeoxAre you in the Oceania region?10:36
AeoxYou said you just had dinner earlier, which presumably puts you at somewhere between 7pm and 9pm now.10:37
prologicAustralia/Brisbane10:37
Aeoxo_O10:37
AeoxSame.10:37
prologicahh :)10:37
prologichiya neighbour :)10:37
AeoxWell, I'm southside. About an hour out.10:37
AeoxHey there! :D10:37
AeoxYou coming to PyCon next year/10:37
Aeox?*10:37
prologicI'm West Side10:37
prologicYes quite likely10:38
AeoxAwesome.10:38
prologicas most of my other collagues too10:38
AeoxSee you there then. ;)10:38
prologicI believe our work will pay for us10:38
prologicI work at Griffith University10:38
AeoxLmao10:38
prologicname's James btw :)10:38
Aeoxfor all I know you're someone I know IRL10:38
Aeoxoh wait, no you're not.10:38
AeoxWhich campus, if I may?10:38
prologicNathan10:38
prologicanyway you have your two examples10:39
prologicnow tie them together in your app in whatever way you see fit :)10:39
prologicit's all about events and components10:39
AeoxDoing so now. Thanks man. :>10:39
prologicno problems10:39
prologicit was nothing really :)10:39
prologiccircuits is so heavily unit tested10:39
prologicthings jusually work10:39
prologicplease do use dev though10:39
prologicit's way way nicer than 2.1.0 :)10:40
AeoxAlrighty, will swap over now.10:41
prologichttp://codepad.org/itS2MsV710:42
prologichmm10:42
prologicthat's the only difference between a TCP server and a UNIX server10:42
prologicneat really :)10:42
AeoxYeah10:42
Aeoxturns out your examples on RTD are quite old. :P10:42
AeoxAnd also nonexistent except for a TCP echo server.10:42
AeoxEr10:43
Aeoxfatal: repository 'https://bitbucket.org/circuits/circuits-dev/' not found10:43
*** c45y has joined #circuits10:45
prologicyou also want to read the circuits-dev rtd :)10:45
prologiccircuits-dev.readthedocs.org10:45
Aeoxico10:45
AeoxicOk10:45
AeoxicCheers.10:45
Aeoxich c45y10:45
c45yh10:45
Aeoxicprologic: c45y is the guy I was talking about.10:45
prologicahh10:45
c45yHey mate10:45
prologichi10:45
c45yapparently we work together10:46
AeoxicNow I feel left out because I don't work at GU.10:46
Aeoxic:(10:46
prologichttps://jenkins.shiningpanda-ci.com/prologic/job/circuits/?10:46
prologicwoot10:46
prologicbuild is back to normal all round10:46
prologichttps://bitbucket.org/circuits/circuits-dev10:46
prologicthis is the dev repo10:46
prologicI may has mis-typed10:46
Aeoxicc45y: It's p. cool.10:46
c45yI feel like a bad python writer, famework looks neat10:46
Aeoxicprologic: Oh, you need .git at the end for Bitbucket.10:46
AeoxicI forgot about that.10:47
AeoxicOh wait, no, apparently not.10:47
prologicumm no10:47
prologicI use mercurial most of the time :)10:47
prologicsorry10:47
prologichehe10:47
prologicwe do have github mirrors though10:48
prologicwhich haven't been battled tested as yet10:48
AeoxicOoooh10:48
Aeoxicthat explains why this isn't working10:48
AeoxicI was git prefixing out of habit.10:48
prologicbut pip install -e hg+https://bitbucket.org/circuits/circuits-dev#egg=circuits10:48
prologicshould do thr tick10:48
AeoxicYeah10:48
AeoxicI was git+10:48
prologicI have it as a requirements in a few of my other peojcts :)10:48
AeoxicYou guys have to use merc?10:48
AeoxicEw. :<10:48
prologicno10:48
prologicI happen to prefer it :)10:48
prologicat GU we use git everywhere10:49
prologicI use Mercurial there too10:49
AeoxicOh while I think about GU10:49
prologicpersonal preference :)10:49
c45yWe use anything there really10:49
AeoxicWhat the hell is a selection criterion?10:49
Aeoxicc45y: I meant to ask you but I forgot.10:49
prologicI have no idea :)10:49
c45ysaw web guys using scv or whatever it was the other day10:49
prologicusually bs stuff made up to suit some job process? :)10:49
prologicI dunno :)10:49
c45yAeoxic, its a type of animal10:49
AeoxicIt's for a position at GU.10:49
prologicyeah I dunno :)10:50
prologicI'm always just honest about what I can and can't do and my experiences10:50
prologicand just show my stuff off10:50
prologicusually that works for me :)10:50
c45y^ do this10:50
AeoxicAight10:50
c45ymake sure they know you can program well10:50
Aeoxicwill fill out the things tomorrow.10:50
prologicplus I can also say I've been working in OSS for 12+ years10:50
AeoxicLol10:50
c45yWe seem to ahve a lack of programmers around the place10:50
Aeoxicso10:50
Aeoxicwhat10:50
prologicnext year is circuits' 10th year of dev10:50
AeoxicI write the criteria in PHP?10:50
AeoxicOh wait, "can program"10:50
c45yAeoxic, do it in node, to show how hip you are10:50
AeoxicLmao10:50
AeoxicI'm learning Go, actually.10:51
AeoxicAnd C on your recommendation.10:51
c45yLink github, talk about work on junction etc10:51
prologicheh10:51
prologicis that enough to get a job? :)10:51
AeoxicProbably.10:51
prologiclol10:51
prologichttp://mio-lang.org/10:51
c45yonly if it used extensive regexing10:51
AeoxicI love Python too much to dedicate my time writing an alternative.10:51
c45ySo write C, for python :)10:51
prologichehe10:52
prologicI lvoe Python too10:52
Aeoxicc45y: No point. I don't need the speed.10:52
prologicbut I still find writing mio fun10:52
prologicand challenging10:52
Aeoxicc45y: And if I did I'd PyPy.10:52
c45yYou will one day10:52
AeoxicOr Jython tbh.10:52
c45yor C10:52
prologicit's very similar to Python already with similar semantics10:52
c45yfor memory10:52
AeoxicOr write it in PHP and use HipHop.10:52
prologicbut has a few differences10:52
AeoxicTruth.10:52
Aeoxicc45y: Teach me C.10:52
c45ylolno10:52
c45yI can hardly write it these days10:52
AeoxicMy experience with C is limited to Charybdis development.10:52
prologichehe this is the most users we've had in #circuits for a few years10:53
prologic:)10:53
Aeoxico_O10:53
prologicnice to see it hit past 1210:53
AeoxicKind of surprised that there's so few people here tbh.10:53
AeoxicAlso c45y, your hostname. :|10:53
Aeoxicprologic: Is circuits not hugely popular or something?10:53
AeoxicIt seems pretty damn simple to use so I don't see why it wouldn't be. :x10:53
prologicthere's strong competition for Twisted in the Python community10:54
prologicvery hard to beat their level of marketting10:54
prologicor rather umm10:54
prologicforcul marketing :)10:54
prologic"Just use Twisted" is the usual response!10:54
prologicwell popularity is a relative thing10:55
prologichttps://crate.io/packages/circuits/10:55
prologicvs.10:55
Aeoxic"We don't use camelCase"10:55
prologichttps://crate.io/packages/Twisted/10:55
c45yAeoxic, huh10:56
Aeoxic?10:56
c45yI still can't believe I've never seen it, its something I actually half implement all the time10:56
c45yAeoxic, nm, checked my hostmask10:56
prologicseen what?10:56
c45ycircuits10:56
prologicoh :010:56
prologicyes well10:57
prologicit's been around since 200410:57
prologicand we keep improvint it all the time10:57
prologicanyway like I said10:57
prologicheavy forcful marketing from Twisted10:57
prologiccircuits = 60k downloads10:57
c45yUnless r/python tells me or I actually have spare time to just search for things I never see cool modules10:57
prologicTwisted = >2M downlaods10:57
prologicgo figure :)10:57
c45yI like all twisted offers, but hate twisted itself10:57
Aeoxic^10:58
c45ythis may well be a good alternative10:58
prologicI probably don't blog about ti nearly as much as I should10:58
prologicbut who has the time :)10:58
prologicyeah well10:58
prologicwe offer all of what wisted has10:58
prologicand circuits even integrates with twisted10:58
prologicthat is to say10:58
Aeoxicc45y: Eh, I just post whatever whenever.10:58
prologicwe can use twisted protocols10:58
AeoxicMy last one was about the latest MC exploit.10:58
prologicand run twisted apps on top of circuits10:58
prologicthis was a recent addition a few months ago10:58
Aeoxico_O10:58
AeoxicMeanwhile, pants' latest addition was "fixed typo in README.md"10:59
c45ywas it called REEDME.md beforehand?10:59
AeoxicNo, it was "absurdly simply" to "absurdly simple".10:59
prologichttp://shortcircuit.net.au/~prologic/blog/category/tutorials/10:59
prologichttp://shortcircuit.net.au/~prologic/blog/article/2013/08/24/circuits-twisted/11:00
prologichttp://shortcircuit.net.au/~prologic/blog/article/2013/02/16/introducing-the-circuits-team/11:00
AeoxicIs that run on a wiki?11:01
AeoxicThat's... an interesting approach.11:01
prologicumm Pelican static site geneartor11:01
prologicbut my websites are run on a wiki11:01
AeoxicYour main website.11:01
AeoxicYeah11:01
prologichttp://sahriswiki.org/11:01
prologichttp://prologic.shortcircuit.net.au/11:01
prologicall using circuits.web11:01
prologiccircuits eats it's own dog food11:01
prologicdrinks it's own coolade11:01
prologicetc11:01
AeoxicI'll probably sit with Flask for my web apps.11:02
AeoxicCircuits for the networking backends.11:02
prologicyou can proably run your flask apps on circuits.web :)11:02
prologicit is WSGI compliant11:02
prologichttp://circuitsweb.com/11:02
c45yI actually have a micro wsgi framework im writing that I may well use this for11:03
prologichttp://circuitsframework.com/11:03
prologicso is there anything else I can do fo ryou guys?11:32
AeoxicAll good here, got it sorted.11:32
Aeoxic:>11:32
prologicI might go shower and head to bed soon11:32
prologicawesome :)11:32
AeoxicThanks again mate.11:33
prologicwelcome11:33
Aeoxicprologic: So if I wanted to write to stdin via circuits.io.Process11:56
prologicfire a write event to it's stdout channel12:04
AeoxicTo out?12:04
Aeoxico_O12:04
prologicyou can either reference the stdout file component directly12:05
prologicfrom the Proecss instance12:05
prologicor use it's channel name12:05
AeoxicI feel12:05
Aeoxicreally weird12:05
prologicwhich from the code is12:05
Aeoxicconsidering stdout is usually output from the app12:05
prologic<pid>.stdout12:05
Aeoxicand stdin is in12:05
Aeoxicas opposed to12:05
Aeoxic"write to stdout"12:05
prologicoh wait12:05
prologicI misread :)12:05
prologicsorry yes12:05
prologicfire an write to <pid>.stdin12:06
prologicor reference it's stdin file component12:06
prologichaha12:06
prologicbit tired :)12:12
AeoxicThis is12:12
Aeoxicbeing quite irritating now12:12
prologicsorry such a bad misreading :)12:12
Aeoxic:<12:12
AeoxicHeh that's fine.12:12
AeoxicStill confused, however.12:12
AeoxicPoking at various things now.12:12
prologicit probably takes a little getting used to :/12:13
prologicI'm here to help :)12:13
AeoxicWell12:13
Aeoxiceverything's fine12:13
Aeoxicexcept the writing to stdin.12:13
AeoxicAnd, presumably, the reading from stdout.12:13
AeoxicI haven't got to that yet.12:13
AeoxicI'm doing the former first because you have to do so to quit the wrapped app.12:13
prologicself.fire(write("foo"), "1234.stdin")12:14
prologicwhere 1234 is the process's pid12:14
prologicshould work12:14
AeoxicThat's kind of what I've got, but as the class doesn't inherit Component, that kind of doesn't work.12:14
AeoxicI could make it do so12:14
Aeoxicbut then I'd have to change nearly every method name because they conflict. :<12:14
prologichttp://codepad.org/fyuNHvzu12:15
prologicsee the debug output?12:15
AeoxicYa12:15
prologicnotice the stdout events12:15
AeoxicMhm?12:15
prologicinherit from baseComponent12:15
prologicit doesn't do any automatic event handlers of methods12:15
prologicor12:15
prologiccreate a Manager() instance somewhere12:15
prologicand create a Process instance directly12:15
prologicand regsiter it to the manager12:16
prologicm = Manager()12:16
prologicp = Process([...]).register(m)12:16
prologicm.start()  # runs in a separate thread12:16
prologicbut it is better ihmo if you write your whole app in circuits :)12:16
AeoxicProbably12:18
AeoxicI'm trying to do just that.12:18
prologictelnet.py is a good example to go with12:19
prologicfor a base app structure12:19
prologicor even better12:19
prologichttps://bitbucket.org/prologic/irclogger/12:19
prologicand12:19
prologichttps://bitbucket.org/prologic/ircnotifier/12:19
prologicthe later has an integrated web api12:19
prologicand is used for repo updates for circuits to here and #circuits-dev12:19
Aeoxico_O12:20
AeoxicI think I might rebuild this entirely as one master that wraps all the apps instead of Master <--> Many ( wrapper <-> app )12:20
AeoxicOnly problem is if the master breaks for w/e reason, we lose all apps.12:20
prologichmm sounds interesting :)12:23
AeoxicAttributeError: 'Spectre' object has no attribute '_executing_thread'12:23
AeoxicEr12:23
AeoxicThat's inheriting BaseComponent.12:23
prologicdid you override __init__?12:23
AeoxicOops I thought I updated that.12:23
prologicremember to call the super __init__12:23
prologicor the component will break12:24
AeoxicEch12:24
Aeoxiclooks so dirty. :(12:24
prologicit's the way it all works :)12:24
prologicallows for much dynamism12:24
prologicnot a word but meh :)12:24
prologicthere's a reason behind every architecutral descision :)12:25
prologiccircuits caches every handler for example12:25
prologicso event handler lookups are as fast as possible12:25
prologicself.fire works from any component without having to know who the manager is12:25
prologicetc12:25
prologicthere is a convenient init()12:25
prologicthat you can define on your component12:25
prologicwhich you don't have to worry about calling any super init12:26
prologice.g:12:26
prologicclass App(Component):12:26
prologic   def init(self, ...):12:26
prologic      ...12:26
prologicit gets called when the component is proeprly created and takes the same args/kwargs as you'd pass to the class factory when instantiating12:26
AeoxicI have it working-ish now. No errors, and the app exits when it should12:29
Aeoxicbut it doesn't appear to be sending the data properly. ;_;12:29
prologicDebugger() is your friend :)12:31
Aeoxic<write[<Process/process 18984:MainThread (queued=4) [S]>] ('stop\n' )>12:31
AeoxicLooks like it's writing to me.12:31
prologichmm12:31
prologicchannel looks wrong12:31
prologicaren't you trying to write to a process's stdin?12:31
prologicyou need:12:31
prologicself.fire(write(data), channel)12:31
AeoxicAh12:32
Aeoxicyet apparently process doesn't have an stdin attribute12:32
prologicunfortuantely Process doesn't have any convenient event handlers that forward on to it's stdin/stdout/stderr files12:32
Aeoxic;_;12:32
prologicbut we could improve that12:32
AeoxicYa.12:32
AeoxicHah12:32
prologicwell it does12:32
prologicself._stdin is the File component12:32
prologicself.fire(write(data), p._stdin)12:32
prologicshould work12:33
prologicwhere p is a Process instance12:33
prologicAPI improvements are _always_ welcome :)12:33
Aeoxic<write[<File/19208.stdin 19205:MainThread (queued=0) [S]>] ('stop\n' )>12:33
prologicthat looks better12:35
AeoxicThe subprocess is still running, however.12:35
Aeoxicweird. ;_;12:35
prologicdid it get the stop message?12:37
prologicbugs (if found) wil be unit tested and squashed!12:37
AeoxicOne sec12:39
Aeoxicmight've been an operator error12:39
AeoxicNo12:45
Aeoxicprologic: It isn't, apparently.12:45
Aeoxic;_;12:45
ircnotifier1 commit(s) pushed to circuits-dev12:46
ircnotifier0eb31cb9c9a3 by prologic: Wrote a unit test to ensure writing to a process's stdin works12:46
prologicit's a little clunky (the behavior) I have to admit12:46
prologicbut it does work12:46
prologiccheck the test I just wrote12:46
AeoxicAlright so12:46
Aeoxicit works if I don't stop the server immediately after, apparently.12:47
prologicahh yes12:47
prologicof course12:47
prologicyeah don't do that :)12:47
AeoxicI have no idea how that didn't occur to me haha12:47
Aeoxicso is there a "safe" way to do that?12:47
prologicthe event won't get processed in time12:47
prologicjoin the running app/manager12:47
prologicwait12:47
prologiclet me check :)12:47
*** Aeoxic has joined #circuits12:47
AeoxicIRC stole focus as I pressed CTRL+W12:48
Aeoxic<__<12:48
prologicwait12:48
prologicwhat are you stopping ?12:48
prologicthe app12:48
prologicor the subprocess?12:48
AeoxicThe Python12:48
AeoxicI've already stopped the subprocess with the stdin12:48
prologichmm12:48
prologiccircuits has code that tries to ensure it processes al enqueed events before terminigng12:48
prologicbut if you're prematurely stoppping the Process instance12:49
prologicthen yeah that's kinda bad12:49
AeoxicI have to write stop to the process12:49
AeoxicLiterally, "stop\n"12:49
Aeoxicto make it terminate nicely.12:49
prologichmm not sure without looking at a debug trace12:50
prologicasync programming is hard12:50
prologicbut circuits tries to make it a little easier :)12:50
AeoxicIs there any way to manually queue events?12:50
prologicdefine manually?12:50
AeoxicForce two actions to be performed synchronously.12:51
Aeoxictwo or more, that is.12:51
prologicyou can manually flush events12:51
prologicbut fire/call are the only event triggering apis12:51
prologicahh yes12:51
prologiccall/wait12:51
prologicsynchonrous event triggering12:51
AeoxicHmm?12:51
prologicuses python generators interally12:51
prologicsee examples/primitives/12:51
prologichttps://bitbucket.org/circuits/circuits-dev/src/0eb31cb9c9a30b97ef14299926de7d2e30ef9dee/examples/primitives/call.py?at=default12:52
prologichttps://bitbucket.org/circuits/circuits-dev/src/0eb31cb9c9a30b97ef14299926de7d2e30ef9dee/examples/primitives/wait.py?at=default12:53
prologiceither or12:53
prologiccall is actually built on top of fire and wait12:53
prologicbrb12:56
prologicOsso our other main dev should be here shortly :)12:56
AeoxicI have to bounce in a moment unfortunately.12:58
AeoxicQuite late here.12:58
*** Osso has joined #circuits12:58
AeoxicWait12:58
Aeoxicwhat12:59
AeoxicCERN12:59
Ossohello12:59
AeoxicHi.12:59
pdurbinCERN?13:00
Aeoxic[22:58] --> Osso has joined this channel (~osso@pb-d-128-141-29-233.cern.ch).13:00
AeoxicApparently.13:00
OssoleilI work at CERN yeah13:00
AeoxicHectic.13:00
pdurbinoh. cool13:01
prologicback13:02
prologicAeoxic, aren't we the same tz? :)13:04
prologicit's only 11pm :)13:04
Aeoxicprologic: We're less than an hour from each other. :P13:04
AeoxicYeah but I like having a normal-person sleeping pattern.13:04
prologichaha13:04
AeoxicPlus my girlfriend is getting irritated at me I think. <_<13:04
prologicyeah I'm going to bed soon too13:04
prologicwife and baby went ot bed hours ago13:05
AeoxicI tried the yield / wait call stuff.13:05
prologichi osso13:05
Ossoleilhey13:05
prologicand?13:05
AeoxicIt essentially passed the message on13:05
Aeoxicthen did nothing13:05
AeoxicBut it didn't even do that, apparently.13:05
AeoxicIt just sort of hung.13:05
prologichmm13:05
prologicinteresting13:05
AeoxicProbably me doing it incorrectly tbh.13:05
prologicwell call/wait are still quite new13:06
prologicrelatively13:06
prologiccould be a bug13:06
AeoxicWtf13:06
Aeoxicapparently this app13:06
Aeoxicwrites to stderr13:06
Aeoxicnot stdout13:06
prologicI know it can be tricky to wait ona specific event13:06
Aeoxic>:|13:06
prologicahh13:06
prologicwell there's ya problem :)13:06
AeoxicThat isn't really a problem, I'm still getting the output.13:06
prologichmm13:06
prologicwe should provide a kwargs to Process13:06
prologicso you can combine stdout/stderr13:06
Aeoxic<read[21767.stderr] (b'2013-11-14 22:58:04 [INFO] Generating keypair\n' )>13:06
AeoxicActually, prologic, it is a problem.13:12
AeoxicI don't get the data now. ;_;13:12
prologicbecause it's outputting to stderr?13:15
AeoxicMost probably.13:16
prologicchange the event handler in youra app then13:16
prologicto match13:16
prologicor listen to all read events13:17
prologic@handler("read", channel="*")13:17
prologicdef _on_read(self, event, *args, **kwargs):13:17
prologic   ...13:17
prologicyou'll have to figure out which read event was which though13:17
prologicbased on event.channels13:18
AeoxicYeah that was it, haha.13:19
AeoxicWho even does that <__<13:19
Aeoxic"stdout is too mainstream"13:19
prologicheh13:20
prologicI think adding a combine_stdout_stderr kwargs is in order13:20
prologicor something13:20
prologicprobably just mimic the subprocess.Popen api13:20
Aeoxicstdout=PIPE, stderr=stdout13:21
prologiccircuits.io.Process mostly takes the same parameters anyway13:21
prologic*nods*13:21
AeoxicSo13:21
prologicneed to just accept those kwargs13:21
Aeoxicwait / call13:21
Aeoxicetc13:21
prologicand pass it on to the self.p instance13:21
AeoxicYou have these events as a class subclassing Event13:21
AeoxicThe particular thing I'm running is just a function.13:21
Aeoxic`self.stop()`13:21
Aeoxicmore or less13:21
prologicyou can turn any function/method into an event handler13:22
Aeoxic`self.process.stop` actually.13:22
prologicand even register it manually13:22
AeoxicRight.13:24
prologic@handler decorator13:25
prologicor13:25
prologicyour_decorated_function = handler("foo")(your_function)13:25
prologicand13:25
prologicself.addHandler()13:25
AeoxicI have no idea what I'm handling, though.13:26
AeoxicAll I'm trying to do is run two events synchronously.13:26
prologicevents13:26
Aeoxico_O13:26
prologichandlers handle events13:26
prologic@handler("foo")13:26
prologicdef _on_foo(...)13:26
prologiclater on13:26
prologicm.fire(Event.create("foo"))13:26
prologicwhilst call/wait are synchronous apis13:26
prologicon top of circuits asynchronous core13:27
prologicit simulartes synchonrous behavior only13:27
prologici.e: no two events will ever run at the same time13:27
prologicnot concurrently anyway13:27
prologicif you really wanted that13:27
prologicyou'd have to split your system13:27
prologicand run each part in a separate thread13:27
AeoxicTbh if I really needed that13:27
prologicor process13:27
AeoxicPython was a bad choice.13:27
prologictrue :)13:28
prologicconcurrency/parallism is not Python's foremost strength right now13:28
prologicbut circuits components/systems13:28
prologiccan be run in threads13:28
prologicand even processes13:28
prologicand if run in a separate process13:28
prologiccan be linked via a bridge (circuits ipc) back to the parent process13:28
AeoxicUgh Christ13:29
Aeoxicthis issue again13:29
prologichmm?13:29
Aeoxicwriting to stdin causes the read event to fire, and then have an issue with the fact that there's a socket object passed to it.13:29
prologiceh?13:30
prologicI don't quite follow13:30
Aeoxic(<read[server] (<socket.socket object, fd=9, family=1, type=2049, proto=0>, b'STOP' )>) {<class 'TypeError'>}: coercing to str: need bytes, bytearray or buffer-like object, socket found13:30
AeoxicBecause my read handler is, for now, just `print(str(data, "utf8"))`13:31
AeoxicI'm just wanting to get a look at the output not do much with it atm13:31
prologichmm13:33
prologicare you confusing the two different kinds of read events?13:33
prologicthere's a server version13:33
prologicand client/file version13:33
prologica read event for a connection client to a server13:34
prologicwill produce a read event like13:34
prologicread(sock, data)13:34
prologicwhilst a client13:34
prologicread(data)13:34
AeoxicThat shouldn't be occurring.13:34
prologicyou need to define separate read handlers for server and client13:34
prologichmm13:35
prologiconly thing I could think of that explianed tha terror :)13:35
AeoxicI don't really understand what's going on right here.13:35
AeoxicThis works fine until I pass "STOP" to the socket13:35
prologiccan I see your code anywhere?13:36
AeoxicYeah13:36
AeoxicI'll push it now13:36
Aeoxicprologic: https://bitbucket.org/Aeoxic/spectre13:39
prologichttps://bitbucket.org/Aeoxic/spectre/src/9710c34f38997a4b6b63b15cbc1a84e7de984480/spectre.py?at=master#cl-5913:44
prologicthis handler13:44
prologiclistens to read events on all channels13:44
prologicyou'll also get the unixserver read events13:44
prologicwhich will raise an error13:44
AeoxicOh13:44
AeoxicI thought you were referring to stdin/out/err13:45
Aeoxicwhen you said that13:45
AeoxicSo what channel would I use?13:45
prologicalso13:45
prologicyour13:45
prologicself.spectre.stop()13:45
prologicprobably won't do anything13:45
prologicyou need to do13:45
prologicself.spectre.process.stop()13:45
prologicotherwise you'd shutdown the whole app managing all this stuff13:45
prologicself.stop, self.run and self.start13:46
prologicare methods of all compoents13:46
prologicat least if you call self.stop() on any component that's part of a running system13:46
prologicthe whole system will terminate13:46
AeoxicAlright.13:46
prologicI'd just leave it as it is13:46
prologicbut make the arguments13:46
prologic*args, **kwargs13:46
prologicand check that you're actuallty getting a Process's stdout/stderr read event13:47
prologicand not a UNIXServer's read event13:47
prologicyou can dynamically bind the handler yourself13:47
prologiconce the Process instance is setup and ready to go13:47
prologicbut it's a bit more work13:47
prologicinternally the Process implementation does this anyway13:47
prologicby using handler(...)(func)13:47
Aeoxic[23:47] <prologic> and check that you're actuallty getting a Process's stdout/stderr read event13:47
prologicand self.addHadner() calls13:47
AeoxicHow do I check?13:47
prologicinspect event.channels13:48
prologicso13:48
prologic@handler("read", channel="*")13:48
prologicdef _on_all_read(self, event, *args, **kwargs):13:48
prologic   if event.channels == ("server",)13:48
prologic      ...13:48
prologic   else:13:48
prologic      ...13:48
prologicevent.channels (for any given event) is a tuple of all channels the event was fired to13:49
prologicmost of the time it's just a single item tuple13:49
prologicbut you can do13:49
prologicself.fire(e, "foo", "bar")13:49
prologicfire e to channels foo and bar13:49
prologichttp://codepad.org/R5fF2HvS13:52
AeoxicAlright I'm gonna go sleep. I'll hit it up in the morning again.13:55
AeoxicCatch you later man.13:55
AeoxicThanks for all your help. :>13:56
prologicnps13:56
prologicnight :)13:56
*** Aeoxic has quit IRC13:57
*** ninkotech__ has quit IRC16:23
*** fallingmeat has joined #circuits20:52
prologicmorn'n all22:59
*** fallingmeat has quit IRC23:04

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