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


Python biz.Pipeline类代码示例

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


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


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