• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python biz.Pipeline类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_task_status_select_wdg

def get_task_status_select_wdg(task_sobject):
    """
    Given a sthpw/task sobject, return a SelectWdg with all its potential status options. This is done by looking up
    what those options are through the parent Pipeline.

    :param task_sobject: sthpw/task sobject
    :return: SelectWdg
    """

    task_status_select = SelectWdg('task_status_select')
    task_status_select.set_id('task_status_select')
    task_status_select.add_style('width: 165px;')
    task_status_select.add_empty_option()

    task_pipe_code = task_sobject.get_value('pipeline_code')

    # if the current task has no pipeline, then search for
    # any task pipeline
    if not task_pipe_code:
        # just use the default
        task_pipe_code = 'task'

    pipeline = Pipeline.get_by_code(task_pipe_code)
    if not pipeline:
        pipeline = Pipeline.get_by_code('task')

    for status in pipeline.get_process_names():
        task_status_select.append_option(status, status)

    if task_sobject.get('status'):
        task_status_select.set_value(task_sobject.get('status'))

    return task_status_select
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:33,代码来源:input_widgets.py


示例2: execute

    def execute(my):

        key = "enable_workflow_engine"
        from prod_setting import ProdSetting
        setting = ProdSetting.get_value_by_key(key)
        if setting not in [True, 'true']:
            return


        # find the node in the pipeline
        task = my.get_caller()
        sobject = task.get_parent()
        if not sobject:
            return

        pipeline = None

        process_code = task.get_value("process_code", no_exception=True)
        if process_code:
            process_sobj = Search.get_by_code("config/process", process_code)
            if process_sobj:
                pipeline_code = process_sobj.get_value("pipeline_code")
                pipeline = Pipeline.get_by_code("sthpw/pipeline", pipeline_code) 

        if not pipeline:
            pipeline = Pipeline.get_by_sobject(sobject)






        if not pipeline:
            return

        process_name = task.get_value("process")
        status = task.get_value("status")

        process = pipeline.get_process(process_name)
        if not process:
            # we don't have enough info here
            return

        node_type = process.get_type()
        process_name = process.get_name()

        event = "process|%s" % status.lower()
        output = {
            'sobject': sobject,
            'pipeline': pipeline,
            'process': process_name,
        }
        Trigger.call(task, event, output=output)
开发者ID:nuxping,项目名称:TACTIC,代码行数:53,代码来源:workflow.py


示例3: handle_td

    def handle_td(my, td):
        sobject = my.get_current_sobject()
        # find the pipeline code of the task
        pipeline_code = sobject.get_value('pipeline_code', no_exception=True)
        parent_pipeline_code = ''
        if my.parent:
            parent_pipeline_code = my.parent.get_value('pipeline_code', no_exception=True)
        # if not find the pipeline of the parent and match the process
        if not pipeline_code:
            task_process = sobject.get_value("process")
            if task_process:

                parent = my.parent
                if parent:
                    parent_pipeline_code = parent.get_value('pipeline_code', no_exception=True)
                    pipeline = Pipeline.get_by_code(parent_pipeline_code)
                    if pipeline:
                        attributes = pipeline.get_process_attrs(task_process)
                        pipeline_code = attributes.get('task_pipeline')


        value = my.get_value()
        color = Task.get_default_color(value)
        
        # If task status  pipeline is chosen, 
        # use color attribute from status (process)
        if pipeline_code:
            td.set_attr("spt_pipeline_code", pipeline_code)

            pipeline = Pipeline.get_by_code(pipeline_code)
            
            if pipeline:
                #attributes = pipeline.get_process_attrs(value)
                #color = attributes.get("color")
                process = pipeline.get_process(value)
                if process:
                    color = process.get_color()
                    if not color: 
                        process_sobject = pipeline.get_process_sobject(value)
                        if process_sobject:
                            color = process_sobject.get_value("color") 

        if color:
           td.add_style("background-color: %s" % color)


        if parent_pipeline_code:
            td.set_attr("spt_parent_pipeline_code", parent_pipeline_code)
        super(TaskStatusElementWdg, my).handle_td(td)
开发者ID:asmboom,项目名称:TACTIC,代码行数:49,代码来源:misc_input_wdg.py


