IRC Logs for #circuits Friday, 2016-09-30

*** Coldblackice has joined #circuits01:48
*** Coldblackice has quit IRC01:59
*** Coldblackice has joined #circuits02:05
*** Coldblackice has quit IRC03:20
*** braoru has joined #circuits05:24
braoruI re-create a sample using node where I can't get event getting fired from outside :-) : https://gist.github.com/braoru/691b1abb72b03ab1731f7b50aa49162c But I think I will play a little more with the json-rpc framework. Is there a way to define callable function that are not handler ?06:54
prologicbraoru: what is your expected output?08:38
prologicAlso what version of circuits are you using?08:38
braoruprologic, was to fire event from outside but I readed some code from circuit and I see it's definitly not possible08:39
prologichttps://gist.github.com/prologic/e023359e60fa903e430d2f0f3153a22a08:39
braorubut I succeed bridging circuits with grpcio08:40
prologicthe gist does what I expect it to08:40
prologicwhat am I missing?08:40
braoruMain -> X : None but in fact the event is never fired08:41
braorubecause et fire it outside of the main handler08:41
prologicwhat are you expecting to see?08:42
braoruX -> Hello from .. on the main08:44
braorubut as you said yesterday it's not possible08:44
braorubut the things I don't understand is why when I run with python -i I'm capable of doing app.fire(remote(hello())) with success ..08:45
prologicwait...08:45
prologic:)08:45
braoruno problem I continue tu play with circuits.web to see what it imply to migrate our tornado part to circuits ..08:47
braorumainly all the stuff related to srp authentication & jwt token handling :)08:48
prologichrmm08:48
prologicthis code is really weird :)08:48
prologiccan you explain in a different way what you're trying to do? :)08:49
prologicin general remote events either via node or bridge actually does work :)08:49
prologicand is used in several production systems08:49
braoruI'm sure it's working08:50
braoruit's me not' understanding properly :)08:51
prologicL115 will never work08:51
prologicbecause .fire() is asynchronous08:51
prologicso it will always print Main -> X: None08:51
braorucall & fire are async ?08:52
braoruyes right both return generator08:52
braoruI remember08:53
prologiccall/wait are synchornous08:54
braoruI'm still trying to figure how (or if it's possible or not) we could interact between ou tornado handler and circtuis and in the same time I play with the framework to understand it better .)08:54
prologicfire is asynchornous08:54
braoruso you can't get value from fire or it's a promise ?08:54
prologichmm08:55
prologicone sec08:56
prologichttps://gist.github.com/a8c5b7835d76130f175975260b9c34e808:58
prologicI hope this helps expain how fire() works and it's value08:59
prologicyou'll notice that y doesn't have a value straight away08:59
prologicbut does eventually08:59
prologicbut it behaves differently to call/wait which actually wait for the event to complete08:59
braoruok08:59
prologicreturning a generator (coroutine)08:59
prologicI'm still trying to understand your first gist :/ (sorry!)09:00
braoruis there a way to know if an event is done ?09:00
braoruthe main idea was to externaly  fire/call event from outside of the component "app"09:01
braorubut now I see that not really possible.. so I could use jsonrpc09:01
braoruand this morning I manager to fire event from grpc.io call :-)09:02
prologicyou can listen to foo_complete09:03
prologicor foo_success09:03
braoruok09:03
braoruI note it :)09:03
braoruthen I can easily wrap the call within a future09:03
prologicand what you're saying above is wrong09:03
prologicwe fire events from outside the "app" all the time in our test suite09:03
braoruthen .. why it's not working for me .. just because I'm fire it too fast ?09:04
prologictrying to work that out :)09:05
prologicgimme a few mins09:05
braoruAnd me I'm starting to read the test suite :)09:05
braoruI probably have missed something there yesterday09:06
prologichttps://gist.github.com/49443c855010b6ef33135cd80ecdefd409:09
prologicyup as I suspected09:09
prologictiming issue09:09
prologicif you put a sleep(5)09:09
prologicit works09:09
prologicbut you really shoudln't be doing any of this09:09
prologictime.sleep() is highly discouraged with circuits09:10
prologiccoordinate your events instead09:10
braoruyes time.sleep seem to be a dirty workaround09:11
prologicit is :)09:11
prologicyou just were lacking proper coordination09:11
prologicbut be aware as well that you will not be able to use call/wait from outside of circuits09:12
prologic*unless* you do some generator trickery09:12
braoruI's what I concluded after follow _fire() code09:12
braoruThen could be just simplier to use circtuis.web and fo a full circuits app09:13
braoruand as I said .. integrating grpc.io is very simple09:13
braorujust have to implement the stubservice as a subclass of you component09:14
braoruYou could even do a double inheritance I thinks but I need a proper way to completely exclude some methode from the event handler (without adding _ as a prefix)09:15
prologictbh it isn't very hard to ports web apps from tornado/twisted/django to circuits.web :)09:16
prologicsubclass BaseComponent instead09:16
prologicit doesn't do the automagic event handlers for you09:17
prologicyou have to explicitly use @handler() then09:17
braoruhoo ok09:22
braorugood idea :)09:22
braoruthe problem is not realy the http route management ..09:22
braoruit's more all the side things09:22
braorumainly jwt token & srop authentication , tornado give nice helper to create decorator to deal with it09:23
braoruI'm still reading the circuits.web documentation :)09:23
prologicdo us a favour :)09:35
prologicport all that juicy goodness from Tornado to circuits.web :)09:35
prologicbut do it the circuits way with events, event filters and components09:35
prologicwe don't use decorators if we can help it09:35
braoruI can't promise :) not because I don't want but because I think I'm not capable of .. but if I do anything special I would be please to help including it :)09:36
prologiclook at the way we do json apis in our examples/web/09:36
braoruI'm looking a the test  of the web part09:36
prologicI don't agree; I think you'd be capable :)09:36
prologicI'm here to help!09:36
braoruand a grpc component would be great :)09:37
braorucontroller09:37
braoruif I follow the naming correctly .)09:37
braorulike translating the proto file in event instead of simply method :)09:38
braorummh how do you split between get/delete/post/head/option within a controller ?09:40
prologicthat's the job of the default Dispatcher09:51
prologicwhich takes incoming request events and fires new events based on either their path or method09:51
prologicso your controller can be either of:09:51
prologicclass Root(Controller):09:52
prologic    def index(self, ...):09:52
prologicor09:52
prologicdef GET(self, ...):09:52
prologicit's not the best dispatcher I admit; but it serves 90% of many of our use-cases and those of our users09:53
prologicI think we used to have a routes dispatcher too but we removed it for lack of tests/quality09:53
prologicfeel free to send a PR adding it back in with better testing/docs/quality :)09:53
braoruok will look at it09:56
*** braoru has quit IRC14:37
*** Coldblackice has joined #circuits20:00
*** Coldblackice has quit IRC20:01

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