JPPF Issue Tracker
star_faded.png
Please log in to bookmark issues
feature_request_small.png
CLOSED  Feature request JPPF-551  -  Possibility to setup default execution policy in jppf client config
Posted Oct 11, 2018 - updated Today (09:52)
action_vote_minus_faded.png
0
Votes
action_vote_plus_faded.png
icon_info.png This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue details
  • Type of issue
    Feature request
  • Status
     
    Closed
  • Assigned to
     lolo4j
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
     zorba128
  • Owned by
    Not owned by anyone
  • Category
    Configuration
  • Resolution
    RESOLVED
  • Priority
    Normal
  • Targetted for
    icon_milestones.png JPF 6.0.1
Issue description
Provide jppf.properties configuration option to setup default execution policy for newly created jobs, something similar to:
jppf.jobSLA.defaultPolicy = "jppf.policy.xml"
jppf.jobSLA.defaultPolicy.javascript = "return true"
it might support inline policy or loading policy from external file

#3
Comment posted by
 lolo4j
Oct 14, 07:45
In the database servicxes, we have an execution policy filter that is very similar to what your are describing; I think it even covers more uses cases. I propose to use the same mechanism (and code) for a default execution policy for the job SLA, will that do?

Furthermore, I also propose to add the methods setDefaultExecutionPolicy(ExecutionPolicy) and getDefaultExecutionPolicy() to JPPFClient (or one of its superclasses), so the same functionality can be achieved programmatically as well.
#5
Comment posted by
 zorba128
icon_reply.pngOct 15, 09:17, in reply to comment #3
I propose to use the same mechanism (and code) for a default
execution policy for the job SLA, will that do?


sure, looks perfect

Furthermore, I also propose to add the methods
setDefaultExecutionPolicy(ExecutionPolicy) and getDefaultExecutionPolicy()
to JPPFClient (or one of its superclasses), so the same functionality can
be achieved programmatically as well.


Is this the right place for that method? What would happen if one submits job with policy set and client has default policy defined?

marcin

#6
Comment posted by
 lolo4j
icon_reply.pngOct 16, 07:23, in reply to comment #5
Is this the right place for that method? What would happen if one submits
job with policy set and client has default policy defined?


A non-null default policy would only apply to jobs whose policy is null. That's my understanding of what default policy means.

Also, keep in mind that you can have multiple instances of JPPFClient, each potentially with its own configuration (via the JPPFClient(TypedProperties config) constructor). We must preserve the flexibility this provides. So yes, I believe JPPFClient is where the default policy accessors should be.

Note that you can also easily implement a default policy feature by subclassing JPPFClient and overriding its submitJob(JPPFJob) method, for example like this:
final ExecutionPolicy defaultPolicy = new AtLeast("availableProcessors", 4);
try (final JPPFClient client = new JPPFClient() {
  @Override
  public List<Task<?>> submitJob(JPPFJob job) {
    if (job.getSLA().getExecutionPolicy() == null)
      job.getSLA().setExecutionPolicy(defaultPolicy);
    return super.submitJob(job);
  }
}) {
  // ... do some stuff ...
}
#7
Comment posted by
 lolo4j
Today, 09:51
Implemented in master and branch 6.0. Published doc (v6.1):