windmill
windmill copied to clipboard
Count leaf jobs durations instead of parent flow jobs duration to avoid accounting time waiting for executors
In https://github.com/windmill-labs/windmill/blob/0c5a7f12bae92cbf27641736c3b915c728483be0/backend/src/users.rs#L505
we count all jobs, but a flow that trigger other jobs will be as if it consumed cpu time when it actually didn't. The Right way would be to exclude 'flow' and 'flowpreview' from the sum.
cc @sqwishy
I might be misunderstanding but avoiding double counting time from flows is why the query includes WHERE ... parent_job IS NULL 🤔
Ok I did miss that. It has the slight issue that if you only count the embedding flow, then you are also "paying/using" time in-between jobs looking for an executor. It would probably better to just exclude flows.
I think what you're describing is technically more correct. But right now when you run a flow it says "ran in 1.234s" and if you look at your usage before and after you notice an increase of 1.234s. Which seems like what someone would expect. With the change it would increase a bit less, and might be confusing. Maybe it's a good change anyway idk 🤔
let's deprioritize this, it will become important when we care about billing which is not yet.