Merge lp:lava-scheduler/lmp into lp:lava-scheduler

Proposed by Fu Wei
Status: Merged
Merged at revision: 263
Proposed branch: lp:lava-scheduler/lmp
Merge into: lp:lava-scheduler
Diff against target: 47 lines (+16/-0)
1 file modified
lava_scheduler_app/utils.py (+16/-0)
To merge this branch: bzr merge lp:lava-scheduler/lmp
Reviewer Review Type Date Requested Status
Antonio Terceiro Approve
Neil Williams Pending
Tyler Baker Pending
Dave Pigott Pending
Review via email: mp+186071@code.launchpad.net

Description of the change

Add LMP modules init value support

To post a comment you must log in.
Revision history for this message
Antonio Terceiro (terceiro) wrote :

Looks OK to me.

 review approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lava_scheduler_app/utils.py'
--- lava_scheduler_app/utils.py 2013-09-12 09:30:32 +0000
+++ lava_scheduler_app/utils.py 2013-09-17 15:23:11 +0000
@@ -46,6 +46,7 @@
46 node_json = {}46 node_json = {}
47 all_nodes = {}47 all_nodes = {}
48 node_actions = {}48 node_actions = {}
49 node_lmp = {}
49 50
50 # Check if we are operating on multinode job data. Else return the job51 # Check if we are operating on multinode job data. Else return the job
51 # data as it is.52 # data as it is.
@@ -57,6 +58,7 @@
57 # get all the roles and create node action list for each role.58 # get all the roles and create node action list for each role.
58 for group in json_jobdata["device_group"]:59 for group in json_jobdata["device_group"]:
59 node_actions[group["role"]] = []60 node_actions[group["role"]] = []
61 node_lmp[group["role"]] = []
6062
61 # Take each action and assign it to proper roles. If roles are not63 # Take each action and assign it to proper roles. If roles are not
62 # specified for a specific action, then assign it to all the roles.64 # specified for a specific action, then assign it to all the roles.
@@ -72,6 +74,19 @@
72 else:74 else:
73 node_actions[role].append(new_action)75 node_actions[role].append(new_action)
7476
77 # For LMP init in multinode case
78 all_lmp_modules = json_jobdata["lmp_module"]
79 for role in node_lmp.keys():
80 for lmp in all_lmp_modules:
81 new_lmp = copy.deepcopy(lmp)
82 if 'parameters' in new_lmp \
83 and 'role' in new_lmp["parameters"]:
84 if new_lmp["parameters"]["role"] == role:
85 new_lmp["parameters"].pop('role', None)
86 node_lmp[role].append(new_lmp)
87 else:
88 node_lmp[role].append(new_lmp)
89
75 group_count = 090 group_count = 0
76 for clients in json_jobdata["device_group"]:91 for clients in json_jobdata["device_group"]:
77 group_count += int(clients["count"])92 group_count += int(clients["count"])
@@ -91,6 +106,7 @@
91 node_json[role][c]["group_size"] = group_count106 node_json[role][c]["group_size"] = group_count
92 node_json[role][c]["target_group"] = target_group107 node_json[role][c]["target_group"] = target_group
93 node_json[role][c]["actions"] = node_actions[role]108 node_json[role][c]["actions"] = node_actions[role]
109 node_json[role][c]["lmp_module"] = node_lmp[role]
94110
95 node_json[role][c]["role"] = role111 node_json[role][c]["role"] = role
96 # multinode node stage 2112 # multinode node stage 2

Subscribers

People subscribed via source and target branches