/srv/irclogs.ubuntu.com/2020/05/13/#smooth-operator.txt

* MarkMaglana likes butternut squash soup with coconut milk00:41
MarkMaglanabut first, coffee00:41
__chip__MarkMaglana: calabacín relleno ftw08:33
__chip__good morning all08:33
* __chip__ still in alter-ego mode for today08:34
MarkMaglana__chip__: damn that relleno looks yummy! now i gotta find me one of those.08:39
__chip__jam: dunno if you saw we landed a fix to master for the flake8 woes, just chaning the charm.py for now08:43
__chip__changing*08:43
jam__chip__, I didn't see that, thank you08:43
__chip__we can look at pinning versions at some point but for now this was alright08:43
__chip__jam: i was tempted to merge it into everything red but didnt' want to trip you up :)08:43
__chip__(just 279 bah)08:44
__chip__(i merged it into mine, and i expect facu merged it into his)08:44
jam__chip__, do we have any idea why it fails on travis but not locally?08:53
jamI struggled to get a working 'different' version of flake808:53
jamtip seems broken against the pycodestyle it requires08:53
__chip__jam: it fails locally if you install flake8 and autopep8 from pip08:53
__chip__jam: last night the rules seemed more subtle than what you'd reported so maybe the issue you saw was fied08:53
__chip__jam: flake8 now asks for  pycodestyle<2.7.0,>=2.6.0a108:55
__chip__jam: and autopep8, pycodestyle>=2.5.008:55
__chip__so I get pycodestyle 2.6.0 and everything's happy (except our tests until we fixed master)08:56
jamChipaca, https://paste.ubuntu.com/p/zVsD7qkmG9/08:56
jamflake 3.8.1, pycodestyle 2.6.0 pyflakes 2.2.0 and flake8 fails AFAICT08:56
__chip__jam: maybe pip install -U ?08:56
__chip__jam: I get flake8-3.8.1, pycodestyle 2.6.0, and pyflakes 2.2.0, and it's happy08:57
jamThe original install was pip3 install --upgrade --user flake8 pydocstyle autopep808:57
__chip__jam: maybe it's python 3.6 that's the issue?08:58
__chip__i'm on 3.8 here08:58
__chip__let me try with 3.608:58
jamthe traceback implicates importlib-metadata, but that has "skipping upgrade importlib-metadata; python_version < "3.8"08:59
__chip__er, can't do 3.6, doing 3.508:59
__chip__jam: that's happy too09:00
jam__chip__, is there a clear 'uninstall everything and try again' ? Or I can just go back to whatever flake8 was working and stop fighting it :)09:00
__chip__jam: https://gitlab.com/pycqa/flake8/-/issues/40609:01
__chip__which points to …09:01
jam__chip__, opened 2 years ago, and fixed by depending on a specific version of pycodestyle09:01
__chip__yeah09:01
__chip__jam: wrt 'uninstall everything and try again', i just blow away the venv09:02
jamwhich now we're 2 versions beyond that09:02
__chip__jam: let's compare 'pip list' output09:02
__chip__jam: https://paste.ubuntu.com/p/nRgxRx4NSn/09:03
jamhttps://paste.ubuntu.com/p/FDyjwXB8x3/09:03
jam(that is the one that works, let me upgrade and try again)09:04
jamthis flake8 fails to load: https://paste.ubuntu.com/p/QxcZMwwfrT/09:05
__chip__jam: what happens if you grep for break_around_binary_operator in the lib?09:07
__chip__I only see a _break_around_binary_operator method in pycodestyle09:07
__chip__nothing calling into it09:07
mup_Issue operator#282 opened: Harness: Unable to assert if framework was called correctly by charm <Created by relaxdiego> <https://github.com/canonical/operator/issues/282>09:09
jamlib/python3.6/site-packages/pycodestyle.py:1279:def _break_around_binary_operators(tokens):09:10
jamit is an '_break'09:10
__chip__jam: right, but what tries to call break_around_binary_operator ?09:11
jam__chip__, so it is something about magically loading plugins, but my system doesn't seem to have that string, digging09:12
__chip__that exception should really print what file it's trying to load, huh09:12
__chip__MarkMaglana: thanks for the bug report!09:13
jam /usr/lib/python3/dist-packages/pycodestyle.py09:13
jamwho installed that...09:13
MarkMaglana__chip__: no worries! :)09:13
__chip__jam: gremlins09:14
jam__chip__, 'apt install flake8' depends on pycodestyle09:14
jamapparently the plugin loading finds the dist package but imports from the non-dist ?09:14
jamso to have a 'pip3 install --user flake8' I can't have an 'apt install flake8'09:14
jam__chip__, so with apt remove flake8 and a bunch of dependencies, ./run_tests fails for the "right" reason09:17
__chip__jam: huzzah, maybe09:18
jamok, so I at least can reproduce and merged the fix and pushed it09:18
__chip__MarkMaglana: question for you09:19
__chip__MarkMaglana: what does 'build_juju_unit_status' do?09:20
__chip__MarkMaglana: ah, found it09:21
MarkMaglana__chip__: it just returns a *Status object based on arguments: https://github.com/relaxdiego/charm-k8s-grafana/blob/b689a77cb2714075b2c88e5fe6442e26f1ca033e/src/domain.py#L72-8209:21
MarkMaglana:)09:21
__chip__MarkMaglana: what is pod_status?09:21
* __chip__ digs more09:21
__chip__ah, something from k8s?09:21
MarkMaglana__chip__: you got it09:22
jam__chip__, so if I understand correctly, what Mark wants is to see that his code is setting the unit status to A, and then to B, and then finally to C as part of responding to the config_changed event.09:22
jam__chip__, however, we don't assert at each step, so you can only see the final "after all is done the status is correct"09:23
__chip__MarkMaglana: why wouldn't k8s.get_pod_status return a framework status directly?09:23
jam__chip__, the config-changed handler is looping on the result of a mocked get_pod_status and should notice the transition of the pod to being active09:23
MarkMaglana__chip__: that one is to actually check if the k8s pod's livenessProbe and readinessProbe both return true.09:23
jamMarkMaglana, does the above sound correct for what you are trying to do?09:24
jamThere are 2 possibilities as I see it. 1) I do have code for a _get_backend_calls() that would give details of how you interact step by step, I don't knw that I recommend that route, but the PR is https://github.com/canonical/operator/pull/26409:24
mup_PR #264: test/test_model.py: Test Model using Harness._get_backend calls <Created by jameinel> <https://github.com/canonical/operator/pull/264>09:25
jamb) You could change your mock so that you check the unit status just before you return a new pod status09:25
MarkMaglanai think i found that calling the framework status directly doesn't give me the fine-grained result that i needed. at the time I wrote that, the framework reported the pod as ready but in the k8s layer it was just live but not yet ready to receive requests. I wanted to make sure I reported that correctly to `juju status` so that the user doesn't panic or wonder what's going on.09:25
jamso you can see "the unit status started as X, then I returned pod status Y, then the unit status updated to Y, then I returned Z, and the unit status updated to Z"09:25
__chip__"the framework reported the pod as ready but in the k8s layer it was just live but not yet ready to receive requests" ← isn't that a bug in the framework?09:26
jam__chip__, it is a practical reality that saying "start this" takes a while for it to actually start09:26
jam__chip__, there is the k8s layer that says the container has started09:26
jam__chip__, and there is the "can I actually connect to the socket of the app"09:27
__chip__ahhh09:27
* __chip__ ahhhs09:27
MarkMaglanathat's what i report with PodStatus: https://github.com/relaxdiego/charm-k8s-grafana/blob/b689a77cb2714075b2c88e5fe6442e26f1ca033e/src/adapters/k8s.py#L75-L9909:27
MarkMaglanais_running looks at the livenessProbe and is_ready looks at the readinessProbe09:28
MarkMaglanajam: sorry i didn't notice that you were chatting me up with a different topic :)09:31
jamMarkMaglana, all of that should be prefaced with, I believe in Juju 2.8 pod-spec-set was made "transactional" which means Juju won't ask k8s to start the pod until your hook exits. So setting the pod spec and spinning isn't going to get you anywhere because Juju hasn't actually started the pod yet.09:31
MarkMaglanajam: that "transactional" tip is good information. in that case what would be the best way to report back to the user about the actual status of the underlying workload?09:51
jamMarkMaglana, I'm raising the question internally if it should be transactional. one option is to hook into the 'update-status' hook that Juju fires periodically (approx every 5 min). It isn't a great update rate09:52
jamMarkMaglana, the other option is to use something like cron / a forked subprocess09:52
jamand use "juju-run" to get back into the hook context and report back09:52
jamI don't think we have much to make that easy in the framework, unfortunately09:52
MarkMaglanajam: yeah 5 mins is not ideal. :)09:53
jamThere have also been conversations that Juju should be triggering events on pod state changes09:53
jamBut all that is hypothetical09:53
MarkMaglanagotcha. hmmmm.09:53
MarkMaglanajam: interesting challenge to tackle but for now, what do you suggest i do with the assertion? should i forego checking if the status was set 3x in my unit test and just check if the final status is correct?09:54
MarkMaglanabrb my washer/dryer is singing lol09:55
jamso there is (1) which is use my patch that adds direct checking of every backend call, (2) check in the individual steps, (3) break apart the two so the one side emits events, and then you can have a second handler that monitors what events are sent. (4) just assert the final state09:55
MarkMaglanajam: thanks! i'll check out all options. :)10:01
__chip__yuss, got a dispatch shim main working10:04
__chip__main.py is now a mess10:04
__chip__refactoring :)10:05
MarkMaglanain case this helps anyone else, this has been a godsend for me when reviewing code on github: https://chrome.google.com/webstore/detail/sourcegraph/dgjhfomjieaadpoljlnidmbgkdffpack10:41
mup_PR operator#283 opened: ops/main: handle dispatch being a shim  <Created by chipaca> <https://github.com/canonical/operator/pull/283>11:03
__chip__jam: ^ wdyt?11:04
jam__chip__, about SourceGraph or about dispatch? :)11:05
__chip__jam: the latter11:05
__chip__haven't looked at the former yet11:05
* __chip__ looks11:05
__chip__MarkMaglana: doesn't github already do that?11:06
MarkMaglana__chip__: well sh**. you're right! lol.11:07
__chip__MarkMaglana: doesn't quite work in firefox yet :( but they'll get it there11:08
MarkMaglana__chip__: I'm more of a Brave browser hipster guy.11:09
facubatistaMuy buenos días a todos!11:10
__chip__MarkMaglana: ah! it does work, i was just impatient11:11
__chip__facubatista: heyy11:11
facubatistahola __chip__11:12
__chip__facubatista: could you start your day with a nice fresh cup of #276?11:13
mup_PR #276: explicitly ask for a newer sphinx on rtd <Created by chipaca> <https://github.com/canonical/operator/pull/276>11:13
facubatista__chip__, gladly11:13
* facubatista pours himself a cup of that11:14
* __chip__ passes facubatista a smaller cup11:14
* facubatista clumsyly spoils all the bytes all over desk and keyboard11:14
* __chip__ hands facubatista the kitchen towels11:15
* __chip__ watches facubatista dress up as a mummy11:15
* __chip__ /o\11:15
facubatistajajaja11:16
jam__chip__, did you even send an email/meeting for Ajduk to reschedule?11:16
__chip__i did not even11:17
__chip__i did send one to jay11:17
mup_PR operator#276 closed: explicitly ask for a newer sphinx on rtd <Created by chipaca> <Merged by chipaca> <https://github.com/canonical/operator/pull/276>11:23
__chip__jam: to schedule meetings with people in utc-6, should i make you optional, or is there any time that might work for you?11:38
jam__chip__, depends how much you want me to be there. :) I can make exceptions and work an evening here and there,and I'm willing to do a regular "monday nights I work evenings" but I wouldn't want it to be at arbitrary times11:40
__chip__jam: you kick ass at these meetings, not having you there makes them so much worse :) maybe one day a week you work evenings and we schedule these meetings for then? (i think it's just 2 (so far!) that are that far west)11:41
jam__chip__, one day a week is manageable11:42
__chip__jam: as it's just two, bi-weekly, tell me what day and at what hour :)11:43
facubatistajam, so, I deployed my blog as subordinate, which implied adding the relation to apache; at that moment "relation_joined" triggered on my charm, and I did some prints at that time...11:43
jam__chip__, so your thought is 2 every other week, or one every week?11:43
facubatistajam, as a next step, I wrote the proper code for that hook (configuring apache, if I'm right)... and then upgraded my charm... but "relation_joined" didn't trigger again... only "configuration changed"11:44
facubatistajam, what is the appropiate thing to do here? shall I hook that method to some other specific event and make it trigger? use config_changed for that? I'm failing to do a step properly?11:45
jamfacubatista, so relation-joined only happens 1 time, when the new unit is seen. relation-changed would happen multiple times if Apache is giving you feedback.11:47
jamfacubatista, I would think that telling Apache "here use this directory" only really needs to be told to it one time.11:47
jamNow, if some of your config causes a change in what content you are telling Apache about11:47
jamthen in *config-changed* you would call self.model.get_relation('apache').data[self.unit] =new stuff11:48
facubatistajam, I don't really have a config that is related to Apache, in that sense11:48
facubatistajam, so, this is useful except when "bulding" my code :(11:48
facubatistayes, when all is done it should work ok11:49
facubatistajam, can I trigger that "relation_joined" manually somehow?11:50
facubatistaor I could use an "action"11:50
jam__chip__, so 8am UTC-6 is 6pm UAE time. If that works, then doing those on Mondays at 6pm (just after our standup) would be a good time.11:50
jamIf we need to go later because people don't start at 8am, then I'd still probably want to do them on Monday.11:50
jamfacubatista, if you just want to test your code, I think you can do "juju run --unit some/1 'hooks/relation-joined'"11:51
jamthe other option is to remove the relation and add it again, but that will kill the unit and create it again11:52
facubatistajam, if I do "juju run --unit some/1 'hooks/relation-joined'", the event I got still have a .relation pointed to apache?11:53
facubatista*will still have11:53
jam__chip__, so that would be Monday, UTC 14:00. But I could go until UTC 18:00 if necessary11:53
jamfacubatista, I don't think Juju sets the JUJU_RELATION_ID, etc if you manually trigger a hook11:54
jamfacubatista, 'get_relation' should still work, because the relation is still defined, but event.relation probably won't be set11:56
facubatistaanother reason to stop using `event.relation.data` and go to `self.model.get_relation('apache').data`, which looks less "backwards thinking" than the former11:57
facubatistajam, mmm... in `self.model.get_relation('apache').data` I'm expressing "the data from an application", not "the data from an unit"11:59
jamfacubatista, you're looking at all the relation data there11:59
jamso you still need11:59
jamself.model.get_relation('apache').data[unit/or/app]12:00
__chip__jam: ack. I'll look at the calendar later and let you know what it looks like.12:00
jam__chip__, #283 reviewed. I think we're still missing a case12:00
__chip__I've jused realised the time, the bug revue, and the lack of lunch12:00
mup_PR #283: ops/main: handle dispatch being a shim  <Created by chipaca> <https://github.com/canonical/operator/pull/283>12:00
* __chip__ takes the laptop to the kitchen12:00
facubatistajam, meeting?12:02
facubatistajam, __chip__, standup?13:31
__chip__https://github.com/sphinx-doc/sphinx/pull/7655  :-D13:42
mup_PR sphinx-doc/sphinx#7655: Make sphinx.util.typing.stringify render optional unions better <autodoc> <enhancement> <Created by chipaca> <Merged by tk0miya> <https://github.com/sphinx-doc/sphinx/pull/7655>13:42
__chip__facubatista: #280 GTG13:47
mup_PR #280: Included the dependencies in requirements files, updated README and .travis <Created by facundobatista> <https://github.com/canonical/operator/pull/280>13:47
facubatista__chip__, thanks13:47
mup_PR operator#280 closed: Included the dependencies in requirements files, updated README and .travis <Created by facundobatista> <Merged by facundobatista> <https://github.com/canonical/operator/pull/280>13:47
facubatistajam, boo https://paste.ubuntu.com/p/jSgxJZjzbT/13:48
* facubatista will write an action for this13:48
mup_Issue operator#282 closed: Harness: Unable to assert if framework was called correctly by charm <Created by relaxdiego> <Closed by relaxdiego> <https://github.com/canonical/operator/issues/282>13:48
DominikFHey all! I tested the `charm create -t operator-python` command today and wanted to provide some feedback. I didn't find the changes here https://github.com/juju/charm-tools , has the repository changed?14:29
__chip__DominikF: which changes?14:34
DominikF__chip__: The changes that enabled this new template14:35
__chip__DominikF: charm-tools is that repository, but we're not charm-tools (i don't really know what that command does... so maybe it's unmaintained?)14:35
DominikF__chip__: sorry maybe I misunderstood. Last week we had a conversation about having skeleton charms for the operator framework and I was told that this was added to the charm-tools. The command that I listed above does exactly that and works great, I thought it was the work that your team was talking about.14:38
__chip__DominikF: i'm glad it works :-D but if it was done by my team, it was done before i was on it14:39
__chip__DominikF: maybe cory_fu_?14:39
DominikF__chip__: sorry! I thought it was recent work and found it strange that there was no new commit for it.14:40
__chip__DominikF: sadly, no14:41
__chip__at _some_ point charmcraft will grow that ability, but not just yet (it didn't make the roadmap)14:41
=== cory_fu_ is now known as cory_fu
mthaddon__chip__, DominikF: charm tools is maintained by cory_fu https://github.com/juju/charm-tools/tree/master/charmtools/templates and the operator-python template pulls from https://github.com/devec0/template-python-operator currently15:54
__chip__mthaddon: ack15:54
mthaddon__chip__: maybe that should at some point be owned by the charmcraft team (the python-operator template)?15:55
__chip__mthaddon: at some point there'll be a 'charmcraft init'15:56
* __chip__ will also add a 'charmcraft innit' which will be like 'bruv'15:56
mthaddonhahaha, ah cool - would that have different options for "give me an IaaS charm" and "give me a k8s charm"?15:57
DominikFmthaddon: that's exactly what I wanted to ask15:57
__chip__mthaddon: it got kicked to the next cycle so i don't have details :) or i could say "probably"15:57
DominikFIf there could be a template for k8s charms15:57
__chip__i mean15:57
__chip__ideally there'd be no difference :)15:57
__chip__we're almost there with dispatch15:58
mthaddonDominikF: there's some discussion about this on https://discourse.juju.is/t/first-steps-with-the-operator-framework/3006/4 fwiw16:00
DominikFmthaddon: thanks!16:03
* __chip__ breaths a sigh of releif16:46
__chip__relief also16:46
cory_fumthaddon, __chip__: Sorry for the long delay in replying; had some particularly long meetings today.  Getting caught up on the discussion17:16
cory_fuDominikF: ^17:16
cory_fuI'm the defacto maintainer of charm-tools but it's basically just been in maintenance mode rather than active development since we expect it to be phased out by charmcraft.  The template PR was contributed and comes from that external repo, as noted, so changes to the template should be proposed there.17:20
cory_fuMy understanding, though, is that the intention with the new framework is to try to keep boilerplate small enough that ideally a template wouldn't be needed.  Ideally, creating a K8s charm vs a machine charm shouldn't be significantly different but might involve importing some different helpers to use with your charm class.17:21
cory_fuI think the template is a stop-gap and there is the issue that it is likely to get out of date as the design patterns evolve.17:22
__chip__cory_fu: thanks!17:23
cory_fuI'm also looking forward to charmcraft being a much more focused tool.  A lot of things, like the template system, have grown organically into charm-tools over the years that I think really make things more confusing for the end user.17:24
mup_Issue operator#269 closed: Warn that model.unit.is_leader() can raise an exception <Created by timClicks> <Closed by timClicks> <https://github.com/canonical/operator/issues/269>18:20
* facubatista is out21:32
=== __chip__ is now known as Chipaca
Chipaca👋22:01

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