JPPF Issue Tracker
Please log in to bookmark issues
OPEN  Feature request JPPF-443  -  Variable substitutions and scripted expressions for execution policies arguments
Posted Mar 17, 2016 - updated Mar 17, 2016
Issue details
  • Type of issue
    Feature request
  • Status
  • Assigned to
    Not assigned to anyone
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
  • Owned by
    Not owned by anyone
  • Category
  • Resolution
    Not determined
  • Priority
  • Targetted for
    icon_milestones.png JPPF 6.0
Issue description
Currently, we can write execution policies like this:
ExecutionPolicy policy = new AtLeast("jppf.processing.threads", 4);
In plain English: execute the job on nodes that have at least four processing threads.

While this works very well, it does not allow conditions where the right-side operand is an expression based on other properties. For instance, we cannot easily express "execute the job on nodes that have at least as many processing threads as they have cores". We can do it using a scripted policy, but it is very verbose and cumbersome, for instance:
StringBuilder sb = new StringBuilder();
sb.append("var cores = jppfSystemInfo.getRuntime().getInt('availableProcessors');\n");
sb.append("var threads = jppfSystemInfo.getJppf().getInt('jppf.processing.threads');\n");
sb.append("threads >= cores;");
ExecutionPolicy policy = new ScriptedPolicy("javascript", sb.toString());
We propose to add the possiblity to write the same policy with a much simpler syntax:
ExecutionPolicy policy = new AtLeast("jppf.processing.threads", "${availableProcessors}");
The right-hand operand may need to be wrapped into a specific type like new Expression(String expression), especially for expressions that return strings, but that's the general idea.

There are no comments