[jira] [Commented] (OFBIZ-10865) Allow prioritization of background jobs
[ https://issues.apache.org/jira/browse/OFBIZ-10865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16799657#comment-16799657 ] Jacques Le Roux commented on OFBIZ-10865: - Ah forgot to mention one point I saw when reviewving: please Scott format in order to reduce lines length to max 120 chars, thanks. > Allow prioritization of background jobs > --- > > Key: OFBIZ-10865 > URL: https://issues.apache.org/jira/browse/OFBIZ-10865 > Project: OFBiz > Issue Type: Improvement > Components: framework >Reporter: Scott Gray >Assignee: Scott Gray >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-10865.diff > > > As discussed on the dev list [1], allow Jobs to specify a priority and be > queued accordingly by the JobPoller so that important jobs can be prioritized > over normal jobs, and low priority jobs can be left until last. > This is a first pass implementation with just the main changes. We will > still need to allow the priority to be set in the JobManager and > LocalDispatcher's "schedule" methods before jobs generated at runtime can be > prioritized. IMO the existing schedule methods are a mess and need to be > converted into a builder pattern before adding any more job attributes. The > new priority field also needs to be added to the webtools UI wherever > appropriate. > Changes are as follows: > - Add a "priority" field to JobSandbox entity (numeric/Long) > - Add JobPriority constants class containing fields LOW (0), NORMAL (50) and > HIGH (100) > - Add getPriority method to the Job interface and implement methods for > AbstractJob (returns NORMAL), PersistedServiceJob (returns > JobSandbox.priority) and PurgeJob (returns LOW) > - Change the JobPoller executor's queue to use PriorityBlockingQueue > (unbounded) instead of LinkedBlockingQueue (bounded) > - Implement custom Comparator for the priority queue to sort by priority > descending and then runTime ascending > - Change the poll size per poll to be (queueSize() - queue.size) instead of > queue.remainingCapacity() due to the new queue being unbounded > - I've also opted to limit the database poll query to the poll size using > maxRows() because it seemed dangerous to me to use an unconstrained query on > this table > - Ensured recurring jobs receive the default (NORMAL) priority when being > rescheduled so that they're sorted correctly on the next time they show up in > the database poll > - Ensured jobs generated at runtime are given a default priority of NORMAL > [1] > https://lists.apache.org/thread.html/f9107f8ca9a17a2df731337fc3d9766ebad33467fea4393fb069552d@%3Cdev.ofbiz.apache.org%3E -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OFBIZ-10865) Allow prioritization of background jobs
[ https://issues.apache.org/jira/browse/OFBIZ-10865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16799346#comment-16799346 ] Nicolas Malin commented on OFBIZ-10865: --- After quick review, it's simple step to improve the service schedule, so no reason do keep it as patch :) nice work > Allow prioritization of background jobs > --- > > Key: OFBIZ-10865 > URL: https://issues.apache.org/jira/browse/OFBIZ-10865 > Project: OFBiz > Issue Type: Improvement > Components: framework >Reporter: Scott Gray >Assignee: Scott Gray >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-10865.diff > > > As discussed on the dev list [1], allow Jobs to specify a priority and be > queued accordingly by the JobPoller so that important jobs can be prioritized > over normal jobs, and low priority jobs can be left until last. > This is a first pass implementation with just the main changes. We will > still need to allow the priority to be set in the JobManager and > LocalDispatcher's "schedule" methods before jobs generated at runtime can be > prioritized. IMO the existing schedule methods are a mess and need to be > converted into a builder pattern before adding any more job attributes. The > new priority field also needs to be added to the webtools UI wherever > appropriate. > Changes are as follows: > - Add a "priority" field to JobSandbox entity (numeric/Long) > - Add JobPriority constants class containing fields LOW (0), NORMAL (50) and > HIGH (100) > - Add getPriority method to the Job interface and implement methods for > AbstractJob (returns NORMAL), PersistedServiceJob (returns > JobSandbox.priority) and PurgeJob (returns LOW) > - Change the JobPoller executor's queue to use PriorityBlockingQueue > (unbounded) instead of LinkedBlockingQueue (bounded) > - Implement custom Comparator for the priority queue to sort by priority > descending and then runTime ascending > - Change the poll size per poll to be (queueSize() - queue.size) instead of > queue.remainingCapacity() due to the new queue being unbounded > - I've also opted to limit the database poll query to the poll size using > maxRows() because it seemed dangerous to me to use an unconstrained query on > this table > - Ensured recurring jobs receive the default (NORMAL) priority when being > rescheduled so that they're sorted correctly on the next time they show up in > the database poll > - Ensured jobs generated at runtime are given a default priority of NORMAL > [1] > https://lists.apache.org/thread.html/f9107f8ca9a17a2df731337fc3d9766ebad33467fea4393fb069552d@%3Cdev.ofbiz.apache.org%3E -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OFBIZ-10865) Allow prioritization of background jobs
[ https://issues.apache.org/jira/browse/OFBIZ-10865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16794577#comment-16794577 ] Scott Gray commented on OFBIZ-10865: Thanks [~mthl], I've updated the diff. Little bit rusty with svn > Allow prioritization of background jobs > --- > > Key: OFBIZ-10865 > URL: https://issues.apache.org/jira/browse/OFBIZ-10865 > Project: OFBiz > Issue Type: Improvement > Components: framework >Reporter: Scott Gray >Assignee: Scott Gray >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-10865.diff > > > As discussed on the dev list [1], allow Jobs to specify a priority and be > queued accordingly by the JobPoller so that important jobs can be prioritized > over normal jobs, and low priority jobs can be left until last. > This is a first pass implementation with just the main changes. We will > still need to allow the priority to be set in the JobManager and > LocalDispatcher's "schedule" methods before jobs generated at runtime can be > prioritized. IMO the existing schedule methods are a mess and need to be > converted into a builder pattern before adding any more job attributes. The > new priority field also needs to be added to the webtools UI wherever > appropriate. > Changes are as follows: > - Add a "priority" field to JobSandbox entity (numeric/Long) > - Add JobPriority constants class containing fields LOW (0), NORMAL (50) and > HIGH (100) > - Add getPriority method to the Job interface and implement methods for > AbstractJob (returns NORMAL), PersistedServiceJob (returns > JobSandbox.priority) and PurgeJob (returns LOW) > - Change the JobPoller executor's queue to use PriorityBlockingQueue > (unbounded) instead of LinkedBlockingQueue (bounded) > - Implement custom Comparator for the priority queue to sort by priority > descending and then runTime ascending > - Change the poll size per poll to be (queueSize() - queue.size) instead of > queue.remainingCapacity() due to the new queue being unbounded > - I've also opted to limit the database poll query to the poll size using > maxRows() because it seemed dangerous to me to use an unconstrained query on > this table > - Ensured recurring jobs receive the default (NORMAL) priority when being > rescheduled so that they're sorted correctly on the next time they show up in > the database poll > - Ensured jobs generated at runtime are given a default priority of NORMAL > [1] > https://lists.apache.org/thread.html/f9107f8ca9a17a2df731337fc3d9766ebad33467fea4393fb069552d@%3Cdev.ofbiz.apache.org%3E -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OFBIZ-10865) Allow prioritization of background jobs
[ https://issues.apache.org/jira/browse/OFBIZ-10865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16794495#comment-16794495 ] Mathieu Lirzin commented on OFBIZ-10865: Hello Scott, I think your patch misses the definition of the {{org.apache.ofbiz.service.job.JobPriority}} class. > Allow prioritization of background jobs > --- > > Key: OFBIZ-10865 > URL: https://issues.apache.org/jira/browse/OFBIZ-10865 > Project: OFBiz > Issue Type: Improvement > Components: framework >Reporter: Scott Gray >Assignee: Scott Gray >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-10865.diff > > > As discussed on the dev list [1], allow Jobs to specify a priority and be > queued accordingly by the JobPoller so that important jobs can be prioritized > over normal jobs, and low priority jobs can be left until last. > This is a first pass implementation with just the main changes. We will > still need to allow the priority to be set in the JobManager and > LocalDispatcher's "schedule" methods before jobs generated at runtime can be > prioritized. IMO the existing schedule methods are a mess and need to be > converted into a builder pattern before adding any more job attributes. The > new priority field also needs to be added to the webtools UI wherever > appropriate. > Changes are as follows: > - Add a "priority" field to JobSandbox entity (numeric/Long) > - Add JobPriority constants class containing fields LOW (0), NORMAL (50) and > HIGH (100) > - Add getPriority method to the Job interface and implement methods for > AbstractJob (returns NORMAL), PersistedServiceJob (returns > JobSandbox.priority) and PurgeJob (returns LOW) > - Change the JobPoller executor's queue to use PriorityBlockingQueue > (unbounded) instead of LinkedBlockingQueue (bounded) > - Implement custom Comparator for the priority queue to sort by priority > descending and then runTime ascending > - Change the poll size per poll to be (queueSize() - queue.size) instead of > queue.remainingCapacity() due to the new queue being unbounded > - I've also opted to limit the database poll query to the poll size using > maxRows() because it seemed dangerous to me to use an unconstrained query on > this table > - Ensured recurring jobs receive the default (NORMAL) priority when being > rescheduled so that they're sorted correctly on the next time they show up in > the database poll > - Ensured jobs generated at runtime are given a default priority of NORMAL > [1] > https://lists.apache.org/thread.html/f9107f8ca9a17a2df731337fc3d9766ebad33467fea4393fb069552d@%3Cdev.ofbiz.apache.org%3E -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OFBIZ-10865) Allow prioritization of background jobs
[ https://issues.apache.org/jira/browse/OFBIZ-10865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16794195#comment-16794195 ] Scott Gray commented on OFBIZ-10865: Patch: [^OFBIZ-10865.diff] > Allow prioritization of background jobs > --- > > Key: OFBIZ-10865 > URL: https://issues.apache.org/jira/browse/OFBIZ-10865 > Project: OFBiz > Issue Type: Improvement > Components: framework >Reporter: Scott Gray >Assignee: Scott Gray >Priority: Major > Fix For: Upcoming Branch > > Attachments: OFBIZ-10865.diff > > > As discussed on the dev list [1], allow Jobs to specify a priority and be > queued accordingly by the JobPoller so that important jobs can be prioritized > over normal jobs, and low priority jobs can be left until last. > This is a first pass implementation with just the main changes. We will > still need to allow the priority to be set in the JobManager and > LocalDispatcher's "schedule" methods before jobs generated at runtime can be > prioritized. IMO the existing schedule methods are a mess and need to be > converted into a builder pattern before adding any more job attributes. The > new priority field also needs to be added to the webtools UI wherever > appropriate. > Changes are as follows: > - Add a "priority" field to JobSandbox entity (numeric/Long) > - Add JobPriority constants class containing fields LOW (0), NORMAL (50) and > HIGH (100) > - Add getPriority method to the Job interface and implement methods for > AbstractJob (returns NORMAL), PersistedServiceJob (returns > JobSandbox.priority) and PurgeJob (returns LOW) > - Change the JobPoller executor's queue to use PriorityBlockingQueue > (unbounded) instead of LinkedBlockingQueue (bounded) > - Implement custom Comparator for the priority queue to sort by priority > descending and then runTime ascending > - Change the poll size per poll to be (queueSize() - queue.size) instead of > queue.remainingCapacity() due to the new queue being unbounded > - I've also opted to limit the database poll query to the poll size using > maxRows() because it seemed dangerous to me to use an unconstrained query on > this table > - Ensured recurring jobs receive the default (NORMAL) priority when being > rescheduled so that they're sorted correctly on the next time they show up in > the database poll > - Ensured jobs generated at runtime are given a default priority of NORMAL > [1] > https://lists.apache.org/thread.html/f9107f8ca9a17a2df731337fc3d9766ebad33467fea4393fb069552d@%3Cdev.ofbiz.apache.org%3E -- This message was sent by Atlassian JIRA (v7.6.3#76005)