|
92 | 92 |
|
93 | 93 |
|
94 | 94 | def add_parking_lot_breaker(task: Task, lot: ParkingLot) -> None:
|
95 |
| - """Register a task as a breaker for a lot. If this task exits without being removed |
96 |
| - as a breaker, the lot will break. This will cause an error to be raised for all |
97 |
| - tasks currently parked in the lot, as well as any future tasks that attempt to |
98 |
| - park in it. |
99 |
| - """ |
| 95 | + """Register a task as a breaker for a lot. See :meth:`ParkingLot.break_lot`""" |
100 | 96 | if task not in GLOBAL_PARKING_LOT_BREAKER:
|
101 | 97 | GLOBAL_PARKING_LOT_BREAKER[task] = [lot]
|
102 | 98 | else:
|
103 | 99 | GLOBAL_PARKING_LOT_BREAKER[task].append(lot)
|
104 | 100 |
|
105 | 101 |
|
106 | 102 | def remove_parking_lot_breaker(task: Task, lot: ParkingLot) -> None:
|
107 |
| - """Deregister a task as a breaker for a lot. See :func:`add_parking_lot_breaker`.""" |
| 103 | + """Deregister a task as a breaker for a lot. See :meth:`ParkingLot.break_lot`""" |
108 | 104 | try:
|
109 | 105 | GLOBAL_PARKING_LOT_BREAKER[task].remove(lot)
|
110 | 106 | except (KeyError, ValueError):
|
@@ -273,10 +269,14 @@ def repark_all(self, new_lot: ParkingLot) -> None:
|
273 | 269 | return self.repark(new_lot, count=len(self))
|
274 | 270 |
|
275 | 271 | def break_lot(self, task: Task | None = None) -> None:
|
276 |
| - """Break this lot, causing all parked tasks to raise an error, and any |
| 272 | + """Break this lot, with ``task`` noted as the task that broke it. |
| 273 | +
|
| 274 | + This causes all parked tasks to raise an error, and any |
277 | 275 | future tasks attempting to park to error. Unpark & repark become no-ops as the
|
278 | 276 | parking lot is empty.
|
279 |
| - The error raised contains a reference to the task sent as a parameter. |
| 277 | +
|
| 278 | + The error raised contains a reference to the task sent as a parameter. It is also |
| 279 | + saved in the ``broken_by`` attribute. |
280 | 280 | """
|
281 | 281 | if task is None:
|
282 | 282 | task = _core.current_task()
|
|
0 commit comments