Locked History Actions

Diff for "InfolabClusterComputeHowtoSingle"

Differences between revisions 1 and 2
Revision 1 as of 2012-10-16 22:59:13
Size: 998
Editor: akrevl
Comment:
Revision 2 as of 2012-10-16 23:00:58
Size: 1061
Editor: akrevl
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
We are going to use just a simple Python script as our main program for this HOWTO: We are going to use just a simple Python script as our main program for this HOWTO. You can download the script here [[attachment:SingleCore.py]].

This HOWTO describes how to run a single core job on the Infolab Compute Cluster.

1. The program

We are going to use just a simple Python script as our main program for this HOWTO. You can download the script here SingleCore.py.

import socket, datetime, time, getpass

start = datetime.datetime.now()
hostname = socket.gethostname().split('.')[0]
username = getpass.getuser()
time.sleep(10)
end = datetime.datetime.now()

dfmt = "%Y-%m-%d %H:%M:%S"
print "Started: %s Finished: %s Host: %s User: %s" % (start.strftime(dfmt), end.strftime(dfmt), hostname, username)

The script starts, records the current time, figures out the hostname it is running on and the username it is running as. Then it sleeps for 10 seconds (so we at least have some impact on the cluster), records the time again and prints out a string that may look a little something like this:

Started: 2012-10-16 15:56:55 Finished: 2012-10-16 15:57:05 Host: ilhead1 User: akrevl