Beispiel #1
0
 def update_loop_execs(old_obj, translate_dict):
     if len(old_obj.db_loop_execs) == 0:
         return []
     # create new LoopExec and add existing as LoopIteration's
     ts_start = None
     ts_end = None
     new_iters = []
     for loop_exec in old_obj.db_loop_execs:
         item_execs = []
         for item_exec in loop_exec.db_item_execs:
             if item_exec.vtType == DBModuleExec.vtType:
                 item_execs.append(DBModuleExec.update_version(item_exec,
                                                               translate_dict))
             if item_exec.vtType == DBGroupExec.vtType:
                 item_execs.append(DBGroupExec.update_version(item_exec,
                                                              translate_dict))
             # skip DBLoopExecs
         new_iter = DBLoopIteration(item_execs=item_execs,
                                    id=id_scope.getNewId(DBLoopIteration.vtType),
                                    ts_start=loop_exec.db_ts_start,
                                    ts_end=loop_exec.db_ts_end,
                                    iteration=loop_exec.db_iteration,
                                    completed=loop_exec.db_completed,
                                    error=loop_exec.db_error)
         new_iters.append(new_iter)
         if ts_start is None or ts_start > loop_exec.db_ts_start:
             ts_start = loop_exec.db_ts_start
         if ts_end is None or ts_end < loop_exec.db_ts_end:
             ts_end = loop_exec.db_ts_end
     return [DBLoopExec(id=id_scope.getNewId(DBLoopExec.vtType),
                                    ts_start=ts_start,
                                    ts_end=ts_end,
                                    loop_iterations=new_iters)]
Beispiel #2
0
    def update_item_execs(old_obj, translate_dict):
        # remove loop_execs and add them as loop_iterations under a single loop_exec
        new_objs = []
        ts_start = None
        ts_end = None
        new_iters = []
        for obj in old_obj.db_item_execs:
            if obj.vtType == DBModuleExec.vtType:
                new_objs.append(
                    DBModuleExec.update_version(obj, translate_dict))
            if obj.vtType == DBGroupExec.vtType:
                new_objs.append(DBGroupExec.update_version(
                    obj, translate_dict))
            if obj.vtType == DBLoopExec.vtType:
                item_execs = []
                for item_exec in obj.db_item_execs:
                    if item_exec.vtType == DBModuleExec.vtType:
                        item_execs.append(
                            DBModuleExec.update_version(
                                item_exec, translate_dict))
                    if item_exec.vtType == DBGroupExec.vtType:
                        item_execs.append(
                            DBGroupExec.update_version(item_exec,
                                                       translate_dict))
                    # skip DBLoopExecs
                new_iter = DBLoopIteration(item_execs=item_execs,
                                           id=id_scope.getNewId(
                                               DBLoopIteration.vtType),
                                           ts_start=obj.db_ts_start,
                                           ts_end=obj.db_ts_end,
                                           iteration=obj.db_iteration,
                                           completed=obj.db_completed,
                                           error=obj.db_error)
                new_iters.append(new_iter)
                if ts_start is None or ts_start > obj.db_ts_start:
                    ts_start = obj.db_ts_start
                if ts_end is None or ts_end < obj.db_ts_end:
                    ts_end = obj.db_ts_end
        if len(new_iters):
            new_objs.append(
                DBLoopExec(id=id_scope.getNewId(DBLoopExec.vtType),
                           ts_start=ts_start,
                           ts_end=ts_end,
                           loop_iterations=new_iters))
        return new_objs

        return DBWorkflow.update_version(old_obj.db_workflow, translate_dict)
Beispiel #3
0
    def update_item_execs(old_obj, translate_dict):
        # remove loop_execs and add them as loop_iterations under a single loop_exec
        new_objs = []
        ts_start = None
        ts_end = None
        new_iters = []
        for obj in old_obj.db_item_execs:
            if obj.vtType == DBModuleExec.vtType:
                new_objs.append(DBModuleExec.update_version(obj,
                                                            translate_dict))
            if obj.vtType == DBGroupExec.vtType:
                new_objs.append(DBGroupExec.update_version(obj,
                                                           translate_dict))
            if obj.vtType == DBLoopExec.vtType:
                item_execs = []
                for item_exec in obj.db_item_execs:
                    if item_exec.vtType == DBModuleExec.vtType:
                        item_execs.append(DBModuleExec.update_version(item_exec,
                                                                      translate_dict))
                    if item_exec.vtType == DBGroupExec.vtType:
                        item_execs.append(DBGroupExec.update_version(item_exec,
                                                                     translate_dict))
                    # skip DBLoopExecs
                new_iter = DBLoopIteration(item_execs=item_execs,
                                           id=id_scope.getNewId(DBLoopIteration.vtType),
                                           ts_start=obj.db_ts_start,
                                           ts_end=obj.db_ts_end,
                                           iteration=obj.db_iteration,
                                           completed=obj.db_completed,
                                           error=obj.db_error)
                new_iters.append(new_iter)
                if ts_start is None or ts_start > obj.db_ts_start:
                    ts_start = obj.db_ts_start
                if ts_end is None or ts_end < obj.db_ts_end:
                    ts_end = obj.db_ts_end
        if len(new_iters):
            new_objs.append(DBLoopExec(id=id_scope.getNewId(DBLoopExec.vtType),
                                       ts_start=ts_start,
                                       ts_end=ts_end,
                                       loop_iterations=new_iters))
        return new_objs

        
        return DBWorkflow.update_version(old_obj.db_workflow, translate_dict)
Beispiel #4
0
 def update_loop_execs(old_obj, translate_dict):
     if len(old_obj.db_loop_execs) == 0:
         return []
     # create new LoopExec and add existing as LoopIteration's
     ts_start = None
     ts_end = None
     new_iters = []
     for loop_exec in old_obj.db_loop_execs:
         item_execs = []
         for item_exec in loop_exec.db_item_execs:
             if item_exec.vtType == DBModuleExec.vtType:
                 item_execs.append(
                     DBModuleExec.update_version(item_exec, translate_dict))
             if item_exec.vtType == DBGroupExec.vtType:
                 item_execs.append(
                     DBGroupExec.update_version(item_exec, translate_dict))
             # skip DBLoopExecs
         new_iter = DBLoopIteration(item_execs=item_execs,
                                    id=id_scope.getNewId(
                                        DBLoopIteration.vtType),
                                    ts_start=loop_exec.db_ts_start,
                                    ts_end=loop_exec.db_ts_end,
                                    iteration=loop_exec.db_iteration,
                                    completed=loop_exec.db_completed,
                                    error=loop_exec.db_error)
         new_iters.append(new_iter)
         if ts_start is None or ts_start > loop_exec.db_ts_start:
             ts_start = loop_exec.db_ts_start
         if ts_end is None or ts_end < loop_exec.db_ts_end:
             ts_end = loop_exec.db_ts_end
     return [
         DBLoopExec(id=id_scope.getNewId(DBLoopExec.vtType),
                    ts_start=ts_start,
                    ts_end=ts_end,
                    loop_iterations=new_iters)
     ]