/srv/irclogs.ubuntu.com/2020/03/27/#smooth-operator.txt

Chipacagood morning all!09:10
mthaddono/09:12
Chipacamthaddon: how's things?09:15
mthaddonstaying healthy so far thanks - and you?09:15
Chipacamthaddon: healthy *and* sane!09:16
* Chipaca is winning09:17
mthaddon:)09:18
Chipacamthaddon: I keep on going back to your 'operator framework documentation' document, and i'm thankful for it every time09:19
mthaddonah cool, yeah, I saw you'd started work on rewriting the README. Glad that's proving useful09:20
Chipacat0mb0: 👋09:46
facubatistaMuy buenos días a todos!11:07
Chipacafacubatista: goood  morning!11:08
facubatistahola Chipaca11:08
* Chipaca takes a braek11:26
facubatistathe Framework.observe method gets whatever we pass it as a callback and checks isinstance(observer, types.MethodType)11:51
facubatistawhy it has to be a method?11:51
facubatistait exploded to me, I was doing a quick         self.framework.observe(self.on.upgrade_charm, lambda e: logger.info("====== upgrade ok"))11:52
ChipacaI don't know why, when I saw that I thought "that should be something like `callable`"11:54
facubatistalet's see if somebody has a reason for that, otherwise I'll fix it11:54
Chipacafacubatista: maybe better filed as a bug, people seem off today11:59
niemeyerfacubatista: Events are persisted12:04
niemeyerfacubatista: We don't want to store code in the database12:04
niemeyerfacubatista: Hopefully the error method was indicative of what it needed to be, or was it not?12:05
niemeyers/error method/error string/12:05
Chipacaniemeyer: I don't understand how one thing follows from the other12:06
facubatistaRuntimeError: Observer method not provided explicitly and function type has no "on_upgrade_charm" method12:06
facubatistaI understand now "Observer" as I read the framework code12:07
niemeyerfacubatista: That's not entirely clear12:07
facubatistaniemeyer, right12:07
niemeyerfacubatista: Might be improved indeed12:07
niemeyerChipaca: Which things thing follows what?12:07
facubatistaChipaca, we store the *method name*, not the method itself12:08
Chipacaniemeyer: events are persisted, we don't want to store code in the database, so the handler needs to be a method12:08
facubatistaChipaca, later we do a getattr, I guess12:08
Chipacawe store the method name? why?12:08
niemeyerChipaca: Deferring12:08
Chipacabut we stored the event, and the charm is initialized so all the handlers are hooked up12:09
niemeyerChipaca: we don't call the same observer twice unless it asks to be called again12:09
Chipacawhy would we store the method name?12:09
niemeyerChipaca: I just responded that one.. :)12:09
Chipacano you didn't :)12:09
niemeyerSuch a productive conversation12:10
Chipacayes12:10
Chipacayou are being obtuse12:10
Chipacaplease stop12:10
niemeyerChipaca: I've been trying to explain things, and meanwhile you've been saying the equivalent of "I don't understand it".. unless you ask intelligent questions, I can't help you12:11
facubatistaniemeyer, if I get an event foo, and I defer it, why can't we store "foo", then in the next run, we deliver "foo" to whatever is hooked at that time?12:11
niemeyerfacubatista: Because of that issue above: we don't call the same observer twice unless it asks to be called again12:11
niemeyerfacubatista: For that to happen, we need an identity for that "it asks"12:12
niemeyerfacubatista: How would you do that for a lambda?12:12
Chipacaok, now I understood, thank you12:12
facubatistabut if I deferred it, I'm not asking to deliver me the event in the future? the problem is if I change the method or callable (charm upgrade) in the middle?12:13
Chipacafacubatista: but you might have multiple handlers for the event12:13
Chipacafacubatista: and only some of them deferred12:14
facubatistaah, right12:14
facubatistaniemeyer, Chipaca, thanks!12:14
facubatistathis is the kind of details we need to be sure is in the docs :)12:14
Chipacafacubatista: and in the errors :-D12:14
niemeyerfacubatista: To be honest, I've been always double-hearted about the whole deferring thing12:15
niemeyerIt might not pull its weight12:15
niemeyerIt's also worth noting in this context that we err on the safe side..12:16
niemeyerDespite the apparent way it works, internally handlers don't really ask for deferring an event12:16
niemeyerThey do the opposite: the ack the event as handled12:16
niemeyerThe act of deferring prevents that acknowledgement12:17
facubatistaniemeyer, deferring event across runs complicates a lot of little things (not only the code, also the developer thinking of the model) -- are there cases where deferring the event is the only sane option?12:17
facubatista(with "model" I didn't mean the juju model, but the "how my charm works and handle all system complexities")12:18
niemeyerThis is a long way to say that deferring doesn't in fact trigger a complex path into the code.. we _always_ persist events, and then trigger a common path that handles pending events12:18
niemeyerThat's what makes me feel a bit less bad about the complexity..12:19
niemeyerOur logic makes it harder for events to be lost, even if you never call defer() at all12:19
niemeyerfacubatista: I would simply not explain any of that complexity until really required.. if people have to understand the details of that stuff, we failed12:21
facubatistaniemeyer, mmm... if we don't persist it, and we crash while handling it... the Agent would not re-send it as we never acked it?12:21
niemeyerfacubatista: I'm a bit confused about the context for this question.. we always persist it, right?12:22
facubatista(don't really know how the Agent works in this regard)12:22
niemeyerfacubatista: Yeah, that's what I was trying to explain above: we *always* persist it12:22
facubatistaniemeyer, yes, we always persist it; I'm challenging that decision :)12:22
niemeyerfacubatista: This is not triggered by deferring12:22
niemeyerfacubatista: The difference in deferring is actually very small in terms of overall behavior12:22
niemeyerfacubatista: You simply flip a switch saying "do I remove this event now that I handled it?"12:23
niemeyerfacubatista: Everything else is exactly the same12:23
facubatistaniemeyer, yes, because we always persist it12:23
niemeyerYeah12:23
facubatistaniemeyer, bear with me a little in this other POV12:23
niemeyerfacubatista: Which means that on crashes the event will be sent again12:23
facubatistaniemeyer, what if we NOT always persist it? what if we persist it only when deferring? we may crash while handling it, yes, but shouldn't the Agent re-send the event?12:24
niemeyerfacubatista: Not necessarily, and our events don't come only from the agent12:24
facubatistaah, right, it may be a pure internal event12:25
niemeyerfacubatista: This entire logic works any time something calls emit()12:25
facubatistaniemeyer, great, I see now all the picture, thanks!12:27
* facubatista adds a note to improve that error message12:28
niemeyerfacubatista: np, and it sounds healthy to continue challenging such options12:32
Chipacaniemeyer: question: in what situations do we expect snapshot/restore to be used?12:41
niemeyerChipaca: Hopefully not much.. it's the underlying mechanism that enables StoredState, which is a much nicer interface for normal development12:42
Chipacaniemeyer: so https://github.com/johnsca/interface-mysql/blob/master/interface_mysql.py is not kosher then?12:43
Chipacamaybe it predates storedstate?12:43
niemeyerChipaca: EventBase is not an Object at the moment.. I had an exchange here with facubatista recently covering that.. he was going to do some research to see how hard it would make it a more usual object12:45
niemeyerI think that's the only odd case we have12:45
niemeyerI won't be around for the standup today, but please drop me a note here if you need something13:07
facubatistaniemeyer, comments on this would be great, thanks! https://docs.google.com/document/d/1zKwzo26bNVFgohaRB_kdUCsFPY3OcjfcpQklGpkOHpc/edit#13:15
* facubatista brb13:15
* facubatista is back13:21
* Chipaca wishes all standups went like that14:04
axinoah so this is where the cool kids hang14:32
axinohang out14:32
axino(is probably better English !)14:32
facubatistahello axino14:35
Chipacamthaddon: https://github.com/canonical/operator/blob/06d242ff31b4a5cc6e7e829f9e8f99c6974def86/tbd_examples.md FWIW14:44
Chipacaaxino: welcome!14:44
axinoo/14:44
Chipacamthaddon: I'm just staging stuff in that PR while I finish getting our docs ducks docked14:44
mthaddonChipaca: nice! definitely like the format, makes sense14:46
Chipacathis assumes i understood the questions tho :-D14:46
niemeyerfacubatista: Replied with a few comments15:01
niemeyerfacubatista: In general it looks nice15:01
niemeyerHello new people15:01
facubatistaniemeyer, ack15:03
facubatistaniemeyer, we are in the same page, then; there's one extra case annotated now in the spec, but I need to check with juju one detail about multiple parameters15:22
facubatistaand confirmed!15:27
facubatista(multiple --breakpoint parameters is possible in juju)15:28
facubatistathere are current cases for this, e.g. --overlay in juju deploy15:28
niemeyerI'd just accept --breakpoint=a,b,c as you suggested15:28
facubatistaniemeyer, in reality, if the user goes and write --breakpoint=a,b,c, juju would set up JUJU_BREAKPOINT to "a,b,c", and it will work just the same :)15:29
niemeyerRight15:29
niemeyerAs long as you define that this is the behavior :)15:29
facubatistathe Spec is in good shape15:29
facubatistayay, my first spec here :p15:30
niemeyer👏 👏 👏 👏 👏15:30
Chipacafacubatista: it's even better than that15:31
Chipacafacubatista: it's _the_ first spec here :-D15:31
facubatistajajaja15:32
* facubatista -> lunch15:32
* facubatista is back16:34
Chipacahmm17:15
Chipacafacubatista: i just set the approved date on that spec, but then thought17:15
Chipacamaybe we should ask our juju friends first :)17:16
facubatistaChipaca, what about?17:16
facubatistaI mean, ask them?17:16
Chipacafacubatista: whether they're ok with the changes to debug-hook17:16
Chipacacan't imagine a scenario where they block it though17:17
* Chipaca might just be short of imagination17:17
facubatistaChipaca, it's a step in the milestone, but it's a good idea indeed to gain consensus in the spec itself17:17
facubatistaChipaca, who would be the persons to contact about this?17:18
Chipacafacubatista: I'll see if rick_h has a moment17:18
Chipacafacubatista: ok, no answer on that front, so I'd say let's leave it with jam18:17
facubatistaYES YES YES20:23
* facubatista dances the success dance20:23
* facubatista eods and eows21:00
facubatistasee you all on Monday21:00
Chipacaaw man i missed the success dance21:37
niemeyerNever too late for dancing..21:41

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