[04:44] <jam> morning all
[07:33] <Chipaca> moin moin moin
[07:57] <mup_> Issue operator#224 opened: [Idea] provide some form of scaffolding <Created by woutervb> <https://github.com/canonical/operator/issue/224>
[07:58] <jam> morning Chipaca
[07:58] <Chipaca> jam: how's things?
[07:58] <jam> Pretty good. how are things with you?
[07:59] <Chipaca> jam: not bad. I'm not in hospital, so that's winning, right?
[07:59] <jam> Chipaca, yeah, not sick, stuck at home, but healthy and well fed. :)
[07:59] <Chipaca> jam: on a less serious note I managed to install windows on my work laptop without nuking the linux installation (not even grub) so that's also a plus
[08:00] <Chipaca> so that should help dell figure out what's going on with it without having to come out
[08:00] <jam> Chipaca, ah, dell requires Windows to do support?
[08:00] <Chipaca> normally i would've gone "i bought this with linux off of you, do your <grawlixes> job", but that would've meant sending someone out just to figure it out
[08:00] <jam> I'm surprised you didn't have to reinstall grub
[08:01] <Chipaca> jam: remote diagnostics, yes, apparently it's a windows-only thing
[08:01] <Chipaca> jam: me too! apparently uefi means windows is not as aggressive to the bootloader as it used to be
[08:03]  * Chipaca wonders what happened to issue 224
[08:03] <mup_> Issue #224: [Idea] provide some form of scaffolding <Created by woutervb> <https://github.com/canonical/operator/issue/224>
[08:03] <Chipaca> yep, 404ing for me
[08:03] <jam> ran away ?
[08:03] <Chipaca> but mup seems to find it
[08:04] <jam> found it from https://github.com/canonical/operator/issues/224
[08:04] <jam> Chipaca, mup has a bad url
[08:04] <jam> 'issue/224' vs 'issues/224'
[08:04] <Chipaca> ah
[08:04] <Chipaca> niemeyer: ^ that one's on you probably
[08:04] <Chipaca> the mup issue i mean :)
[08:09] <jam> Chipaca, the email from Sohini "Weekly Update". Elements we will be working to prioritize with the charmtech team
[08:09] <Chipaca> mhmm
[08:09] <jam> "Options" seems particularly misplaced, as options only exists because of reactive (AIUI)
[08:10] <jam> (they had an options section as a way to configure a layer, but since we use instantiation of a class as the way to 'bring in a component' it doesn't feel like you need YAML config.)
[08:10] <Chipaca> jam: I have no idea what that is, so I'll believe you =)
[08:10] <jam> unless I'm misunderstanding what they were trying to do.
[08:10] <jam> Chipaca, it sounds like we need to be having some form of discussion with whoever is asking for these things ):
[08:10] <jam> :)
[08:11] <Chipaca> I missed sohini yesterday with my hardware shenanigans, but will catch up today
[08:11] <niemeyer> Sorry, I'll get that mup issue fixed today.. waited to fix it in that batch of changes but missed it
[08:11] <jam> Debug as an action is something I'm curious about.
[08:11] <Chipaca> wait, tomorrow (it's moved)
[08:12] <Chipaca> jam: debug-as-an-action i imagine is "have an action that's just for using via debug-hook" but irunno
[08:13] <Chipaca> i'm good at imagining stuff :-|
[08:13] <jam> Chipaca, maybe. Or maybe it's 'juju run-action --wait debug' which dumps out a databag of stuff you might want to figure out what the charm is doing
[08:13] <jam> but as a line-item its a bit ill defined.
[08:17] <jam> Chipaca, I've been trying to think about how we could handle 'ensuring enough packages are installed by the time you get to your charm code'.
[08:18] <Chipaca> jam: any conclusions so far?
[08:18] <jam> The problem being you can't just put "import external_lib" at the top of your src/charm.py because when the install hook runs nothing is installed yet
[08:18] <jam> Chipaca, so I think you can do things like lazy importing (wait to import until you need it), and put it in install, but it all feels a bit cludgy.
[08:18] <Chipaca> jam: if it's just an import yes, the problem is if you need a system package, isn't it?
[08:18] <jam> I was considering being evil and saying that 'hooks/install' runs before Charm.on.install, and you can put your dependency handling in there.
[08:19] <jam> but you still have the problem of src/charm.py struggling to start up if you do it the 'natural' way
[08:19] <jam> Chipaca, right, so if you have "on_start(): import package"; but "on_install(): import ops.apt; ops.apt.install(python-package)"
[08:19] <jam> you could make it work
[08:19] <jam> but it does feel kludgy
[08:20] <Chipaca> jam: wait, why a python package?
[08:20] <Chipaca> 'system package' i meant something like postgres
[08:20] <jam> Chipaca, so for system packages generally, you can just apt install it during on_install so no problem
[08:20] <Chipaca> right
[08:20] <jam> the problem, IMO, is python packages needing to be installed before your charm can import them.
[08:20] <Chipaca> and python packages should be in the charm already
[08:21] <Chipaca> via the build step
[08:21] <Chipaca> (of course this is me living in the future where the build tool is done and platform is a thing)
[08:21] <jam> Chipaca, how does the PYTHONPATH get setup to find them?
[08:21] <Chipaca> jam: properly
[08:22] <Chipaca> :)
[08:22] <Chipaca> jam: but more seriously, via having the charm.py shepang point at something that sets up the pythonpath
[08:22] <jam> So *a* step needs to rewrite something for '/var/lib/juju/agents/unit-<foo-X>/charm/???' to be a place that we can satisfy imports from, right?
[08:23] <Chipaca> shebang*
[08:23] <Chipaca> jam: whether that something is a virtualenv python, or just a wrapper, i don't know yet (nor particularly care), but both would work
[08:23] <jam> Chipaca, but what rewrites that path?
[08:23] <jam> and what installs the venv?
[08:23] <Chipaca> jam: the build step
[08:24] <jam> Chipaca, how does that handle the fact that it installs to a different path-on-disk during 'juju deploy' ?
[08:24] <jam> relative paths?
[08:24] <jam> eg, what sets up the venv on the target system
[08:24] <jam> we package a python binary in the charm?
[08:25] <Chipaca> relative paths should work, we need to test that
[08:25] <Chipaca> otherwise things get even more interesting
[08:25] <Chipaca> i'd rather not ship a python binary in the charm but i'm not ideologically opposed to it
[08:26] <Chipaca> all it _should_ take in my mind is a wrapper to set up the environ before calling system python
[08:26] <Chipaca> but i have yet to carve out time to play with this
[08:26] <jam> Chipaca, does that wrapper end up being 'dispatch' ?
[08:27] <Chipaca> jam: that could work also
[08:27] <niemeyer> Isn't all that what we already have?
[08:27] <Chipaca> niemeyer: what do you mean?
[08:29] <niemeyer> I'm just trying to understand what the discussion was about.. it sounds like we have what was being described:
[08:30] <niemeyer> A wrapper that sets up Python paths and calls the charm, including known locations inside the charm in sys.path
[08:31] <Chipaca> niemeyer: are you still writing?
[08:32] <niemeyer> No :)
[08:32] <niemeyer> We need a mup plugin..
[08:32] <Chipaca> niemeyer: where do we have that wrapper?
[08:33] <niemeyer> Chipaca: dispatch, per jam note
[08:33] <Chipaca> niemeyer: where is it
[08:33] <Chipaca> the wrapper, where, on github, is it
[08:34] <niemeyer> Chipaca: Wasn't support for dispatch in jam's agenda?
[08:34] <Chipaca> niemeyer: you said we already have what was being described; where do we have it?
[08:36] <niemeyer> Chipaca: It's not implemented.. it's agreed, in jam's agenda, in juju development code as well.. I was simply asking if that's what the discussion was about.. not sure why we're now arguing about where in GitHub it is?
[08:37] <jam> I think the confusion is that we were discussing how it should hang together, and you seemed to claim that while we have plans for it, we haven't actually implemented those yet. And I was asking about concretely how it would/should function.
[08:37] <Chipaca> niemeyer: because "Isn't that what we already have?" shuts down the discussion we were having
[08:38] <jam> Do we bundle what would otherwise be system libs, so that it is all served from a not-touched-by-the-system venv.
[08:38] <Chipaca> niemeyer: so, as you shut down the discussion, I'm calling you out so that you explain yourself
[08:38] <niemeyer> Oh my.. You know you can say "no, because...".. right?
[08:39] <niemeyer> Chipaca: I literally said "I'm just trying to understand"..
[08:39] <Chipaca> niemeyer: yes, now that I know what you meant, I can say that, but the discussion is still dead and needs resurrecting to continue it
[08:39] <Chipaca> yeah
[08:39] <niemeyer> Sorry, I'm stepping out.. I'm not in a good vibe to have this kind of discussion right now
[08:42] <stub> Might want to look at charms.reactive bootstrap process. It setup a virtualenv (so subordinates are insulated from version conflicts with primaries), installs python dependencies and deb packages, then reinvokes itself with the virtualenv interpreter.
[08:44] <jam> stub, indeed. I have looked at it a bit, though actually finding where the bits are is a bit convoluted, and hidden behind the various yaml definitions, etc.
[08:44] <jam> Trying to determine if the only way is to go via wheelhouses with full depedencies and isolated venvs
[08:44] <stub> I think it was mostly in layer:base
[08:44] <niemeyer> It also built stuff in production, which seems unwise
[08:44] <stub> wheelhouses were a pain because we want platform independent, and wheels are not always
[08:44] <niemeyer> But stub is right, it's some incarnation of that
[08:45] <jam> incarceration of that?
[08:45] <jam> :)
[08:45] <niemeyer> And we should definitely learn from it
[08:45] <niemeyer> jam: to much covid
[08:45] <niemeyer> too much
[08:47] <niemeyer> stub: Is there a way to avoid the platform dependency, though?
[08:47] <niemeyer> stub: I would love to justify having pure python charms, but the conversations so far make me believe we can't do without
[08:48] <stub> I think my problems were due to having old versions of setuptools/distutils etc. in the chain. And python dependencies that built C extensions even when they were told not too (looking at you cassandra client)
[08:48] <niemeyer> stub: Wheelhouses also feels like an insufficient solution in the sense we need to carry C lib dependencies, etc
[08:48] <niemeyer> stub: Building *in deployment* right?  Yeah, we need to kill that
[08:49] <stub> I think I hit both cases. Things building in deployment, and things building at build time and embedding platform dependent shared libraries.
[08:50] <stub> Yes, we want to avoid both.
[08:50] <niemeyer> stub: You mean shared libraries that have unsatisfied symbols at the target?
[08:50] <jam> stub, so why not use the platform libs for interacting with the platform app that you're installing?
[08:51]  * Chipaca steps out for a bit
[08:51] <stub> amd64 shared libraries getting embedded in the charm, which isn't going to work if someone tries to deploy on z-series
[08:51] <stub> jam: There are not always platform libraries, and offline deployments make pulling them in from PPAs a pain.
[08:52] <jam> (it feels like venvs reinvent the distribution problem, which is the point of distribution platforms)
[08:52] <stub> The cassandra charm needed to connect to cassandra, which has a really fat client with c extensions and a complex build and not in Ubuntu main or universe.
[08:53] <niemeyer> jam: Yeah, and I don't know how to get charms forward without us diving into that for the hundredth time
[08:53] <stub> The original charm pulled it in from a PPA. The reactive rewrite managed to get it from the wheelhouse.
[08:53] <niemeyer> I would love to just be able to say "charms need to be pure Python"
[08:53] <jam> stub, but still had to compile it for the arch?
[08:53] <niemeyer> But it sounds unrealistic
[08:54] <stub> jam: I think I managed to get it to avoid building the C extensions ('charm build' tries to enforce that, but it didn't work). But I would not be surprised to find amd64 specific shared libraries in the wheels.
[08:57] <stub> niemeyer: 'charms need to be pure Python' may well be the best approach. Bootstrap can inject platform specific binaries before the main charm.py is imported. Bootstrap installing deb packages would solve 90% of the use cases.
[08:58] <niemeyer> stub: The issue with recommending that is that we force charmers to become deb packagers as well.. and not only that.. we now need alternative binary deployment strategies for every platform
[08:58] <jam> stub, certainly the Juju model that charms are architecture independent was premised on arch specific things would be handled at the apt layer
[08:58] <jam> bbiab, making coffe
[08:58] <stub> Other 10% would be weirder stuff, like pulling a tarball from a Juju resource (say, a JVM). Or installing wheels from a wheelhouse.
[08:59] <niemeyer> stub: That's why I'm finding difficult to workaround the need for charms to become yet another binary package
[08:59] <stub> Yes, 'learn to package debs' is a high barrier to entry :-/
[08:59] <niemeyer> and distribute!
[09:00] <niemeyer> ... and even then not have a cross-platform strategy
[09:07] <stub> And it would be sad if it put a heavy burden on charmers dealing with the more common situation, where pure python and maybe a deb package from main.
[09:07] <niemeyer> Yeah, this case should remain simple
[09:15] <stub> Maybe it is just a case of declaring arch: ['amd64','arm64'] in metadata.yaml, and having arch/amd64 or arch/arm64 directories added to $PATH and $PYTHONPATH. Fat charms.
[09:17] <niemeyer> stub: Yeah, that sounds unavoidable as soon as we agree to do binaries
[09:17] <niemeyer> stub: Otherwise we have no control of the outcome whatsoever
[09:17] <niemeyer> stub: The new charm hub will also deal with multiple architectures gracefully
[09:17] <stub> The fat could move to resources, which could be intelligently pulled down (or attached at deploy time for offline deployments). But that is more complex.
[09:18] <niemeyer> So again we get back to the issue of building and organization of both the source and the result of that operation
[09:18] <niemeyer> facubatista has that on his agenda, but we don't have something clear yet
[09:18] <jam> stub, I think resources make a strong case for binary deps
[09:19] <niemeyer> stub: Agreed about resources
[10:45] <Chipaca> niemeyer: fwiw facu is waiting for feedback on the build tool email before continuing that work (because he isn't blocked on other fronts)
[10:47] <Chipaca> brb, rebooting into windows (eugh)
[11:10] <facubatista> Muy buenos días a todos!
[11:13]  * Chipaca now has to decide whether to be without his work laptop for at least a week, or be with an extremly slow laptop until the big Q is over
[11:14] <jam> morning facubatista
[11:14] <facubatista> hola jam
[11:14] <jam> Chipaca, they just extended ours 'indefinitely' (until further notice) :(
[11:15] <Chipaca> yeah :-(
[11:15] <Chipaca> ours isn't going away anytime soon
[11:15] <Chipaca> facubatista: ｇｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｏｄ  ｍｏｒｎｉｎｇ！
[11:16] <facubatista> Chipaca, hola!
[11:17]  * facubatista is reading previous conversation, why are we discussing AGAIN if we'll freeze a Python binary inside the charm, etc?
[11:18] <facubatista> do not discuss this again in the air, let's comment on the proto-spec I created, otherwise we're always in t0
[11:19] <Chipaca> facubatista: agreed
[11:19] <facubatista> "the problem, IMO, is python packages needing to be installed before your charm can import them." <-- this is already solved, I'm waiting feedback on that
[11:19] <Chipaca> facubatista: my intention is to play with this stuff based on your build tool thing, and get back to it
[11:23] <jam> niemeyer, shall we just cancel the weekly 1:1? We can always schedule time to chat when we have a topic instead.
[11:30] <jam> facubatista, I updated https://docs.google.com/document/d/1RHrOMbqsXz9qwk_3sHJ7AJOdlh-Mb-TkFUAtbXb37Og/edit# with a discussion of the plans for the Operator framework. Feel free to leave comments that we can use to help clarify anything.
[11:30] <facubatista> jam, thanks!
[11:39] <facubatista> jam, what do you mean with " The intent is that each of those handlers is maintaining its own state engine, "?
[11:39] <facubatista> jam, each method registered in my charm should maintain one state engine??
[11:41] <jam> facubatista, generally handlers are going to be maintaining some sort of state in response to events. And while they ultimately share some of that state, the intent is that you shouldn't ever stop sending them lifecycle events just because something else is also responding to it.
[11:41] <jam> facubatista, for your charm "have I written out the blog's static files" "do they need updating" feels like the state engine that you're using.
[11:41] <jam> the apache interaction of "have I configured apache to serve my files" is separate logic.
[11:42] <facubatista> mmm
[11:42] <facubatista> I wasn't planning to maintain that state, but maybe I'm too naive?
[11:42] <jam> I don't think it is usually explicitly model as a state machine, but functionally it is.
[11:43] <jam> facubatista, for simple charms, I feel it is perfectly fine to determine your state by querying the model, rather than storing it separately.
[11:43] <facubatista> if I get the install event it means that I have not written out the static files yet; if I get the upgrade event it means that the install ended correctly, and files are there, etc
[11:43] <jam> facubatista, but like the pgsql interface needs to know what you've requested of pg, and whether it has told you that it has done its preparations for you (what roles you need, what you want to call your database, etc.)
[11:44] <facubatista> jam, sorry, we're moving away from the static files example, right?
[11:44] <jam> facubatista, so Juju generally guarantees "at least once" events, and otherwise hooks should be idempotent. If something fails, it may call a hook >1 time.
[11:45] <jam> facubatista, yeah, I was giving a clearer example of a state machine. For static files, your plan seems fine.
[11:45] <jam> I don't know if there will be config, which might indicate you need to write new files, etc.
[11:45] <facubatista> I understand that idempotency, it's orthogonal to needing to have a state machine
[11:46] <facubatista> jam, I'm trying to parse you're sentence about pgsql, 1'
[11:49] <facubatista> jam, I'd really to "see" that pgsql example; in my mind when I instantiate the PG interface I will tell it whatever I need, then the interface when receives the relation event will configure the DB engine, and trigger the "all ready" event for me
[11:49] <jam> facubatista, correct. but that is the state engine that the DB component keeps track of.
[11:49] <jam> 'what did you ask for, has the DB told me that it is ready, ok, ready to fire the DB is ready event"
[11:50] <facubatista> my point is: no state machine is needed for that
[11:50] <facubatista> "what did you ask for" -> this is stored in the interface
[11:51] <facubatista> "has the DB told me that it is ready" -> this is what "receiving the relation event" means
[11:51] <facubatista> etc
[11:51] <facubatista> (that's why I need to "see" the code, maybe I'm missing parts and/or complexity here)
[12:01] <jam> facubatista, so that is still a state machine, even if you are storing the state in the interface
[12:01] <jam> Chipaca, did we forget to add a meet link to the bug revue calendar entry?
[12:01] <jam> just use standup?
[12:01] <Chipaca> jam: yeah let's just use standup
[12:01] <facubatista> jam, I'm not storing state for a state machine, I'm storing the asked DB engine config
[13:07] <mup_> Issue operator#161 closed: self.model.pod.set_spec should only be run on leader <Created by mthaddon> <Closed by niemeyer> <https://github.com/canonical/operator/issues/161>
[14:41] <mup_> Issue operator#225 opened: BoundSharedState changed events is misnamed (or misleading) <Created by addyess> <https://github.com/canonical/operator/issues/225>
[14:56]  * facubatista brb
[15:44]  * facubatista -> lunch
[16:18]  * facubatista is back
[17:05] <niemeyer> Alright.. off from the last call of the day, and calling it a day
[17:05] <niemeyer> Have a good eod folks
[17:06] <facubatista> niemeyer, have a nice rest
[17:27] <Chipaca> facubatista: i'm off as well. enjoy the evening solitude!
[17:28] <Chipaca> facubatista: or, don't. You do you.
[17:28]  * facubatista is alone in the office, turns the music volume on to the max
[20:08] <facubatista> niemeyer, ended trying to collect our thoughts here: https://docs.google.com/document/d/1270Fl9c6NzfMMA71xkqTwyO5nUIyBO6GQnvy34wtH5w/edit#
[20:31]  * facubatista eods