Braun Reyes
08/26/2019, 5:42 AMChris White
flow.run() will always only ever return a State object corresponding to the flow’s final state. It sounds like you want non-zero exit codes for the sake of monitoring, which is a separate business - I’d recommend placing a terminal task on your Flow with an any_failed trigger that calls sys.exit(1) (or os._exit(1)) to achieve your goalJeremiah
Braun Reyes
08/26/2019, 2:34 PMBraun Reyes
08/26/2019, 2:36 PMBraun Reyes
08/26/2019, 2:39 PMsub_process = Popen(
[self.shell, tmp.name],
stdout=PIPE,
stderr=STDOUT,
env=current_env
)
line = ''
for raw_line in iter(sub_process.stdout.readline, b''):
line = raw_line.decode('utf-8').rstrip()
<http://self.logger.info|self.logger.info>(line)
sub_process.wait()
if sub_process.returncode:
msg = "Command failed with exit code {0}: {1}".format(
sub_process.returncode, line
)
raise prefect.engine.signals.FAIL(msg) from None # type: ignore
return lineBraun Reyes
08/26/2019, 2:40 PMChris White
Jeremiah