@tasklets.tasklet<EOL><INDENT>def run_to_queue(self, queue, conn, options=None, dsquery=None):<DEDENT>
try:<EOL><INDENT>multiquery = self._maybe_multi_query()<EOL>if multiquery is not None:<EOL><INDENT>yield multiquery.run_to_queue(queue, conn, options=options)<EOL>return<EOL><DEDENT>if dsquery is None:<EOL><INDENT>dsquery = self._get_query(conn)<EOL><DEDENT>rpc = dsquery.run_async(conn, options)<EOL>while rpc is not None:<EOL><INDENT>batch = yield rpc<EOL>if (batch.skipped_results and<EOL>datastore_query.FetchOptions.offset(options)):<EOL><INDENT>offset = options.offset - batch.skipped_results<EOL>options = datastore_query.FetchOptions(offset=offset, config=options)<EOL><DEDENT>rpc = batch.next_batch_async(options)<EOL>for i, result in enumerate(batch.results):<EOL><INDENT>queue.putq((batch, i, result))<EOL><DEDENT><DEDENT>queue.complete()<EOL><DEDENT>except GeneratorExit:<EOL><INDENT>raise<EOL><DEDENT>except Exception:<EOL><INDENT>if not queue.done():<EOL><INDENT>_, e, tb = sys.exc_info()<EOL>queue.set_exception(e, tb)<EOL><DEDENT>raise<EOL><DEDENT>
Run this query, putting entities into the given queue.