diff options
author | Benjamin Nash <benash@umich.edu> | 2005-08-16 15:27:39 -0400 |
---|---|---|
committer | Benjamin Nash <benash@umich.edu> | 2005-08-16 15:27:39 -0400 |
commit | 0d82e0f8b6d44bc759c3cd7d1e4d499fbbdc459e (patch) | |
tree | 986c2bad5216f4eb480bc84a1617803413f39a4a /util/pbs/job.py | |
parent | bcc333e92006f52baeef1ae0f94d4765513584d8 (diff) | |
parent | 09bb20348465f960b9465d94182306137d4b854f (diff) | |
download | gem5-0d82e0f8b6d44bc759c3cd7d1e4d499fbbdc459e.tar.xz |
Merge m5.eecs.umich.edu:/bk/m5
into zed.eecs.umich.edu:/z/benash/bk/m5
--HG--
extra : convert_revision : 36bb126381caf84d85a566579225b02c15f8f356
Diffstat (limited to 'util/pbs/job.py')
-rwxr-xr-x | util/pbs/job.py | 36 |
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()) |