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


Python Trigger.call方法代码示例

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


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

示例1: execute

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def execute(my):
        process = my.input.get("process")
        sobject = my.input.get("sobject")
        pipeline = my.input.get("pipeline")

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

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

        if node_type in ["condition", "action", "approval"]:

            my.set_all_tasks(sobject, process, "")

            input_processes = pipeline.get_input_processes(process)
            for input_process in input_processes:
                input_process = input_process.get_name()

                input = {
                    'pipeline': pipeline,
                    'sobject': sobject,
                    'process': input_process
                }

                event = "process|revise"
                Trigger.call(my, event, input)


        else:
            my.set_all_tasks(sobject, process, my.get_status())
开发者ID:jayvdb,项目名称:TACTIC,代码行数:32,代码来源:workflow.py

示例2: execute

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

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

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

        print "Revise: ", process, node_type

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

        if node_type in ['manual', 'node']:
            my.set_all_tasks(sobject, process, "revise")
        if node_type in ['action']:
            my.set_all_tasks(sobject, process, "revise")

        if node_type in ['approval','action','condition']:

            input_processes = pipeline.get_input_processes(process)
            for input_process in input_processes:
                input_process = input_process.get_name()

                input = {
                    'pipeline': pipeline,
                    'sobject': sobject,
                    'process': input_process
                }

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

示例3: handle_revise

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def handle_revise(my):

        my.log_message(my.sobject, my.process, "revise")
        my.run_callback(my.pipeline, my.process, "revise")
        # set all tasks in the process to revise
        my.set_all_tasks(my.sobject, my.process, "revise")

        process_obj = pipeline.get_process(my.process)

        # send revise single to previous processes
        input_processes = pipeline.get_input_processes(my.process)
        for input_process in input_processes:
            input_process = input_process.get_name()

            if my.process_parts:
                input_process = "%s.%s" % (my.process_parts[0], input_process)


            input = {
                'pipeline': my.pipeline,
                'sobject': my.sobject,
                'process': input_process
            }

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

示例4: _test_js

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def _test_js(my):
        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        sobject.set_value("code", "test")

        # simple condition
        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
        </pipeline>
        '''
        pipeline, processes = my.get_pipeline(pipeline_xml)

        process = processes.get("a")
        process.set_json_value("workflow", {
            'cbjs_action': '''
            console.log("This is javascript");
            console.log(input);
            return false
            '''
        } )
        process.commit()


        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process,
            "status": "pending"
        }

        import time
        start = time.time()
        Trigger.call(my, "process|pending", output)
开发者ID:jayvdb,项目名称:TACTIC,代码行数:37,代码来源:workflow_test.py

示例5: handle_complete

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def handle_complete(my):
 
        # run a nodes complete trigger
        status = "complete"
        my.log_message(my.sobject, my.process, status)
        my.run_callback(my.pipeline, my.process, status)

        process_obj = my.pipeline.get_process(my.process)

        # call the process|pending event for all output processes
        output_processes = my.pipeline.get_output_processes(my.process)
        for output_process in output_processes:
            output_process = output_process.get_name()

            if my.process_parts:
                output_process = "%s.%s" % (my.process_parts[0], output_process)

            output = {
                'pipeline': my.pipeline,
                'sobject': my.sobject,
                'process': output_process
            }

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

示例6: _test_manual

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def _test_manual(my):

        print "test manual"

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        sobject.set_value("code", "test")
        sobject.set_value("a", False)
        sobject.set_value("b", False)


        pipeline_xml = '''
        <pipeline>
          <process name="a"/>
          <process type="action" name="b"/>
          <connect from="a" to="b"/>
        </pipeline>
        '''

        pipeline, processes = my.get_pipeline(pipeline_xml)

        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(my, "process|pending", output)

        # nothing should have run
        my.assertEquals( "pending", sobject.get_value("a"))
        my.assertEquals( False, sobject.get_value("b"))
开发者ID:jayvdb,项目名称:TACTIC,代码行数:35,代码来源:workflow_test.py

示例7: _test_multi_input

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def _test_multi_input(my):

        # Disabled for now
        return

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        code = "test%s" % Common.generate_alphanum_key()
        sobject.set_value("code", code)


        #search = Search("sthpw/message")
        #sobjects = search.get_sobjects()
        #for sobject in sobjects:
        #    sobject.delete()



        # simple condition
        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
          <process type="action" name="b1"/>
          <process type="action" name="b2"/>
          <process type="action" name="b3"/>
          <process type="action" name="b4"/>
          <process type="action" name="c"/>
          <process type="action" name="d"/>
          <connect from="a" to="b1"/>
          <connect from="a" to="b2"/>
          <connect from="a" to="b3"/>
          <connect from="a" to="b4"/>
          <connect from="b1" to="c"/>
          <connect from="b2" to="c"/>
          <connect from="b3" to="c"/>
          <connect from="b4" to="c"/>
          <connect from="c" to="d"/>
        </pipeline>
        '''
        pipeline, processes = my.get_pipeline(pipeline_xml)


        process = processes.get("c")
        process.set_json_value("workflow", {
            'on_action': '''
            print "c: running action"
            '''
        } )
        process.commit()


        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(my, "process|pending", output)
