I have a script that is called by a Server Action, and is triggered by several different trigger conditions and schedules (it's in an action group so everything points to the one python script).
Is there any way for me to learn which of the triggers definitively called this script? In some cases, a trigger and schedule occur within a second or two of each other, and the script ends up running twice. No big deal, but would be great if I could detect if the script were called as a result of a specific trigger, or a schedule. If I knew that, I could just end early if it's a lower-priority run.
One option is to make 2 copies of this script, one that deals with only trigger-related things, and the other for schedule-related things. But I'd rather have all the code in one place.
If there is no way to learn of the "call stack", then perhaps I could set a variable before the script runs and then examine the contents first-thing in the script. But that isn't foolproof. I could also have umpteen "yep, it was me" variables, but that also seems inefficient, plus there's no clean way to reset those variables.