<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Michael Jay Lissner</title><link href="https://michaeljaylissner.com/" rel="alternate"></link><link href="https://michaeljaylissner.com/feeds/tag/rant" rel="self"></link><id>https://michaeljaylissner.com/</id><updated>2014-11-01T00:00:00-07:00</updated><entry><title>Some Thoughts on Celery</title><link href="https://michaeljaylissner.com/posts/2014/11/01/some-thoughts-on-celery/" rel="alternate"></link><updated>2014-11-01T00:00:00-07:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2014-11-01:posts/2014/11/01/some-thoughts-on-celery/</id><summary type="html">
&lt;p&gt;We finally upgraded &lt;a href="https://www.courtlistener.com"&gt;CourtListener&lt;/a&gt; last week and things went pretty well with the exception of two issues. First, we had some extended downtime as we waited for the database migration to complete. In retrospect, I should have realized that updating every item one row at a time would take a while. My bad. &lt;/p&gt;
&lt;p&gt;Second, &lt;a href="http://www.celeryproject.org/"&gt;Celery&lt;/a&gt; broke again and that took me the better part of a day to detect and fix. As a central part of our infrastructure, this is really, &lt;em&gt;truly&lt;/em&gt; frustrating. The remainder of this post goes into what happened, why it happened and how I finally managed to fix it. &lt;/p&gt;
&lt;h2 id="why"&gt;Why?&lt;/h2&gt;
&lt;p&gt;First, why did this happen? Well…because I decided to log something. I created a task that processes &lt;a href="https://free.law/2014/10/31/announcing-oral-arguments-on-courtlistener/"&gt;our new audio files&lt;/a&gt; and I thought, “Hey, these should really log to the Juriscraper log rather than the usual celery log.” So, I added two lines to the file: One importing the log file and the second writing a log message. &lt;em&gt;This&lt;/em&gt; is the little change that brought Celery to a grinding halt. &lt;/p&gt;
&lt;h2 id="what-the-hell"&gt;What the Hell?&lt;/h2&gt;
&lt;p&gt;If you’re wondering why logging would break an entire system, well, the answer is because Celery runs as a different user than everything else. In our case, as the &lt;code&gt;celery&lt;/code&gt; user — a user that didn’t have permission to the log file I requested. Ugh. &lt;/p&gt;
&lt;p&gt;Fine, that’s not so bad, but there were a number of other frustrating things that made this much worse:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The Celery init script that we use was reporting the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="err"&gt;↪&lt;/span&gt; &lt;span class="n"&gt;sudo&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="n"&gt;celeryd&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;
&lt;span class="n"&gt;celeryd&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;multi&lt;/span&gt; &lt;span class="n"&gt;v3&lt;/span&gt;&lt;span class="mf"&gt;.0.13&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Chiastic&lt;/span&gt; &lt;span class="n"&gt;Slide&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Starting&lt;/span&gt; &lt;span class="n"&gt;nodes&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;w1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;courtlistener&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;OK&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But no, it was not starting “&lt;span class="caps"&gt;OK&lt;/span&gt;”. It was immediately crashing.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;No log messages…&lt;em&gt;anywhere&lt;/em&gt;. This appears to be because you have to detach &lt;code&gt;stdin&lt;/code&gt; and &lt;code&gt;stdout&lt;/code&gt; before daemonizing and according to asksol on &lt;span class="caps"&gt;IRC&lt;/span&gt;, this has been fixed in recent versions of Celery so even daemonizing errors can go to the Celery logs. Progress!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The collection of things that happens when &lt;code&gt;celery&lt;/code&gt; starts is complicated:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I call &lt;code&gt;sudo service celeryd start&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;service&lt;/code&gt; calls &lt;code&gt;/etc/init.d/celeryd&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;celeryd&lt;/code&gt; does some stuff and calls &lt;code&gt;celery.sh&lt;/code&gt; (another file altogether), where our settings are.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: Apparently this is a CourtListener-specific customization, so this step probably won’t apply to you, but I have no idea where this wacky set up came from (it’s been in place for years).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Control is returned to &lt;code&gt;celery&lt;/code&gt;, which starts celery itself with a command generated from &lt;code&gt;celery.sh&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;On top of this, there’s a &lt;code&gt;celery&lt;/code&gt; binary and there’s a celery &lt;a href="https://docs.djangoproject.com/en/dev/howto/custom-management-commands/"&gt;management command&lt;/a&gt; for Django. (&lt;strong&gt;Update&lt;/strong&gt; the Django commands were removed in Celery 3.1. More progress!) &lt;code&gt;celery --help&lt;/code&gt; prints out 68 lines of documentation. Not too bad, but many of those lines refer you to other areas of the documentation. For example, &lt;code&gt;celery worker --help&lt;/code&gt; prints another 100 lines of help text. &lt;em&gt;Jesus&lt;/em&gt; this thing is complicated. &lt;/p&gt;
&lt;p&gt;Did I mention it has &lt;a href="http://seeknuance.com/2012/07/30/celery-api-changes-drive-me-nuts/"&gt;changing APIs&lt;/a&gt;?&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I digress a bit, but the point here is that it fails silently, there are no log messages when it fails, and there’s no way to know which part of a complicated infrastructure is the problem. End rant.&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="#fn:1" rel="footnote"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;h2 id="seeking-sanity"&gt;Seeking Sanity&lt;/h2&gt;
&lt;p&gt;It took me a long time to figure out what was going wrong, but I did eventually figure it out. The process, in case you run into something similar, is to modify &lt;code&gt;celeryd&lt;/code&gt; so it prints out the command that it eventually runs. At that point you’ll have the correct command. With that, you can run it as the &lt;code&gt;celery&lt;/code&gt; user and with some luck you’ll see what the problem is. There’s &lt;a href="http://stackoverflow.com/a/21883578/64911"&gt;a modified init script for this purpose, if you like&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Other tips:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If you have a new enough version of Celery, there are &lt;a href="http://celery.readthedocs.org/en/latest/tutorials/daemonizing.html#troubleshooting"&gt;some troubleshooting tips&lt;/a&gt; that should help. They did nothing for me, because I haven’t upgraded yet for fear of the changing APIs.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;There seem to be a handful of different command line flags that Celery can use to be sent to the background. You’ll need to disable these when you’re testing or else you won’t see error messages or anything (apparently?).&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="moving-forward"&gt;Moving Forward&lt;/h2&gt;
&lt;p&gt;So, I feel bad: I’ve ranted a good deal about Celery, but I haven’t proposed any solutions. It looks like a lot of things have been improved in recent versions of Celery, so part of the solution is likely for us to upgrade. &lt;/p&gt;
&lt;p&gt;But this isn’t the first time I’ve spent a long time trying to make Celery work, so what other ideas it take to make Celery a less complicated, more reliable tool? &lt;/p&gt;
&lt;p&gt;The ideas I’ve come up with so far are: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;More documentation for installation and set up troubleshooting with the possibility of a wiki.&lt;ul&gt;
&lt;li&gt;But already I rant about how much documentation it has.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A simpler interface that eliminates a number of edge uses.&lt;ul&gt;
&lt;li&gt;But I have no idea what, if anything, can be eliminated. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Support for fewer task brokers.&lt;ul&gt;
&lt;li&gt;But I use RabbitMQ and am considering switching to Redis.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A more verbose, more thorough debug mode.&lt;ul&gt;
&lt;li&gt;But apparently this is already in place in the latest versions?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Let Celery run as the &lt;code&gt;www-data&lt;/code&gt; user as a general practice?&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;But apparently that’s a bad idea. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; this is a bad idea in general, but it’s not &lt;em&gt;particularly&lt;/em&gt; bad if you don’t expose Celery on the network. If you’re only running it locally, you can probablly get by with Celery as a &lt;code&gt;www-data&lt;/code&gt; user or similar. &lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As you can tell, I don’t feel strongly that any of these are the right solution. I am convinced though that Celery has a bad smell and that it’s ripe for a leaner solution to fill some of its simpler use cases. I’m currently considering switching to a simpler task queue, but I don’t know that I’ll do it since Celery is the de-facto one for Django projects.&lt;/p&gt;
&lt;p&gt;We deserve a good, simple, reliable task queue though, and I wonder if there are good ideas for what could be changed in Celery to make that possible. I, for one, would love to never spend another minute trying to make RabbitMQ, Celery and my code play nicely together. &lt;/p&gt;
&lt;div class="footnote"&gt;
&lt;hr/&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;In truth Celery is a classic love/hate relationship. On the one hand, it evokes posts like this one, but on the other, it allows me to send tasks to a background queue and distribute loads among many servers. Hell, it’s good enough for Instagram. On the other hand, god damn it, when it fails I go nuts. &lt;a class="footnote-backref" href="#fnref:1" rev="footnote" title="Jump back to footnote 1 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</summary><category term="Celery"></category><category term="Python"></category><category term="Rant"></category></entry><entry><title>Every Now and Again, I Rant About iPods</title><link href="https://michaeljaylissner.com/posts/2009/05/24/sometimes-i-rant-about-ipods/" rel="alternate"></link><updated>2009-05-24T23:34:44-07:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2009-05-24:posts/2009/05/24/sometimes-i-rant-about-ipods/</id><summary type="html">&lt;p&gt;Like the title says, every now and again, I have to rant about how annoying
iPods (and by extension, Apple) are. This is one of those&amp;nbsp;times.&lt;/p&gt;
&lt;p&gt;The picture below represents the folder hierarchy of my &lt;span class="caps"&gt;20GB&lt;/span&gt; iPod, 
as displayed in the Ubuntu Disk&amp;nbsp;Analyzer:&lt;/p&gt;
&lt;p&gt;&lt;img alt="iPods Annoy Me" src="https://michaeljaylissner.com/images/ipods annoy me.png" /&gt;&lt;/p&gt;
&lt;p&gt;Right now, this iPod is nearly full. I filled it with a very normal 
hodge-podge of songs. Naturally, I like some artists better than others, 
and so, I have more of their songs. &lt;em&gt;The Beatles&lt;/em&gt; and &lt;em&gt;Zeppelin&lt;/em&gt;, for example, 
I have a lot of. &lt;em&gt;A-Ha&lt;/em&gt;, and &lt;em&gt;Four Non Blonds&lt;/em&gt;, not so much. When this is the 
case, I&amp;#8217;ll have a folder filled with lots of songs - a big folder. If you 
look at the image above though, you&amp;#8217;ll see that my iPod is organized into 
50 equal directories, named r1 to&amp;nbsp;r50.&lt;/p&gt;
&lt;p&gt;Now, why would Apple do this? Why would they take perfectly organized songs
in neat and tidy folders and then split them into 50 folders with 
meaningless names? Because that makes it more of a pain in the butt to 
figure out what music is on the iPod, and in theory makes it harder to 
share the songs. For the copyright violators, this should slow them&amp;nbsp;down. &lt;/p&gt;
&lt;p&gt;For the rest of the world, it&amp;#8217;s a pain, because rather than browsing our 
iPod like we would a normal music player, instead we must use iTunes, or, 
if we use Linux, reverse engineer the thing, which invariably doesn&amp;#8217;t work 
that&amp;nbsp;well. &lt;/p&gt;
&lt;p&gt;Apple could have made a device that worked normally on all computers, 
like everybody else did, but instead they have locked us into iTunes, 
a weird directory structure, and a system designed to be as obscure as 
possible. Not&amp;nbsp;cool.&lt;/p&gt;</summary><category term="ipod"></category><category term="rant"></category><category term="DRM"></category></entry><entry><title>Cheney is so shady, it pisses me off.</title><link href="https://michaeljaylissner.com/posts/2008/12/19/cheney-is-so-fing-shady-it-pisses-me-off/" rel="alternate"></link><updated>2008-12-19T21:35:28-08:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2008-12-19:posts/2008/12/19/cheney-is-so-fing-shady-it-pisses-me-off/</id><summary type="html">&lt;p&gt;Cheney is &lt;a href="http://www.google.com/hostednews/ap/article/ALeqM5jz2z92QFdgFrIMAJC-4GQcHOm3MgD955ETCO0"&gt;at work&lt;/a&gt; to keep his records from becoming public as part of 
the National Archives when he goes out of&amp;nbsp;office. &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The vice president alone may determine what constitutes vice presidential
 records or personal records, how his records will be created, maintained, 
 managed and disposed, and are all actions that are committed to his 
 discretion by&amp;nbsp;law.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I can think of no reason why this would be necessary unless he&amp;#8217;s the shadiest 
