jpuris02/28/2023, 6:39 PM
if not is_success: logger.error(error_msg) return Failed(message="I've failed because ...!")
The last stack trace is really unnecessary. I'd only want to output information that the flow has ended in failure state 😞
19:31:34.931 | ERROR | Flow run 'sociable-mantis' - Traceback (most recent call last): ... actually relevant stack trace from "error_msg" ... 19:31:35.161 | ERROR | Flow run 'sociable-mantis' - Finished in state Failed('I've failed because ...!') Traceback (most recent call last): <... a massive stack trace on raising a failure from prefect :(> raise await get_state_exception(state) prefect.exceptions.FailedRun: I've failed because ...!
Nate02/28/2023, 6:55 PM
when calling your flow that returns
In : @flow ...: def testing(): ...: return Failed(message="i dont want a stack trace") ...: In : testing(return_state=True) 10:54:21.538 | INFO | prefect.engine - Created flow run 'pristine-cuttlefish' for flow 'testing' 10:54:23.156 | ERROR | Flow run 'pristine-cuttlefish' - Finished in state Failed('i dont want a stack trace') Out: Failed(message='i dont want a stack trace', type=FAILED, result=LiteralResult(type='literal', artifact_type='result', artifact_description='Literal: `None`', value=None))
jpuris02/28/2023, 6:57 PM