本文整理汇总了Python中tactic_client_lib.TacticServerStub.set_project方法的典型用法代码示例。如果您正苦于以下问题:Python TacticServerStub.set_project方法的具体用法?Python TacticServerStub.set_project怎么用?Python TacticServerStub.set_project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tactic_client_lib.TacticServerStub
的用法示例。
在下文中一共展示了TacticServerStub.set_project方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set_project [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: _test_get_submission
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set_project [as 别名]
def _test_get_submission(self):
server = TacticServerStub()
server.set_project("sample3d")
# choose some arbitrary bin
bin_id = 4
filters = []
filters.append( ['bin_id', bin_id] )
connectors = server.query("prod/submission_in_bin", filters)
# get all of the submissions from the bin
submission_ids = [x.get('submission_id') for x in connectors]
filters = [ ['id', submission_ids] ]
submissions = server.query("prod/submission", filters)
# get all of the snapshots from the submissions
for submission in submissions:
search_key = submission.get('__search_key__')
print "-"*20
snapshot = server.get_snapshot(search_key, include_paths=True)
paths = snapshot.get('__paths__')
for path in paths:
print path
示例3: get_server
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set_project [as 别名]
def get_server(my):
# do a query for the search
from tactic_client_lib import TacticServerStub
if my.protocol == 'xmlrpc':
stub = TacticServerStub(setup=False, protocol=my.protocol)
stub.set_server(my.host)
stub.set_project(my.project_code)
stub.set_ticket(my.ticket)
else:
stub = TacticServerStub.get()
return stub
示例4: BaseClientCbk
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set_project [as 别名]
class BaseClientCbk(object):
def set_ticket(self, ticket):
self.ticket = ticket
def set_options(self, options):
self.options = options
def get_option(self, name):
return self.options.get(name)
def _execute(self):
# get the server name
server_name = self.get_option("server_name")
if not server_name:
raise ClientCallbackException("No [server_name] option delivered to callback")
server_name = server_name[0]
# get the project
project_code = self.get_option("project_code")
if not project_code:
raise ClientCallbackException("No [project_code] option delivered to callback")
project_code = project_code[0]
# the entire pipeline is run in a TacticServer Transaction
from tactic_client_lib import TacticServerStub
self.server = TacticServerStub()
self.server.set_server(server_name)
self.server.set_ticket(self.ticket)
self.server.set_project(project_code)
self.server.start("Pipeline checkin")
try:
self.execute()
except Exception, e:
self.server.abort()
raise
else:
示例5: _test_create_submission
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set_project [as 别名]
def _test_create_submission(self):
server = TacticServerStub()
server.set_project("sample3d")
# choose some arbitrary bin
bin_id = 4
filters = []
# asset
parent_type = "prod/asset"
parent_code = "chr001"
parent_key = server.build_search_key(parent_type, parent_code)
parent = server.get_by_search_key(parent_key)
parent_id = parent.get('id')
# create a submission
data = {
'description': 'A test submission',
'artist': 'joe',
'context': 'model'
}
submission = server.insert("prod/submission", data, parent_key=parent_key)
submission_key = submission.get('__search_key__')
submission_id = submission.get('id')
file_path = './miso_ramen.jpg'
context = "publish"
snapshot = server.simple_checkin(submission_key, context, file_path, mode="upload")
# no connect to the bin with a connector
data = {
"bin_id": bin_id,
'submission_id': submission_id
}
server.insert("prod/submission_in_bin", data)
示例6: Sample3dTest
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set_project [as 别名]
class Sample3dTest(unittest.TestCase):
def setUp(self):
pass
def test_all(self):
print "Running Sample3d Test"
from pyasm.security import Batch
from pyasm.biz import Project
Batch()
Project.set_project("sample3d")
#self.server = TacticServerStub(protocol="local")
self.server = TacticServerStub(protocol="xmlrpc")
project_code = "sample3d"
self.server.set_project(project_code)
self.server.start("Sample3d Test")
try:
self._test_create_search_type()
self._test_create_submission()
self._test_get_submission()
self._test_shot_sequence_hierarchy()
self._test_query_snapshots()
#self._test_performance()
except Exception:
self.server.abort()
raise
self.server.abort()
#try:
# self.server.query("prod/asset")
#except Exception:
# self.server.abort()
# raise
#self.server.abort()
def _test_query_snapshots(self):
filters = []
filters.append( ['context', 'model'] )
filters.append( ['search_type', 'prod/asset?project=sample3d'] )
snapshots = self.server.query_snapshots(filters=filters, include_paths=True)
import time
start = time.time()
for snapshot in snapshots:
print snapshot.get('__search_key__')
print snapshot.get('__paths__')
print "parent: ", snapshot.get('__parent__')
print time.time() - start
def _test_create_search_type(self):
search_type = 'test'
search_type_obj = self.server.create_search_type(search_type)
print search_type_obj
def _test_performance(self):
for i in range(0,1):
assets = self.server.query("prod/asset")
for asset in assets:
asset_key = asset.get("__search_key__")
snapshots = self.server.get_all_children(asset_key,'sthpw/snapshot')
#snapshot = self.server.get_snapshot(asset_key,context='model', include_paths=True)
#print snapshot.get('__paths__')
def _test_get_submission(self):
server = TacticServerStub()
server.set_project("sample3d")
# choose some arbitrary bin
bin_id = 4
filters = []
filters.append( ['bin_id', bin_id] )
connectors = server.query("prod/submission_in_bin", filters)
# get all of the submissions from the bin
submission_ids = [x.get('submission_id') for x in connectors]
filters = [ ['id', submission_ids] ]
submissions = server.query("prod/submission", filters)
#.........这里部分代码省略.........
示例7: ExpressionApiTest
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set_project [as 别名]
class ExpressionApiTest(unittest.TestCase):
def setUp(self):
pass
def test_all(self):
self.server = TacticServerStub()
project_code = "unittest"
self.server.set_project(project_code)
self.server.start("Expression Test")
try:
self._setup()
self._test_expression()
except:
self.server.abort()
raise
else:
self.server.abort()
def _setup(self):
city_data = {
'code': 'los_angeles'
}
search_type = "unittest/person"
self.persons = []
for i in range(0,4):
data = {
'name_first': 'person%s' % i,
'name_last': 'Test',
'city_code': 'los_angeles',
'age': '25'
}
person = self.server.insert(search_type, data)
self.persons.append( person )
def _test_expression(self):
# get the people sobjects
expr = "@SOBJECT(unittest/person)"
result = self.server.eval(expr)
self.assertEquals(4, len(result))
self.assertEquals("los_angeles", result[0].get("city_code") )
# get a single person
expr = "@SOBJECT(unittest/person)"
result = self.server.eval(expr, single=True)
self.assertEquals("los_angeles", result.get('city_code'))
# get the first_name
expr = "@GET(unittest/person.name_first)"
names = self.server.eval(expr)
self.assertEquals(len(names), 4)
#self.assertEquals("person0", names[0])
#self.assertEquals("person1", names[1])
# count the number of people
expr = "@COUNT(unittest/person)"
count = self.server.eval(expr)
self.assertEquals(4, count)
# get the age of a person
expr = "@GET(unittest/person.age)"
age = self.server.eval(expr, self.persons[0], single=True)
self.assertEquals(25, age)
return
示例8: TacticSearch
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set_project [as 别名]
self.listNameSnapshots = []
# Inicializando a classe que vare todo o servidor buscando caminhos de
# imagens do SAM.
self.imagens, self.paths, self.paths01 = TacticSearch().getPathFiles("maya")
''' Toda parte de configuracao de servidor '''
projeto_name = 'xxxx'
ip_sever = 'xxx.xxx.x.xx'
if projeto_name:
server = TacticServerStub()
server.set_server(ip_sever)
server.set_project(projeto_name)
print 'OK server'
else:
print 'server down'
search_type = projeto_name + '/shot'
print 'USER LOGIN: %s' % (server.get_login())
print server.build_search_type(search_type)
''' Inicializando a busca por arquvos '''
# self.nameSnapshots()
def converter_jpg(self, path):
# Vai converter todas as imagens que forem necessarias.
converter(path)
示例9: execute
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import set_project [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)