| 214 | # Monkey patching to allow the apply_async call and response to |
| 215 | # be handled on behalf of the domain. |
| 216 | class IPYAsync: |
| 217 | def __init__(self, asynchronous, domain, rv, eid, tid, ctrl): |
| 218 | self.asynchronous = asynchronous |
| 219 | self.domain = domain |
| 220 | self.rv = rv |
| 221 | self.metadata = self.asynchronous.metadata |
| 222 | self.eid = eid |
| 223 | self.tid = tid |
| 224 | self.ctrl = ctrl |
| 225 | |
| 226 | def ready(self): |
| 227 | return self.asynchronous.ready() |
| 228 | |
| 229 | def get(self): |
| 230 | if self.asynchronous.successful(): |
| 231 | val = self.asynchronous.get() |
| 232 | return self.domain.evaluate_async2(val, self.ctrl) |
| 233 | return self.rv |
| 234 | |
| 235 | pass |
| 236 | |
| 237 | |
| 238 | # @interactive |