def _save(self, finished=None, steps=None, data=None): with self._db_conn() as conn: success = conn.query( ''' UPDATE %s SET last_contact=%%(now)s, update_count=update_count + 1, steps=%%(steps)s, finished=%%(finished)s, data=%%(data)s WHERE id = %%(task_id)s AND execution_id = %%(execution_id)s AND last_contact > %%(now)s - INTERVAL %%(ttl)s SECOND ''' % self._queue.table_name, now=datetime.utcnow(), task_id=self.task_id, execution_id=self.execution_id, ttl=self._queue.execution_ttl, steps=json.dumps(steps if steps is not None else self.steps), finished=finished if finished is not None else self.finished, data=json.dumps(data if data is not None else self.data)) if success != 1: raise TaskDoesNotExist() else: if steps is not None: self.steps = steps if finished is not None: self.finished = finished if data is not None: self.data = data
def _save(self, finished=None, steps=None, data=None): with self._db_conn() as conn: success = conn.query(''' UPDATE %s SET last_contact=%%(now)s, update_count=update_count + 1, steps=%%(steps)s, finished=%%(finished)s, data=%%(data)s WHERE id = %%(task_id)s AND execution_id = %%(execution_id)s AND last_contact > %%(now)s - INTERVAL %%(ttl)s SECOND ''' % self._queue.table_name, now=datetime.utcnow(), task_id=self.task_id, execution_id=self.execution_id, ttl=self._queue.execution_ttl, steps=json.dumps(steps if steps is not None else self.steps), finished=finished if finished is not None else self.finished, data=json.dumps(data if data is not None else self.data)) if success != 1: raise TaskDoesNotExist() else: if steps is not None: self.steps = steps if finished is not None: self.finished = finished if data is not None: self.data = data
def enqueue(self, data): """ Enqueue task with specified data. """ jsonified_data = json.dumps(data) with self._db_conn() as conn: conn.execute( 'INSERT INTO %s_tasks (data) VALUES (%%s)' % self.table_prefix, jsonified_data)
def enqueue(self, data): """ Enqueue task with specified data. """ jsonified_data = json.dumps(data) with self._db_conn() as conn: conn.execute( 'INSERT INTO %s_tasks (data) VALUES (%%s)' % self.table_prefix, jsonified_data )
def enqueue(self, data): """ Enqueue task with specified data. """ jsonified_data = json.dumps(data) with self._db_conn() as conn: return conn.execute( 'INSERT INTO %s (created, data) VALUES (%%(created)s, %%(data)s)' % self.table_name, created=datetime.utcnow(), data=jsonified_data )
def enqueue(self, data): """ Enqueue task with specified data. """ jsonified_data = json.dumps(data) with self._db_conn() as conn: return conn.execute( 'INSERT INTO %s (created, data) VALUES (%%(created)s, %%(data)s)' % self.table_name, created=datetime.utcnow(), data=jsonified_data)
def _save(self): with self._db_conn() as conn: conn.execute(''' UPDATE %(prefix)s_executions SET last_contact=NOW(), steps=%%s, finished=%%s WHERE id = %%s ''' % { 'prefix': self._queue.table_prefix }, json.dumps(self.steps), self.finished, self._execution_id)
def _save(self): with self._db_conn() as conn: conn.execute( ''' UPDATE %(prefix)s_executions SET last_contact=NOW(), steps=%%s, finished=%%s WHERE id = %%s ''' % {'prefix': self._queue.table_prefix}, json.dumps(self.steps), self.finished, self._execution_id)
def post(self): blah = self.get_argument("search") with pool.connect(MEMSQL_HOST, MEMSQL_PORT, 'root', '', 'griever') as conn: topic = conn.query("select * from grievers where topic like '%" + blah + "%'") print(topic) self.render("../static/html/index.html", topic=json.dumps(topic))