|
=== jam1 is now known as jam |
|
[09:17] <niemeyer> Mornings |
|
[09:18] <Chipaca> good morning! |
|
[09:24] <Chipaca> jam: WRT create_harness returning one arg or two, I think it being two does signal the divide very cearly, but OTOH it feels very un-pythonic and very go-ish |
|
[09:28] <Chipaca> I wonder what Facu thinks about two-vs-one, maybe it's not as unpythonic as i think |
|
[09:29] <niemeyer> The main question I'd ask in this context is whether people will use both almost always |
|
[09:29] <niemeyer> If that's true, then returning both seems fine.. if it's not true, then it's a bit awkward |
|
[09:31] <niemeyer> The create_harness name also leans itself to a single argument a bit better |
|
[09:32] <niemeyer> Another advantage of the single argument is that as the harness is passed around, the many test methods will have the charm at hand as well |
|
[10:30] <Chipaca> hm, mark maglana makes a fair point |
|
[10:30] <Chipaca> bah, more or less |
|
[10:30] <Chipaca> hm |
|
[10:44] <jam> Chipaca: well for me, integration tests would be the next level up, where you are interacting with other charms. |
|
[10:44] <jam> I don't see a way to "just do unit tests" of MyCharm.on_install without having the harness |
|
[10:44] <jam> since the whole point is that on_install is going to look at the model and figure out what it needs to do. |
|
[10:44] <Chipaca> that's the "more or less" thing: there isn't One True Definition of where the line between unit and integration and functional and … is |
|
[10:46] <Chipaca> jam: i'll answer on the pr |
|
[10:52] <Chipaca> hopefully that communicated the nuances |
|
[11:00] <jam> thx |
|
[11:00] <jam> https://github.com/canonical/operator/pull/181 is some docs for charm.py. It turns out I didn't want to make anything private. |
|
[11:01] <Chipaca> jam: yeah from that ginormous list i grepped there wasn't anything that stood out as private, to my eyes |
|
[11:02] <Chipaca> WRT #160, do we want ops to be a namespace or not? |
|
[11:02] <Chipaca> we could always have a separate namespace package that's only used for that |
|
[11:02] <Chipaca> might make things easier |
|
[11:02] <Chipaca> e.g. have ops-helpers |
|
[11:03] <Chipaca> ops_helpers* |
|
[11:04] <Chipaca> then we'd have ops_helpers-apt as a repo/pypi entry, with ops_helpers.apt in it, etc., getting the independent component aspect of the namespaced without the worry about random people polluting ops itself |
|
[11:10] <jam> unfortunately this falls very much into "until we use it in anger, we won't really know how one vs the other feels" |
|
[11:11] <jam> ops.helpers is a bit nicer, IMO, but requires ops to be a namespace first. |
|
[11:12] <jam> Chipaca: so LazyMapping is one that I would consider making private, as it is an implementation detail. same for BindingMapping and *maybe* RelationMapping, though the last one is exposed as an attribute from Model.relations |
|
[11:13] <jam> the other 2 are not directly exposed. |
|
[11:14] <jam> Handle is probably also something that is more of an implementation detail for events. |
|
[11:14] <jam> It doesn't feel like something that we would want charmers to actively engage with. |
|
[11:15] <jam> Chipaca: it is now quite hard for me to go through looking for private things and *not* docstring everything... |
|
[11:16] <jam> StoredDict/List/Set also feel like they should be hidden details. |
|
[11:16] <jam> Yes you have one of them, but you shouldn't be creating them. |
|
[11:16] <Chipaca> just because it's exposed doesn't mean it has to be public, right? |
|
[11:17] <Chipaca> i mean we could document it as a collections.abc.Mapping or something |
|
[11:22] <Facu> Muy buenos días a todos! |
|
[11:28] <Chipaca> Facu: goooood morning! |
|
[11:28] <Facu> :) |
|
[11:29] <Chipaca> hehe, i hadn't use that one in *ages* |
|
[11:30] <Chipaca> niemeyer: when does your self-immolation^Wisolation end? |
|
[11:38] <niemeyer> > that's the "more or less" thing: there isn't One True Definition of where the line between unit and integration and functional and … is |
|
[11:39] <niemeyer> Yeah, I wouldn't get too worried about that either.. it's more about what we're testing and how than how people choose to label those tests |
|
[11:39] <niemeyer> I haven't seen the issue yet, though, so let me read it to get more context |
|
[11:39] <niemeyer> Chipaca: My current plan is to go back home on Saturday if nothing else happens |
|
[11:39] <niemeyer> Like me starting to cough desperately.. |
|
[11:40] <Facu> https://github.com/canonical/operator/issues/179 talks about adding a `self.open_port` that IIUC a way to telling juju to do something; do we have others like that already implemented? example? |
|
[11:41] <niemeyer> Hmm.. I don't see any issues related to functional testing |
|
[11:41] <niemeyer> Facu: Yeah, we have quite a bit of them.. they're not all sticking to the same location, though.. depends a bit on context, which you'll heave to think through a bit |
|
[11:41] <niemeyer> Facu: But basically, |
|
[11:42] <niemeyer> Facu: We have a backend that deals with calling the actual commands.. so that's the only piece of code that should be doing that job. It's replaceable for testing. Then, |
|
[11:42] <Facu> (I was trying to spot the part of the code that implements this kind of communication to juju) |
|
[11:43] <niemeyer> Facu: The Model is the thing that represents the world view in that specific charm and unit.. through it the code can navigate through several aspects such as configuration, units, apps, etc |
|
[11:43] <niemeyer> Facu: The backend method that calls the commands sticks on one of these places, trying as much as possible to relate to the specific type where the method is made available |
|
[11:44] <niemeyer> Facu: With that knowledge, navigate for a while in the model code and you'll get a good grasp of all the pieces |
|
[11:44] <Facu> niemeyer, for example, that open_port would be a method of model.Network? |
|
[11:45] <niemeyer> Facu: Maybe, but maybe not depending on what that means |
|
[11:46] <niemeyer> Facu: I'll need to dig down in the model to remember the exact relationships as well.. here is the thing to keep in mind: what is the job of open/close port? What exact part of the model is being affected by it? |
|
[11:46] <Facu> mmm... or maybe Unit |
|
[11:46] <Facu> niemeyer, perfect, thanks |
|
[11:46] <niemeyer> Facu: With that questioning, look through the existing model and try to picture it |
|
[11:49] <Chipaca> niemeyer: wrt testing, comment at the bottom of the harness pr |
|
[11:51] <niemeyer> Chipaca: Thanks.. yeah, not really worried about that point |
|
[11:52] <niemeyer> If all people every do is use the harness to test their charm, that's still much better than doing absolutely nothing.. |
|
[11:52] <niemeyer> We won't be able to force people to write tests they don't want to, no matter how we name it |
|
[11:52] <niemeyer> We can encourage them to write tests, though, by making it as easy as possible to do so |
|
[11:54] <Chipaca> sigh. People that are convinced they follow the One True Way. |
|
[11:54] <Chipaca> the one true way being, in this case, apparently, "mock all the things" |
|
[11:54] * Chipaca mocks the 'mock all the things' attitude |
|
[11:55] <Chipaca> actually, i'm being mean. i should stop that. |
|
[11:55] <niemeyer> Yeah, stop mocking them |
|
[11:57] <jam> Chipaca: so my particular feeling on his charms is that he has written yet-another-framework. Which might be a framework we want to discuss (what would it look like if our events passed the context in and got it back out again). But if he is going to implement yet-another-adapter anyway |
|
[11:57] <jam> I'm not sure there is much we could do on our end. |
|
[11:57] <jam> I do understand having clear Interfaces for your code. But eventually the abstractions make it hard to know what is actually going on. |
|
[11:57] <niemeyer> > what would it look like if our events passed the context in and got it back out again |
|
[11:57] <jam> I personally find the test quite obtuse to actually see what it is setting up and testing. |
|
[11:57] <niemeyer> What do you mean here? |
|
[11:58] <jam> niemeyer: if the State and Model were passed as parameters instead of attributes of the Charm. |
|
[11:58] <jam> eg, everything is just functional |
|
[11:58] <jam> but IMO, that is a different framework. |
|
[11:58] <niemeyer> Yeah, it's called Haskell |
|
[12:00] <niemeyer> We want to be following good practices, but we don't want to do so just because it's dogmatic.. it's more relevant to make Python developers feel *happy* to be using our APIs than it is to make a scientist happy that we're using his theories |
|
[12:00] <niemeyer> I'll be with you shortly.. will prepare myself a cuppa |
|
[12:23] <Chipaca> Facu: show me show me show me :-p |
|
[12:24] <Chipaca> Facu: does it involve PrefixedEvents |
|
[12:24] <Facu> Chipaca, this is what I have https://pastebin.canonical.com/p/P2f8G9c33y/ , focus on lines 18 and 49, which is what we want to change |
|
[12:24] <niemeyer> > Facu: show me show me show me :-p |
|
[12:24] <niemeyer> > ... how you do that trick ... |
|
[12:25] <niemeyer> Hopefully not the one that makes me scream, tho |
|
[12:25] <Facu> Chipaca, but to really try this I need something "on the other end", I was thinking about installing this charm together with https://jaas.ai/u/ubuntu-ci-engineering/graphite/trusty/1 , and change that FileLogger fake thing with a MetricWhatever |
|
[12:25] <Chipaca> niemeyer: which trick? the muti-coloured one? |
|
[12:25] <niemeyer> We're such a musical group |
|
[12:26] <Facu> I do not want to work "in isolation", I want to have real life examples to have a better grasp on how the changes would "feel" |
|
[12:26] <Chipaca> Facu: sgtm |
|
[12:26] <niemeyer> Chipaca: https://www.youtube.com/watch?v=n3nPiBai66M |
|
[12:29] <Chipaca> niemeyer: hah! these dots i had not connected |
|
[12:30] <Chipaca> in fact i think i might have heard this song once a long long time ago |
|
[12:30] <Chipaca> strange |
|
[12:33] <Chipaca> Facu: wrt PrefixedEvent (and thanks to Dmitrii-Sh for pointing this out) means you do self.on["dumper"] and you get a PrefixedEvent that has non-prefixed events on it |
|
[12:33] <Chipaca> that is, instead of self.on.dumper_relation_joined you do self.on["dumper"].relation_joined etc |
|
[12:33] <Chipaca> so that might be a natural way to go there |
|
[12:34] <Chipaca> Facu: but you're on the right path wrt not doing this in the void |
|
[12:35] <Facu> Chipaca, ack, I'll get a real life example working (but before, that summary I promised about diversity and job offer) |
|
[12:38] <Chipaca> Facu: ok |
|
[12:41] <jam> testing-harness PR updated for single return value |
|
[12:43] <Chipaca> jam: what does ‘# noinspection PyProtectedMember’ do? |
|
[13:28] <Dmitrii-Sh> charm.on[relation_name].relation_joined would be a good way to do it |
|
[13:28] <Dmitrii-Sh> you can't do something like this though: self.framework.observe(charm.on[relation_name].relation_joined, self) |
|
[13:29] <Dmitrii-Sh> because the relation_name part is a charm-specific endpoint and your interface type can't handle that variability |
|
[13:29] <Dmitrii-Sh> self.framework.observe(charm.on[relation_name].relation_joined, self.on_relation_joined) works |
|
[13:46] <Chipaca> i think i'm going to go for a run |
|
[13:47] <Facu> I don't like the implicitness of that "self" as second parameter, as targets of the events; I think we should encourage people to be explicit there, it's simpler to learn and see each others code (and *maybe* leave that option as an "advanced mechanism", for flexibility) |
|
[13:48] <Chipaca> Facu: yep, we reached the same conclusion |
|
[13:48] <Chipaca> shortly before you joined, we're discouraging the shorthand 'self' |
|
[13:48] <Chipaca> because of what it leads to |
|
[13:48] <Chipaca> but, muscle memory :-) |
|
[13:49] <Chipaca> Facu: this based in part on feedback from users that, seeing 'self', wonder why there isn't just a 'autoconnect_all_the_things' |
|
[13:51] <Facu> Chipaca, this means we will not allow this generic/implicit way? or that we would just encourage the other method? |
|
[13:51] <Chipaca> Facu: the latter |
|
[13:52] <Facu> ack |
|
[13:52] <Chipaca> actually i think we might want to think of doing the former |
|
[13:52] <Chipaca> but for now certainly the latter |
|
[13:53] * Chipaca postpones the run |
|
[15:13] <Facu> I deployed my charm, which crashed during the install hook call; I fixed it but I can't upgrade it, as it says unit-my-super-charm-3: 12:11:26 INFO juju.worker.uniter awaiting error resolution for "install" hook |
|
[15:13] <Facu> if I destroy the unit and deploy it again it's fine, but takes a loot |
|
[15:13] <niemeyer> Facu: See juju resolve |
|
[15:13] <niemeyer> Facu: See juju resolved |
|
[15:13] <Facu> niemeyer, thanks |
|
[15:14] <Facu> niemeyer, IIUC I should tell it to no retry, as before I need to upgrade it, right? I mean, it doesn't auto-upgrade it or anything |
|
[15:16] <niemeyer> Facu: It doesn't |
|
[15:16] <niemeyer> Facu: The idea is that after units error out they stop completely |
|
[15:16] <Facu> niemeyer, perfect, thanks |
|
[15:17] <niemeyer> Facu: So you say "go on, you should be good to go now" |
|
[15:18] <Facu> I used --no-retry=True (which would mean something like "please get out of the error state, but hold still") and then upgraded the charm again (which succeeded!! \o/ ) |
|
[15:18] <niemeyer> Facu: Not hold still, but just don't retry the hook that failed.. |
|
[15:18] <niemeyer> Facu: It may run other hooks |
|
[15:18] <niemeyer> Facu: and the same hook again if it has to for other reasons |
|
[15:19] <Facu> ack, "install" is a one time only hook, right? where all this is documented? |
|
[15:20] <niemeyer> Yeah, one time |
|
[16:14] <Chipaca> jam: is rtype:None the usual way of saying "this returns None"? (asking because None is not a type) |
|
[16:19] <niemeyer> This tastes sooo unpythonic |
|
[16:28] <Chipaca> niemeyer: which this? |
|
[16:28] <niemeyer> rtype:None |
|
[16:29] <Chipaca> heh |
|
[16:29] <niemeyer> I assume that's the type hinting, but maybe not? |
|
[16:29] <Chipaca> it's purportedly picked up by sphynx and presented in nice ways |
|
[16:29] <niemeyer> Ah, sorry.. ECONTEXT |
|
[16:29] <Chipaca> i've been making noises about using python's type hinting (which can be picked up by sphynx as well), which reads nicer imho |
|
[16:30] <Chipaca> but people seem unconvinced :-) |
|
[16:31] <Chipaca> niemeyer: https://github.com/agronholm/sphinx-autodoc-typehints#sphinx-autodoc-typehints is what i meant there |
|
[17:06] * Chipaca ⇝ cuppa tea |
|
[17:09] <niemeyer> Alright! |
|
[17:09] <niemeyer> Who wants some reviews!? |
|
[17:10] <Facu> niemeyer, I do! https://github.com/canonical/operator/pull/168 |
|
[17:16] <Facu> I'm kind of lost about trying a charm and an interface at the same time, probably missing some concepts here and there, I'm kind of stuck... |
|
[17:17] * Facu needs a rubber duck that actually knows juju and charms |
|
[17:17] <niemeyer> Facu: Reviewed.. I think we need to talk about it |
|
[17:17] <niemeyer> Facu: But not here.. more bandwidth |
|
[17:17] <Facu> niemeyer, https://meet.google.com/veq-yfqm-kdk ? |
|
[17:18] <niemeyer> Great, let's do it |
|
[17:49] <Chipaca> niemeyer: you said 'John--' but i'd already closed the window |
|
[17:50] <Chipaca> niemeyer: I'm going to assume it was "John you're so awesome" until disproven |
|
[17:51] <niemeyer> Chipaca: That was it |
|
[17:52] * Chipaca ← winning |
|
[18:03] * Chipaca closes ALL the PRs |
|
[18:06] <Chipaca> niemeyer: if you have a bit of time, I wonder if you have thoughts on https://github.com/canonical/operator/pull/157#pullrequestreview-370519700-body-html |
|
[18:09] <niemeyer> I'll do a full pass before the end of my day, but will take a quick break now |
|
[18:18] <Chipaca> niemeyer: also for when you come back, https://github.com/canonical/operator/issues/178 |
|
[18:34] <Chipaca> Facu: #182 fwiw |
|
[18:34] <Facu> checking |
|
[18:37] <Chipaca> Facu: I'd add a static checker to the Makefile but we want less of that arcana, not more :-) |
|
[18:38] <Chipaca> OTOH we could put it in the .travis.yml instead of the Makefile :-D |
|
[18:39] <Chipaca> OTOH² the 'right' way would involve the ast |
|
[18:44] <Facu> Chipaca, I'd not worry about that, this stuff is normally solved by code reviews and education |
|
[18:44] <Facu> Chipaca, not all unpythonicies (?) need to be catched automatically |
|
[18:46] <Chipaca> Facu: unpythonicities* :) |
|
[18:47] <Chipaca> Facu: also, cue Jasper |
|
[18:48] <Facu> Chipaca, "Jasper"? |
|
[18:48] <Chipaca> Facu: https://www.youtube.com/watch?v=sKiLfH3DVGc |
|
[18:48] <Facu> je |
|
[18:53] <Chipaca> I really wonder why there isn't a flag on logging to use format instead of C-style |
|
[18:53] <Chipaca> somebody should PIP that |
|
[19:08] <Facu> Chipaca, I have an item in my projects list to try to do that |
|
[19:08] * Facu -> short errands |
|
[19:42] * niemeyer returns |
|
[19:55] * Facu is back |
|
[21:09] <Facu> YES! I DID IT! |
|
[21:09] * Facu does the success dance |
|
[21:09] <Facu> I now have my super charm deployed together with postgresql |
|
[21:10] <Facu> my super charm and a custom/fake db interface |
|
[21:10] <niemeyer> Wooahy |
|
[21:10] <Facu> https://pastebin.canonical.com/p/ftCNRZgwrH/ |
|
[21:10] * niemeyer would high-five, but that's disallowed now |
|
[21:10] <Facu> jajaj |
|
[21:11] <Facu> I'm now in the position of starting to really explore the change |
|
[21:11] <Facu> but tomorrow! |
|
[21:11] * Facu eods |
|
[21:11] <niemeyer> That DBAvailable event really wants me to make StoredState work there |
|
[21:12] <niemeyer> s/wants me/makes me want/ |
|
|