Beispiel #1
0
 def cycle(cls):
     from .service import auto_complete, auto_submit_chain, auto_submit_root, auto_start
     auto_complete()
     auto_submit_chain()
     auto_submit_root()
     auto_start()
     print('Cycle at {t}.'.format(t=now(True)))
Beispiel #2
0
 def __init__(self,
              desc,
              data,
              state=None,
              workdir=None,
              worker=None,
              ttype=None,
              dependency=None,
              time_create=None,
              time_start=None,
              time_end=None,
              is_root=True):
     self.desc = desc
     self.data = data
     if time_create is None:
         time_create = now()
     self.time_create = time_create
     if state is None:
         from .config import config as c
         state = c['default_state']
     self.state = state
     self.worker = worker
     self.workdir = workdir
     self.ttype = ttype
     self.dependency = dependency
     self.is_root = is_root
Beispiel #3
0
 def __init__(self, start=None):
     if start is None:
         start = now()
     super(Start, self).__init__({'start': start})
Beispiel #4
0
 def update_run(self):
     self.run = now() - self.start
Beispiel #5
0
 def create_now(cls):
     return cls(create=now(), start=None, end=None)
Beispiel #6
0
def complete(task):
    task = Task.from_json(task.to_json())
    task.end = now()
    task.state = State.Complete
    return task
Beispiel #7
0
def start(task):
    task = Task.from_json(task.to_json())
    task.start = now()
    task.state = State.Runing
    return task
Beispiel #8
0
def mark_complete(task) -> None:
    if task.time_stamp.end is None:
        task.time_stamp = TaskStamp(create=task.time_stamp.create,
                                    start=task.time_stamp.start,
                                    end=now())
    return update(ts.complete(task))
Beispiel #9
0
def mark_start(task) -> None:
    if task.time_stamp.start is None:
        task.time_stamp = TaskStamp(create=task.time_stamp.create,
                                    start=now(),
                                    end=task.time_stamp.end)
    return update(ts.start(task))