Args: dp (list): A datapoint as inputs. It could be either batched or not batched depending on the predictor implementation). callback: a thread-safe callback. When the results are ready, it will be called with the "future" object.
(self, dp, callback=None)
| 163 | t.start() |
| 164 | |
| 165 | def put_task(self, dp, callback=None): |
| 166 | """ |
| 167 | Args: |
| 168 | dp (list): A datapoint as inputs. It could be either batched or not |
| 169 | batched depending on the predictor implementation). |
| 170 | callback: a thread-safe callback. When the results are ready, it will be called |
| 171 | with the "future" object. |
| 172 | Returns: |
| 173 | concurrent.futures.Future: a Future of results. |
| 174 | """ |
| 175 | f = Future() |
| 176 | if callback is not None: |
| 177 | f.add_done_callback(callback) |
| 178 | self.input_queue.put((dp, f)) |
| 179 | return f |