Devlog for Aug 22 2014

Was in Edinburgh again, missed writing it as I went along. Oh well.

  • Ported the code for the Wikipedia Android app automated builds to Python, and you can see it in action at http://tools.wmflabs.org/wikipedia-android-builds/ now. It lets you download the latest build, and notes the last successful build time. Good enough :) It was originally in bash, and porting it to python allowed me to create a ‘fake’ API (just JSON blobs written to known locations in the file system). Next step is to write a helper app
  • The Atom experiment is coming along well. Am using it for most of my Puppet work these days. Should give LightTable another go as well.

That’s it!

Devlog for 21 Aug 2014

In Edinburgh! I’ve finally stopped spelling it as Edinborough!

  • Added ‘user group’ functionality to Quarry, and added a sudo user group that does what you would think it does. Will be assigned super, super sparingly.
  • Found out that I’d have to explicitly specify charset of the database when I’m creating it or MySQL will default to a stupid charset. Forced all tables and columns to utf8 and that seems to have fixed a bunch of unicode issues. Yay?
  • Still facing occasional MySQL server has gone away errors with SQLAlchemy for local MySQL instance, despite asking SQLAlchemy to recycle connections every hour or so. Reduced the recycle time to 10m, hopefully that helps.
  • Read Tony Hoare’s Turing Award speech from 1980, titled “The Emperor’s Old Clothes”. I think I should read more of these papers / speeches, helps keep perspective and ‘learn from history’. Lots of warnings against complexity seem to be a very common theme, and one I’ve also personally encountered many times. Recommend reading :)
  • More DMZ work! Now running edits per country stats separated by mobile vs desktop for all countries for all wikipedias! EXCITING!

Devlog for 20 Aug 2014

Woke up at 11AM again! w000t!

  • Fixed a stupid bug in Quarry that made it fail if MySQL decided that a column you were selecting is a Decimal. Fixed this in time for…
  • Helped out with a webinar from J-Mo for people to learn SQL and do research against Wikimedia stuff with Quarry! Went without a glitch mostly, so yay :) Oren asked for an API for Quarry, I’ll investigate ways to get that done
  • Found that some queries against enwiki succeed on s1.labsdb but not on s4.labsdb. I attribute this to cache characteristics, and have switched Quarry to use s1 for now.
  • Did more work on DMZ, getting in place a runner / processor infrastructure and sqlite backed intermediary storage so I can write simpler code to get the data I want. Super excited to see how this goes. It’ll be much easier for me to add new queries now.
  • More work on DMZ! I had a late night sprint and split edits by mobile and desktop (and was surprised by seeing how much lesser edits came from mobile). Next would be to gather up population and internet penetration data and then GO MAKE SOME GRAPHS, probably with iPython. I’m returning to making graphs for real after, what, 6 years or so? :) I was using C# and Excel then :) /nick ExcitedPanda
  • Also made some progress on our makeshift Android CI-ish build system for the Wikipedia app. Should be done soon.

Devlog for 19 Aug 2014

Here we go again.

  • Wrote a small blog post talking about how to package python packages as debian packages.
  • More work on getting Graphite setup for Wikimedia Labs. Everything is up and running now (after a number of embarrassing typos). Need to figure out NAT rules to let labs machines talk to labmon1001, and then it can start receiving data!!!1
  • Got access to Wikimedia’s Hadoop cluster, and ran my first HIVE query ever! This is exciting :)
  • Made packages for pygeoip and ua-parser. Having to make both trusty and precise packages was fun. I ended up building them on separate machines, but am sure there’s a simpler way.
  • Started doing some SQL about editors from different countries. Did you know that there are 2x as many edits to english wikipedia from India as from Germany? And that Wikidata has had 10x as many edits from Toollabs as from Germany (the largest contributing country)? I didn’t either! This is fun.

Simple python packaging for Debian / Ubuntu

(As requested by Jean-Fred)

One of the ‘pain points’ with working on deploying python stuff at Wikimedia is that pip and virtualenvs are banned on production, for some (what I now understand as) good reasons (the solid Signing / Security issues with PYPI, and the slightly less solid but nonetheless valid ‘If we use pip for python and gem for ruby and npm for node, EXPLOSION OF PACKAGE MANAGERS and makes things harder to manage’). I was whining about how hard debian packaging was for quite a while without checking how easy/hard it was to package python specifically, and when I finally did, it turned out to be quite not that hard.

