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
1=== modified file 'lava_scheduler_app/utils.py'
2--- lava_scheduler_app/utils.py 2013-09-12 09:30:32 +0000
3+++ lava_scheduler_app/utils.py 2013-09-17 15:23:11 +0000
4@@ -46,6 +46,7 @@
5 node_json = {}
6 all_nodes = {}
7 node_actions = {}
8+ node_lmp = {}
9
10 # Check if we are operating on multinode job data. Else return the job
11 # data as it is.
12@@ -57,6 +58,7 @@
13 # get all the roles and create node action list for each role.
14 for group in json_jobdata["device_group"]:
15 node_actions[group["role"]] = []
16+ node_lmp[group["role"]] = []
17
18 # Take each action and assign it to proper roles. If roles are not
19 # specified for a specific action, then assign it to all the roles.
20@@ -72,6 +74,19 @@
21 else:
22 node_actions[role].append(new_action)
23
24+ # For LMP init in multinode case
25+ all_lmp_modules = json_jobdata["lmp_module"]
26+ for role in node_lmp.keys():
27+ for lmp in all_lmp_modules:
28+ new_lmp = copy.deepcopy(lmp)
29+ if 'parameters' in new_lmp \
30+ and 'role' in new_lmp["parameters"]:
31+ if new_lmp["parameters"]["role"] == role:
32+ new_lmp["parameters"].pop('role', None)
33+ node_lmp[role].append(new_lmp)
34+ else:
35+ node_lmp[role].append(new_lmp)
36+
37 group_count = 0
38 for clients in json_jobdata["device_group"]:
39 group_count += int(clients["count"])
40@@ -91,6 +106,7 @@
41 node_json[role][c]["group_size"] = group_count
42 node_json[role][c]["target_group"] = target_group
43 node_json[role][c]["actions"] = node_actions[role]
44+ node_json[role][c]["lmp_module"] = node_lmp[role]
45
46 node_json[role][c]["role"] = role
47 # multinode node stage 2

Subscribers

People subscribed via source and target branches