Computer Sciences Department logo

CS 368-2 (2012 Spring) — Day 7 Homework

Due Thursday, April 12, at the start of class.


Analyze a complicated log file from Condor and report on where jobs are being run.

Mostly, this is an exercise in using regular expressions. But the data being analyzed come from Condor, which is the software that manages the CHTC resources and their jobs here on campus. While it is too much to explain all of Condor and why these particular log entries might be interesting, at least you will get a hint of what is going on. And once we start talking about CHTC and Condor, the data may begin to make more sense.

Background Information

Condor is a distributed high-throughput computing system developed and maintained here at the University of Wisconsin–Madison in the Computer Sciences department. It is the software that runs the CHTC facility. Essentially, Condor:

Your script will analyze one Condor log file to figure out which exact execution machine each job ran on.


Essentially, this script is similar to the word-frequency counting part of the script from homework #4. That is, the script will count how often certain events occurred and report on them.

However, there are significant differences this time:

The log file is available for download: input-07-log.txt (4.1 MB, ~52K lines).

The precise description of the task requires many words and examples, but fortunately, the code is fairly easy to write in Python! For reference, my solution is less than 40 lines of code, and I wrote two functions to make things simpler and clearer. It takes much less than one second to run on the whole input file.

Selecting the Interesting Lines

Here are a few lines from the file, with one example of an interesting line highlighted:

11/03/11 05:38:07 ******************************************************
11/03/11 05:38:07 ** condor_shadow (CONDOR_SHADOW) STARTING UP
11/03/11 05:38:07 ** /usr/sbin/condor_shadow
11/03/11 05:38:07 ** SubsystemInfo: name=SHADOW type=SHADOW(6) class=DAEMON(1)
11/03/11 05:38:07 ** Configuration: subsystem:SHADOW local:<NONE> class:DAEMON
11/03/11 05:38:07 ** $CondorVersion: 7.7.2 Sep 27 2011 BuildID: 372978 PRE-RELEASE-UWCS $
11/03/11 05:38:07 ** $CondorPlatform: x86_64_rhas_3 $
11/03/11 05:38:07 ** PID = 31257
11/03/11 05:38:07 ** Log last touched 11/3 05:38:07
11/03/11 05:38:07 ******************************************************
11/03/11 05:38:07 Using config source: /etc/condor/condor_config
11/03/11 05:38:07 Using local config sources: 
11/03/11 05:38:07    /etc/condor/condor_config.local
11/03/11 05:38:07    /etc/condor/
11/03/11 05:38:07    /etc/condor/condor_config.special
11/03/11 05:38:07 DaemonCore: command socket at <>
11/03/11 05:38:07 DaemonCore: private command socket at <>
11/03/11 05:38:07 Setting maximum accepts per cycle 8.
11/03/11 05:38:07 Initializing a VANILLA shadow for job 4786121.0
11/03/11 05:38:07 (4786121.0) (31257): Request to run on glidein_12311@compute-2-3.nys1 <> was DELAYED (previous job still being vacated)
11/03/11 05:38:08 (4786121.0) (31257): Request to run on glidein_12311@compute-2-3.nys1 <> was ACCEPTED
11/03/11 05:38:09 (4786116.0) (30040): Job 4786116.0 terminated: exited with status 8
11/03/11 05:38:09 (4786116.0) (30040): Reporting job exit reason 100 and attempting to fetch new job.

Notice the line immediately preceding the highlighted one. It is very similar in many respects, but ends differently. For this assignment, it is not an interesting line. For what it’s worth, the interesting lines reflect jobs that are accepted to be run on remote machines.

Below, I have extracted several of the interesting lines for comparison. Of course, there are lots of other log lines omitted between these samples.

11/03/11 08:06:50 (4744634.0) (6423): Request to run on <> was ACCEPTED
11/03/11 08:06:50 (4786880.0) (6226): Request to run on glidein_13822@compute-10-24.local <> was ACCEPTED
11/03/11 08:06:50 (4744653.0) (6426): Request to run on <> was ACCEPTED
11/03/11 08:06:50 (4786881.0) (6232): Request to run on glidein_16278@compute-11-14.local <> was ACCEPTED
11/03/11 08:06:50 (4744883.0) (6430): Request to run on <> was ACCEPTED
11/03/11 08:06:50 (4786882.0) (6227): Request to run on glidein_23769@compute-10-25.local <> was ACCEPTED

Notice that they all have the following format, where the parts that vary from line to line are highlighted:


Important: Your script must count information from these lines and only these lines.

Dividing the Interesting Lines by Slot Type

The report needs only the SLOT and HOST parts of the lines above. Start with the SLOT part: Notice that some slot labels begin with “glidein_” and some do not? The final report must list the glide-in counts separately from the regular ones. Given that there are two parts to the report, how will you track the counts?

Counting Hosts

The HOST part of each interesting line identifies the machine that a job was matched to and ran on. The report counts the number of times each host occurs in these lines of the log file. But, notice that many of the hosts are very similar to each other, except for a number:

So, before counting a host, change it as follows: Replace a sequence of one or more digits followed by a dot character (.) with one hash and one dot characters (#.). Here are some examples:

Host BeforeHost After

That’s it! Count the occurrences of the modified hosts, separately for glide-in and regular slots.

Sample Output

Here is a sample report, run on a different input file:

  5 c#.local
  2 compute-10-#.local
  1 compute-11-#.local
  2 compute-2-#.local
  1 node#.local



Start your script the right way! Here is a suggestion:

#!/usr/bin/env python

"""Homework for CS 368-2 (2012 Spring)
Assigned on Day 07, 2012-04-10
Written by <Your Name>

Do the work yourself, consulting reasonable reference materials as needed. Any resource that provides a complete solution or offers significant material assistance toward a solution not OK to use. Asking the instructor for help is OK, asking other students for help is not. All standard UW policies concerning student conduct (esp. UWS 14) and information technology apply to this course and assignment.

Hand In

A printout of your code on a single sheet of paper (if possible). Be sure to put your own name in the initial comment block of the code. Identifying your work is important, or you may not receive appropriate credit.