I'm running Prefect from tests - which works great...
# ask-community
j
I'm running Prefect from tests - which works great. Currently Failed tasks log that failure at Info level, I wonder if Warning or Error might be more appropriate? It would certainly make it more obvious to me in logs/output here's an example
a
So the line you are referring to is only informing that a signal has been raised, which seems to be a valid INFO log message. But you can raise on exception if you want:
Copy code
# PrefectStateSignals are trapped and turned into States
        except signals.PrefectStateSignal as exc:
            <http://self.logger.info|self.logger.info>(
                "{name} signal raised: {rep}".format(
                    name=type(exc).__name__, rep=repr(exc)
                )
            )
            if raise_on_exception:
                raise exc
            new_state = exc.state
In general, Prefect handles the state transition for you, so you shouldn’t have to worry about it.
j
Thanks Anna.
only informing that a signal has been raised, which seems to be a valid INFO log message
yes, definitely valid. I'm just thinking it might be useful to log it as a warning, for increased visibility in logs (especially when not running through a prefect server (locally or on CI). (I can catch the exception during dev and the behaviour is of the program is correct, this is only about making this more visible in log out) Does that make sense?
a
sure. let me open an issue for it. @Marvin open “Change the log level to Warning when raising signal from the Runner”
🙏 1
@John Shearer the issue has been closed since generally we warn when something is not working as intended and it’s not the case here.
j
Thanks @Anna Geller. Sure, that's fine. I appreciate you raising the discussion.
🙌 1