开发者ID:jayvdb,项目名称:TACTIC,代码行数:61,代码来源:workflow_test.py

示例8: _test_choice

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def _test_choice(my):

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        sobject.set_value("code", "test")
        sobject.set_value("a", False)
        sobject.set_value("b", False)
        sobject.set_value("c", False)
        sobject.set_value("d", False)
        sobject.set_value("e", False)


        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
          <process type="condition" name="b"/>
          <process type="action" name="c"/>
          <process type="action" name="d"/>
          <process type="action" name="e"/>
          <connect from="a" to="b"/>
          <connect from="b" to="c" from_attr="stream1"/>
          <connect from="b" to="d" from_attr="stream2"/>
          <connect from="b" to="e" from_attr="stream3"/>
        </pipeline>

        '''

        pipeline, processes = my.get_pipeline(pipeline_xml)

        process = processes.get("b")
        process.set_json_value("workflow", {
            'on_action': '''
            # ... some code to determine True or False
            return ['stream1', 'stream3']
            ''',
            'on_complete': '''
            sobject.set_value('b', "complete")
            '''
        } )
        process.commit()


        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(my, "process|pending", output)

        my.assertEquals( "complete", sobject.get_value("a"))
        my.assertEquals( "complete", sobject.get_value("b"))
        my.assertEquals( "complete", sobject.get_value("c"))
        my.assertEquals( False, sobject.get_value("d"))
        my.assertEquals( "complete", sobject.get_value("e"))
开发者ID:jayvdb,项目名称:TACTIC,代码行数:58,代码来源:workflow_test.py

示例9: handle_pending

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def handle_pending(my):

        # DISABLE for now
        #if not my.check_inputs():
        #    return

        # simply calls action
        my.log_message(my.sobject, my.process, "pending")
        my.set_all_tasks(my.sobject, my.process, "pending")
        my.run_callback(my.pipeline, my.process, "pending")

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

示例10: _test_hierarchy

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def _test_hierarchy(my):

        # create a dummy sobject
        sobject = SearchType.create("unittest/person")

        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
          <process type="hierarchy" name="b"/>
          <process type="action" name="c"/>
          <connect from="a" to="b"/>
          <connect from="b" to="c"/>
        </pipeline>
        '''
        pipeline, processes = my.get_pipeline(pipeline_xml)
        parent_process = processes.get("b")
        print "parent: ", pipeline.get_code()

        sobject.set_value("pipeline_code", pipeline.get_code())
        sobject.commit()

        # create the sub pipeline
        subpipeline_xml = '''
        <pipeline>
          <process type="action" name="suba"/>
          <process type="action" name="subb"/>
          <process type="action" name="subc"/>
          <connect from="suba" to="subb"/>
          <connect from="subb" to="subc"/>
        </pipeline>
        '''
        subpipeline, subprocesses = my.get_pipeline(subpipeline_xml)
        subpipeline.set_value("parent_process", parent_process.get_code())
        subpipeline.commit()
        print "sub: ", subpipeline.get_code()



        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(my, "process|pending", output)

        my.assertEquals( "complete", sobject.get_value("a"))
        my.assertEquals( "complete", sobject.get_value("b"))
        my.assertEquals( "complete", sobject.get_value("c"))
        my.assertEquals( "complete", sobject.get_value("suba"))
        my.assertEquals( "complete", sobject.get_value("subb"))
        my.assertEquals( "complete", sobject.get_value("subc"))
