Source

glas_process / glas_process / model.py

from datetime import datetime
from reprtools import FormatRepr
from couchdbkit import (
    Document,
    IntegerProperty,
    StringProperty,
    DictProperty,
    DateTimeProperty,
)


class Task(Document):
    #XXX: dummy
    __rerp__ = FormatRepr('<Task {belongs_to} {status}>')

class Step(Document):
    doc_type = 'glas_process:step'

    __repr__ = FormatRepr('<Step of {task} started {started:%Y-%m-%d}>')

    task = StringProperty()
    status = StringProperty()
    inputs = DictProperty()
    steper = StringProperty()
    started = DateTimeProperty(default=datetime.utcnow)
    finished = DateTimeProperty(default=None)

class Event(Document):
    doc_type = 'glas_process:event'
    __repr__ = FormatRepr(r'<Event {step} {index}>')

    step = StringProperty()
    index = IntegerProperty()