How to use the huey.contrib.sqlitedb.Task function in huey

To help you get started, we’ve selected a few huey examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coleifer / huey / huey / contrib / sqlitedb.py View on Github external
def enqueued_items(self, limit=None):
        query = self.tasks(Task.data).tuples()
        if limit is not None:
            query = query.limit(limit)
        return [item[0] for item in query]
github coleifer / huey / huey / contrib / sqlitedb.py View on Github external
def dequeue(self):
        try:
            task = (self
                    .tasks()
                    .order_by(Task.id)
                    .limit(1)
                    .get())
        except Task.DoesNotExist:
            return
        res = self.delete().where(Task.id == task.id).execute()
        if res == 1:
            return task.data
github coleifer / huey / huey / contrib / sqlitedb.py View on Github external
def dequeue(self):
        try:
            task = (self
                    .tasks()
                    .order_by(Task.id)
                    .limit(1)
                    .get())
        except Task.DoesNotExist:
            return
        res = self.delete().where(Task.id == task.id).execute()
        if res == 1:
            return task.data
github coleifer / huey / huey / contrib / sqlitedb.py View on Github external
def initialize_task_table(self):
        self.database.bind([Task, Schedule, KeyValue])

        with self.database:
            self.database.create_tables([Task, Schedule, KeyValue])
github coleifer / huey / huey / contrib / sqlitedb.py View on Github external
def tasks(self, *columns):
        return Task.select(*columns).where(Task.queue == self.name)
github coleifer / huey / huey / contrib / sqlitedb.py View on Github external
def delete(self):
        return Task.delete().where(Task.queue == self.name)
github coleifer / huey / huey / contrib / sqlitedb.py View on Github external
def enqueue(self, data):
        Task.create(queue=self.name, data=data)