开发者ID:nuxping,项目名称:TACTIC,代码行数:55,代码来源:workflow_test.py

示例11: _test_multi_input

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def _test_multi_input(self):

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        code = "test%s" % Common.generate_alphanum_key()
        sobject.set_value("code", code)



        # simple condition
        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
          <process type="action" name="b1"/>
          <process type="action" name="b2"/>
          <process type="action" name="b3"/>
          <process type="action" name="b4"/>
          <process type="action" name="c"/>
          <process type="action" name="d"/>
          <connect from="a" to="b1"/>
          <connect from="a" to="b2"/>
          <connect from="a" to="b3"/>
          <connect from="a" to="b4"/>
          <connect from="b1" to="c"/>
          <connect from="b2" to="c"/>
          <connect from="b3" to="c"/>
          <connect from="b4" to="c"/>
          <connect from="c" to="d"/>
        </pipeline>
        '''
        pipeline, processes = self.get_pipeline(pipeline_xml)


        process = processes.get("c")
        process.commit()

        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(self, "process|pending", output)
       
        self.assertEquals( "complete", sobject.get_value("a"))
        self.assertEquals( "complete", sobject.get_value("b1"))
        self.assertEquals( "complete", sobject.get_value("b2"))
        self.assertEquals( "complete", sobject.get_value("b3"))
        self.assertEquals( "complete", sobject.get_value("b4"))
        self.assertEquals( "complete", sobject.get_value("c"))
        self.assertEquals( "complete", sobject.get_value("d"))
开发者ID:mincau,项目名称:TACTIC,代码行数:54,代码来源:workflow_test.py

示例12: execute

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

        web = WebContainer.get_web()
        
        # get the input names
        input_names = web.get_form_value(SerialStatusWdg.STATUS_CMD_INPUT).split('|')
        
        values = []
        for input_name in input_names:
            value = web.get_form_value(input_name)
            if value:
                values.append(web.get_form_value(input_name))
            
       
        # FIXME: HARDCODED Value for status column!!!!
        column = "status"

        for value in values:
            # get the sobject to be updated
            search_type,id,status = value.split("|")
            search = Search(search_type)
            search.add_id_filter(id)
            my.sobject = search.get_sobject()
            
            status_attr = my.sobject.get_attr(column)

            cur_status = status_attr.get_current_process()
            if cur_status == status:
                continue

            status_attr.set_status(status)
           
            update_column = 'time_update'
            if update_column in my.sobject.get_attr_names():
                my.sobject.set_value(update_column, Sql.get_timestamp_now(), quoted=False)
            my.sobject.commit()

           
            # if this is successful, the store it in the status_log
            status_log = SObjectFactory.create("sthpw/status_log")
            status_log.set_value("login", Environment.get_user_name() )
            status_log.set_value("search_type", search_type)
            status_log.set_value("search_id", id)
            #status_log.set_value("status", "%s to %s" % (cur_status, status) )
            status_log.commit()
            status_log.set_value("from_status", cur_status)
            status_log.set_value("to_status", status)

            # Call the finaled trigger
            Trigger.call(my, status)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:52,代码来源:serial_status.py

示例13: _test_trigger

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def _test_trigger(my):

        # create a dummy sobject
        sobject = SearchType.create("unittest/person")

        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
        </pipeline>
        '''
        pipeline, processes = my.get_pipeline(pipeline_xml)

        process = processes.get("a")
        process.set_value("workflow", "")
        process.commit()


        folder = Common.generate_alphanum_key()

        Trigger.clear_db_cache()
        event = "process|action"
        trigger = SearchType.create("config/trigger")
        trigger.set_value("event", event)
        trigger.set_value("process", process.get_code())
        trigger.set_value("mode", "same process,same transaction")
        trigger.set_value("script_path", "%s/process_trigger" % folder)
        trigger.commit()

        script = SearchType.create("config/custom_script")
        script.set_value("folder", folder)
        script.set_value("title", "process_trigger")
        script.set_value("script", '''
        print "---"
        for key, value in input.items():
            print key, value
        print "---"
        print "process: ", input.get("process")
        ''')
        script.commit()
 
        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(my, "process|pending", output)
