IRC Logs for #circuits Monday, 2018-11-12

*** smugdarkloser has joined #circuits01:55
smugdarkloserwhat is the point of this framework01:56
smugdarkloseri found this because im interested in the general topic -- building an app framework for electronics01:56
smugdarkloserwhats the idea with circuits?01:56
*** smugdarkloser has quit IRC02:07
*** ke4roh has joined #circuits12:16
*** qwebirc20622 has joined #circuits12:43
qwebirc20622Hi! I'm playing with the framework and stuck with Manager.start() method application. My usecase is to create main component which utilized WebSocket and during its lifecycle spawn another components that run in another threads, instead of processes. Problem is that it seems my event from child component can't reach its way back to main component, what could be wrong?13:07
qwebirc20622In sequential execition, everything is fine, the only difference between them is a call of Manager.start()13:08
spaceonecan you show the sourc code?13:09
qwebirc20622Wait a sec, I'll try13:10
qwebirc20622spaceone: can you see it by link?
spaceonewell, no13:13
spaceonethey force a login13:13
spaceonefuck bitbucket... gitlab/github is way more better :-P13:14
qwebirc20622Once upon a time they had GitHub auth and I were surprised trying to find the button couple of weeks ago13:14
spaceonei maybe can clone it?13:14
qwebirc20622Clone requires auth13:14
spaceonethen not13:15
qwebirc20622Okay, then I need a gist...13:15
spaceonei have an idea, if the thread ends, do you call manager.join() ?13:16
spaceonein the main thread?13:16
qwebirc20622spaceone: in main thread I call just run()13:17
qwebirc20622spaceone: here if I call .start() afterwards with process=False, event write() called in this part get lost
qwebirc20622spaceone: Updated the gist, added mixture
spaceonei still don't see where start() is called13:21
qwebirc20622spaceone: so, basically and instance of Player is created in MainThread and .run() is called. The instance accepts child class of Game as constructor argument, so during its lifecycle the games is added into the event loop13:21
qwebirc20622spaceone: okay, added the start() explicitly I just tried to revert changes13:22
spaceonedid you added the Debugger component, to see what's going on?13:23
qwebirc20622That's how I know that write() is called but no sequential websocket write() happens13:24
qwebirc20622The worst part about it is that if I call start() first and register() afterwards for the game, my docker containers stuck and I need to restart the whole docker xD Once it ever crashed13:25
qwebirc20622Oh, I mean, register() and then start()13:26
qwebirc20622In reverse I get exception smth like Unregistrable13:26
spaceonei am nor sure if start() is designed to be called multiple times13:26
qwebirc20622Its called only once for each instance13:26
qwebirc20622And there's examples for a few instances but any example of start() relies on processes and IPC13:27
qwebirc20622I can try that too but why13:27
spaceonewell, for each instance is more than once13:28
spaceoneat least for me it looks strange to register() and start()13:28
qwebirc20622Well, do you think I need to skip register()? But are you sure that these managers can exchange events without registration?13:29
spaceonecan you call self.stop() in gameover() ?13:29
spaceoneno, they can'T13:29
qwebirc20622If process=True, it calls register() upon link argument, so I think that's quite logical13:30
qwebirc20622well, all of the events are driven by server that I don't manage13:30
qwebirc20622OFC I can just fire the event but is it really necessary?13:30
spaceonewhich event?13:32
qwebirc20622the gameover13:32
spaceonegameover runs on a server? and you are only the client?!13:33
qwebirc20622Gameover is sent by server13:33
qwebirc20622And yes, I'm the client13:33
spaceoneand is the client13:34
qwebirc20622I'm simply reflect the server events, which are start -> turnover -> gameover and on each except for gameover I should return a result13:34
qwebirc20622yes, everything13:34
spaceonedo you have multiple players in one client?13:34
qwebirc20622No, its one player and multiple simultaneous games13:35
spaceoneah okay13:35
qwebirc20622each game stops at random time13:35
spaceonehow do they stop?13:35
spaceonevia gameover() and win() on the server?13:35
qwebirc20622and when it stops, a gameover event is sent by server to me(the client)13:35
spaceonethis sends some json to the client?13:36
spaceonebut doesn't handle it13:36
qwebirc20622the last if statement in the 'read()' is all about servers13:36
qwebirc20622It just fires associated event13:36
qwebirc20622so I free player from game lifecycle management13:36
spaceonewhich event would that be?13:36
spaceoneso turnover and gameover are executed on the client?13:38
qwebirc20622so, let me give you a short explanation. A player connects to server and awaits response. On response, it log in. After that, it receives a set of games, each game is associated with one message.13:38
spaceoneno, wait13:38
spaceonei think i got most13:38
qwebirc20622Then, for each game event sequence goes like  [(create instance) -> write() -> [ turnover() -> write() ] + -> gameover()]13:39
spaceoneso, as i suggested:13:39
spaceonewhy don't you call self.stop() in gameover() ?13:39
qwebirc20622But to free player from knowledge about events, there's a dictionary associated from them13:39
qwebirc20622See, the problem is that I don't even reach to gameover event13:39
qwebirc20622let me add some log to gist13:40
spaceonebtw. you should use handlers.get(state) instead of handlers[state] in line 5813:41
qwebirc20622spaceone: take a look at it13:41
qwebirc20622spaceone: why?13:41
spaceonebecause if the server sends 'foo' you will end up in a exception13:42
qwebirc20622spaceone: well, I check if the name is in the dictionary13:42
qwebirc20622spaceone: but thanks for advice13:42
qwebirc20622ah, you mean additional format validation, I get it13:43
spaceoneno you don't13:44
spaceone            handler = handlers[state]13:44
spaceoneif handler is not None:13:44
qwebirc20622yeah, I've got your idea, thanks13:44
spaceonebut well, do you see that each game is started in an own channel?13:44
qwebirc20622spaceone: yes, that's the idea13:45
spaceoneproably the event-handlers are not watching these channels13:45
qwebirc20622spaceone: well, as I said at the start, if I remove Manager.start(), everything is fine13:45
spaceonethey are in the channel 'player'13:45
qwebirc20622Wait a sec, I'll try to run sequentially once again13:46
spaceoneand what if you start a prcess instead of a thread?13:46
spaceonedoes it changes anything13:46
spaceoneand why are the "registered" events after the "read" events? this could be the failure13:47
qwebirc20622spaceone: you see, for that I would need a little bit of refactoring to utilize ipc() event13:47
spaceoneokay, then doesn't matter13:47
qwebirc20622spaceone: what do you mean by the failure?13:47
spaceoneoh, nothing13:48
spaceonei just saw that the read events are the start()13:48
qwebirc20622spaceone: I added the successful log, as you can see, the write[player] is followed by write for to the websocket13:54
qwebirc20622Just need to remove the .start() and it works13:54
spaceonefor me it still looks like a channel name problem13:55
qwebirc20622Yeah, it seems as if event can't reach the player channel in MainThread13:55
qwebirc20622Now, I will try to check IPC case and see if it improves my situation13:56
spaceonehm okay13:56
spaceonedid you implement response() ?13:58
spaceoneor is it from the websocket component?13:59
qwebirc20622Its in the mixture class13:59
spaceonecan you test what happens if you fire it into the game-12345 channel?14:02
spaceoneshouldn't the logs also contain the authentication phase?14:03
qwebirc20622spaceone: it contains just anonymous one14:08
qwebirc20622spaceone: I can but WebSocket listens events on channel='player'14:09
spaceonehmm, okay.. currently i don't have a clue then14:12
spaceonei never worked with threads i think14:12
spaceoneonly once14:12
qwebirc20622spaceone: logic with bridges(used by start()) seems a bit weird, I'm forced to store the uuid on a player side, on the other hand, it is not clear how to determine the uuid on child side14:48
*** ke4roh has quit IRC20:40
*** qwebirc20622 has quit IRC21:09

Generated by 2.14.0 by Marius Gedminas - find it at!