Example #1
0
    def _refresh(self):
        with self._db_conn() as conn:
            row = conn.get('''
                SELECT
                    exc.task_id, tsk.data, exc.steps
                FROM
                    %(prefix)s_tasks AS tsk
                    INNER JOIN %(prefix)s_executions AS exc ON tsk.id = exc.task_id
                WHERE exc.id = %%s
            ''' % { 'prefix': self._queue.table_prefix }, self._execution_id)

        self.task_id = row.task_id
        self.data = json.loads(row.data)
        self.steps = json.loads(row.steps)
Example #2
0
    def _refresh(self):
        with self._db_conn() as conn:
            row = conn.get(
                '''
                SELECT
                    exc.task_id, tsk.data, exc.steps
                FROM
                    %(prefix)s_tasks AS tsk
                    INNER JOIN %(prefix)s_executions AS exc ON tsk.id = exc.task_id
                WHERE exc.id = %%s
            ''' % {'prefix': self._queue.table_prefix}, self._execution_id)

        self.task_id = row.task_id
        self.data = json.loads(row.data)
        self.steps = json.loads(row.steps)
Example #3
0
    def _refresh(self):
        with self._db_conn() as conn:
            row = conn.get('''
                SELECT * FROM %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)

        if not row:
            raise TaskDoesNotExist()

        self.task_id = row.id
        self.data = json.loads(row.data)
        self.steps = self._load_steps(json.loads(row.steps))
        self.started = row.started
        self.finished = row.finished
    def _refresh(self):
        with self._db_conn() as conn:
            row = conn.get('''
                SELECT * FROM %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)

        if not row:
            raise TaskDoesNotExist()

        self.task_id = row.id
        self.data = json.loads(row.data)
        self.steps = self._load_steps(json.loads(row.steps))
        self.started = row.started
        self.finished = row.finished