Home | Trees | Indices | Help |
---|
|
1 # -------------------------------------------------------------------------- # 2 # Copyright 2006-2009, University of Chicago # 3 # Copyright 2008-2009, Distributed Systems Architecture Group, Universidad # 4 # Complutense de Madrid (dsa-research.org) # 5 # # 6 # Licensed under the Apache License, Version 2.0 (the "License"); you may # 7 # not use this file except in compliance with the License. You may obtain # 8 # a copy of the License at # 9 # # 10 # http://www.apache.org/licenses/LICENSE-2.0 # 11 # # 12 # Unless required by applicable law or agreed to in writing, software # 13 # distributed under the License is distributed on an "AS IS" BASIS, # 14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # 15 # See the License for the specific language governing permissions and # 16 # limitations under the License. # 17 # -------------------------------------------------------------------------- # 18 19 """Accounting probes that collect data from leases""" 20 21 from haizea.core.accounting import AccountingProbe, AccountingDataCollection 22 from haizea.core.leases import Lease 2325 """ 26 Collects information from Advance Reservation leases 27 28 * Counters 29 30 - "Accepted AR": Number of accepted AR leases 31 - "Rejected AR": Number of rejected AR leases 32 33 * Per-run data 34 35 - "Total accepted AR": Final number of accepted AR leases 36 - "Total rejected AR": Final number of rejected AR leases 37 38 """ 39 COUNTER_ACCEPTED="Accepted AR" 40 COUNTER_REJECTED="Rejected AR" 41 STAT_ACCEPTED="Total accepted AR" 42 STAT_REJECTED="Total rejected AR" 4370 7145 """See AccountingProbe.__init__""" 46 AccountingProbe.__init__(self, accounting) 47 self.accounting.create_counter(ARProbe.COUNTER_ACCEPTED, AccountingDataCollection.AVERAGE_NONE) 48 self.accounting.create_counter(ARProbe.COUNTER_REJECTED, AccountingDataCollection.AVERAGE_NONE) 49 self.accounting.create_stat(ARProbe.STAT_ACCEPTED) 50 self.accounting.create_stat(ARProbe.STAT_REJECTED)5153 """See AccountingProbe.finalize_accounting""" 54 self._set_stat_from_counter(ARProbe.STAT_ACCEPTED, ARProbe.COUNTER_ACCEPTED) 55 self._set_stat_from_counter(ARProbe.STAT_REJECTED, ARProbe.COUNTER_REJECTED)5658 """See AccountingProbe.at_lease_request""" 59 if lease.get_type() == Lease.ADVANCE_RESERVATION: 60 if lease.get_state() == Lease.STATE_PENDING: 61 self.accounting.incr_counter(ARProbe.COUNTER_ACCEPTED, lease.id) 62 elif lease.get_state() == Lease.STATE_REJECTED: 63 self.accounting.incr_counter(ARProbe.COUNTER_REJECTED, lease.id)6466 """See AccountingProbe.at_lease_done""" 67 if lease.get_type() == Lease.ADVANCE_RESERVATION: 68 if lease.get_state() == Lease.STATE_REJECTED: 69 self.accounting.incr_counter(ARProbe.COUNTER_REJECTED, lease.id)73 """ 74 Collects information from immediate leases 75 76 * Counters 77 78 - "Accepted Immediate": Number of accepted Immediate leases 79 - "Rejected Immediate": Number of rejected Immediate leases 80 81 * Per-run data 82 83 - "Total accepted Immediate": Final number of accepted Immediate leases 84 - "Total rejected Immediate": Final number of rejected Immediate leases 85 86 """ 87 COUNTER_ACCEPTED="Accepted Immediate" 88 COUNTER_REJECTED="Rejected Immediate" 89 STAT_ACCEPTED="Total accepted Immediate" 90 STAT_REJECTED="Total rejected Immediate" 91118 11993 """See AccountingProbe.__init__""" 94 AccountingProbe.__init__(self, accounting) 95 self.accounting.create_counter(IMProbe.COUNTER_ACCEPTED, AccountingDataCollection.AVERAGE_NONE) 96 self.accounting.create_counter(IMProbe.COUNTER_REJECTED, AccountingDataCollection.AVERAGE_NONE) 97 self.accounting.create_stat(IMProbe.STAT_ACCEPTED) 98 self.accounting.create_stat(IMProbe.STAT_REJECTED)99101 """See AccountingProbe.finalize_accounting""" 102 self._set_stat_from_counter(IMProbe.STAT_ACCEPTED, IMProbe.COUNTER_ACCEPTED) 103 self._set_stat_from_counter(IMProbe.STAT_REJECTED, IMProbe.COUNTER_REJECTED)104106 """See AccountingProbe.at_lease_request""" 107 if lease.get_type() == Lease.IMMEDIATE: 108 if lease.get_state() == Lease.STATE_PENDING: 109 self.accounting.incr_counter(IMProbe.COUNTER_ACCEPTED, lease.id) 110 elif lease.get_state() == Lease.STATE_REJECTED: 111 self.accounting.incr_counter(IMProbe.COUNTER_REJECTED, lease.id)112114 """See AccountingProbe.at_lease_done""" 115 if lease.get_type() == Lease.IMMEDIATE: 116 if lease.get_state() == Lease.STATE_REJECTED: 117 self.accounting.incr_counter(IMProbe.COUNTER_REJECTED, lease.id)121 """ 122 Collects information from best-effort leases 123 124 * Counters 125 126 - "Best-effort completed": Number of best-effort leases completed 127 throughout the run 128 - "Queue size": Size of the queue throughout the run 129 130 * Per-lease data 131 132 - "Waiting time": Time (in seconds) the lease waited in the queue 133 before resources were allocated to it. 134 - "Slowdown": Slowdown of the lease (time required to run the lease 135 to completion divided by the time it would have required on a 136 dedicated system) 137 138 * Per-run data 139 140 - "Total best-effort completed": Final number of completed best-effort leases 141 - "all-best-effort": The time (in seconds) when the last best-effort 142 lease was completed. 143 144 """ 145 146 COUNTER_BESTEFFORTCOMPLETED="Best-effort completed" 147 COUNTER_QUEUESIZE="Queue size" 148 LEASE_STAT_WAITINGTIME="Waiting time" 149 LEASE_STAT_SLOWDOWN="Slowdown" 150 STAT_BESTEFFORTCOMPLETED="Total best-effort completed" 151 STAT_ALLBESTEFFORT="all-best-effort" 152 153182155 """See AccountingProbe.__init__""" 156 AccountingProbe.__init__(self, accounting) 157 self.accounting.create_counter(BEProbe.COUNTER_BESTEFFORTCOMPLETED, AccountingDataCollection.AVERAGE_NONE) 158 self.accounting.create_counter(BEProbe.COUNTER_QUEUESIZE, AccountingDataCollection.AVERAGE_TIMEWEIGHTED) 159 self.accounting.create_lease_stat(BEProbe.LEASE_STAT_WAITINGTIME) 160 self.accounting.create_lease_stat(BEProbe.LEASE_STAT_SLOWDOWN) 161 self.accounting.create_stat(BEProbe.STAT_BESTEFFORTCOMPLETED) 162 self.accounting.create_stat(BEProbe.STAT_ALLBESTEFFORT)163165 """See AccountingProbe.finalize_accounting""" 166 self._set_stat_from_counter(BEProbe.STAT_BESTEFFORTCOMPLETED, BEProbe.COUNTER_BESTEFFORTCOMPLETED) 167 all_best_effort = self.accounting.get_last_counter_time(BEProbe.COUNTER_BESTEFFORTCOMPLETED) 168 self.accounting.set_stat(BEProbe.STAT_ALLBESTEFFORT, all_best_effort)169171 """See AccountingProbe.at_timestep""" 172 queue_len = lease_scheduler.queue.length() 173 self.accounting.append_to_counter(BEProbe.COUNTER_QUEUESIZE, queue_len)174176 """See AccountingProbe.at_lease_done""" 177 if lease.get_type() == Lease.BEST_EFFORT: 178 wait = lease.get_waiting_time().seconds 179 self.accounting.set_lease_stat(BEProbe.LEASE_STAT_WAITINGTIME, lease.id, wait) 180 self.accounting.set_lease_stat(BEProbe.LEASE_STAT_SLOWDOWN, lease.id, lease.get_slowdown()) 181 self.accounting.incr_counter(BEProbe.COUNTER_BESTEFFORTCOMPLETED, lease.id)
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Dec 17 10:59:23 2009 | http://epydoc.sourceforge.net |