Skip to content

Commit

Permalink
The condor_log file can be now set in run_with_condor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Blanca committed Jul 22, 2009
1 parent 3ebea06 commit 5b7d624
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions psubprocess/condor_runner.py
Expand Up @@ -94,7 +94,7 @@ def write_condor_job_file(fhand, parameters):
class Popen(object):
'It launches and controls a condor job'
def __init__(self, cmd, cmd_def=None, runner_conf=None,
stdout=None, stderr=None, stdin=None):
stdout=None, stderr=None, stdin=None, condor_log=None):
'It launches a condor job'
if cmd_def is None:
cmd_def = []
Expand All @@ -106,7 +106,10 @@ def __init__(self, cmd, cmd_def=None, runner_conf=None,
if 'transfer_files' not in runner_conf:
runner_conf['transfer_files'] = True

self._log_file = NamedTemporaryFile(suffix='.log')
if condor_log is None:
self._log_file = NamedTemporaryFile(suffix='.log')
else:
self._log_file = condor_log
#create condor job file
condor_job_file = self._create_condor_job_file(cmd, cmd_def,
self._log_file,
Expand Down
6 changes: 6 additions & 0 deletions scripts/run_with_condor.py
Expand Up @@ -39,6 +39,8 @@ def parse_options():
help='A file to store the stdin')
parser.add_option('-d', '--cmd_def', dest='cmd_def',
help='The command line definition')
parser.add_option('-l', '--condor_log', dest='condor_log',
help='The condor log file')
return parser

def get_options():
Expand All @@ -65,6 +67,10 @@ def get_options():
if os.path.exists(cmd_def):
cmd_def = open(cmd_def).read()
options['cmd_def'] = eval(cmd_def)

if cmd_options.condor_log is not None:
options['condor_log'] = open(cmd_options.condor_log, 'w')

return options

def kill_process():
Expand Down

0 comments on commit 5b7d624

Please sign in to comment.