本文整理汇总了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()
示例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)