« first day (5030 days earlier)      last day (143 days later) » 

05:31
Does anyone know if python's build in lru_cache is cleared with each request to a django request? And for each "run" of a celery task?
@paul23 you have to consult the lifetime of your decorated callable, and if anything calls cache_clear(). There's no magic on the Python side.
I mean the built in lru_cache from functools
05:50
It probably wouldn't matter so much about cache_clear() vs. python processes being spawned
 
3 hours later…
08:59
@MisterMiyagi "mixing homebrew-packaged with normal python" means do brew install on some packages, pip install on others
09:11
...packages on which other packages depend. Then enjoy the fun updating.
 
4 hours later…
12:57
@smci I don’t understand (again and sorry). We are talking about using brew'ed Python to create and use via venv, right? Why would brew installed Python packages have any effect there? There’s a reason why venv does not inherit external packages by default, and it’s not brew specific.
13:26
FWIW, I did recently have pip+package manager problems because one package (psycopg2) insisted on being compiled against system source. That wasn’t pretty, but RHEL+dnf and not brew. I would honestly chalk that up as a defect of the package (mind, not necessarily a defect that is feasible to fix).
13:54
morning cabbages, folks!
@MisterMiyagi I'm not sure if it's related to the issues you had, but I always use psycopg2-binary instead
"but in production it is advised to use the package built from sources." <waits patiently for elaboration on why>. I've never had any issues so anecdata FTW
Hmm, interesting. Thanks for digging that out. I really should have done the legwork there to find the issue
14:10
No worries, the reason why perked my interests :)
 
2 hours later…
16:24
In the documentary that's come on through Youtube's random wandering, I've just found out that Master Putter-Togetherer is an official title. There's only 2 of them left. I feel like the programming profession could keep the spirit alive for people working in system integration
16:37
@AndrasDeak--СлаваУкраїні but isn't the cache cleared, because uwsgi spawns a new python process? Similarly is each celery task a new process?
Another question: does anyone know about a library to convert utf-8 str in python to ascii strings with the unicode characters escaped like \u007F?
@paul23 my thinking was more that the cache could be split across processes. At least with gunicorn you get child processes and each take a namespace. For something like AppScheduler you would need to run it pre-fork or each child process will keep repeating the task. I don't know celery so you'd need to see whether it maintains a pool and whether there is some method of IPC controlled by the master process
The fact that it has its own version of lru_cache suggests, to me at least, that it's not gonna work with the generic implementation
'hellö'.encode('ascii', 'backslashreplace').decode("utf-8", "backslashreplace")
that doesn't return the original string
Encoding with ascii and decoding with utf8 doesn't return the original string? :thonking:
 
2 hours later…
AAB
AAB
18:39
cbg all
SQLite3 has a WAL mode, which is better at conurrency
from python code I have tried so far, I see better performance with PRAGMA JOURNAL=DELETE and PRAGMA SYNCHRONOUS=FULL which seem to be the default on my machine
The only time reader are blocked is if I use BEGIN TRANSACTION EXCLUSIVE
apart from that I am not able to create a scenario a reader is blocked because of a writer
The database works fine only when I try insert from 2 or more process I get the database locked
else for readers I dont see any issue except if my transaction is using EXCLUSIVE
for executing a a few 100 inserts and then doing a conn.commit() is always faster in JOURNAL=DELETE than WAL mode
am I doing something wrong, is it fine for me to ask this question on SO?
19:22
well seems like you can't escape normal distribution even in the stack overflow survey results
what's your favorite survey result? -> all folks
@AAB I don't understand your question. You can have unlimited readers and one writer
@paul23 You want 'hellö'.encode('ascii', 'backslashreplace').decode("unicode_escape"), but there are caveats. See stackoverflow.com/questions/4020539. The reason your approach doesn't work is that 'backslashreplace' is an error-handling protocol, not an encoding. When you encode, the resulting bytes contains bytes corresponding to backslashes, which are perfectly valid UTF-8, so no error handling happens on the round trip.
2
A single writer should not block readers but the WAL should basically freeze the DB state and make an atomic write (which, in theory, could take hours). So I think it's more about consistency of readers during that period of an open transaction than anything else
Aside from that, UTF-8 is not some magic word that means "please use Unicode". It is one possible encoding of text which has the property "is capable of encoding every Unicode code point".
by "there are caveats" I mean that's the encoding you should specify for the general approach implied by your code; but that approach cannot solve every problem that you're likely to want solved if you're writing code like this. Please read all the other answers. It is not a straightforward task, fundamentally. That's not Python's fault (this time); it's just that what you're asking to do is much harder than it sounds like.
19:48
Man, I made such a hash of that. Get in the bin

« first day (5030 days earlier)      last day (143 days later) »