示例4: __init__

    def __init__(self, name='task_status', task_pipeline=None):
        '''by default, it should grab all sthpw/task pipelines'''
        if not task_pipeline:
            project_code = Project.get_project_code()
            task_pipeline = Pipeline.get_by_search_type('sthpw/task', project_code)
        if isinstance(task_pipeline, list):
            self.task_pipelines = task_pipeline
        else:
            self.task_pipelines = [Pipeline.get_by_code(task_pipeline)]

        self.process_names = []
        self.checkbox_control = None
        super(TaskStatusFilterWdg,self).__init__(name)
        self.label = "Task Status Filter: "
        self.set_persistence()
开发者ID:mincau,项目名称:TACTIC,代码行数:15,代码来源:task_manager_wdg.py


示例5: _add_options

    def _add_options(my):
        ''' add the options to the select '''
        search_type = my._get_search_type()
        if not search_type:
            return
        # get all processes if no search type is given
        proj_code = Project.extract_project_code(search_type)
        is_group_restricted = False

        if my.has_empty:
            my.add_first_option()
        else:
            from asset_filter_wdg import ProcessFilterWdg
            if ProcessFilterWdg.has_restriction():
                is_group_restricted = True

        process_names, process_values = Pipeline.get_process_select_data(\
            search_type, is_filter=my.is_filter, project_code=proj_code,\
            is_group_restricted=is_group_restricted, sobject = my._sobject)


        my.set_option("values", process_values)
        my.set_option("labels", process_names)
        if not my.is_filter:
            behavior = {
            'type': 'onchange',
            'cbjs_action': "if (bvr.src_el.value=='')\
                {alert('Please choose a valid process.');}" }
开发者ID:0-T-0,项目名称:TACTIC,代码行数:28,代码来源:prod_input_wdg.py


示例6: execute

    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,代码行数:34,代码来源:pipeline_task_trigger.py


示例7: notify_listeners

    def notify_listeners(my):
        '''The command must have operated on an sobject with a pipeline and
        the operation must have been done on a process in that pipeline'''

        # find the sobject that this command operated on
        sobjects = my.get_sobjects()
        if not sobjects:
            return

        sobject = sobjects[0]
        if not sobject.has_value("pipeline_code"):
            return


        # we have sufficient information
        current_pipeline_code = my.get_pipeline_code()
        if not current_pipeline_code:
            current_pipeline_code = sobject.get_value("pipeline_code")


        current_process = my.get_process()
        event = my.get_event_name()
        if not current_pipeline_code or not current_process:
            return
        # get the pipelne (for in pipeline process)
        pipeline = Pipeline.get_by_code(current_pipeline_code)
        my.handle_pipeline(pipeline, current_process, event)
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:27,代码来源:command.py


示例8: handle_td

 def handle_td(my, td):
     super(LoginTableElementWdg, my).handle_td(td)
     task = my.get_current_sobject()
     if task:
         search_type = task.get_value('search_type')
         search_id = task.get_value('search_id')
         
         if not search_type or not search_id:
             return
         
         search_key = SearchKey.build_search_key(search_type, search_id, column='id')
         
         from pyasm.common import SObjectSecurityException
         try:
             parent = Search.get_by_search_key(search_key)
             pipeline = Pipeline.get_by_sobject(parent)
            
             if pipeline:
                 attrs = pipeline.get_process_attrs(task.get_value('process'))
             
                 td.add_attr('spt_pipeline_code', attrs.get('%s_login_group'%my.get_name()))
         except SObjectSecurityException, e:
             pass
         except SearchException, e:
             if e.__str__().find('not registered') != -1:
                 pass
             elif e.__str__().find('does not exist for database') != -1:
                 pass    
             elif e.__str__().find('Cannot find project') != -1:
                 pass
             else:
                 raise
开发者ID:0-T-0,项目名称:TACTIC,代码行数:32,代码来源:process_group_select_wdg.py


示例9: get_context_data

    def get_context_data(my, search_type=None):
        '''get the list of contexts that can be checked in with this widget'''
        # usually there is no pipeline for prod/shot_instance
        #search_type = my.search_type
        labels, values = Pipeline.get_process_select_data(search_type, \
            project_code=Project.get_project_code())
        

        return labels, values