开发者ID:jayvdb,项目名称:TACTIC,代码行数:50,代码来源:workflow_test.py

示例14: _test_input

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def _test_input(my):

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        sobject.set_value("code", "test")

        # simple condition
        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
          <process type="condition" name="b"/>
          <process type="action" name="c"/>
          <process type="action" name="d"/>
          <connect from="a" to="b"/>
          <connect from="b" to="c" from_attr="success"/>
          <connect from="b" to="d" from_attr="success"/>
        </pipeline>
        '''
        pipeline, processes = my.get_pipeline(pipeline_xml)


        # check input values
        process = processes.get("b")
        process.set_json_value("workflow", {
            'on_action': '''
            inputs = input.get("inputs")
            sobject.set_value("b_input", inputs[0]);
            outputs = input.get("outputs")
            sobject.set_value("b_output", ",".join(outputs))
            sobject.set_value("test", "test")
            '''
        } )
        process.commit()


        # Run the pipeline
        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process
        }
        Trigger.call(my, "process|pending", output)
        # make sure we have the same sobject
        my.assertEquals( "test", sobject.get_value("test") )
        my.assertEquals( "a", sobject.get_value("b_input"))
        my.assertEquals( "c,d", sobject.get_value("b_output"))
开发者ID:jayvdb,项目名称:TACTIC,代码行数:49,代码来源:workflow_test.py

示例15: _test_action_process

# 需要导入模块: from pyasm.command import Trigger [as 别名]
# 或者: from pyasm.command.Trigger import call [as 别名]
    def _test_action_process(my):

        # create a dummy sobject
        sobject = SearchType.create("sthpw/virtual")
        sobject.set_value("code", "test")
        sobject.set_value("a", False)
        sobject.set_value("b", False)
        sobject.set_value("c", False)
        sobject.set_value("d", False)
        sobject.set_value("e", False)

        pipeline_xml = '''
        <pipeline>
          <process type="action" name="a"/>
          <process type="action" name="b"/>
          <process type="action" name="c"/>
          <process type="action" name="d"/>
          <process type="action" name="e"/>
          <connect from="a" to="b"/>
          <connect from="b" to="c"/>
          <connect from="b" to="d"/>
          <connect from="c" to="e"/>
          <connect from="d" to="e"/>
        </pipeline>
        '''
        pipeline, processes = my.get_pipeline(pipeline_xml)


        process = "a"
        output = {
            "pipeline": pipeline,
            "sobject": sobject,
            "process": process,
            "status": "pending"
        }

        import time
        start = time.time()
        Trigger.call(my, "process|pending", output)
        #print "time: ", time.time() - start
        my.assertEquals( "complete", sobject.get_value("a"))
        my.assertEquals( "complete", sobject.get_value("b"))
        my.assertEquals( "complete", sobject.get_value("c"))
        my.assertEquals( "complete", sobject.get_value("d"))

        # TODO: this got called twice ... not what we want : fix later
        my.assertEquals( "complete", sobject.get_value("e"))
开发者ID:jayvdb,项目名称:TACTIC,代码行数:49,代码来源:workflow_test.py


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