/srv/irclogs.ubuntu.com/2020/04/15/#smooth-operator.txt

jammorning all04:44
Chipacamoin moin moin07:33
mup_Issue operator#224 opened: [Idea] provide some form of scaffolding <Created by woutervb> <https://github.com/canonical/operator/issue/224>07:57
jammorning Chipaca07:58
Chipacajam: how's things?07:58
jamPretty good. how are things with you?07:58
Chipacajam: not bad. I'm not in hospital, so that's winning, right?07:59
jamChipaca, yeah, not sick, stuck at home, but healthy and well fed. :)07:59
Chipacajam: 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 plus07:59
Chipacaso that should help dell figure out what's going on with it without having to come out08:00
jamChipaca, ah, dell requires Windows to do support?08:00
Chipacanormally 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 out08:00
jamI'm surprised you didn't have to reinstall grub08:00
Chipacajam: remote diagnostics, yes, apparently it's a windows-only thing08:01
Chipacajam: me too! apparently uefi means windows is not as aggressive to the bootloader as it used to be08:01
* Chipaca wonders what happened to issue 22408:03
mup_Issue #224: [Idea] provide some form of scaffolding <Created by woutervb> <https://github.com/canonical/operator/issue/224>08:03
Chipacayep, 404ing for me08:03
jamran away ?08:03
Chipacabut mup seems to find it08:03
jamfound it from https://github.com/canonical/operator/issues/22408:04
jamChipaca, mup has a bad url08:04
jam'issue/224' vs 'issues/224'08:04
Chipacaah08:04
Chipacaniemeyer: ^ that one's on you probably08:04
Chipacathe mup issue i mean :)08:04
jamChipaca, the email from Sohini "Weekly Update". Elements we will be working to prioritize with the charmtech team08:09
Chipacamhmm08:09
jam"Options" seems particularly misplaced, as options only exists because of reactive (AIUI)08:09
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
Chipacajam: I have no idea what that is, so I'll believe you =)08:10
jamunless I'm misunderstanding what they were trying to do.08:10
jamChipaca, it sounds like we need to be having some form of discussion with whoever is asking for these things ):08:10
jam:)08:10
ChipacaI missed sohini yesterday with my hardware shenanigans, but will catch up today08:11
niemeyerSorry, I'll get that mup issue fixed today.. waited to fix it in that batch of changes but missed it08:11
jamDebug as an action is something I'm curious about.08:11
Chipacawait, tomorrow (it's moved)08:11
Chipacajam: debug-as-an-action i imagine is "have an action that's just for using via debug-hook" but irunno08:12
Chipacai'm good at imagining stuff :-|08:13
jamChipaca, 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 doing08:13
jambut as a line-item its a bit ill defined.08:13
jamChipaca, 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:17
Chipacajam: any conclusions so far?08:18
jamThe 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 yet08:18
jamChipaca, 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
Chipacajam: if it's just an import yes, the problem is if you need a system package, isn't it?08:18
jamI was considering being evil and saying that 'hooks/install' runs before Charm.on.install, and you can put your dependency handling in there.08:18
jambut you still have the problem of src/charm.py struggling to start up if you do it the 'natural' way08:19
jamChipaca, right, so if you have "on_start(): import package"; but "on_install(): import ops.apt; ops.apt.install(python-package)"08:19
jamyou could make it work08:19
jambut it does feel kludgy08:19
Chipacajam: wait, why a python package?08:20
Chipaca'system package' i meant something like postgres08:20
jamChipaca, so for system packages generally, you can just apt install it during on_install so no problem08:20
Chipacaright08:20
jamthe problem, IMO, is python packages needing to be installed before your charm can import them.08:20
Chipacaand python packages should be in the charm already08:20
Chipacavia the build step08:21
Chipaca(of course this is me living in the future where the build tool is done and platform is a thing)08:21
jamChipaca, how does the PYTHONPATH get setup to find them?08:21
Chipacajam: properly08:21
Chipaca:)08:22
Chipacajam: but more seriously, via having the charm.py shepang point at something that sets up the pythonpath08:22
jamSo *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:22
Chipacashebang*08:23
Chipacajam: whether that something is a virtualenv python, or just a wrapper, i don't know yet (nor particularly care), but both would work08:23
jamChipaca, but what rewrites that path?08:23
jamand what installs the venv?08:23
Chipacajam: the build step08:23
jamChipaca, how does that handle the fact that it installs to a different path-on-disk during 'juju deploy' ?08:24
jamrelative paths?08:24
jameg, what sets up the venv on the target system08:24
jamwe package a python binary in the charm?08:24
Chipacarelative paths should work, we need to test that08:25
Chipacaotherwise things get even more interesting08:25
Chipacai'd rather not ship a python binary in the charm but i'm not ideologically opposed to it08:25
Chipacaall it _should_ take in my mind is a wrapper to set up the environ before calling system python08:26
Chipacabut i have yet to carve out time to play with this08:26
jamChipaca, does that wrapper end up being 'dispatch' ?08:26
Chipacajam: that could work also08:27
niemeyerIsn't all that what we already have?08:27
Chipacaniemeyer: what do you mean?08:27
niemeyerI'm just trying to understand what the discussion was about.. it sounds like we have what was being described:08:29
niemeyerA wrapper that sets up Python paths and calls the charm, including known locations inside the charm in sys.path08:30
Chipacaniemeyer: are you still writing?08:31
niemeyerNo :)08:32
niemeyerWe need a mup plugin..08:32
Chipacaniemeyer: where do we have that wrapper?08:32
niemeyerChipaca: dispatch, per jam note08:33
Chipacaniemeyer: where is it08:33
Chipacathe wrapper, where, on github, is it08:33
niemeyerChipaca: Wasn't support for dispatch in jam's agenda?08:34
Chipacaniemeyer: you said we already have what was being described; where do we have it?08:34
niemeyerChipaca: 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:36
jamI 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
Chipacaniemeyer: because "Isn't that what we already have?" shuts down the discussion we were having08:37
jamDo we bundle what would otherwise be system libs, so that it is all served from a not-touched-by-the-system venv.08:38
Chipacaniemeyer: so, as you shut down the discussion, I'm calling you out so that you explain yourself08:38
niemeyerOh my.. You know you can say "no, because...".. right?08:38
niemeyerChipaca: I literally said "I'm just trying to understand"..08:39
Chipacaniemeyer: yes, now that I know what you meant, I can say that, but the discussion is still dead and needs resurrecting to continue it08:39
Chipacayeah08:39
niemeyerSorry, I'm stepping out.. I'm not in a good vibe to have this kind of discussion right now08:39
stubMight 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:42
jamstub, 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
jamTrying to determine if the only way is to go via wheelhouses with full depedencies and isolated venvs08:44
stubI think it was mostly in layer:base08:44
niemeyerIt also built stuff in production, which seems unwise08:44
stubwheelhouses were a pain because we want platform independent, and wheels are not always08:44
niemeyerBut stub is right, it's some incarnation of that08:44
jamincarceration of that?08:45
jam:)08:45
niemeyerAnd we should definitely learn from it08:45
niemeyerjam: to much covid08:45
niemeyertoo much08:45
niemeyerstub: Is there a way to avoid the platform dependency, though?08:47
niemeyerstub: I would love to justify having pure python charms, but the conversations so far make me believe we can't do without08:47
stubI 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
niemeyerstub: Wheelhouses also feels like an insufficient solution in the sense we need to carry C lib dependencies, etc08:48
niemeyerstub: Building *in deployment* right?  Yeah, we need to kill that08:48
stubI think I hit both cases. Things building in deployment, and things building at build time and embedding platform dependent shared libraries.08:49
stubYes, we want to avoid both.08:50
niemeyerstub: You mean shared libraries that have unsatisfied symbols at the target?08:50
jamstub, so why not use the platform libs for interacting with the platform app that you're installing?08:50
* Chipaca steps out for a bit08:51
stubamd64 shared libraries getting embedded in the charm, which isn't going to work if someone tries to deploy on z-series08:51
stubjam: There are not always platform libraries, and offline deployments make pulling them in from PPAs a pain.08:51
jam(it feels like venvs reinvent the distribution problem, which is the point of distribution platforms)08:52
stubThe 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:52
niemeyerjam: Yeah, and I don't know how to get charms forward without us diving into that for the hundredth time08:53
stubThe original charm pulled it in from a PPA. The reactive rewrite managed to get it from the wheelhouse.08:53
niemeyerI would love to just be able to say "charms need to be pure Python"08:53
jamstub, but still had to compile it for the arch?08:53
niemeyerBut it sounds unrealistic08:53
stubjam: 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:54
stubniemeyer: '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:57
niemeyerstub: 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 platform08:58
jamstub, certainly the Juju model that charms are architecture independent was premised on arch specific things would be handled at the apt layer08:58
jambbiab, making coffe08:58
stubOther 10% would be weirder stuff, like pulling a tarball from a Juju resource (say, a JVM). Or installing wheels from a wheelhouse.08:58
niemeyerstub: That's why I'm finding difficult to workaround the need for charms to become yet another binary package08:59
stubYes, 'learn to package debs' is a high barrier to entry :-/08:59
niemeyerand distribute!08:59
niemeyer... and even then not have a cross-platform strategy09:00
stubAnd 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
niemeyerYeah, this case should remain simple09:07
stubMaybe 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:15
niemeyerstub: Yeah, that sounds unavoidable as soon as we agree to do binaries09:17
niemeyerstub: Otherwise we have no control of the outcome whatsoever09:17
niemeyerstub: The new charm hub will also deal with multiple architectures gracefully09:17
stubThe 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:17
niemeyerSo again we get back to the issue of building and organization of both the source and the result of that operation09:18
niemeyerfacubatista has that on his agenda, but we don't have something clear yet09:18
jamstub, I think resources make a strong case for binary deps09:18
niemeyerstub: Agreed about resources09:19
Chipacaniemeyer: fwiw facu is waiting for feedback on the build tool email before continuing that work (because he isn't blocked on other fronts)10:45
Chipacabrb, rebooting into windows (eugh)10:47
facubatistaMuy buenos días a todos!11:10
* 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 over11:13
jammorning facubatista11:14
facubatistahola jam11:14
jamChipaca, they just extended ours 'indefinitely' (until further notice) :(11:14
Chipacayeah :-(11:15
Chipacaours isn't going away anytime soon11:15
Chipacafacubatista: gooooooooooooooooooooooooooooooooooooooooooooooooooooooood  morning!11:15
facubatistaChipaca, hola!11:16
* facubatista is reading previous conversation, why are we discussing AGAIN if we'll freeze a Python binary inside the charm, etc?11:17
facubatistado not discuss this again in the air, let's comment on the proto-spec I created, otherwise we're always in t011:18
Chipacafacubatista: agreed11: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 that11:19
Chipacafacubatista: my intention is to play with this stuff based on your build tool thing, and get back to it11:19
jamniemeyer, shall we just cancel the weekly 1:1? We can always schedule time to chat when we have a topic instead.11:23
jamfacubatista, 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
facubatistajam, thanks!11:30
facubatistajam, what do you mean with " The intent is that each of those handlers is maintaining its own state engine, "?11:39
facubatistajam, each method registered in my charm should maintain one state engine??11:39
jamfacubatista, 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
jamfacubatista, 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
jamthe apache interaction of "have I configured apache to serve my files" is separate logic.11:41
facubatistammm11:42
facubatistaI wasn't planning to maintain that state, but maybe I'm too naive?11:42
jamI don't think it is usually explicitly model as a state machine, but functionally it is.11:42
jamfacubatista, for simple charms, I feel it is perfectly fine to determine your state by querying the model, rather than storing it separately.11:43
facubatistaif 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, etc11:43
jamfacubatista, 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:43
facubatistajam, sorry, we're moving away from the static files example, right?11:44
jamfacubatista, 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:44
jamfacubatista, yeah, I was giving a clearer example of a state machine. For static files, your plan seems fine.11:45
jamI don't know if there will be config, which might indicate you need to write new files, etc.11:45
facubatistaI understand that idempotency, it's orthogonal to needing to have a state machine11:45
facubatistajam, I'm trying to parse you're sentence about pgsql, 1'11:46
facubatistajam, 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 me11:49
jamfacubatista, 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:49
facubatistamy point is: no state machine is needed for that11:50
facubatista"what did you ask for" -> this is stored in the interface11:50
facubatista"has the DB told me that it is ready" -> this is what "receiving the relation event" means11:51
facubatistaetc11:51
facubatista(that's why I need to "see" the code, maybe I'm missing parts and/or complexity here)11:51
jamfacubatista, so that is still a state machine, even if you are storing the state in the interface12:01
jamChipaca, did we forget to add a meet link to the bug revue calendar entry?12:01
jamjust use standup?12:01
Chipacajam: yeah let's just use standup12:01
facubatistajam, I'm not storing state for a state machine, I'm storing the asked DB engine config12:01
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>13:07
mup_Issue operator#225 opened: BoundSharedState changed events is misnamed (or misleading) <Created by addyess> <https://github.com/canonical/operator/issues/225>14:41
* facubatista brb14:56
* facubatista -> lunch15:44
* facubatista is back16:18
niemeyerAlright.. off from the last call of the day, and calling it a day17:05
niemeyerHave a good eod folks17:05
facubatistaniemeyer, have a nice rest17:06
Chipacafacubatista: i'm off as well. enjoy the evening solitude!17:27
Chipacafacubatista: or, don't. You do you.17:28
* facubatista is alone in the office, turns the music volume on to the max17:28
facubatistaniemeyer, ended trying to collect our thoughts here: https://docs.google.com/document/d/1270Fl9c6NzfMMA71xkqTwyO5nUIyBO6GQnvy34wtH5w/edit#20:08
* facubatista eods20:31

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