1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 from haizea.core.scheduler.slottable import ResourceReservation
20 import haizea.common.constants as constants
21 import sys
22
24 """The base class for scheduling exceptions"""
25 pass
26
28 """A simple exception class used when a lease cannot be scheduled
29
30 This exception must be raised when a lease cannot be scheduled
31 """
32
35
38
41
44
45
47 """The base class for scheduling errors"""
48 pass
49
52
55 self.lease = lease
56 self.doing = doing
57
58 self.message = "Lease %i is in an inconsistent state (%i) when %s" % (lease.id, lease.get_state(), doing)
59
62
65 self.exc = exc
66 self.exc_info = sys.exc_info()
67
69 return self.exc_info[2]
70
71
73 """A wrapper for reservation event handlers.
74
75 Reservations (in the slot table) can start and they can end. This class
76 provides a convenient wrapper around the event handlers for these two
77 events (see Scheduler.__register_handler for details on event handlers)
78 """
79 - def __init__(self, sched, on_start, on_end):
80 self.sched = sched
81 self.on_start_method = on_start
82 self.on_end_method = on_end
83
85 self.on_start_method(self.sched, lease, rr)
86
88 self.on_end_method(self.sched, lease, rr)
89
97
99 - def __init__(self, lease, start, end, res, vmrr, transfers):
103