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

Chipacagoooooooooooooooooooooooooooooood  morning!08:32
bthomas𝐺𝑜𝑜𝑑 𝑀𝑜𝑟𝑛𝑖𝑛𝑔08:41
bthomas 08:41
Chipacabthomas: how're things going?08:50
bthomasChipaca: I working on how to refactor prometheus charm test cases to use ops.testing.Harness. The Harness supports testing the whole Charm class. Some of the test cases in the prometheus charm test utilties like "adapter/k8s.py" which makes rest calls to Kubernetes API server. This does not seem to fit the Harness framework. I am ignoring this for now and looking at what all can be refactored.08:53
bthomasAlso reading a bit of some of the python standard library docs08:55
jammorning Chipaca09:14
bthomasmorning jam: looks like you are still jet lagged09:14
jambthomas, at one point I was thinking to always use my local time. Right now, I just always say good morning.09:15
jamIt is always morning somewhere09:15
bthomas:-) It must be night there and you are awake.09:16
jambthomas, I haven't moved to the US yet. it is only 1pm here.09:16
bthomasah09:16
jamI'm on a plane next Wednesday.09:16
Chipacafly cartesian09:17
jamChipaca, what voice is ChanServ giving you?09:20
Chipacajam: a blue one09:21
Chipacawhat a nightmare this logging thing09:51
Chipacareloading a module does not reset its globals, so test_log's reset_logging was wrong09:51
Chipacaand it broke logassert for some reason i haven't been able to figure out09:52
Chipacammm, pytest-xdist → ops test suite finishes in 12 seconds09:57
jamChipaca, shiny. How does xdist handle mock patching, etc. Just farmed out subsets to different processes?10:08
Chipacajam: yep, just farmed out10:08
Chipacajam: different from pytest-parallel which does threading (and breaks spectacularly)10:08
jamChipaca, I don't know if you ever used it, but 'subunit' from Robert Collins had a bunch of similar ideas10:08
Chipacaused it for syncdaemon, a couple of lives ago10:09
bthomasWhich component is responsible for ensuring that status of a pods in an application unit deployed by a charm is correctly set ? Is it Juju/Kubernetes, the Operator Framework or the Charm ?10:10
jambthomas, the charm sets a basic status, Juju tempers that status as it knows that the pod hasn't finished starting yet.10:10
mupPR operator#373 opened: fix up logging tests impacting global state so much <Created by chipaca> <https://github.com/canonical/operator/pull/373>10:11
Chipacajam: ^ that was biting me yesterday when trying to test the storage heuristics branch10:11
jamChipaca, responded10:17
Chipacajam: re²sponded10:21
Chipaca:)10:21
jamrerere10:21
Chipacareeee10:22
jamChipaca, probably here is better for active conversation: What I'd like is that for whatever code path we are executing that is calling setup_root_logging, refactor it to not be called in the path that the test suite needs.10:33
Chipacajam: i could add a no_logging bool on main10:52
jamChipaca, from a side point, why are we triggering main itself for that many tests...10:52
Chipacajam: well, it is test_main :-p10:53
Chipacajam: I'll see if it can be pared down a bit, maybe i got carried away?10:53
Chipacathe ones that call out to subprocess shouldn't need this10:53
jamChipaca, if it is only test_main then we are probably ok10:53
jam(and test_log, but that is also explicit about logging)10:54
Chipacayep, only test_main10:54
jamIt just felt like lots of test suites, but that is just because we use inheritence to do scenarios10:54
Chipacaand I think I should be able to take it off the _TestMain subclasses10:54
jamI thought the inherited TestMain were using subprocess10:54
Chipacaexactly, i'll see if those were needed10:55
Chipacagive me 510:55
Chipacajam: indeed i can drop all the _TestMain decorators10:58
Chipacathat was silly of me, got carried away10:59
Chipacajam: better now?11:00
jamChipaca, yep. I'm curious why you need TestDispatch, something there where we are doing direct main() interaction?11:01
Chipacajam: all the test cases there call main directly11:01
facubatista¡Muy buenos días a todos!11:02
Chipacajam: via the one _check method11:02
jammorning facubatista11:02
jamChipaca, approved11:02
bthomasMorning facubatista11:02
Chipacafacubatista: 👋❗11:02
jamhttps://www.ubuntusoftware.net/about/ looks like a trademark infringement waiting11:02
Chipacawhat the11:03
Chipacaand with a german phone11:03
bthomasHell, almost certainly is an infringement11:03
jamThey aren't using the Circle of Friends at least11:04
facubatistaChipaca, how is it breaking logassert? maybe we could improve logassert's resiliance?11:05
Chipacafacubatista: I don't know :-) logassert doesn't see the logs11:05
Chipacafacubatista: probably because test_log was doing logging.shutdown(); importlib.reload(logging)11:05
facubatistaja11:06
Chipacafacubatista: not sure logassert can be made resilient to that :)11:06
Chipaca(and reload doesn't do what you'd expect with globals)11:06
facubatistaChipaca, it doesn't re-load the module?11:07
Chipacafacubatista: it reloads it, but the module's dict is reused11:08
Chipacafacubatista: also,11:08
ChipacaIf a module imports objects from another module using from ... import ..., calling reload() for the other module does not redefine the objects imported from it — one way around this is to re-execute the from statement, another is to use import and qualified names (module.name) instead.11:08
facubatistamakes sense, yes11:09
facubatistait looks like test_log can be improved, yes11:10
Chipacafacubatista: and logging uses weakref which makes the whole thing harder to reason, for me11:10
Chipacafacubatista: #37311:10
mupPR #373: fix up logging tests impacting global state so much <Created by chipaca> <https://github.com/canonical/operator/pull/373>11:10
jamChipaca, any feedback on https://github.com/canonical/charmcraft/pull/99 so I can land that for Facu?11:10
mupPR charmcraft#99: charmcraft/jujuignore.py: Allow extending the list of patterns <Created by jameinel> <https://github.com/canonical/charmcraft/pull/99>11:10
Chipacajam: me? reviewing _other_ people's code?11:11
* Chipaca apologises11:11
facubatistajam, if you could change the "from .." thingie, it would be great, thanks!11:12
jamfacubatista, I just pushed the change11:12
facubatistaawesome, thanks!11:12
jamChipaca, apologizing for reviewing someone else's code? Or for misspelling apologises :P11:12
* Chipaca makes guises for Apollo11:14
Chipacajam: not sure why the test of relative imports changes so suddenly, for me11:16
Chipacayear ye, hear ye: {**d} is weird11:17
jamChipaca, I thought it would be (.*d) :011:19
jamChipaca, well, you might create .hidden file, but you'd never create a ..hidden file11:20
jamI think it breaks the feeling of a path11:20
jam../foo is normal11:21
jam..foo is not11:21
Chipacajam: if d is a map object (as in collections.abc.Mapping), {**d} creates a copy of it (like dict(**d))11:21
Chipacaif a and b are mappings, {**a, **b} creates a new, merged one11:21
jamah, I'd never tried to do that with {}.11:22
Chipacabah, in both cases it's not a copy/merged one but a dict with the k/v11:22
Chipacanew from 3.511:22
Chipacadon't like it11:22
Chipaca:)11:22
Chipacawas reminded of it by somebody just now11:22
jambah humbug I say11:22
Chipacaall them modern bows and arrows11:22
jamChipaca, I suppose it is a syntax like list[:]11:22
jambut {**dict} doesn't quite ring the same to me11:23
Chipacahush, next they'll be doing [*list]11:23
Chipacawaaait11:23
Chipacathat already works11:23
Chipaca/o\11:23
jamChipaca, I will be missing the next meeting. The finished processing my wife's passport but I have to go pick it up *right now* or they keep it over the weekend.11:31
Chipacajam: go go go11:32
jamChipaca, our scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should11:32
jam[*list]11:32
Chipacajam: ask me about [*a, *b]11:33
jamChipaca, that looks to my eyes as creating [[1,2,3], [4,5,6]]11:34
Chipacajam: no that would be just [a,b]11:34
Chipacaclearly * is the asplode operator11:34
bthomasflake8 gives me W503. But if I fix that it gives me W504. Since W503 is deprecated I am adding it to the ignore list.12:40
Chipacabthomas: maybe your flake8 is old?12:58
Chipacabthomas: because that change was merged in 201812:59
bthomasChipaca: Thanks. my flake8 version = 3.7.9 .12:59
Chipacabthomas: huh, i can't get those to trigger here13:03
* Chipaca tries a bit more13:03
narinderguptaChipaca, hi good morning. I am in process of setting the environment variable in my pod spec do you know how can we setup for conaintaners somehow env: is not recognized13:03
narinderguptaops.model.ModelError: b'ERROR json: unknown field "env"\n'13:03
narinderguptaI am using the template to define the pod spec and replacing the variable.13:04
Chipacanarindergupta: can you show me the code?13:04
narinderguptaChipaca, I started with this http://paste.ubuntu.com/p/v6GXk2RRKW/ but this is my current template file http://paste.ubuntu.com/p/pfFNs4vPwS/13:06
narinderguptaAs I may ask to add more feature in k8s related to resources13:06
narinderguptaChipaca, as K8s get auto scalability feature based on resource usage which is good way to do autoscaling as well.13:07
narinderguptaChipaca, this is my http://paste.ubuntu.com/p/PGgR2Ccnt4/ charm.py13:08
bthomasChipaca: hmmm . It was triggering on this commit of mine https://github.com/balbirthomas/charm-k8s-prometheus/commit/d4a82c43d1e8f56a9bf1970dbf4aae73ebffb817 (second hunk)13:09
* bthomas rushes to get coffee before standup13:11
Chipacanarindergupta: I think your problem is that in that first link, the 'env' block is indented such that it isnside a port13:27
Chipacanarindergupta: I suspect most of those things aren't meant to be inside a port13:29
narinderguptaChipaca, correct it is not the port let me fix that and restart13:29
narinderguptaI was trying to follow this https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/application/cassandra/cassandra-statefulset.yaml13:30
narinderguptaChipaca, may I know what else is covered apart from port, env, readinessProbe,13:30
Chipacanarindergupta: covered by what?13:31
narinderguptaBy framework like when I tried resources, securityContext and lifecycle I got the same error13:32
Chipacanarindergupta: because you're putting them under 'ports', and they don't go there13:32
Chipacanarindergupta: this has nothing to do with the framework13:32
narinderguptaOh ok13:32
facubatistaChipaca, meeting?13:32
Chipacafacubatista: trying to13:32
narinderguptaChipaca, here is new modified file with correct syntax and hopefully it will work http://paste.ubuntu.com/p/s49Xhztf3Y/13:38
narinderguptaChipaca, same error ops.model.ModelError: b'ERROR json: unknown field "resources"\n'13:41
narinderguptaapplication-charm-k8s-cassandra: 13:40:47 ERROR juju.worker.uniter.operation hook "start" (via hook dispatching script: dispatch) failed: exit status 113:41
Chipacanarindergupta: is this file supposed to have the same structure as the cassandra-statefulset.yaml you linked?13:43
narinderguptaChipaca, this is pod spec I am planning to create through template and the way Cassandra deployed on kubernetes is the one from link I shared which I am trying to replicate through juju.13:46
narinderguptaChipaca, while writing Kafka charm I used this http://paste.ubuntu.com/p/ZvCf8Drt3R/13:47
Chipacanarindergupta: https://discourse.juju.is/t/updated-podspec-yaml-new-features/212413:50
Chipacanarindergupta: in particular, a lot of those things need to be under 'kubernetes'13:50
Chipacanarindergupta: look for 'k8s specific container attributes'13:51
narinderguptaOh ok13:51
Chipacafacubatista: https://github.com/canonical/charmcraft/pull/116 fwiw14:41
mupPR charmcraft#116: include install info in README <Created by chipaca> <https://github.com/canonical/charmcraft/pull/116>14:41
facubatistaack14:42
Chipacafacubatista: also plz can haz https://github.com/canonical/operator/pull/37314:49
mupPR #373: fix up logging tests impacting global state so much <Created by chipaca> <https://github.com/canonical/operator/pull/373>14:49
Chipacafacubatista: so i can merge it into the storage thing14:49
facubatistaChipaca, reviewing14:50
Chipacafacubatista: thanks!14:59
mupPR operator#373 closed: fix up logging tests impacting global state so much <Created by chipaca> <Merged by chipaca> <https://github.com/canonical/operator/pull/373>15:06
mupPR operator#374 opened: use controller-side storage automatically in some cases <Created by chipaca> <https://github.com/canonical/operator/pull/374>15:31
Chipacafacubatista: i'm getting test failures on charmcraft master15:43
facubatistanice! (not)15:44
Chipacafacubatista: can you test if https://paste.ubuntu.com/p/4G3vG6zz9B/ still works for you in your particular env?15:45
facubatistaChipaca, how are you running the tests?15:46
Chipacafacubatista: in a virtualenv15:46
narinderguptaChipaca, thanks I was able at least start the pod now as I have to remove few things and check back later the issues with template15:46
Chipacafacubatista: using pytest15:46
Chipacanarindergupta: good to hear15:46
facubatistaChipaca, but that works for me... see https://pastebin.canonical.com/p/5vDkCkZYHM/ , l.1 is how I normally run the tests, l.22 is inside the venv15:48
Chipacafacubatista: you seem to always have a PYTHONPATH i guess :)15:48
facubatistaChipaca, oh, yes15:55
facubatistaChipaca, testing your patch...15:55
facubatistaChipaca, it worked, although I'd prefer this: https://paste.ubuntu.com/p/qZWs56W43k/15:58
Chipacafacubatista: if you can reproduce a scenario where that is needed, sure :)15:59
Chipacai almost wrote exactly that, but, aiui if you don't need it outside you won't need it inside15:59
Chipacacapisci?16:00
facubatistaChipaca, is `export PYTHONPATH=` the way to "delete" a envvar?16:02
Chipacafacubatista: unset16:02
Chipacafacubatista: although most things don't differentiate between empty and unset16:03
facubatistaChipaca, see https://paste.ubuntu.com/p/8p26CqbBvT/16:04
facubatistaI need the PYTHONPATH to the venv be reused, no matter if I had it before or not16:05
facubatistaChipaca, forgot to include in that pastebin that my PYTHONPATH is normally set to '/home/facundo/.bin/pymods' (so the envvar is there, totally unrelated to any venv)16:06
* facubatista brb16:06
Chipacafacubatista: you there?16:45
facubatistayeap16:46
facubatistaChipaca, yeap16:47
Chipacafacubatista: something funky going on with the environ for test_main breaking setting TMPDIR, but i figured a workaround16:48
facubatistaTMPDIR?16:50
Chipacafacubatista: explanation in a pr soon16:50
facubatistaincenption tests are hard16:50
facubatistainception ones too16:50
Chipacafacubatista: https://github.com/canonical/charmcraft/pull/11716:52
mupPR charmcraft#117: a couple of fixes for tests <Created by chipaca> <https://github.com/canonical/charmcraft/pull/117>16:52
Chipacafacubatista: fixes the leftover tmp dirses16:53
Chipacaand with that i think i eod16:53
* Chipaca EODs17:17
facubatistajustinclark, easy PRs for you to start reviewing...18:13
facubatistathis is trivial: https://github.com/canonical/charmcraft/pull/11618:13
mupPR charmcraft#116: include install info in README <Created by chipaca> <https://github.com/canonical/charmcraft/pull/116>18:13
facubatistathis is easy in the fix, but may lead you to read some code: https://github.com/canonical/charmcraft/pull/11718:13
mupPR charmcraft#117: a couple of fixes for tests <Created by chipaca> <https://github.com/canonical/charmcraft/pull/117>18:13
facubatistaand this one is kind of easy too, and dives you right into complex code: https://github.com/canonical/charmcraft/pull/11818:14
mupPR charmcraft#118: Some changes in preparation for big "include everything but jujuignored" branch <Created by facundobatista> <https://github.com/canonical/charmcraft/pull/118>18:14
justinclarkAwesome. I'll start going through these facubatista.18:27
facubatistajustinclark, awesome! let us know any questions18:28
narinderguptaChipaca, do we know how to get IP address of a pod?19:42
drewn3ssfacubatista: I know you're working on issue #39, not sure how far along it is, but I just noticed the README[.md] is not included, hence, no info in charmstore uploads.  Miight be nice to pick up README and README.md in the mean time in current code, unless you're close.  This file can't be relocated to /src to be pulled in automatically.20:06
mupPR #39: Change Relation.apps to Relation.app <Created by johnsca> <Merged by niemeyer> <https://github.com/canonical/operator/pull/39>20:06
facubatistadrewn3ss, I'm close on finishing #39, PRs are already proposed20:07
mupPR #39: Change Relation.apps to Relation.app <Created by johnsca> <Merged by niemeyer> <https://github.com/canonical/operator/pull/39>20:07
drewn3sssweet, ta!20:08
facubatistacharmcraft#39, that is20:08
mupIssue charmcraft#39: Include all project files (whatever is present there) <Created by facundobatista> <https://github.com/canonical/charmcraft/issues/39>20:08
* facubatista eods20:32

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