开发者ID:0-T-0,项目名称:TACTIC,代码行数:9,代码来源:sobject_load_wdg.py


示例10: get_color

    def get_color(my, sobject, index):

        div = DivWdg()
        colors = [
            div.get_color("background3"),
            div.get_color("background3", -10),
            div.get_color("background3", -20),
        ]

        default_color = colors[index%3]

        pipeline_code = sobject.get_value("pipeline_code")
        if not pipeline_code:
            pipeline_code = "task"


        """
        parent = sobject.get_parent()
        if not parent:
            #return default_color
            pipeline_code = "task"
        else:
            pipeline_code = parent.get_value("pipeline_code", no_exception=True)
            if not pipeline_code:
                #return default_color
                pipeline_code = "task"
        """


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

        """
        process_name = sobject.get_value("process")
        if not process_name:
            process_name = sobject.get_value("context")

        # get the process
        process = pipeline.get_process(process_name)
        if not process:
            return default_color
        """

        status = sobject.get_value("status")
        process = pipeline.get_process(status)
        if not process:
            return default_color

        color = process.get_color()
        if not color:
            return default_color
        else:
            color = Common.modify_color(color, 0)


        return color
开发者ID:blezek,项目名称:TACTIC,代码行数:57,代码来源:sobject_calendar_wdg.py


示例11: execute

    def execute(my):

        input = my.get_input()

        sobject = my.get_caller()

        if isinstance(sobject, Task):
            task = sobject
        else:
            process = input.get("process")
            raise Exception("Not supported yet")



        # get the task process
        process = task.get_value("process")
        status = task.get_value("status")


        pipeline_code = task.get_value("pipeline_code")
        if not pipeline_code:
            pipeline_code = 'task'

        task_pipeline = Pipeline.get_by_code(pipeline_code)
        if not task_pipeline:
            return
        # get the last process
        statuses = task_pipeline.get_process_names()
        if not statuses:
            return 


        completion_statuses = []
        for status in statuses:
            status_obj = task_pipeline.get_process(status)
            attrs = status_obj.get_attributes()
            completion = attrs.get("completion")
            if completion == "100":
                completion_statuses.append(status)

        if not completion_statuses:
            completion_statuses.append(statuses[-1])

        is_complete = False

        update_data = input.get('update_data')
        if update_data.get("status") in completion_statuses:
            is_complete = True


        if is_complete == True:
            #task.set_value("is_complete", True)
            if not task.get_value("actual_end_date"):
                task.set_now("actual_end_date")
                my.add_description('Internal Task Complete Trigger')
                task.commit(triggers=False)
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:56,代码来源:pipeline_task_trigger.py


示例12: get_process_names

    def get_process_names(my):
        '''get a unique list of process names'''
        search_type = my._get_search_type()
        proj_code = Project.extract_project_code(search_type)

        dict = Pipeline.get_process_name_dict(search_type, project_code=proj_code)
        process_list = []
        for x in dict.values():
            process_list.extend(x)
        names = Common.get_unique_list(process_list)
        return names
开发者ID:0-T-0,项目名称:TACTIC,代码行数:11,代码来源:prod_input_wdg.py


示例13: get_file_in_package_status_select

def get_file_in_package_status_select():
    task_status_select = SelectWdg('file_status_select')
    task_status_select.set_id('file_status_select')
    task_status_select.add_style('width: 165px;')
    task_status_select.add_empty_option()

    pipeline = Pipeline.get_by_code('twog_Delivery')

    for status in pipeline.get_process_names():
        task_status_select.append_option(status, status)

    return task_status_select
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:12,代码来源:change_status_wdg.py


