Skip to content

Commit

Permalink
Re #7405 Save log for each job
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet authored and VickieLynch committed Jul 9, 2013
1 parent ad5dc70 commit c554b0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def to_batch(self):
else:
script += "SaveIqAscii(process=%r)\n" % xml_process

script += "Reduce(log_file='reduction_%s.log')\n" % name
script += "Reduce()\n"
scripts.append(script)

return scripts
Expand Down
8 changes: 4 additions & 4 deletions Code/Mantid/scripts/reduction_workflow/command_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def OutputPath(path):
ReductionSingleton().set_output_path(path)
ReductionSingleton().reduction_properties["OutputDirectory"] = path

def Reduce1D(log_file=None):
return ReductionSingleton().reduce(log_file=log_file)
def Reduce1D():
return ReductionSingleton().reduce()

def Reduce(log_file=None):
return ReductionSingleton().reduce(log_file=log_file)
def Reduce():
return ReductionSingleton().reduce()

def AppendDataFile(datafile, workspace=None):
"""
Expand Down
10 changes: 6 additions & 4 deletions Code/Mantid/scripts/reduction_workflow/reducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def post_process(self):
"""
pass

def reduce(self, log_file=None):
def reduce(self):
"""
Go through the list of reduction steps
"""
Expand All @@ -161,7 +161,10 @@ def reduce(self, log_file=None):
Logger.get("Reducer").error("A reduction algorithm wasn't set: stopping")
return

_first_ws_name = None
for ws in self._data_files.keys():
if _first_ws_name is None:
_first_ws_name = ws
alg = AlgorithmManager.create(self.reduction_algorithm)
alg.initialize()
props = [p.name for p in alg.getProperties()]
Expand Down Expand Up @@ -206,9 +209,8 @@ def reduce(self, log_file=None):
output_dir = os.path.expanduser('~')

self.log_text += "Reduction completed in %g sec\n" % (time.time()-t_0)
if log_file is not None:
base_name = os.path.basename(log_file)
log_path = os.path.join(output_dir, base_name)
if _first_ws_name is not None:
log_path = os.path.join(output_dir, "%s_reduction.log" % _first_ws_name)
else:
log_path = os.path.join(output_dir,"%s_reduction.log" % self.instrument_name)
self.log_text += "Log saved to %s" % log_path
Expand Down

0 comments on commit c554b0e

Please sign in to comment.