-
Type:
Suggestion
-
Resolution: Unresolved
-
None
-
Component/s: Scheduled Tasks
-
None
-
1
-
4
Jobs can be scheduled to run in one of two ways:
a) Once across the whole cluster. Jobs scheduled to run across the whole cluster:
- Are persistent. They are stored in the database and persist across restarts of Jira and remain even if the plugin is disabled or removed.
- (Persisted jobs with no JobRunner are ignored until the JobRunner is registered again.)
- Can run on any node in the cluster, not just the node that originally scheduled the job.
- Will only run once for each scheduled run time
- In some cases, multiple instances of the same job might be running at the same time. This might happen when the job interval is shorter than the time required to complete the job. In such a case, a node might start a new job, although another instance of this job is still running on a different node in the cluster. To avoid this, restrict jobs to particular nodes by using cluster-wide locks.
- Should only be scheduled by one node in the cluster.
- When a job is re-scheduled we remove and then add the job again. Under certain circumstances this may cause the job to miss a run time (if you use a cron expression) or perhaps run twice in succession (if you use a "run immediately" schedule).
- For this reason, we recommend a "best-effort" check if the job is already scheduled before trying to add a job to the schedule and the use of an initial start date that is a few seconds in the future in preference to using one that runs immediately.
b) Locally. Jobs scheduled to run locally:
- Are not persistent. They should be scheduled each time the plugin is enabled and unscheduled when the plugin is disabled.
- Should be scheduled on every node in the cluster, if that is appropriate for your plugin's requirements.
- Will run on the node where they are scheduled, and not on any other node (unless also scheduled on that node).
However the customer wants to schedule a job on a selected node or on set of selected node. Currently we don't have this functionality, can we consider it and introduce in jira?