Python type hints are probably "worth it" in the large for me
I recently added type hints to a little program , and that experiencewasn't entirely positive that left me feelingthat maybe I shouldn't bother. Because I don't promise to beconsistent, I went back and re-added type hints to the program allover again, starting from the non-hinted version. This time I didthe type hints rather differently and the result came out wellenough that I'm going to keep it.
Perhaps my biggest change was to entirely abandon NewType()
My life has been improved by my quiet Prometheus alert status monitor
I recently created a setup to provide a backup for our email-basedPrometheus alerts ; the basicresult is that if our current Prometheus alerts change, a windowwith a brief summary of current alerts will appear out of the wayon my (X) desktop. Our alerts are delivered through email, and whenI set up this system I imagined it as a backup, in case emaildelivery had problems that stopped me from seeing alerts . I didn't entirely realize that inthe process, I'd created
Some notes on my experiences with Python type hints and mypy
As I thought I might , today I spent sometime adding full and relatively honest type hints to my recentPython program . Theexperience didn't go entirely smoothly and it left me with a numberof learning experiences and things I want to note down in case Iever do this again.The starting point is that my normal style of coding small programsis to not make classes to represent different sorts of things andinstead use only basic built in collection types, like lists, tuples,dictionaries, and so on
Python type hints may not be for me in practice
Python 3 has optional type hints (and has had them for some time),and some time ago I was a bit tempted to start using some of them ; more recently, I wrote a small amount ofcode using them . Recently I needed to write a little Python program and as I started, I was briefly tempted to try type hints. Then Idecided not to, and I suspect that this is how it's going to go inthe future.
The practical problem of type hints for me when
What NFS server threads do in the Linux kernel
If we ignore the network stack and take an abstract view, the Linuxkernel NFS server needs to do things at various different levelsin order to handle NFS client requests. There is NFS specificprocessing (to deal with things like the NFS protocol and NFSfilehandles ), general VFS processing (includingmaintaining general kernel information like dentries ), then processing in whatever specific filesystemyou're serving, and finally some actual IO if necessary. In theabstract, there are all sorts of ways to split up the responsibilityfor
The question of how many NFS server threads you should use (on Linux)
Today, not for the first time, I noticed that one of our NFSservers was sitting at a load average of 8with roughly half of its overall CPU capacity used. People withexperience in Linux NFS servers are now confidently predicting thatthis is a 16-CPU server, which is correct (it has 8 cores and 2 HTthreads per core). They're making this prediction because the normalLinux default number of kernel NFS server threads to run is eight.
(Your distribution may have changed this
The general issue of terminal programs and the Alt key
When you're using a terminal program (something that provides aterminal window in a GUI environment, which is now the dominantform of 'terminals'), there's a fairly straightforward answer forwhat should happen when you hold down the Ctrl key while typinganother key. For upper and lower case letters, the terminal programgenerates ASCII bytes 1 through 26, for Ctrl-[ you get byte 27(ESC), and there are relatively standard versions of some othercharacters . For other characters
My new solution for quiet monitoring of our Prometheus alerts
Our Prometheus setup delivers allalert messages through email, because we do everything through email(as a first approximation). As we saw yesterday, doing everythingthrough email has problems when your central email server isn'tresponding ; Prometheus raised alertsabout the problems but couldn't deliver them via email because thecore system necessary to deliver email wasn't doing so. Today, Ibuilt myself a little X based system to get around that, using thesame approach as my non-interrupting notification of new email
Our Prometheus alerting problem if our central mail server isn't working
Over on the Fediverse, I said something :
Ah yes, the one problem that our Prometheus based alert system can't send us alert email about: whenthe central mail server explodes. Who rings the bell to tell you thatthe bell isn't working?
(This is of course an aspect of monitoring your Prometheus setupitself , and also seeing if Alertmanageris truly healthy .)
There is a story here. The short version of the story is that todaywe wound up with a mail loop that completely
Thinking about how to tame the interaction of conditional GET and caching
Due to how I do caching here, Wandering Thoughts has along standing weird HTTP behavioral quirk where a non-conditionalGET for a syndication feed here can get a different answer than aconditional GET . One (technical) way toexplain this issue is that the cache validity interval fornon-conditional GETs is longer than the cache validity interval forconditional GETs. In theory this could be the complete explanationof the issue, but in practice there's another part to it, which isthat DWiki doesn't