示例14: get_display

    def get_display(my):

        widget = DivWdg()

        pipeline_code = my.get_option('pipeline')
        pipeline = Pipeline.get_by_code(pipeline_code)
        if not pipeline:
            widget.add("No pipeline defined")
            return widget
            

        processes = pipeline.get_process_names()

        widget.add_style("border: solid 1px blue")
        widget.add_style("position: absolute")
        widget.add_style("top: 300")
        widget.add_style("left: -500")

        for process in processes:

            #inputs = pipeline.get_input_processes(process)
            outputs = pipeline.get_output_processes(process)

            div = DivWdg()
            widget.add(div)
            div.add_class("spt_input_option")
            div.add_attr("spt_input_key", process)

            #if not outputs:
            #    # then we can't go anywhere, so just add a message
            #    text = ""
            #    div.add(text)
            #    continue

            values = []
            #values.extend( [str(x) for x in inputs] )
            values.append(process)
            values.extend( [str(x) for x in outputs] )


            select = SelectWdg(my.get_input_name())
            select.set_value(process)
            select.add_empty_option('-- Select --')
            select.set_option("values", values)
            div.add(select)

            from tactic.ui.panel import CellEditWdg
            CellEditWdg.add_edit_behavior(select)


        return widget
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:51,代码来源:misc_input_wdg.py


示例15: last_process_finished

    def last_process_finished(my, pipeline, task_process, is_subpipeline=False):
        ''' find if the last process is finished '''
        if not pipeline:
            return True
        last_processes = pipeline.get_backward_connects(task_process)
        # TODO: use get_input_processes
        #last_processes = pipeline.get_input_processes(task_process)

        # subpipeline scenario
        if task_process.find("/") != -1:
            pipeline_code, process = task_process.split("/", 1)
            pipeline = Pipeline.get_by_code(pipeline_code)
            return my.last_process_finished(pipeline, process, is_subpipeline=True)
        # the first process of the pipe should be green-lit
        if not last_processes:
            return True
        for process in last_processes:
    
            # if the process is from another pipeline
            # TODO: disabling for now
            
            
            full_process = process
            if is_subpipeline:
                full_process = '%s/%s' %(pipeline.get_code(), process)
            complete_list = my.process_completion_dict.get(full_process)
            

            # skip processes that have no tasks
            # count is a safe-guard in case pipeline.get_backward_connects()
            # does not return None or [] in the future by accident
            # so the limit for a pipeline is 60 processes for now.
            count = 0
            while not complete_list and last_processes and count < 60:
                count = count + 1
                last_processes =  pipeline.get_backward_connects(process)
                for process in last_processes:
                    full_process = process
                    if is_subpipeline:
                        full_process = '%s/%s' %(pipeline.get_code(), process)
                    complete_list = my.process_completion_dict.get(full_process)

            # previous processes have no tasks assigned, in other words, they are finished    
            if not complete_list:
                return True

            for item in complete_list:
                if item != 100:
                    return False
        return True
开发者ID:0-T-0,项目名称:TACTIC,代码行数:50,代码来源:task_wdg.py


示例16: get_color

    def get_color(my, sobject, index):

        div = DivWdg()
        colors = [
            div.get_color("background3"),
            div.get_color("background3", -10),
            div.get_color("background3", -20),
        ]

        default_color = colors[index%3]

        try:
            color = sobject.get("color")
            if color:
                return color
        except:
            pass

        bg_color, text_color = my.color_map.get('status')
        if bg_color:
            color_value = bg_color.get(sobject.get_value('status'))
            
            if color_value:
                return color_value

        pipeline_code = sobject.get_value("pipeline_code", no_exception=True)
        if not pipeline_code:
            pipeline_code = "task"


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

        status = sobject.get_value("status", no_exception=True)
        process = pipeline.get_process(status)
        if not process:
            return default_color

        color = process.get_color()
        if not color:
            return default_color
        else:
            color = Common.modify_color(color, 0)


        return color
开发者ID:0-T-0,项目名称:TACTIC,代码行数:47,代码来源:sobject_calendar_wdg.py