person ever in office. Oh,&amp;nbsp;right.&lt;/p&gt;
&lt;p&gt;As an ex-government worker, I can testify to how ridiculous this is: It&amp;#8217;s 
really fucking&amp;nbsp;ridiculous.&lt;/p&gt;</summary><category term="rant"></category><category term="archive"></category><category term="cheney"></category><category term="government"></category></entry><entry><title>I Am Me, Dammit!</title><link href="https://michaeljaylissner.com/posts/2008/09/15/i-am-me-dammit/" rel="alternate"></link><updated>2008-09-15T15:00:30-07:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2008-09-15:posts/2008/09/15/i-am-me-dammit/</id><summary type="html">&lt;p&gt;Well, it happened. The bastards stole my identity. They somehow got my credit 
card number, address, phone number, etc, took them, and put them to use. Grand 
total losses: $309. Not too bad,&amp;nbsp;considering.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve called my credit card company, and they promise to reimburse me for my 
losses. This is when I thank the federal government for making them do this. 
Thank you&amp;nbsp;feds!&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m thinking about how this happened, and I have a theory. I am about 95% sure 
this happened as a result of shopping for car parts online. One of the 
retailers I went to (lost to me now) decided to share my contact information 
with a number of &amp;#8220;partners&amp;#8221; so that a part I was looking for could be found 
more easily. I ended up getting the part, but I think they might have shared 
more info than they should have.&amp;nbsp;Arg. &lt;/p&gt;
&lt;p&gt;After all of the services that credit cards have tried to sell me over the 
years to protect me from this kind of thing, I&amp;#8217;m happy to say that I&amp;#8217;m fine 
without them. It&amp;#8217;s really not the end of the world&amp;#8230;it&amp;#8217;s annoying though,&amp;nbsp;yes.&lt;/p&gt;</summary><category term="rant"></category><category term="theft"></category><category term="bastard"></category><category term="identity"></category><category term="security"></category></entry><entry><title>Amazon Has mp3’s! I Wish I Could Download Them…</title><link href="https://michaeljaylissner.com/posts/2008/01/22/amazon-has-mp3s/" rel="alternate"></link><updated>2008-01-22T19:04:40-08:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2008-01-22:posts/2008/01/22/amazon-has-mp3s/</id><summary type="html">&lt;p&gt;It made some headlines, and is about to make more during superbowl. 
&lt;a href="http://www.news.com/8301-10784_3-9848258-7.html?tag=newsmap"&gt;Amazon 
has started selling mp3&amp;#8217;s from all four of the major record labels.&lt;/a&gt; It&amp;#8217;s a 
pretty cool revelation, so I went ahead and checked it&amp;nbsp;out.&lt;/p&gt;
&lt;p&gt;Guess what? Linux users, you are screwed. In order to download albums from 
Amazon, you must &amp;#8220;Get the Amazon mp3 downloader&amp;#8221;&amp;#8230;which is not available for 
Linux. Excuse me? Say what? I have downloaded literally hundreds upon hundreds 
of files from the Internet, and never have I needed a special tool other than 
Firefox. Why&amp;nbsp;now? &lt;/p&gt;
&lt;p&gt;Amazon, if you&amp;#8217;re going to do something great like this, do it whole hog. 
Don&amp;#8217;t make me install junkware. After all, I&amp;#8217;m &lt;em&gt;choosing&lt;/em&gt; to give you 
money,&amp;nbsp;right? &lt;/p&gt;</summary><category term="Music"></category><category term="Copyright"></category><category term="Amazon"></category><category term="Rant"></category></entry><entry><title>An Important Distinction</title><link href="https://michaeljaylissner.com/posts/2007/11/26/an-important-distinction/" rel="alternate"></link><updated>2007-11-26T17:02:25-08:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2007-11-26:posts/2007/11/26/an-important-distinction/</id><summary type="html">&lt;p&gt;For the record&amp;nbsp;people:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Quite:&lt;/strong&gt; I haven&amp;#8217;t &lt;strong&gt;quite&lt;/strong&gt; finished my soup. This is &lt;strong&gt;quite&lt;/strong&gt; a nice&amp;nbsp;restaurant.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quiet:&lt;/strong&gt; This is a &lt;strong&gt;quiet&lt;/strong&gt; restaurant. I enjoy peace and &lt;strong&gt;quiet&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We recently looked for roommates, and we subtracted points from anybody that 
wrote in their response email the word &amp;#8220;quite&amp;#8221; where they meant to say &amp;#8220;quiet.&amp;#8221; 
It was extraordinary how many applicant roommates think they are &amp;#8220;a quite&amp;nbsp;person&amp;#8221;.&lt;/p&gt;</summary><category term="Pedantry"></category><category term="Rant"></category></entry></feed>