summaryrefslogtreecommitdiff
path: root/util/pbs/job.py
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-08-16 11:27:49 -0400
committerNathan Binkert <binkertn@umich.edu>2005-08-16 11:27:49 -0400
commit09bb20348465f960b9465d94182306137d4b854f (patch)
tree3686d70546720d78ee2af6febb886337a1b5aecb /util/pbs/job.py
parent38da461fd79bcfd3eed683076f1ba40465af775e (diff)
downloadgem5-09bb20348465f960b9465d94182306137d4b854f.tar.xz
Updates to job scripts to accept more than 15 characters of jobname
Make the Link directory even more useful by working with sub-directories. util/pbs/job.py: Expose JOBNAME as a separate parameter from PBS_JOBNAME. If the former exists, it is used as the jobname for starting the job, if it doesn't exist, PBS_JOBNAME is used. This is to get around the 15 character maximum pbs job name length. While we're at it, shuffle things around to hopefully make things a bit more clear. util/pbs/send.py: Make the Link directory functionality more sophisticated, copy sub-directories and links to directories. (we still don't copy dotfiles though) Add the setname() function to contact pbs and use raj's hack to tell the webpage about longer jobnames. (it's gross, don't look) truncate the pbs job name to 15 characters so that it works. --HG-- extra : convert_revision : 4a76b1a1c33721c7ca93e2fbb761f95bc3a2ac69
Diffstat (limited to 'util/pbs/job.py')
-rwxr-xr-xutil/pbs/job.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/util/pbs/job.py b/util/pbs/job.py
index 4ead50de9..f370862de 100755
--- a/util/pbs/job.py
+++ b/util/pbs/job.py
@@ -83,37 +83,35 @@ def readval(filename):
if __name__ == '__main__':
rootdir = env.setdefault('ROOTDIR', os.getcwd())
- jobid = env['PBS_JOBID']
- jobname = env['PBS_JOBNAME']
- jobdir = joinpath(rootdir, jobname)
+ pbs_jobid = env['PBS_JOBID']
+ pbs_jobname = env['PBS_JOBNAME']
basedir = joinpath(rootdir, 'Base')
- user = env['USER']
-
+ jobname = env.setdefault('JOBNAME', pbs_jobname)
+ jobfile = env.setdefault('JOBFILE', joinpath(basedir, 'test.py'))
+ outdir = env.setdefault('OUTPUT_DIR', joinpath(rootdir, jobname))
env['POOLJOB'] = 'True'
- env['OUTPUT_DIR'] = jobdir
- env['JOBFILE'] = joinpath(basedir, 'test.py')
- env['JOBNAME'] = jobname
+
+ if os.path.isdir("/work"):
+ workbase = "/work"
+ else:
+ workbase = "/tmp/"
+
+ workdir = joinpath(workbase, '%s.%s' % (env['USER'], pbs_jobid))
def echofile(filename, string):
try:
- f = file(joinpath(jobdir, filename), 'w')
+ f = file(joinpath(outdir, filename), 'w')
print >>f, string
f.flush()
f.close()
except IOError,e:
sys.exit(e)
- if os.path.isdir("/work"):
- workbase = "/work"
- else:
- workbase = "/tmp/"
-
- workdir = joinpath(workbase, '%s.%s' % (user, jobid))
-
os.umask(0022)
echofile('.start', date())
- echofile('.jobid', jobid)
+ echofile('.pbs_jobid', pbs_jobid)
+ echofile('.pbs_jobname', pbs_jobid)
echofile('.host', socket.gethostname())
if os.path.isdir(workdir):
@@ -132,7 +130,7 @@ if __name__ == '__main__':
except OSError,e:
sys.exit(e)
- os.symlink(joinpath(jobdir, 'output'), 'status.out')
+ os.symlink(joinpath(outdir, 'output'), 'status.out')
args = [ joinpath(basedir, 'm5'), joinpath(basedir, 'run.py') ]
if not len(args):
@@ -147,7 +145,7 @@ if __name__ == '__main__':
if not childpid:
# Execute command
sys.stdin.close()
- fd = os.open(joinpath(jobdir, "output"),
+ fd = os.open(joinpath(outdir, "output"),
os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
os.dup2(fd, sys.stdout.fileno())
os.dup2(fd, sys.stderr.fileno())