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

mthaddonChipaca (although you're not here) thx! :)06:57
Chipacamorning all08:09
mthaddonChipaca: morning! thx for the mock - that definitely works, just need to figure out why mocking GunicornK8sCharm directly doesn't work08:19
Chipacamthaddon: as I read it, the first argument to patch() needs to be something you can import08:21
Chipacaso it doesn't work on methods nor attributes of a class08:21
Chipacaand doubly so for methods on attributes of attributes of attribtues of a class :-p08:21
Chipaca(because charm.unit is charm.model.unit is charm.framework.model.unit)08:22
mthaddonright, I see08:23
mthaddonso the message "ModuleNotFoundError: No module named 'charm.GunicornK8sCharm'; 'charm' is not a package" is a little confusing because you can import charm (we're doing that earlier in the tests), but you can't import the specific thing I was trying to mock08:25
Chipacamthaddon: a package and a module are different things08:29
Chipacamthaddon: charm is indeed not a package08:29
Chipacait is a module08:29
Chipacamthaddon: took me a bit to notice that one :)08:29
Chipacamthaddon: packages are modules that have modules in them08:30
Chipacawhat it's saying is that it can't do "from charm.GunicornK8sCharm import blah"08:30
Chipaca(although AIUI it's actually trying something even deeper, ie importing charm.GunicornK8sCharm.model.unit08:31
Chipaca)08:31
Chipacamthaddon: and reading https://github.com/python/cpython/blob/3.8/Lib/unittest/mock.py#L1546 what it does is drop the last .foo, and then walk the other things importing them08:33
Chipacaie if you say patch('foo.bar.baz.quux') it'll import foo, foo.bar, foo.bar.baz, and then grab quux from the last one08:34
mthaddonack, thx for the info - will read up on that08:34
moon127Chipaca: Do you think we could get a review of https://code.launchpad.net/~moon127/charm-k8s-unifi-poller/+git/charm-k8s-unifi-poller/+merge/389643 today now we discussed and pushed changes?  It would be nice to get that landed.08:52
Chipacamoon127: yes08:54
moon127ta08:55
Chipacathe behaviour of subprocess.run() with shell=1 and multiline arguments on windows is less than good10:00
Chipacagrmbl10:00
* bthomas does cart wheels10:25
bthomasFixed problem with charm not updating status. Now get hook failed "start". Some progress .10:26
facubatista¡Muy buenos días a todos!11:03
facubatistaChipaca, "the behaviour of .* on windows is less than good"11:04
facubatistaChipaca, hola! if I get to land https://github.com/canonical/charmcraft/pull/140 , I'll start the release process11:09
mupPR charmcraft#140: Always log the charmcraft version when indicated <Created by facundobatista> <https://github.com/canonical/charmcraft/pull/140>11:09
Chipacafacubatista: +111:45
facubatistaChipaca, thanks11:45
facubatistaChipaca, let's take a look at https://github.com/canonical/charmcraft/issues?q=is%3Aopen+is%3Aissue+milestone%3A0.4.0 ? The three issues there are not finished, but progressed enough and we can aim those to 0.5.0 now, let's move them?11:48
Chipacafacubatista: fo sho12:01
facubatista?12:01
Chipacafacubatista: for sure12:01
facubatistaChipaca, no meeting?12:02
Chipacafacubatista: michał set themselves as not going, so ¯\_(ツ)_/¯12:02
facubatistanatalia is not "no" but neither "yes" :/12:03
facubatistaChipaca, improve as you will, and let me know, thanks! http://linkode.org/#AvxqcVJWEFzDCEGONFFN5312:19
facubatistaChipaca, I improved the order (forgot to do that), please check linkode's node 212:22
Chipacafacubatista: specifities?12:40
narinderguptaChipaca, at last I was able to run the action but I have install python3 as python2 was not sufficient enough to run the action. Is it something we can change?12:40
Chipacanarindergupta: no12:40
Chipacapython 2 is not supported12:40
narinderguptaChipaca, so python3 is prerequisite for action12:40
narinderguptaChipaca, ok so we have to install it manually in k8s for Cassandra.12:41
narinderguptaChipaca, also event.set_results({"message": outputmes}) it seems it took me sometime to understand the format. Do you think it can make it easy for others in framework.12:43
Chipacafacubatista: check node 3 plz12:48
facubatistaChipaca, "commandline" or "command line"?12:49
Chipacafacubatista: both :-D12:49
Chipacanarindergupta: what exactly is the problem with set_results?12:50
narinderguptaChipaca, there is no problem just to understand the how parameter passed took me sometime. I was expected just message string but I have provide "message": "string"12:51
Chipacanarindergupta: i mean, it's a mapping12:53
Chipacait doesn't have to be "message"12:53
narinderguptayeah12:53
narinderguptaevent.set_results({"message": outputmes})12:54
narinderguptaI have to use above command to setup the action message12:54
Chipacanarindergupta: because actions results are mappings12:54
narinderguptaChipaca, I understand it now and it took me sometime to understand it that's what I am trying to communicated.12:55
narinderguptaChipaca, this is what charmcraft provide event.set_result(12:57
narindergupta                "Probability is too important to be left to the experts."12:57
narindergupta                " -- Richard Hamming")12:57
narinderguptaAnd which does not work.12:57
Chipacad'oh, that's a bug12:58
narinderguptaChipaca, just one more query do we know which even get fired if we use juju remove-unit12:59
Chipacafacubatista: can we slip a fix for this into today's release12:59
Chipacait's super small but it's a bug that breaks the action13:00
Chipacaanyway, heading into an interview now13:00
facubatistaChipaca, yes13:01
facubatistaChipaca, let's talk after your interview13:01
jammorning all13:06
bthomasgood to have you back jam13:15
jam o/13:15
justinclarkhello o/13:34
Chipacajustinclark: goooooooooooooooooooooooooood  morning!13:47
deejChipaca: If you've got a chance to have a look back at the MPs on the openldap charm it'd be appreciated, there's a couple bits of cleanup I'd like to get landed but it'd be nice to get these out of the way first13:50
deejhttps://code.launchpad.net/~deej/charm-k8s-openldap/+git/openldap/+merge/38934513:50
deejhttps://code.launchpad.net/~deej/charm-k8s-openldap/+git/openldap/+merge/38960613:50
facubatistahola justinclark13:51
facubatistaChipaca, so, which bug we should work on urgently?13:51
Chipacadeej: augh. will try to get to those right after the ones for moon12713:57
Chipacafacubatista: i don't think narinder filed it :-)13:57
deejRight on, ta!13:57
Chipacafacubatista: i'll try to repro it now, but it's easy to see13:57
Chipacafacubatista: the arg to set_result in _on_fortune_action in charm.py.j2 is wrong13:57
Chipacafacubatista: because set_result doesn't exist, and set_results takes a map13:58
* justinclark is caffeinated13:58
Chipacaso it's all wongled13:58
Chipacahmmmm13:59
Chipacaor maybe i'm confused and there is no bug13:59
Chipacahmmmmm³13:59
Chipacahah! mocks13:59
Chipacayeah, it's a bug13:59
Chipacathe code tests that it does what it does, which is not what it should do14:00
Chipacafacubatista: charmcraft#14114:11
mupIssue charmcraft#141: action created with 'charmcraft init' calls nonexistent method set_result on the action event <Created by chipaca> <https://github.com/canonical/charmcraft/issues/141>14:11
facubatistaChipaca, you working on it or shall I?14:12
drewn3ssAm I right in that there's no way to unregister an observer in the code currently?14:12
Chipacacommitting the fix14:12
Chipacadrewn3ss: yup14:12
Chipacadrewn3ss: what would you do that for? :)14:13
drewn3sslet me send the code for a better explanation.14:13
drewn3ssbut basically, on_relation_joined of an interface Object may need to register itself to observe config_changed14:13
drewn3ssbut on departed, if there are none left, it should stop responding to the hook14:14
drewn3ssI mean, it'll still be there and it will be a no-op because there's no related units14:14
drewn3ssthe classic "scale-back" issues of charming.14:14
Chipacadrewn3ss: yeah, share code, because that didn't make sense to me when reading it14:15
Chipacaif you register interest in an event in an event handler, you'll never get called14:15
Chipacaso... i guess it already deregisters? always? unconditionally no matter what? :-p14:16
drewn3sswell, I first ran into this because I was observing config_changed from init of the object14:17
drewn3ssrather than from within the event14:17
drewn3ssand then it was observing config_changed before it was even attached14:17
drewn3sswhich was not intended14:17
Chipacadrewn3ss: if your charm doesn't register to observe an event in its constructor, it will never 'get' that event14:18
Chipacadrewn3ss: the charm isn't "alive" all the time, it's brought up, constructed from zero, for every event14:19
Chipacadrewn3ss: so one thing you _could_ do (and I'm not saying it's a good idea) is set a flag in stored state and use that in __init__ to observe or not a certain event14:20
drewn3sshttps://git.launchpad.net/~afreiberger/charm-cloudstats/tree/lib/interface_prometheus/operator.py?h=feature/public-charm#n3114:21
Chipacafacubatista: https://github.com/canonical/charmcraft/pull/142 alstublieft14:21
mupPR charmcraft#142: fix the action generated by 'charmcraft init' <Created by chipaca> <https://github.com/canonical/charmcraft/pull/142>14:21
facubatistaack14:22
drewn3ssand where it's instantiated in the code https://git.launchpad.net/~afreiberger/charm-cloudstats/tree/src/charm.py?h=feature/public-charm#n5514:24
drewn3ssprovider relations need to be able to react to config_changed14:25
drewn3ssand that needs to not have to be handled by the charmer, is my gut feeling14:25
drewn3ssthough, hmm...now that I'm thinking about it, I need to be able to update the config of the relation on config-changed, so maybe that's the wrong place to put it.14:26
drewn3ssbut I'm still going to have to register it and deregister it on joined/departed14:26
drewn3ssbecause I don't want to react to config_changed until I've got the relation available14:27
drewn3ssactually, yeah, that should only be reacting to changes of it's own config...nvm, I see your point, and it's not something I need now, but I will need to de-register in the future, I feel.  or just ensure it's a no-op when I get there because there are no related units.14:28
drewn3ssok, I've put the code in the riight path now, but I think I need to figure out what event.defer() does.14:39
Chipacadrewn3ss: event.defer marshals the event and plops it into a database, and it's then at the top of the queue the next time the charm comes up to handle an event14:42
Chipacadrewn3ss: so i guess the exception to the '1 event per charm invocation' is deferreds, which get to run before the event that caused the charm to be built14:43
drewn3ssok14:43
drewn3ssdoes that happen on failed hook --retry, too?14:43
Chipacayes i don't think the charm gets to know it's a "retry"14:44
drewn3ssmakes sense.14:44
drewn3ssthanks!14:44
Chipacahth14:44
drewn3ssnow I just have to ask why the original coder of this charm wanted to defer some of these events.14:44
drewn3sslooks like it's order of operations management14:44
Chipacadrewn3ss: there is a need for something a charmer can used to say "don't bother me at all until all these things are true", which is the dependencies thing14:45
facubatistanarindergupta, may I have your review of https://github.com/canonical/charmcraft/pull/142 ? thanks14:46
mupPR charmcraft#142: fix the action generated by 'charmcraft init' <Created by chipaca> <https://github.com/canonical/charmcraft/pull/142>14:46
drewn3ssah, ok.  so, a "schedule me later". rather than building a finite state machine.14:46
drewn3ssthanks, Chipaca!14:46
facubatistaFSMs are hard14:46
Chipacablessed be its noodly appendeges14:48
facubatista:)14:48
Chipacaah no, wrong FSM14:48
facubatistaChipaca, also hard14:48
drewn3sslol14:48
Chipacafacubatista: I remember the syncdaemon FSM14:48
Chipacafacubatista: I'm going to fix the indentation of 142 by choosing a shorter fortune14:49
facubatistaChipaca, oh yes14:49
facubatistaChipaca, good choice14:49
facubatistajustinclark, bthomas, may I have a review on https://github.com/canonical/charmcraft/pull/142 ? thanks!15:18
mupPR charmcraft#142: fix the action generated by 'charmcraft init' <Created by chipaca> <https://github.com/canonical/charmcraft/pull/142>15:18
bthomasfacubatista: having a look15:19
facubatistaAh, narindergupta  mentioned it's ok but didn't approve15:19
facubatistabthomas, thanks15:19
narinderguptafacubatista, I have no option to approve may be I am not part of team?15:20
narinderguptafacubatista, gotchu you approve now15:21
facubatistathanks!15:22
facubatistaChipaca, we need to wait for Travis, now15:22
Chipacafacubatista: we no longer need to wait for travis15:41
facubatistaChipaca, wonderful, thanks15:42
Chipacamthaddon: i think you forgot to 'accept' https://code.launchpad.net/~deej/charm-k8s-openldap/+git/openldap/+merge/389345 when you did 'looks good to me'16:54
Chipacamthaddon: er, i meant 'approve'16:54
Chipacai'll look at the following one tomorrow16:55
ChipacaEOD becuase #nobrain17:02
=== ChanServ changed the topic of #smooth-operator to: general discussion of the operator framework || github.com/canonical/operator || ops 0.8.0 || charmcraft 0.4.0
facubatistaRelease done! Subproduct PR: https://github.com/canonical/charmcraft/pull/14318:10
mupPR charmcraft#143: New release (and improved howto) <Created by facundobatista> <https://github.com/canonical/charmcraft/pull/143>18:10
drewn3ss\o/18:15
drewn3ssfacubatista: I'm working on developing a new operator interface (what would have been a layer) to be included in https://launchpad.net/interface-prometheus.  This interface layer, like many others from the reactive layer repository, does not have a setup.py to define the python package.  What does your team suggest for distribution, management, and inclusion of interface modules from upstream18:19
drewn3ssprojects where it may not be appropriate or possible to get them to add packaging to their interface?18:19
drewn3ssI was seeing the readme suggests no need for submodules, but I'm wondering if this is the only solution, or if charmcraft might have another solution up it's sleeve?18:20
drewn3sstechnically, upstream is: https://github.com/tasdomas/juju-interface-prometheus18:22
drewn3sswhile we could suggest a setup.py PR and then include our personal branch in requirements.txt, this seems unideal.18:23
facubatistadrewn3ss, this interface is part of a charm?18:25
drewn3ssyeah.  I'll point you at current code.  I want to move this interface into a public repo for use in all prometheus-exporter charms.18:25
drewn3sshttps://git.launchpad.net/~afreiberger/charm-cloudstats/tree/lib/interface_prometheus/operator.py?h=feature/public-charm18:26
drewn3ssI'm still mid-dev cycle, but trying to find the apporpriate home for things like this, and it seems it'd be ideal to put it in the current interface project.18:27
facubatistadrewn3ss, on one side, if you put the interface under the opslib directory, then everybody having your charm could make use of it (using the operator's opslib import feature)18:28
drewn3sshmm...how's that work?18:29
* drewn3ss goes to see if that's in the readme18:29
facubatistadrewn3ss, but still leaves us to how people would get hold of your charm... currently it will need to have a setup.py to be pip-installed, being that from PyPI or directly from github18:29
facubatistaOTOH, charmcraft may grow the ability of downloading from charmhub in the future, but that's yet to discuss18:30
drewn3ssI think we've got a transition timing issue to solve.  I like the ops.lib idea, but the owner of this interfaced should be the central consumer, which isn't getting ported to operator any time soon.18:32
facubatistadrewn3ss, what do you mean with "the central consumer"?18:35
drewn3ssWell, thinking about distribution of this interface from a product perspective, this is an interface that is used to connect many different exporters to prometheus18:36
drewn3ssso, ultimately, prometheus should be the project that owns this interface18:36
drewn3ssand should live in that charm's opslib, right?18:36
drewn3ssI, as the developer of one of 100 exporters shouldn't own the interface to the main/central consumer18:36
facubatistadrewn3ss, you *could*, and people could use yours if let's say Prometheus Inc :p doesn't provide one18:37
facubatistaI could provide another18:38
facubatistaand eventually Prometheus Inc could provide another18:38
drewn3ssright, but we already have providers listed for several interfaces iin the reactive framework18:38
facubatistaanybody can decide which interface to use through opslib mechanism18:38
drewn3ssis there anything you can point me to for opslib?18:38
drewn3ssI've been sifting the discourse w/out finding quite what I'm looking for.18:39
drewn3ssI did see ops-lib-pgsql is out on pypi18:39
drewn3ssand so docs on how to use the libs makes sense, but how do I distribute?18:39
drewn3ssand how do I make ensure namespace is clear and usable by me (ala snapstore registration of names)18:40
facubatistadrewn3ss, for opslib we don't have namespaces, you can push to PyPI a project 'drew-prometheus', which can have your interface under the opslib directory, and that will be enough for me to use it18:41
facubatistawe don't have much docs yet :(18:41
drewn3ssokay, so I'd have to publish and maintain the package in pypi18:42
drewn3ssbut charmers have not had to do this in the past18:42
facubatistadrewn3ss, if it's pip-installable, you can leave it in github, but you need the setup.py18:42
facubatistahow was it distributed in the past?18:43
drewn3sslayer.yaml interface-prometheus18:43
drewn3sshttps://github.com/juju/layer-index18:45
facubatistadrewn3ss, noted, I'll talk about this with Chipaca, thanks18:45
drewn3ssmuch appreciated, thank you :)18:45
facubatista:)18:46
drewn3ssI'm just concerned that we have a lot of projects already established with owners for charm interfacing, and I don't want to reinvent all of that.18:46
facubatistaack18:46
drewn3ss(I also tried a lot of ways to get pip to just download a project w/out a setup.py and failed)18:47
drewn3sswould be interesting if we could define a generic project that had a setup.py and took #egg as a variable to go hunt for the non-packaged module :)18:48
drewn3ssbut, lord... -_-18:48
drewn3ssand to be clear, interface-prometheus is in our control, but elasticsearch interfaces are owned by omni-vector, for instance.18:48
facubatistadrewn3ss, I have to run now, but for sure I'll focus on this18:49
drewn3ssthanks, m8.  have a good evening.18:49
* facubatista -> tennis, bbl18:50
* facubatista is back21:30
* facubatista eods and eows22:12
facubatistasee you all back on Monday22:12

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