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


Python TacticServerStub.set方法代码示例

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


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

示例1: execute

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set [as 别名]
    def execute(my):
        #protocol = 'xmlrpc'
        protocol = 'local'
        if protocol == 'local':
            server = TacticServerStub.get()
        else:
            server = TacticServerStub(protocol=protocol,setup=False)
            TacticServerStub.set(server)

            project = my.data.get("project")
            ticket = my.data.get("ticket")
            assert project
            assert ticket
            server.set_server("localhost")
            server.set_project(project)
            server.set_ticket(ticket)

        my.class_name = my.data.get('class_name')
        assert my.class_name
        my.kwargs = my.data.get('kwargs')
        if not my.kwargs:
            my.kwags = {}


        #trigger = eval("%s(**my.kwargs)" % my.class_name)
        trigger = Common.create_from_class_path(my.class_name, kwargs=my.kwargs)

        input_data = my.get_input_data()
        trigger.set_input(input_data)
        trigger.execute()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:32,代码来源:subprocess_trigger.py

示例2: execute

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set [as 别名]
    def execute(self):
        #protocol = 'xmlrpc'


        protocol = 'local'
        if protocol == 'local':
            server = TacticServerStub.get()
        else:
            server = TacticServerStub(protocol=protocol,setup=False)
            TacticServerStub.set(server)

            project = self.data.get("project")
            ticket = self.data.get("ticket")
            assert project
            assert ticket
            server.set_server("localhost")
            server.set_project(project)
            server.set_ticket(ticket)

        self.class_name = self.data.get('class_name')
        assert self.class_name
        self.kwargs = self.data.get('kwargs')
        if not self.kwargs:
            self.kwags = {}


        #trigger = eval("%s(**self.kwargs)" % self.class_name)
        trigger = Common.create_from_class_path(self.class_name, kwargs=self.kwargs)

        input_data = self.get_input_data()
        trigger.set_input(input_data)

        try:
            trigger.execute()

            info = trigger.get_info()
            result = info.get("result")
            if result is not None:

                # map booleans to a message
                if result in ['true', True]:
                    result = 'complete'

                elif result in ['false', False]:
                    result = 'revise'

                self.set_pipeline_status(result)
                self.info['result'] = result
            else:
                self.set_pipeline_status("complete")
                self.info['result'] = "complete"


        except Exception as e:
            #self.set_pipeline_status("error", {"error": str(e)})
            self.set_pipeline_status("revise", {"error": str(e)})

            import sys,traceback

            print("Error: ", e)
            # print the stacktrace
            tb = sys.exc_info()[2]
            stacktrace = traceback.format_tb(tb)
            stacktrace_str = "".join(stacktrace)
            print("-"*50)
            print(stacktrace_str)
            print(str(e))
            print("-"*50)

            self.info['result'] = "error"
            self.info['message'] = str(e)
开发者ID:mincau,项目名称:TACTIC,代码行数:73,代码来源:subprocess_trigger.py


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