Use python-stdeb.

Really, that is it. Ignore most other things (until you run into issues that require them :P). It can translate most python packages that are packaged for PyPI into .debs that mostly pass lintian checks. Simplest way to package, that I’ve been following for a while is:

  1. Install python-stdeb (from pip or apt). Usually requires the packages python-all, fakeroot and build-essential, although for some reason these aren’t required by the debian package for stdeb. Make sure you’re on the same distro you are building the package for.
  2. git clone the package from its source
  3. Run python setup.py --command-packages=stdeb.command bdist_deb (or python3 if you want to make Python 3 package)
  4. Run lintian on it. If it spots errors, go back and fix them, usually by editing the setup.py file (or sometimes a stdeb.cfg file). This is usually rather obvious and easy enough to fix.
  5. Run dpkg -i <package> to try to install the package. This will error out if it can’t find the packages that your package depends on. This means that they haven’t been packaged for debian yet. You can mostly fix this by finding that package, and making a deb for it, and installing it as well (recursively making debs for packages as you need them). While this sounds onerous, the fact is that most python packages already exist as deb packages and you stdeb will just work for them. You might have to do this more if you’re packaging for an older distro (cough cough precise cough cough), but is much easier on newer distros.
  6. Put your package in a repository! If you want to use this on Wikimedia Labs, you should use Labsdebrepo. Other environments will have similar ways to make the package available via apt-get. Avoid the temptation to just dpkg -i it on machines manually :)

That’s pretty much it! Much simpler than I originally expected, and not much confusing / conflicting docs. The docs for stdeb are pretty nice and complete, so do read these!

Will update the post as I learn more.

Paying for IRCCloud

I’ve started paying for IRCCloud.

It is the first ‘service’ I am paying for as a subscriber, I think. I’ve considered doing that for a long time, but ‘paying for IRC’ just felt… odd. I’ve been using ZNC + LimeChat. It’s decent, but sucks on Mobile. Keeping a socket open all the time on a phone just kills the battery, plus the UX on most Android clients sucks.

So after seeing Sam Smith use IRCCloud during Wikimania, I made the plunge and paid for IRCCloud. It is still connecting to my bouncer, so I have logs under my control. It also has a very usable Android client, and syncs ‘read’ status across devices, and is quite fast.

Convenience and UX won over ‘Free Software’ this time.

DevLog for 18 Aug 2014

I’ve started the habit of opening up a devlog post each morning and just filling it up as I go along. Let’s hope I can keep this up :)

  • Merged a couple of Android patches. The app is getting better every day without too much involvement from me, and yay for that :) I’ve gotten closure over the Android app – it was fucking terrible, and now it is quite awesome. Need to write another post about that.
  • Fixed annoying bug with mysql connections being reset in Quarry’s query runners after a few hours. I had fixed this earlier when I was using pymysql directly with reconnect(ping=True), and assumed that switching to SQLAlchemy would’ve fixed it for me automagically. Apparently not. MySQL Y U SO BAD?
  • I have sudo access on labmon1001 in prod! First Wikimedia production cluster machine I have root on, and will spend time over the next few weeks setting it up to run graphite. Should be fun!
  • Getting slightly better at packaging python things. Packaged python-txstatsd with no lintian errors, and only a couple warnings :)

DevLog for 17 Aug 2014

Devlogs again! Let’s see how long I can keep this one up.

