Coordinated Interval Chain Execution across multiple clients #663
|
Is your feature request related to a problem? Please describe. While there's Describe the solution you'd like Describe alternatives you've considered I would like to check what do you think about possible solutions. Either extending |
Replies: 4 comments 2 replies
|
Hello. Would you please provide an example of what you are trying to achieve. I cannot understand the problem |
|
If you want to limit the number of instances that this chain may have running at the same time, just set |
|
@pashagolub example is straightforward. You can try chaining with Simultaneous execution occurs because individual clients start at different times, leading to slightly different evaluation times. I understand this is an edge case, so if you believe it falls outside the scope of pg_timetable, that’s also a valid answer. I’m trying to determine whether it’s worth the effort (I’m happy to work on a PR) to adjust this behavior. In my particular case, I attempted to use pg_timetable to orchestrate a long-running data migration (e.g., executing smaller data modification batches repeatedly). In this context, @after is a perfect fit. |
|
Interval chains explicitly are designed with the idea of the client independence. That means client itself controls when the next execution is started. If we are talking about several pg_timetable clients that needs to be synchronized the simplest way would be to switch to regular cron with least common interval. Another solution might be to check DO $$
BEGIN
IF now() - max(finished) < '30 seconds' FROM timetable.timetable.execution_log el WHERE chain_id = 1 THEN
RAISE EXCEPTION 'aaaah, too early!';
END IF;
END;$$Set
Sounds good? |
Interval chains explicitly are designed with the idea of the client independence. That means client itself controls when the next execution is started. If we are talking about several pg_timetable clients that needs to be synchronized the simplest way would be to switch to regular cron with least common interval.
Another solution might be to check
timetable.execution_log.finishedvalue for chain as a first task and decide if we want to proceed.Set
ignore_errorfor this task to TRUE and setmax_instancesto 1 for the…