Again we are using the same simple Python script that sleeps for a while and outputs some time and the arguments that it was called with. You can download the script here: JobArray.py
1 #!/usr/bin/python2.7
2
3 import socket, datetime, time, getpass, sys
4
5 arrayid = sys.argv[1]
6
7 # We're using just using a simple list here but you can
8 # easily imagine this getting read from a file or sth ...
9 arguments = [
10 [ "myarg1-0", "myarg2-0", "myarg3-0" ],
11 [ "myarg1-1", "myarg2-1", "myarg3-1" ],
12 [ "myarg1-2", "myarg2-2", "myarg3-2" ],
13 [ "myarg1-3", "myarg2-3", "myarg3-3" ]
14 ]
15
16 start = datetime.datetime.now()
17 hostname = socket.gethostname().split('.')[0]
18 username = getpass.getuser()
19 time.sleep(10)
20 end = datetime.datetime.now()
21
22 dfmt = "%Y-%m-%d %H:%M:%S"
23 print "Started: %s Finished: %s Host: %s User: %s" % (start.strftime(dfmt), end.strftime(dfmt), hostname, username)
24 print "My arguments:"
25 print arguments [int(arrayid)]
The only twist is, that we are reading the actual arguments from the list provided in the script itself. This could be easily replaced by reading from a cvs file or some other, neater argument storage.