Been a whirlwind few months. I’m moving to the Wikimedia Ops team soon! The Wikipedia app has been released! Lots of excitement around, should do a bigger post sometime with details. This should just follow usual devlog format of stuff for the day

  • Completed deployment of changing the results backend of Quarry to SQLite. That was a fun exercise, and I should write about that separately. Still have some unicode issues left (mostly from the MySQL side) that I’ve hacked around for now.
  • Quarry now uses a cron based query killer instead of relying on Celery. The day before I had force killed the celery deamons and this meant the query kill tasks didn’t run, leaving zombie queries behind. The simpler cron based killer won’t have this issue, since it’s super simple and does only one thing. The only reason I didn’t do this before was that I had not known about SHOW PROCESSLIST before (yes, I suck). It seems to be working fine now, but doesn’t kill superseeded queries immediately. Should be interesting to figure out how to get that done properly.
  • I’ve started trying out Atom again. My previous attempt ended quickly when I ran into a bug which didn’t wrap text at all. A restart seems to have fixed that. The Vim keybindings are ‘ok’ – there’s no hlsearch, which is painful, but I can live with it. I prefer the fuzzy finder in it to Ctrl-P in Vim.
  • Started working on making labs monitoring with graphite possible again. Our graphite / txstatsd roles weren’t meant to be run on trusty, so working on porting things to make sure they work fine on both. I’ve immensely come to appreciate ops over the last year or so, and am quite enjoying my work in that area :) I’ll probably be doing more of these over the next week, since Quarry has reached a nice state now and I await more usage before I spend more time on it.
  • Also did some code review on the Android app. It’s been chugging along quite happily these days :)
  • Ran into a awake-when-he-should-not-have been Oliver Keyes and we have conspired to start some researchy things. I cleaned up some of the python code, and am writing out things to do. This should be fun!

English Translation of ‘Tamil Hip Hop’ song

This is a best effort translation of the song ‘Clubbule Mabbule‘ (Drunk in a Club) from Tamil to English.

(Come on, I smoke, I drink, I'm in a live in relationship)

Fuck, get lost. This is modern culture, eh? If you call this westernization modern culture, then this song is dedicated right for you. Hip hop tamizha, your Aaadheeee.

Women roaming around drunk in clubs What the fuck is happening in Tamil Nadu I salute you all All your honor is flying away

Women roaming around drunk in clubs What the fuck is happening in Tamil Nadu I salute you all All your honor is flying away

Hi girls, first you say ‘how are you?’ After knowing me for 10 months you say ‘Who are you?’ Just three words ‘I love you’ Don’t you even know the meaning of that?

Hey Sheena, Leena, Meena, Veena, Don’t show off as knowing only little bits of tamil with a foreign accent, If you leave Tamil Nadu and go out, does not mean you have to forget your mother tongue Tamil

Rohini, Yohini, Yamini, Kamini, Think they are hot but are actually funny, Don’t blame men pointlessly, (He is looking at me only!) Why do you do this?

Women roaming around drunk in clubs What the fuck is happening in Tamil Nadu I salute you all All your honor is flying away

Women roaming around drunk in clubs What the fuck is happening in Tamil Nadu I salute you all All your honor is flying away

I’m not blaming all women, The deity who gave birth to me is also a woman. All the guys come to my side, or these girls will spoil you as well

Of 100, 50 are like these, Roaming around clubs drinking and smoking, From the time when women cooked nice food, OH MY GOD NOW THEY ARE SMOOKING GANJA WHAT A SHAME

Women roaming around drunk in clubs What the fuck is happening in Tamil Nadu I salute you all All your honor is flying away

Women roaming around drunk in clubs What the fuck is happening in Tamil Nadu I salute you all All your honor is flying away

Pretty woman, with pretty eyes BUT SHE HAS ONE BOTTLE OF RUM!

Pretty woman, with pretty eyes, BUT WITH RUM SHE HAS HALF A PACK OF CIGARETTES

Pretty fairy, I don’t need you, You are dancing heavily drunk.

Gone are the times when women wore jewellery, Now they keep smoking everywhere. Instead of wearing sarees, THEY ARE WEARING HANDKERCHEIFS!

Women roaming around drunk in clubs What the fuck is happening in Tamil Nadu I salute you all All your honor is flying away

Women roaming around drunk in clubs What the fuck is happening in Tamil Nadu I salute you all All your honor is flying away

Gone are the times when women wore jewellery, Now they keep smoking everywhere. Instead of wearing sarees, THEY ARE WEARING HANDKERCHEIFS! THEY ARE WEARING HANDKERCHEIFS! (Shows handkerchief for emphasis)

As far as I know, this is not satire.

“Scouting for Boys”

In Welcome to the Machine there is a line that goes “provided with toys and scouting for boys”. I had initially assumed that it was referring to a young guy who is gay and is ‘scouting for boys’.

And then a few days later I realized that it is talking about ‘the book‘. That is now doubly funny because of the Boy Scouts’ attitude towards gays