Commits

Ronny Pfannschmidt  committed c8d2b47

move model to juggler

  • Participants
  • Parent commits 2e66e37

Comments (0)

Files changed (7)

     nodeid = request._pyfuncitem.nodeid
 
     from glas_process.procdir import ProcDir
-    from glas_process.model import Task
+    from juggler.model import Task
     task = Task(_id=nodeid, testcase=nodeid)
     db.save_doc(task)
     procdir = ProcDir(db, tmpdir/'proc', task)

File glas_process/baseproc.py

 import gevent
 from gevent.queue import Queue
-from .model import Step, Event
+from juggler.model import Step, Event
 
 
 def makestep(procdir, _id, steper, **kw):

File glas_process/ddoc.py

 views = {
     'streams': {
         'map': """(doc) ->
-                if doc.doc_type == "Task"
+                if doc.doc_type == "juggler:Task"
                     emit [doc._id] null;
                 if doc.stream
                     emit [doc.task, doc.step], doc.stream

File 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()
-
-
-

File testing/test_dispatch.py

 from glas_process.procdir import ProcDir
-from glas_process.model import Task
+from juggler.model import Task
 
 def test_getid(tmpdir):
 

File testing/test_events.py

     step = prepare_subprocess(procdir, ['ls'], _id='the_ls')
     procdir.run(step)
     checks = [
-        ('doc_type', "glas_process:step",
+        ('doc_type', "juggler:step",
          'status', 'prepared'),
-        ('doc_type', "glas_process:step",
+        ('doc_type', "juggler:step",
          'status', "running"),
         ('line', 'somefile\n'),
         ('returncode', 0),
-        ('doc_type', "glas_process:step",
+        ('doc_type', "juggler:step",
          'status', "complete"),
     ]
     check_events(procdir, checks)
     step = prepare_subprocess(procdir, ['false'])
     procdir.run(step)
     checks = [
-        ('doc_type', "glas_process:step",
+        ('doc_type', "juggler:step",
          'status', 'prepared'),
-        ('doc_type', "glas_process:step",
+        ('doc_type', "juggler:step",
          'status', "running"),
         ('returncode', 1),
-        ('doc_type', "glas_process:step",
+        ('doc_type', "juggler:step",
          'status', "failed"),
     ]
     check_events(procdir, checks)
     doc = prepare_python(procdir, 'print 1\n')
     procdir.run(doc)
     checks = [
-        ('doc_type', "glas_process:step",
+        ('doc_type', "juggler:step",
          'status', 'prepared'),
-        ('doc_type', "glas_process:step",
+        ('doc_type', "juggler:step",
          'status', "running"),
         ('line', '1\n'),
         ('returncode', 0),
-        ('doc_type', "glas_process:step",
+        ('doc_type', "juggler:step",
          'status', "complete"),
     ]
     check_events(procdir, checks)
 [pytest]
 codechecks = pyflakes pep8
 couchdbkit_suffix = glas_process
+couchdbkit_backend = gevent
 
 [tox]
 indexserver =