– timing small repetitive jobs

It’s exam marking season hereabouts (and, thanks to the AUT industrial action, coursework marking time), so I’ve got my head down in piles of exam scripts.

One exam (on IT security) was a complete nightmare to mark – essay questions, loads of text, oh it just took ages. It really seemed to go on forever. At least I only had to mark half of it – but I really wasn’t looking forward to my other exams, to be marked all on my own.

Python to the rescue!

No, not a random number generator (though it’s sometimes tempting). Instead, a motivational tool: something to keep me focussed and “in the game”.

I have two problems when marking, basically: one is that when I’ve got a huge pile to get through, and it’s going fairly slowly, oh it’s sooo painful and you want it to be over, but it isn’t, and it won’t do itself, and, well, it’s all very antimotivational. The other problem is that I get distracted easily, so I’ll do a few, then chat, then do a few, then play Urban Dead for a bit, then do a few more, etc. Naturally these two problems feed into each other, and a snail’s pace is achieved.

It’s all mental – the issue is focus. Thus, we present, a little script I knocked up in a hurry yesterday evening to help me stay focussed. And I gotta say, it’s proven instrumental in helping me hammer through the networks exams in record time.

Basically, is a simple tool for keeping track of progress through a large batch of small repetetive jobs, where you want to know how long you’re spending on each job on average, and how many you’ve done so far. It has a simple text-mode keyboard interface, whose central feature is “you hit space to tell it you’ve finished one job and are starting another”. You can pause it, report on averages, and see how much time since you started has been spent “unpaused and working” (as opposed to “paused and playing Shartak, say).

It’s very simple: no persistence between sessions, no flashy graphics, and probably only works on Unix – it uses select() on stdin to catch keypresses; a Windows version could be hacked using msvcrt, I guess. The code’s not beautiful, but it does the job beautifully well for me.

Read the comment at the start of the code to see excactly how to use it. It’s dead simple.


Screenshot of in action

The clock starts ticking at 15:06:07; the first job takes 27 seconds, then 2 mins 5, then 1:42, then 2:51. 10 seconds into the next job (at 15:06:23), the clock is paused. 15 seconds later, it’s unpaused, and three seconds later that job’s complete. At 15:06:44 we hit ‘a’ to get a reading of averages/stats: 5 done, average 1 min 27, elapsed wall clock time is 7 mins 36, 96% of which has been spent with the clock ticking. Etc., etc. – you get the picture. Actually, looking at this shows me a bug/feature: when you quit, it doesn’t count the job that was just running – so end a job before quitting if you care about accuracy. :-)

One Response to “ – timing small repetitive jobs”

  1. August 10th, 2006 | 1:25 am

    this is brilliant – inspired me to do something similar though with a slightly different focus (not so much motivational, more monetary accuracy