diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 261: Add LMP modules init value support

Message ID 20130917212324.28197.95666.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Fu Wei Fu Sept. 17, 2013, 9:23 p.m. UTC
------------------------------------------------------------
revno: 261
committer: Fu Wei <fu.wei@linaro.org>
branch nick: lmp
timestamp: Tue 2013-09-10 21:20:02 +0800
message:
  Add  LMP modules init value support
modified:
  lava_scheduler_app/utils.py


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_scheduler_app/utils.py'
--- lava_scheduler_app/utils.py	2013-09-02 16:22:57 +0000
+++ lava_scheduler_app/utils.py	2013-09-10 13:20:02 +0000
@@ -45,6 +45,7 @@ 
     node_json = {}
     all_nodes = {}
     node_actions = {}
+    node_lmp = {}
     
     # Check if we are operating on multinode job data. Else return the job
     # data as it is.
@@ -56,6 +57,7 @@ 
     # get all the roles and create node action list for each role.
     for group in json_jobdata["device_group"]:
         node_actions[group["role"]] = []
+        node_lmp[group["role"]] = []
 
     # Take each action and assign it to proper roles. If roles are not
     # specified for a specific action, then assign it to all the roles.
@@ -71,6 +73,19 @@ 
             else:
                 node_actions[role].append(new_action)
 
+    # For LMP init in multinode case
+    all_lmp_modules = json_jobdata["lmp_module"]
+    for role in node_lmp.keys():
+        for lmp in all_lmp_modules:
+            new_lmp = copy.deepcopy(lmp)
+            if 'parameters' in new_lmp \
+                    and 'role' in new_lmp["parameters"]:
+                if new_lmp["parameters"]["role"] == role:
+                    new_lmp["parameters"].pop('role', None)
+                    node_lmp[role].append(new_lmp)
+            else:
+                node_lmp[role].append(new_lmp)
+
     group_count = 0
     for clients in json_jobdata["device_group"]:
         group_count += int(clients["count"])
@@ -86,6 +101,7 @@ 
             node_json[role][c]["group_size"] = group_count
             node_json[role][c]["target_group"] = target_group
             node_json[role][c]["actions"] = node_actions[role]
+            node_json[role][c]["lmp_module"] = node_lmp[role]
 
             node_json[role][c]["role"] = role
             # multinode node stage 2