Due Thursday, April 19, at the start of class.
Run a job (or many!) on CHTC using Condor. This is our gateway into tapping the full potential of CHTC via scripting.
This assignment is quite straightforward, but I will walk you through some of the set-up steps, just to be sure.
submit-368.chtc.wisc.edu
. You can ssh
to
the machine from any other machine, including your own desktop or laptop. If you are not sure how
to ssh
to a remote machine, check out the Remote Logins section of my
Notes for Beginners page.
condor_status
and
condor_q
. If those commands fail, contact me right away.
homework_09.py
):
#!/usr/bin/env python """Homework for CS 368-2 (2012 Spring) Assigned on Day 09, 2011-11-22 Written by Tim Cartwright Submitted to CHTC by YOUR NAME """ import getpass import os import platform import socket import sys import time input_filename = None if len(sys.argv) > 1: input_filename = sys.argv[1] print >> sys.stderr, __doc__ print 'Time :', time.strftime('%Y-%m-%d (%a) %H:%M:%S %Z') print 'Host :', getpass.getuser(), '@', socket.gethostname() uname = platform.uname() print "System :", uname[0], uname[2], uname[4] print "Version :", platform.python_version() print "Program :", sys.executable print 'Script :', os.path.abspath(__file__) print if input_filename is None: print 'No input filename given, all done!' sys.exit(0) print 'Reading input file at', os.path.abspath(input_filename) input_file_object = open(input_filename, 'r') input_lines = input_file_object.readlines() print 'Found %d lines in the input file' % (len(input_lines)) input_file_object.close() output_file_object = open('homework-09-output.txt', 'w') print >> output_file_object, 'First line of input file:' print >> output_file_object, input_lines[0].rstrip('\n') output_file_object.close() print 'Wrote output file'
YOUR NAME
placeholder!
chmod 0755 homework_09.py
If you named the script something other than homework_09.py
, substitute your actual script file
name in command above instead.
./homework_09.py
And then, with a single command-line argument, which is the name of your input text file:
./homework_09.py input-09.txt
If you cannot run your script like this, neither can Condor! Fix any problems with the script and/or your command until this step works perfectly.
When you provide a command-line argument, be sure to check out the output file created by the script:
homework-09-output.txt
.
Here are some things to observe and/or watch out for.
007 (010.000.000) 11/13 06:26:43 Shadow exception!
The key phrase is the Shadow exception!
part. If you see this message in your log file, probably
repeated many times, remove your entire job cluster. Then, try running your script from the command-line again.
Does it really work? If so, check over your submit file very carefully for typos. When this error happened to
me (yes, I screwed up!), it was because I could not run my script from the command-line correctly.
condor_q
command, type:
man condor_q
Like writing code with Python itself, the more you play around with the basics of Condor and running jobs, the more you will learn and be ready for the next step(s). So, here are some things to try:
#!/usr/bin/env python
line at the top of each scriptchmod
command (above) on your script filesubmit-368.chtc.wisc.edu
, because the environment on that machine is most
similar to the environment on (most of) the execute machines. Once again, be absolutely sure that your compiled
program works from the command line on submit-368
before actually submitting it.
Do the work yourself, consulting reasonable reference materials as needed; any reference material that gives you a complete or nearly complete solution to this problem or a similar one is not OK to use. Asking the instructors 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.
A printout of:
output =
line)error =
line)all from a single run of the script. If possible, fit it all onto a single sheet of paper (double-sided, if need be). Be sure to put your own name somewhere obvious. Identifying your work is important, or you may not receive appropriate credit.