

def query(self, data=None):
    if (len(self.job_queue) > 1000):
        LOGGER.debug(('Skipping query. %s jobs already active.' % len(self.job_queue)))
        return
    if self.querying_for_jobs:
        LOGGER.debug('Skipping query. Already querying for jobs.')
        return
    self.querying_for_jobs = True
    if ((self.uuid_limits['start'] is None) and (self.uuid_limits['end'] is not None)):
        uuid_limit_clause = ("AND itemName() < '%s'" % self.uuid_limits['end'])
    elif ((self.uuid_limits['start'] is not None) and (self.uuid_limits['end'] is None)):
        uuid_limit_clause = ("AND itemName() > '%s'" % self.uuid_limits['start'])
    elif ((self.uuid_limits['start'] is None) and (self.uuid_limits['end'] is None)):
        uuid_limit_clause = ''
    else:
        uuid_limit_clause = ("AND itemName() BETWEEN '%s' AND '%s'" % (self.uuid_limits['start'], self.uuid_limits['end']))
    sql = ("SELECT * \n                FROM `%s` \n                WHERE\n                reservation_next_request < '%s' %s\n                LIMIT 2500" % (self.aws_sdb_reservation_domain, sdb_now(offset=self.time_offset), uuid_limit_clause))
    sql = re.sub('\\s\\s*', ' ', sql)
    self.current_sql = uuid_limit_clause
    LOGGER.debug(('Querying SimpleDB, "%s"' % sql))
    d = self.sdb.select(sql, max_results=5000)
    d.addCallback(self._queryCallback)
    d.addErrback(self._queryErrback)

dataset/ETHPy150Open wehriam/awspider/awspider/servers/execution.py ExecutionServer.query/VarMisuse@253/448 `sql`->`uuid_limit_clause`