示例17: notify_listeners

    def notify_listeners(my, sobject, process, status):

        # find all of the nodes that are listening to this status
        event = "%s|%s|%s" % (sobject.get_search_key(), process, status)
        #Trigger.call(my, event, my.input)

        # or 

        search = Search("sthpw/process")
        search.add_filter("type", "listen")
        search.add_filter("key", event)
        process_sobjs = search.get_sobjects()

        # we have all of the processes that are listening

        for process_sobj in process_sobjs:

            # for each process, we need to find the related sobjects



            # so what exactly does this do ...
            # shouldn't this use triggers?
            pipeline_code = process_sobj.get_value("pipeline_code")
            pipeline = Pipeline.get_by_code(pipeline_code)

            # find all of the related sobjects
            process_obj = pipeline.get_process(process)
            related_search_type = process_obj.get_attribute("search_type")
            related_status = process_obj.get_attribute("status")
            related_process = process_obj.get_attribute("process")
            related_scope = process_obj.get_attribute("scope")

            # get the node's triggers
            if not related_search_type:
                search = Search("config/process")        
                search.add_filter("process", my.process)
                search.add_filter("pipeline_code", pipeline.get_code())
                process_sobj = search.get_sobject()

                workflow = process_sobj.get_json_value("workflow")
                related_search_type = workflow.get("search_type")
                related_proces = workflow.get("proces")
                related_status = workflow.get("status")
                related_scope = workflow.get("scope")
开发者ID:jayvdb,项目名称:TACTIC,代码行数:45,代码来源:workflow.py


示例18: execute

    def execute(my):
        from pyasm.biz import Task, Pipeline


        src_task = my.get_caller()
        process = src_task.get_value("process")
        status = src_task.get_value("status")

        pipeline_code = src_task.get_value("pipeline_code")
        if pipeline_code == "approval":
            tasks = src_task.get_output_tasks()

            if status == "Revise":
                pass

        else:
            tasks = src_task.get_output_tasks(type="approval")


        # for approval, the task must be completed
        completion = src_task.get_completion()
        if completion != 100:
            return


        if not tasks:
            # autocreate ??
            parent = src_task.get_parent()
            pipeline = Pipeline.get_by_sobject(parent)
            if not pipeline:
                return
            processes = pipeline.get_output_processes(process, type="approval")
            if not processes:
                return

            if processes:
                print "Missing task: ", processes


        # set those approvals to "Pending"
        for task in tasks:
            task.set_value("status", "Pending")
            task.commit()
开发者ID:southpawtech,项目名称:TACTIC-DEV,代码行数:43,代码来源:web_init.py


示例19: get_context_data

    def get_context_data(my, search_type='', process=''):
        '''get the labels and values of contexts that can be checked in with this widget'''

        # TODO: this also shows input contexts ... it should only show output
        # contexts
        if not search_type:
            search_type = my.search_type

    

        pipelines = Pipeline.get_by_search_type(search_type, Project.get_project_code() )

        
        if not pipelines:
            return [], []
        # account for sub-pipeline
        if '/' in process:
            process = process.split('/', 1)[1]
        contexts = []
        for pipeline in pipelines:
            pipeline_contexts = []
            pipeline_processes = pipeline.get_process_names()
            if process:
                if process not in pipeline_processes:
                    continue
                pipeline_contexts = pipeline.get_output_contexts(process)
            else:
                pipeline_contexts = pipeline.get_all_contexts()
            for context in pipeline_contexts:
                # for now, cut out the sub_context, until the pipeline
                # completely defines the sub contexts as well
                if context.find("/") != -1:
                    parts = context.split("/")
                    context = parts[0]

                if context not in contexts:
                    contexts.append(context)

        labels = contexts
        values = contexts


        return labels, values
开发者ID:0-T-0,项目名称:TACTIC,代码行数:43,代码来源:filter_wdg.py


示例20: get_display

    def get_display(my):

        current = my.get_current_sobject()
        search_type = get_search_type()

        parent_key = WebContainer.get_web().get_form_value("edit|asset")
        if parent_key != "":
            parent = Search.get_by_search_key(parent_key)

            # get all of the options for this search type
            status_attr_name = "status"
            status_attr = parent.get_attr(status_attr_name)
            pipeline = status_attr.get_pipeline()
        else:
            # FIXME: make this general by looking at the current asset
            pipeline = Pipeline.get_by_name("flash_shot")

        processes = pipeline.get_process_names()
        my.set_option("values", "|".join(processes) )

        return super(TaskProcessSelectWdg,my).get_display()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:21,代码来源:task_wdg.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python biz.Project类代码示例发布时间:2022-05-25
下一篇:
Python biz.File类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap