You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, a job is interrupted if it runs longer than the configured JobIteration.max_job_runtime or if the relevant interruption adapter indicates the job should (due to a shutdown being invoked, for example).
Some apps may need finer grained control over this, or may have additional signals that should be inspected to determine when a job should stop iterating and reenqueue itself.
The way that I've seen this done typically is to override the private job_should_exit? method which is a little cludgy. Firstly, because it requires overriding a private method, but secondly, because if multiple concerns (say two different mix-ins) need to add behaviour, each override needs to make sure it calls 'super' to ensure that all relevant versions of job_should_exit? are called.
It might be a good idea to add some form of public hook that could be configured by the application to allow application authors to add functionality to the job_should_exit? check as necessary in their application.
One possible approach may be to add a chain of responsibility, where procs that determine whether the job should exit can be added and then each could be called in sequence whenever job_should_exit? is called, to determine if any of them indicate that the job should cease iterating. The default behavior of checking the interruption adapter and checking the runtime against a configured maximum could be elements in the chain of responsibility. Application authors could then add additional elements to the chain, like checking if a required resource is healthy, for example.
The text was updated successfully, but these errors were encountered:
Right now, a job is interrupted if it runs longer than the configured
JobIteration.max_job_runtime
or if the relevant interruption adapter indicates the job should (due to a shutdown being invoked, for example).Some apps may need finer grained control over this, or may have additional signals that should be inspected to determine when a job should stop iterating and reenqueue itself.
The way that I've seen this done typically is to override the private
job_should_exit?
method which is a little cludgy. Firstly, because it requires overriding a private method, but secondly, because if multiple concerns (say two different mix-ins) need to add behaviour, each override needs to make sure it calls 'super' to ensure that all relevant versions ofjob_should_exit?
are called.It might be a good idea to add some form of public hook that could be configured by the application to allow application authors to add functionality to the
job_should_exit?
check as necessary in their application.One possible approach may be to add a chain of responsibility, where procs that determine whether the job should exit can be added and then each could be called in sequence whenever
job_should_exit?
is called, to determine if any of them indicate that the job should cease iterating. The default behavior of checking the interruption adapter and checking the runtime against a configured maximum could be elements in the chain of responsibility. Application authors could then add additional elements to the chain, like checking if a required resource is healthy, for example.The text was updated successfully, but these errors were encountered: