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


Python Pipeline.get_by_code方法代码示例

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


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

示例1: get_task_status_select_wdg

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
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,代码行数:35,代码来源:input_widgets.py

示例2: handle_td

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:51,代码来源:misc_input_wdg.py

示例3: notify_listeners

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:29,代码来源:command.py

示例4: execute

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [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

示例5: get_color

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:59,代码来源:sobject_calendar_wdg.py

示例6: execute

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:58,代码来源:pipeline_task_trigger.py

示例7: execute

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:55,代码来源:workflow.py

示例8: get_file_in_package_status_select

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
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,代码行数:14,代码来源:change_status_wdg.py

示例9: get_display

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:53,代码来源:misc_input_wdg.py

示例10: last_process_finished

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:52,代码来源:task_wdg.py

示例11: __init__

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:17,代码来源:task_manager_wdg.py

示例12: get_color

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:49,代码来源:sobject_calendar_wdg.py

示例13: notify_listeners

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    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,代码行数:47,代码来源:workflow.py

示例14: check_rule

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    def check_rule(my):
        task = my.sobject
       
        assigned = task.get_value("assigned")
        task_process = task.get_value("process")
        task_description = task.get_value("description")

        # get the pipeline
        my.parent = task.get_parent()
        pipeline_code = my.parent.get_value("pipeline_code")
        my.pipeline = Pipeline.get_by_code(pipeline_code)
        if not my.pipeline:
            # No pipeline, so don't email
            print "Warning: No Pipeline"
            return False


        task_status = task.get_value("status")
        if task_status == "Review":
            return True
        else:
            return False
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:24,代码来源:email_handler.py

示例15: get_color

# 需要导入模块: from pyasm.biz import Pipeline [as 别名]
# 或者: from pyasm.biz.Pipeline import get_by_code [as 别名]
    def get_color(my, sobject, index):

        div = DivWdg()
        pipeline_code = sobject.get_value("pipeline_code")
        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")
        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:CeltonMcGrath,项目名称:TACTIC,代码行数:25,代码来源:sobject_calendar_wdg.py


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