Exemplo n.º 1
0
def translateWorkflow(_workflow):
    global id_scope
    def update_workflow(old_obj, translate_dict):
        return DBWorkflow.update_version(old_obj.db_workflow, translate_dict)
    translate_dict = {'DBGroup': {'workflow': update_workflow}}

    workflow = DBWorkflow()
    id_scope = IdScope(remap={DBAbstraction.vtType: DBModule.vtType, DBGroup.vtType: DBModule.vtType})
    workflow = DBWorkflow.update_version(_workflow, translate_dict, workflow)
    workflow.db_version = '1.0.4'
    return workflow
Exemplo n.º 2
0
def translateWorkflow(_workflow):
    def update_workflow(old_obj, translate_dict):
        return DBWorkflow.update_version(old_obj.db_workflow, translate_dict)
    translate_dict = {'DBGroup': {'workflow': update_workflow}}
    workflow = DBWorkflow.update_version(_workflow, translate_dict)

    workflow.db_version = '1.0.4'
    return workflow
Exemplo n.º 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)
Exemplo n.º 4
0
 def update_workflow(old_obj, translate_dict):
     return DBWorkflow.update_version(old_obj.db_workflow, translate_dict)