OLD | NEW |
1 # Copyright (c) 2010 Spotify AB | 1 # Copyright (c) 2010 Spotify AB |
2 # Copyright (c) 2010 Jeremy Thurgood <firxen+boto@gmail.com> | 2 # Copyright (c) 2010 Jeremy Thurgood <firxen+boto@gmail.com> |
| 3 # Copyright (c) 2010-2011 Yelp |
3 # | 4 # |
4 # Permission is hereby granted, free of charge, to any person obtaining a | 5 # Permission is hereby granted, free of charge, to any person obtaining a |
5 # copy of this software and associated documentation files (the | 6 # copy of this software and associated documentation files (the |
6 # "Software"), to deal in the Software without restriction, including | 7 # "Software"), to deal in the Software without restriction, including |
7 # without limitation the rights to use, copy, modify, merge, publish, dis- | 8 # without limitation the rights to use, copy, modify, merge, publish, dis- |
8 # tribute, sublicense, and/or sell copies of the Software, and to permit | 9 # tribute, sublicense, and/or sell copies of the Software, and to permit |
9 # persons to whom the Software is furnished to do so, subject to the fol- | 10 # persons to whom the Software is furnished to do so, subject to the fol- |
10 # lowing conditions: | 11 # lowing conditions: |
11 # | 12 # |
12 # The above copyright notice and this permission notice shall be included | 13 # The above copyright notice and this permission notice shall be included |
(...skipping 24 matching lines...) Expand all Loading... |
37 pass | 38 pass |
38 | 39 |
39 def endElement(self, name, value, connection): | 40 def endElement(self, name, value, connection): |
40 if name in self.Fields: | 41 if name in self.Fields: |
41 setattr(self, name.lower(), value) | 42 setattr(self, name.lower(), value) |
42 | 43 |
43 | 44 |
44 class RunJobFlowResponse(EmrObject): | 45 class RunJobFlowResponse(EmrObject): |
45 Fields = set(['JobFlowId']) | 46 Fields = set(['JobFlowId']) |
46 | 47 |
| 48 class AddInstanceGroupsResponse(EmrObject): |
| 49 Fields = set(['InstanceGroupIds', 'JobFlowId']) |
| 50 |
| 51 class ModifyInstanceGroupsResponse(EmrObject): |
| 52 Fields = set(['RequestId']) |
| 53 |
47 | 54 |
48 class Arg(EmrObject): | 55 class Arg(EmrObject): |
49 def __init__(self, connection=None): | 56 def __init__(self, connection=None): |
50 self.value = None | 57 self.value = None |
51 | 58 |
52 def endElement(self, name, value, connection): | 59 def endElement(self, name, value, connection): |
53 self.value = value | 60 self.value = value |
54 | 61 |
55 | 62 |
56 class BootstrapAction(EmrObject): | 63 class BootstrapAction(EmrObject): |
57 Fields = set(['Name', | 64 Fields = set([ |
58 'Args', | 65 'Args', |
59 'Path']) | 66 'Name', |
| 67 'Path', |
| 68 ]) |
| 69 |
| 70 def startElement(self, name, attrs, connection): |
| 71 if name == 'Args': |
| 72 self.args = ResultSet([('member', Arg)]) |
| 73 return self.args |
| 74 |
| 75 |
| 76 class KeyValue(EmrObject): |
| 77 Fields = set([ |
| 78 'Key', |
| 79 'Value', |
| 80 ]) |
60 | 81 |
61 | 82 |
62 class Step(EmrObject): | 83 class Step(EmrObject): |
63 Fields = set(['Name', | 84 Fields = set([ |
64 'ActionOnFailure', | 85 'ActionOnFailure', |
65 'CreationDateTime', | 86 'CreationDateTime', |
66 'StartDateTime', | 87 'EndDateTime', |
67 'EndDateTime', | 88 'Jar', |
68 'LastStateChangeReason', | 89 'LastStateChangeReason', |
69 'State']) | 90 'MainClass', |
| 91 'Name', |
| 92 'StartDateTime', |
| 93 'State', |
| 94 ]) |
70 | 95 |
71 def __init__(self, connection=None): | 96 def __init__(self, connection=None): |
72 self.connection = connection | 97 self.connection = connection |
73 self.args = None | 98 self.args = None |
74 | 99 |
75 def startElement(self, name, attrs, connection): | 100 def startElement(self, name, attrs, connection): |
76 if name == 'Args': | 101 if name == 'Args': |
77 self.args = ResultSet([('member', Arg)]) | 102 self.args = ResultSet([('member', Arg)]) |
78 return self.args | 103 return self.args |
| 104 if name == 'Properties': |
| 105 self.properties = ResultSet([('member', KeyValue)]) |
| 106 return self.properties |
79 | 107 |
80 | 108 |
81 class InstanceGroup(EmrObject): | 109 class InstanceGroup(EmrObject): |
82 Fields = set(['Name', | 110 Fields = set([ |
83 'CreationDateTime', | 111 'BidPrice', |
84 'InstanceRunningCount', | 112 'CreationDateTime', |
85 'StartDateTime', | 113 'EndDateTime', |
86 'ReadyDateTime', | 114 'InstanceGroupId', |
87 'State', | 115 'InstanceRequestCount', |
88 'EndDateTime', | 116 'InstanceRole', |
89 'InstanceRequestCount', | 117 'InstanceRunningCount', |
90 'InstanceType', | 118 'InstanceType', |
91 'Market', | 119 'LastStateChangeReason', |
92 'LastStateChangeReason', | 120 'LaunchGroup', |
93 'InstanceRole', | 121 'Market', |
94 'InstanceGroupId', | 122 'Name', |
95 'LaunchGroup', | 123 'ReadyDateTime', |
96 'SpotPrice']) | 124 'StartDateTime', |
| 125 'State', |
| 126 ]) |
97 | 127 |
98 | 128 |
99 class JobFlow(EmrObject): | 129 class JobFlow(EmrObject): |
100 Fields = set(['CreationDateTime', | 130 Fields = set([ |
101 'StartDateTime', | 131 'AvailabilityZone', |
102 'State', | 132 'CreationDateTime', |
103 'EndDateTime', | 133 'Ec2KeyName', |
104 'Id', | 134 'EndDateTime', |
105 'InstanceCount', | 135 'HadoopVersion', |
106 'JobFlowId', | 136 'Id', |
107 'LogUri', | 137 'InstanceCount', |
108 'MasterPublicDnsName', | 138 'JobFlowId', |
109 'MasterInstanceId', | 139 'KeepJobFlowAliveWhenNoSteps', |
110 'Name', | 140 'LastStateChangeReason', |
111 'Placement', | 141 'LogUri', |
112 'RequestId', | 142 'MasterInstanceId', |
113 'Type', | 143 'MasterInstanceType', |
114 'Value', | 144 'MasterPublicDnsName', |
115 'AvailabilityZone', | 145 'Name', |
116 'SlaveInstanceType', | 146 'NormalizedInstanceHours', |
117 'MasterInstanceType', | 147 'ReadyDateTime', |
118 'Ec2KeyName', | 148 'RequestId', |
119 'InstanceCount', | 149 'SlaveInstanceType', |
120 'KeepJobFlowAliveWhenNoSteps', | 150 'StartDateTime', |
121 'LastStateChangeReason']) | 151 'State', |
| 152 'TerminationProtected', |
| 153 'Type', |
| 154 'Value', |
| 155 ]) |
122 | 156 |
123 def __init__(self, connection=None): | 157 def __init__(self, connection=None): |
124 self.connection = connection | 158 self.connection = connection |
125 self.steps = None | 159 self.steps = None |
126 self.instancegroups = None | 160 self.instancegroups = None |
127 self.bootstrapactions = None | 161 self.bootstrapactions = None |
128 | 162 |
129 def startElement(self, name, attrs, connection): | 163 def startElement(self, name, attrs, connection): |
130 if name == 'Steps': | 164 if name == 'Steps': |
131 self.steps = ResultSet([('member', Step)]) | 165 self.steps = ResultSet([('member', Step)]) |
132 return self.steps | 166 return self.steps |
133 elif name == 'InstanceGroups': | 167 elif name == 'InstanceGroups': |
134 self.instancegroups = ResultSet([('member', InstanceGroup)]) | 168 self.instancegroups = ResultSet([('member', InstanceGroup)]) |
135 return self.instancegroups | 169 return self.instancegroups |
136 elif name == 'BootstrapActions': | 170 elif name == 'BootstrapActions': |
137 self.bootstrapactions = ResultSet([('member', BootstrapAction)]) | 171 self.bootstrapactions = ResultSet([('member', BootstrapAction)]) |
138 return self.bootstrapactions | 172 return self.bootstrapactions |
139 else: | 173 else: |
140 return None | 174 return None |
141 | |
OLD | NEW |