/usr/share/pyshared/celery/db/models.py is in python-celery 2.4.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from datetime import datetime
import sqlalchemy as sa
from .. import states
from .session import ResultModelBase
# See docstring of a805d4bd for an explanation for this workaround ;)
if sa.__version__.startswith('0.5'):
from .dfd042c7 import PickleType
else:
from .a805d4bd import PickleType # noqa
class Task(ResultModelBase):
"""Task result/status."""
__tablename__ = "celery_taskmeta"
__table_args__ = {"sqlite_autoincrement": True}
id = sa.Column(sa.Integer, sa.Sequence("task_id_sequence"),
primary_key=True,
autoincrement=True)
task_id = sa.Column(sa.String(255), unique=True)
status = sa.Column(sa.String(50), default=states.PENDING)
result = sa.Column(PickleType, nullable=True)
date_done = sa.Column(sa.DateTime, default=datetime.now,
onupdate=datetime.now, nullable=True)
traceback = sa.Column(sa.Text, nullable=True)
def __init__(self, task_id):
self.task_id = task_id
def to_dict(self):
return {"task_id": self.task_id,
"status": self.status,
"result": self.result,
"traceback": self.traceback,
"date_done": self.date_done}
def __repr__(self):
return "<Task %s state: %s>" % (self.task_id, self.status)
class TaskSet(ResultModelBase):
"""TaskSet result"""
__tablename__ = "celery_tasksetmeta"
__table_args__ = {"sqlite_autoincrement": True}
id = sa.Column(sa.Integer, sa.Sequence("taskset_id_sequence"),
autoincrement=True, primary_key=True)
taskset_id = sa.Column(sa.String(255), unique=True)
result = sa.Column(sa.PickleType, nullable=True)
date_done = sa.Column(sa.DateTime, default=datetime.now,
nullable=True)
def __init__(self, taskset_id, result):
self.taskset_id = taskset_id
self.result = result
def to_dict(self):
return {"taskset_id": self.taskset_id,
"result": self.result,
"date_done": self.date_done}
def __repr__(self):
return u"<TaskSet: %s>" % (self.taskset_id, )
|