6 Step implemented as python function
9 from TrigValTools.TrigValSteering.Step
import Step
14 """Step calling a python function"""
17 name = kwargs.get(
'name')
or func.__name__
20 self.
func_kwargs = dict([(k,v)
for k,v
in kwargs.items()
if k !=
'name'])
23 def run(self, dry_run=False):
25 self.log.
info(
'Running %s step', self.name)
30 elif self.
output_stream in [self.OutputStream.FILE_ONLY, self.OutputStream.FILE_AND_STDOUT]:
31 dest =
open(self.get_log_file_name(),
'w')
37 with contextlib.redirect_stdout(dest), contextlib.redirect_stderr(dest):
48 except Exception
as e:
49 self.log.
error(
'Exception calling %s: %s', self.
func.__name__, e)
52 return self.
result, f
'# (internal) {self.func.__name__}'