JPPF Issue Tracker
star_faded.png
Please log in to bookmark issues
feature_request_small.png
CLOSED  Feature request JPPF-554  -  AcceptAll, RejectAll execution policy
Posted Oct 15, 2018 - updated Oct 20, 2018
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
    Customization
  • Resolution
    RESOLVED
  • Priority
    Normal
  • Targetted for
    icon_milestones.png JPF 6.0.1
Issue description
To simplify execution policy customization it would be nice if there were "AcceptAll" and "RejectAll" execution policies available. Or simply "empty" but then it is non-obvious if if accepts or rejects everything. These are useful for eg. disabling parts of rule "and(config, rejectAll)" / "or(config/ acceptAll)".

marcin


#1
Comment posted by
 lolo4j
Oct 16, 07:32
When a job's execution policy is null, it means the job will accept all nodes. I will update the documentation and javadoc to clarify this.

I'm not sure I understand the use case for a "reject all" policy. Is this to be used as a convenience, to easily disable parts of complex policies?
#3
Comment posted by
 zorba128
icon_reply.pngOct 18, 08:05, in reply to comment #1
When a job's execution policy is null, it means the job will accept all
nodes. I will update the documentation and javadoc to clarify this.


True - but this applies only to job's execution policy, and not to policy itself. In many other places you cannot, and shouldn't, use null as "empty policy". Like - OrRule/AndRule doesn't handle null as "accept all".

I actually was quite suprised that
PolicyParser.parsePolicy(...)
returns null for empty policy. So
new OrRule(PolicyParser.parsePolicy("<executionPolicy></executionPolicy>"))
will throw NPE.

I agree on RejectAll - you can always have Not(AcceptAll) - assuming positive one is there :). As "no policy applied" means "accept all" - it seems ok even to name it "empty" policy.

Finally - adding "empty" element, your policy algebra becomes monoid (so one will be able to fold on it).

And as always - world without nulls is much nicer. Null is something like unchecked exception in java. Everyone knows it can appear here and there, but you are always suprised when this actually happens :P.

marcin

#4
Comment posted by
 lolo4j
Oct 20, 05:44
There is indeed an inconsistency between the policy validation, which will throw an exception on an empty policy, and the policy parsing, which will not and returns a null policy instead. I am fixing that.

There is also the problem of missing arguments checks for execution policy rules constructors, for which I registered a separate Bug report JPPF-555 - No argument checking in execution policies constructors.

Regarding RejectAll, I finally decided to implement it. If we want to make things convenient, we might as well make them as convenient as possible.