[03:59] jam: if you're still looking for a way to review code outside of a PR (i.e. code that's already been merged), I created a sample issue here: https://github.com/relaxdiego/charm-k8s-alertmanager/issues/1 [03:59] oh and good morning! [03:59] :-) [04:08] morning MarkMaglana [04:08] thanks for the suggestion [04:09] jam: no worries! hope you and the rest of the crew had a great weekend. [04:16] Might want to revisit the use of storing pickles in the db rather than json or yaml. I'm seeing devs hand around one liners for debug like: root@mattermost-operator-0:/var/lib/juju# python3 -c 'import pickle, pprint, sqlite3, sys ; show_none = False ; print("\n".join(["=== {} ===\n{}\n".format(t[0], pprint.pformat(t[1])) for t in [(row[0], pickle.loads(row[1])) for row in sqlite3.connect(sys.argv[1]).execute("SELECT handle, data from snapsho [04:16] t")] if show_none or t[1] is not None]))' ./agents/unit-mattermost-1/charm/.unit-state.db [04:17] Which is not the sort of friendly debugging tip we want on the forums, when you could be using the sqllite cli as intended and it not being an operator framework problem. [05:51] stub, I agree that is pretty ugly. With the caveats that we are looking to stop having an SQLite database locally anyway, since Juju 2.8 will allow us to store the state in the juju controller. [05:52] stub, I'd be pretty curious why they want to read raw snapshot data rather than use the objects in memory [05:52] especially given things like "juju debug-code" to let you drop into a debugger during your hook execution [05:52] True, so we might want a CLI tool available to dump things [05:53] People like to drop to lower levels sometimes, when they don't understand why the higher levels are giving them the answers they are giving them [05:55] Say, objects existing in RAM but not being persisted to the DB would point to unexpected termination before commit [05:56] (whoops, maybe that 'kill -1' wasn't what I meant to do) [07:30] Issue operator#265 closed: Auto determining handlers is actually not recommended [07:32] Issue operator#302 closed: AttributeError: 'MattermostCharmEvents' object has no attribute 'db_relation_joined' [08:22] morning all [08:26] morning Chipaca [10:15] Chipaca, https://github.com/relaxdiego/charm-k8s-alertmanager/issues/1 fyi [11:30] Muy buenos días a todos! [11:30] hi jam - so re: https://github.com/canonical/operator/issues/307 did I understand correctly that the only way to fix this issue is to re-write ALL of my unit tests with harness? [11:31] vgrevtsev, so Harness has the functionality to work around the problem with registering a class with multiple frameworks. [11:31] You can do that work yourself [11:31] or you can use Harness which does it for you [11:31] Issue operator#310 opened: hooks/install ran, but other hooks not expanded [11:32] jam: ok, and https://github.com/canonical/operator/issues/309 - you think it has the same root cause as 307? [11:32] (re model name env var) [11:32] vgrevtsev, no. 309 is that your Adapter code is doing "os.environ['JUJU_MODEL_NAME']" and you don't set the environ variable [11:33] But why it's not failing 100% of the time? [11:33] I mean, at some point this env var is configured by someone else [11:33] vgrevtsev, so the 307 failure is because if Harness test runs first, then the other test runs successfully (order of tests run) [11:33] JUJU_MODEL_NAME failed 100% of the time for me. [11:33] vgrevtsev, are *you* setting JUJU_MODEL_NAME in your shell and running the test suite? [11:34] so it works in that shell, but not in the other shell? [11:34] Of course no. `tox -epy37` that's what I'm doing. [11:37] jam: https://paste.ubuntu.com/p/qB6XhXfHQH/ [11:37] same code, same command [11:38] but different failure points - when it raises the KeyError, it fails on `config_changed.emit()` but it was failing on `harness.begin()` before [11:38] vgrevtsev, look carefully at the line: test/charm_test.py F.. [11:39] when it is ".F." or "..F" it fails with "cannot register" [11:39] because it is running your other test first [11:39] when it is "F.." it fails with JUJU_MODEL_NAME because it is running Harness test first [11:39] vgrevtsev, if you comment out/patch the non-Harness test, then it will always fail with JUJU_MODEL_NAME [11:44] jam: I see what you mean... true, it's failing 100% of the time [11:49] Chipaca, when Juju returns json output, it doesn't pretty format it, but that leads to ugly strings in tests. [11:50] Should I create a nice string for the test, or should I make it exactly like the Juju output? [11:59] jam: nice strings are fine [12:00] jam: the assumption that the python json parser won't care seems reasonable [12:00] Chipaca, so it also appears that the format of "status-get --application=true" is very different than --application=False, which also wasn't accounted for [12:00] as long as it's valid json mind you; one problem with pretty-printing it is that you might end with , at the end of an object, which json hates [12:00] (yaml is fine with it though :) ) [12:00] jam: ooh [12:01] jam: rock on [12:03] where's the documentation for juju's relation-created ? [12:03] Chipaca, since it is new in 2.8 maybe nonexistant ? [12:04] :'( ok [12:04] Chipaca, this looks like the one that should be updated: https://discourse.juju.is/t/charm-hooks/1040 [12:08] facubatista: wrt the tutorial gist, ok if i link it from the dev summary? (with a note that when done we'll put it on discourse) [12:09] Chipaca, +1, shouldn't we improve it at some point? [12:09] facubatista: totally :) i thought you were doing that :D [12:10] facubatista: actually, do you have the url for that? [12:10] * Chipaca doesn't know where he put it [12:10] Chipaca, https://gist.github.com/facundobatista/d3b7de7a624915227de051cba079e3d6 [12:23] i'm going to grab lunch [12:57] PR operator#311 opened: ops/model.py: Proper support for status-get === facundo__ is now known as facubatista [13:13] Chipaca, taking in consideration that this meeting was short, why not have the standup at usual time (in 17' from now) so it doesn't get superlate to jam? [13:14] Chipaca, looking at https://github.com/canonical/operator/issues/310 I see it triggering "run_any_legacy_hook" and seeing that dispatch is just a symlink to itself. [13:14] that would seem to say it thinks that it "is_dispatch_aware" [13:14] Chipaca, sounds like you broke it by just detecting JUJU_DISPATCH_PATH in os.environ and didn't check that it wasn't called as 'dispatch [13:15] "we" broke it when we landed your patch since I certainly was looking at the same code and thought it was correct [13:15] hmmm [13:15] jam: but it's not necessarily called as dispatch (in the shim case for ex) [13:15] which was why we changed that behaviour :-/ [13:18] Chipaca, so the issue is that JUJU_DISPATCH_PATH is set, which is the only check we are currently using, but we aren't being called from dispatch, yes [13:19] Chipaca, I think it was to support the case where 'dispatch' isn't a symlink but is just a shell script [13:19] but we need a way to know how we were first invoked [13:20] (for example, if sys.argv[0] has 'hooks/*' then we do need to create the links, or if 'dispatch' doesn't exist, etc.) [13:20] Chipaca, I posted to the bug, maybe it clearer there? [13:22] * jam heads to dinner for a bit, will be back for standup [13:34] * Chipaca takes a break [14:22] PR operator#312 opened: ops.main: only do _init_dispatch() if dispatch exists [14:22] facubatista, jam, fix for #310 ^ [14:22] Issue #310: hooks/install ran, but other hooks not expanded [14:23] Chipaca, and the test properly failed without the patch ? [14:23] jam: oh yes [14:23] lgtm [14:23] jam: i was just commenting as much on the bug :) [14:24] I could also write a TestMainWithNoDispatchButJujuIsDispatchAwareAndScriptsAreCopies for extra fun [14:24] but didn't feel it added anything [14:25] * Chipaca is a firm believer in separable coordinates [14:54] Issue operator#313 opened: If ops is installed, the test run picks up the wrong one [15:28] PR operator#314 opened: test_main: set up PYTHONPATH so the sub-process picks up this ops [15:31] jam: are you around, or have you stepped away? [15:54] Chipaca, I'm back now [15:54] jam: hi again :) [15:55] jam: should I push the change to use a decorator on #311 ? [15:55] PR #311: ops/model.py: Proper support for status-get [15:55] jam: also, should it be 'register', or '_register'? :) [15:56] jam: if _register, should it also be _from_name? [15:56] Chipaca, I originally had "_register" but then my editor complained that I was using a private method of another class [15:56] aw [15:57] single _ is protected, not private :) [15:57] and "name = None" gives us the value that auto-complete of things annotated StatusBase have a .name attribute [15:57] which all of the actual implementations have [15:57] jam: we could make it name='' so it's always a str, also [15:57] sorry i'm bikeshedding [15:58] Chipaca, I'm happy enough with that [15:58] jam: why would it complain about _register when you're calling it on the class itself though? or was that in the tests [15:59] Chipaca, so I think it is because it isn't inside the class itself, it was at the top level of the module [15:59] ah ok === Chipaca changed the topic of #smooth-operator to: general discussion of the operator framework || github.com/canonical/operator || ops 0.6.0 (pip install ops) || charmcraft 0.1.0 (pip install charmcraft) [16:00] Chipaca, did you already do the work for decorator, or shall I work on it? [16:00] Chipaca, it seems we have general agreement to do it that way [16:00] jam: i've already done it, but it's not a lot of work so as you wish [16:01] Chipaca, if you have it, I'm happy for you to land it [16:28] jam: pushed, waiting for tests [16:28] * facubatista -> lunch [16:28] Chipaca, cheers [16:29] I'll take off now, go for my run and dinner and etc, and will come back after that to land this and push out 0.6.1 [16:29] should we have a changelog in tree? [16:29] Chipaca, some people like it, I can take it or leave it. [16:30] I'll go without until somebody complains :) [16:30] 'git log' works for me [16:30] (and gives us the ability to build the changelog retroactively as long as we're good with the tags [16:30] ) [16:30] anyway. I'm off. [16:30] jam: have a great evening! [16:59] * facubatista is back [18:28] facubatista: i can haz review of #311 ? [18:28] PR #311: ops/model.py: Proper support for status-get [18:29] Chipaca, sure [18:29] tks [18:29] * Chipaca disappears in a puff of dinner-making [18:30] Chipaca, done [18:30] (I already reviewed it in the morning, the only thing missing was the "how to register" thing [18:30] ) [18:38] Chipaca, the "-e" that you put in operator's requirements.txt file, theorically is the "--editable" option of "pip install", right? how that is translated to "get dependencies from setup.py"? [21:06] facundo__: it translates to 'python setup.py develop' i think [21:09] Issue operator#288 closed: StatusBase are registered on instantiation not definition [21:09] PR operator#311 closed: ops/model.py: Proper support for status-get [21:10] Issue operator#310 closed: hooks/install ran, but other hooks not expanded [21:10] PR operator#312 closed: ops.main: only do _init_dispatch() if dispatch exists [21:12] PR operator#315 opened: bumping ops.__version__ for release 0.6.1 [21:40] facundo__: ping [21:43] ok, i'm landing the release bump [21:43] PR operator#315 closed: bumping ops.__version__ for release 0.6.1 === Chipaca changed the topic of #smooth-operator to: general discussion of the operator framework || github.com/canonical/operator || ops 0.6.1 (pip install ops) || charmcraft 0.1.0 (pip install charmcraft) [21:53] stub: 0.6.1 just released for the fix to your #310 (thanks!) [21:53] Issue #310: hooks/install ran, but other hooks not expanded [21:53] and now bed [23:39] Issue operator#316 opened: unit state lost following upgrade-charm