Step calling a python function
Definition at line 13 of file PyStep.py.
◆ __init__()
def python.TrigValSteering.PyStep.PyStep.__init__ |
( |
|
self, |
|
|
|
func, |
|
|
** |
kwargs |
|
) |
| |
Definition at line 16 of file PyStep.py.
17 name = kwargs.get(
'name')
or func.__name__
20 self.func_kwargs = dict([(k,v)
for k,v
in kwargs.items()
if k !=
'name'])
21 self.output_stream = Step.OutputStream.STDOUT_ONLY
◆ run()
def python.TrigValSteering.PyStep.PyStep.run |
( |
|
self, |
|
|
|
dry_run = False |
|
) |
| |
Definition at line 23 of file PyStep.py.
23 def run(self, dry_run=False):
25 self.log.
info(
'Running %s step', self.name)
28 if self.output_stream == self.OutputStream.NO_PRINT:
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):
38 self.result = self.func(**self.func_kwargs)
41 if self.output_stream == self.OutputStream.FILE_AND_STDOUT:
46 if self.result
is None:
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__}'
◆ func
python.TrigValSteering.PyStep.PyStep.func |
◆ func_kwargs
python.TrigValSteering.PyStep.PyStep.func_kwargs |
◆ output_stream
python.TrigValSteering.PyStep.PyStep.output_stream |
◆ result
python.TrigValSteering.PyStep.PyStep.result |
The documentation for this class was generated from the following file: