diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-09-18 10:39:05 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-09-18 10:39:05 +0200 |
| commit | 3743d182d99dbed9d2be84dc357f6839ffe4d2ec (patch) | |
| tree | 7fe88768469f34601c494f5b027bd9c3a6d622e7 /src/main/java/com/c2kernel/lifecycle/instance/Activity.java | |
| parent | 1537f39761e11669335f6499474f23b11cf2cf38 (diff) | |
Hierarchical Roles. Fixes #199
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/Activity.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lifecycle/instance/Activity.java | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java index 95e0ede..3dd94b0 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/Activity.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/Activity.java @@ -1,5 +1,6 @@ package com.c2kernel.lifecycle.instance;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
@@ -21,6 +22,7 @@ import com.c2kernel.lifecycle.instance.stateMachine.Transition; import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.InvalidAgentPathException;
import com.c2kernel.lookup.ItemPath;
+import com.c2kernel.lookup.Path;
import com.c2kernel.lookup.RolePath;
import com.c2kernel.persistency.ClusterStorageException;
import com.c2kernel.persistency.outcome.Outcome;
@@ -203,7 +205,16 @@ public class Activity extends WfVertex DateUtility.setToNow(mStateDate);
//refresh all the job lists
- pushJobsToAgents(itemPath);
+ String agentRole = getCurrentAgentRole();
+ if (agentRole != null && agentRole.length()>0) {
+ try {
+ RolePath myRole = Gateway.getLookup().getRolePath(agentRole);
+ pushJobsToAgents(itemPath, myRole);
+ } catch (ObjectNotFoundException ex) { // non-existent role
+ Logger.msg(7, "Activity.pushJobsToAgents() - Activity role '"+agentRole+" not found.");
+ }
+ }
+
return outcome;
}
@@ -451,22 +462,29 @@ public class Activity extends WfVertex }
return jobs;
}
-
- public void pushJobsToAgents(ItemPath itemPath)
- {
- String agentRole = getCurrentAgentRole();
- if (agentRole == null || agentRole.length()==0) return;
- RolePath myRole;
- try {
- myRole = Gateway.getLookup().getRolePath(agentRole);
- } catch (ObjectNotFoundException ex) { // non-existent role
- Logger.msg(7, "Activity.pushJobsToAgents() - Activity role '"+agentRole+" not found.");
- return;
- }
- if (myRole.hasJobList())
- new JobPusher(this, itemPath, myRole).start();
+ public void pushJobsToAgents(ItemPath itemPath) {
+ String agentRole = getCurrentAgentRole();
+ if (agentRole != null && agentRole.length()>0) {
+ try {
+ RolePath myRole = Gateway.getLookup().getRolePath(agentRole);
+ pushJobsToAgents(itemPath, myRole);
+ } catch (ObjectNotFoundException ex) { // non-existent role
+ Logger.msg(7, "Activity.pushJobsToAgents() - Activity role '"+agentRole+" not found.");
+ }
+ }
+ }
+
+ public void pushJobsToAgents(ItemPath itemPath, RolePath role)
+ {
+ if (role.hasJobList())
+ new JobPusher(this, itemPath, role).start();
+ Iterator<Path> childRoles = role.getChildren();
+ while (childRoles.hasNext()) {
+ RolePath childRole = (RolePath)childRoles.next();
+ pushJobsToAgents(itemPath, childRole);
+ }
}
/**
|
