当前位置: 首页>>代码示例>>Python>>正文


Python Task.add_initial_tasks方法代码示例

本文整理汇总了Python中pyasm.biz.Task.add_initial_tasks方法的典型用法代码示例。如果您正苦于以下问题:Python Task.add_initial_tasks方法的具体用法?Python Task.add_initial_tasks怎么用?Python Task.add_initial_tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.biz.Task的用法示例。


在下文中一共展示了Task.add_initial_tasks方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: postprocess

# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import add_initial_tasks [as 别名]
    def postprocess(self):
        value = self.get_value()
        if not value:
            return

        from pyasm.biz import Task
        Task.add_initial_tasks(self.sobject)
开发者ID:mincau,项目名称:TACTIC,代码行数:9,代码来源:edit_wdg_action.py

示例2: execute

# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import add_initial_tasks [as 别名]
    def execute(my):

        input = my.get_input()
       
        search_key = input.get("search_key")
        update_data = input.get("update_data")

        if not search_key or search_key.startswith('sthpw/'):
            return

        mode = input.get("mode")
        if mode not in ['insert']:
            return


        sobject = my.get_caller()
        pipeline_code = sobject.get_value("pipeline_code", no_exception=True)

        if not pipeline_code:
            return

        from pyasm.biz import Pipeline, Task
        from pyasm.search import SearchType

        pipeline = Pipeline.get_by_code(pipeline_code)
        if not pipeline:
            return

        if pipeline.get_value("autocreate_tasks", no_exception=True) not in ['true', True]:
            return

        #import time
        #start = time.time()
        Task.add_initial_tasks(sobject, pipeline_code=pipeline_code, skip_duplicate=True, mode='standard')
开发者ID:0-T-0,项目名称:TACTIC,代码行数:36,代码来源:pipeline_task_trigger.py

示例3: postprocess

# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import add_initial_tasks [as 别名]
    def postprocess(my):
        web = WebContainer.get_web()
        add_initial_tasks = web.get_form_value("add_initial_tasks")

        if add_initial_tasks != "on":
            return

        Task.add_initial_tasks(my.sobject)
开发者ID:hellios78,项目名称:TACTIC,代码行数:10,代码来源:asset_task_creator_wdg.py

示例4: execute

# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import add_initial_tasks [as 别名]
    def execute(my):
        print "EXECUTING sample command"

        # create the render
        render = SearchType.create("prod/render")
        render.set_parent(my.prev_command.sobject)
        render.set_value("pipeline_code", "turntable")
        render.commit()
        Task.add_initial_tasks(render)

        prev_sobject = my.prev_command.sobject
        prev_process = "model"
        this_sobject = my.prev_command.sobject
        this_process = "turntable"

        # get the deliverable
        snapshot = Snapshot.get_latest_by_sobject(prev_sobject, prev_process)
        if not snapshot:
            return

        # once we have this snapshot, open the file and process
        lib_dir = snapshot.get_lib_dir()
        file_name = snapshot.get_name_by_type("maya")

        file_path = "%s/%s" % (lib_dir, file_name)

        f = open( file_path, 'r')
        lines = f.readlines()
        f.close()

        tmp_dir = Environment.get_tmp_dir()
        new_file_name = "whatever.new"
        new_file_path = "%s/%s" % (tmp_dir, new_file_name)

        f2 = open( new_file_path, 'wb')
        for i, line in enumerate(lines):
            line = "%s - %s" % ( i,line)
            f2.write(line)
        f2.close()

        file_paths = [new_file_path]
        file_types = ['maya']

        from pyasm.checkin import FileCheckin
        checkin = FileCheckin.get(this_sobject, file_paths, file_types, context=this_process)
        checkin.execute()

        my.set_event_name("task/approved")
        my.set_process("preprocess")
        my.set_pipeline_code("turntable")
        my.sobjects = [render]

        # ???
        my.sobject = render


        my.set_as_approved()
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:59,代码来源:command.py

示例5: execute

# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import add_initial_tasks [as 别名]
    def execute(self):
        self.search_key_list = self.kwargs.get('search_key_list')
        web = WebContainer.get_web()
        skip_duplicated = web.get_form_value('skip_duplicated') == 'on'
        pipeline_mode = web.get_form_value('pipeline_mode')

        sobjects = SearchKey.get_by_search_keys(self.search_key_list)
        count = 0
        offset = 0
        for sobject in sobjects:
            if isinstance(sobject, Task):
                raise TacticException('Creation of task for [Task] is not allowed')
            sk = SearchKey.get_by_sobject(sobject)
            if not sobject.has_value('pipeline_code'):
                #raise TacticException('Creation of task is not allowed for item with no pipeline_code attribute.')
                pipeline_code = '__default__'
                sobject.set_value("pipeline_code", pipeline_code)
            else:
                pipeline_code = sobject.get_value('pipeline_code')
            input_name = '%s|task_process'% pipeline_code
            
            contexts = []
            process_names = web.get_form_values(input_name)
            process_names = [name for name in process_names if name]
            if pipeline_mode == 'context':
                # when pipeline_mode is context, we only specify contexts
                # in add_initial_tasks
                contexts = process_names[:]
                process_names = []
            tasks = Task.add_initial_tasks(sobject, sobject.get_value('pipeline_code'),
                    processes=process_names, contexts=contexts, skip_duplicate=skip_duplicated, mode=pipeline_mode, start_offset=offset)

            count += len(tasks)
            offset += 5
        self.add_description("%s Tasks added in total." % count)
开发者ID:mincau,项目名称:TACTIC,代码行数:37,代码来源:task_wdg.py

示例6: handle_pending

# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import add_initial_tasks [as 别名]
    def handle_pending(my):
        my.log_message(my.sobject, my.process, "pending")

        search = Search("config/process")        
        search.add_filter("process", my.process)
        search.add_filter("pipeline_code", my.pipeline.get_code())
        process_sobj = search.get_sobject()

        workflow = process_sobj.get_json_value("workflow")
        if workflow:
            assigned = workflow.get("assigned")
        else:
            assigned = None


        # check to see if the tasks exist and if they don't then create one
        tasks = Task.get_by_sobject(my.sobject, process=my.process)
        if not tasks:
            tasks = Task.add_initial_tasks(my.sobject, processes=[my.process], assigned=assigned)
        else:
            my.set_all_tasks(my.sobject, my.process, "pending")


        Trigger.call(my, "process|action", my.input)
开发者ID:jayvdb,项目名称:TACTIC,代码行数:26,代码来源:workflow.py

示例7: execute

# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import add_initial_tasks [as 别名]
    def execute(my):
        # set all task to pending

        pipeline = my.input.get("pipeline")
        process = my.input.get("process")
        sobject = my.input.get("sobject")


        process_obj = pipeline.get_process(process)
        node_type = process_obj.get_type()

        #print "pending: ", process, node_type

        my.run_callback(pipeline, process, "pending")

        if node_type not in ["node", "manual"]:
            my.set_all_tasks(sobject, process, "pending")



        if node_type in ["action", "condition"]:
            Trigger.call(my, "process|action", output=my.input)

        elif node_type in ["approval"]:

            # check to see if the tasks exist and if they don't then create one
            tasks = Task.get_by_sobject(sobject, process=process)
            if not tasks:
                tasks = Task.add_initial_tasks(sobject, processes=[process])
            else:
                my.set_all_tasks(sobject, process, "pending")


        elif node_type in ["hierarchy"]:

            search = Search("config/process")
            search.add_filter("pipeline_code", pipeline.get_code())
            search.add_filter("process", process)
            process_sobj = search.get_sobject()

            process_code = process_sobj.get_code()

            search = Search("sthpw/pipeline")
            search.add_filter("parent_process", process_code)
            subpipeline = search.get_sobject()
            if not subpipeline:
                return


            child_processes = subpipeline.get_processes()
            #child_pipeline = process_obj.get_child_pipeline()
            #child_processes = child_pipeline.get_processes()

            if child_processes:
                first_process = child_processes[0]
                first_name = first_process.get_name()

                input = {
                        'pipeline': subpipeline,
                        'sobject': sobject,
                        'process': first_process.get_name(),
                }

                event = "process|pending"
                Trigger.call(my, event, input)
开发者ID:nuxping,项目名称:TACTIC,代码行数:67,代码来源:workflow.py


注:本文中的pyasm.biz.Task.add_initial_tasks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。