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


Python TacticServerStub.build_search_key方法代码示例

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


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

示例1: execute

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import build_search_key [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

        # get the script to run
        script_code = my.data.get("script_code")
        if script_code:
            search_type = "config/custom_script"
            search_key = server.build_search_key(search_type, script_code)
            script_obj = server.get_by_search_key(search_key)
            script = script_obj.get('script')
            my.run_script(script)
        else:
            print "Nothing to run"
开发者ID:0-T-0,项目名称:TACTIC,代码行数:32,代码来源:subprocess_trigger.py

示例2: main

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import build_search_key [as 别名]
def main(args):
    usage = "USAGE: checkin.py <search_type> <code> [context] <path>\n"
    usage += "example: python checkin.py beat Sc01.Bt01 .\\test\\image.png"

    context = "publish"

    # TODO: lots of assumptions here
    if len(args) == 2:
        # assume code and file path are equivalent
        code = args[1]
        file_path = args[1]
    elif len(args) == 3:
        code = args[1]
        file_path = args[2]
    elif len(args) == 4:
        code = args[1]
        context = args[2]
        file_path = args[3]
    else:
        print usage
        return

    search_type = args[0]

    server = TacticServerStub()

    # do the actual work
    server.start("Checked in file [%s] to [%s] - [%s]" % (file_path, search_type, code) )
    try:
        # query all of the search_types to simplify argument
        if search_type.find("/") == -1:
            columns = ["search_type"]
            results = server.query("sthpw/search_object", columns=columns)
            for result in results:
                test = result.get("search_type")
                if test.endswith("/%s" % search_type):
                    search_type = test
                    break
            else:
                raise Exception("Search type [%s] not found" % search_type)

        search_key = server.build_search_key(search_type, code)

        # upload the file
        server.upload_file(file_path)

        # checkin the uploaded file
        result = server.simple_checkin(search_key, context, file_path)
    except Exception, e:
        server.abort()
        print "ERROR: ", e.__str__()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:53,代码来源:checkin_pipeline.py

示例3: _test_insert_trigger

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import build_search_key [as 别名]
    def _test_insert_trigger(self):



        # create a db trigger
        sobject = Search.eval("@SOBJECT(sthpw/trigger['event','insert|unittest/person'])", single=True)
        if sobject:
            raise Exception('Please delete the insert|unittest/person trigger in sthpw first')
        trigger_sobj = SearchType.create("sthpw/trigger")
        trigger_sobj.set_value("event", "insert|unittest/person")
        trigger_sobj.set_value("class_name", "pyasm.command.command_test.TestInsertHandler")
        trigger_sobj.set_value("description", "Unittest Test Api Handler")
        trigger_sobj.commit()


        search = Search("sthpw/trigger")
        count = search.get_count()

        # use the client api to insert that trigger
        server = TacticServerStub(protocol='xmlrpc')

        server.start("insert trigger test")
        try:
            # create a new person
            search_type = "unittest/person"
            code = "fred"
            search_key = server.build_search_key(search_type, code)

            Container.put("TestApiHandler/search_key", search_key)
            # insert
            data = { 'code': code }

            # insert test: if the trigger fails then an exception should be
            # raised ...?
            server.insert(search_type, data)
        finally:
            server.abort()

        trigger_sobj.delete()

        search = Search('sthpw/trigger')
        search.add_filter('event', 'insert|unittest/person')
        trig = search.get_sobject()
        self.assertEquals(trig, None)
开发者ID:mincau,项目名称:TACTIC,代码行数:46,代码来源:command_test.py

示例4: main

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import build_search_key [as 别名]
def main(args, login=None):
    # USAGE: checkin_plates.py   
    code = args[0]
    file_range = args[1]
    pattern = args[2]
    # hard-coded for now
    context = 'publish'
    server = TacticServerStub(login)

    # do the actual work
    server.start("Checked in file group [%s]" % pattern)
    try:
        

        # checkin the uploaded file  
        filters = []
        filters.append(('code', code))
        results = server.query(SEARCH_TYPE, filters)
        # take the first one
        if results:
            id = results[0].get('id')
        else:
            print "Plate with code [%s] not found. Please insert an entry in the Plates tab first." %code
            return
        search_key = server.build_search_key(SEARCH_TYPE, id, column='id')


        # move the file
        dir = server.get_handoff_dir()
        print "Copied files to handoff dir\n"
        new_pattern = pattern
        file_type = 'main'
        
        # run group checkin
        server.group_checkin(search_key, context, file_path=new_pattern, file_type=file_type, \
                file_range=file_range, mode='copy', info={'type':'2d_plates'})
        
    except:
        server.abort()
        raise
    else:
        server.finish()
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:44,代码来源:checkin_plates.py

示例5: main

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import build_search_key [as 别名]
def main(args):

    search_type = args[0]
    code = args[1]
    if len(args) == 2:
        context = "publish"
        to_dir = "."
    elif len(args) == 3:
        context = "publish"
        to_dir = args[2]
    else:
        context = args[2]
        to_dir = args[3]

    server = TacticServerStub()

    # do the actual work
    server.start("Checked out file/s to [%s]" % to_dir)
    try:
        # query all of the search_types to simplify argument
        if search_type.find("/") == -1:
            columns = ["search_type"]
            results = server.query("sthpw/search_object", columns=columns)
            for result in results:
                test = result.get("search_type")
                if test.endswith("/%s" % search_type):
                    search_type = test
                    break
            else:
                raise Exception("Search type [%s] not found" % search_type)

        search_key = server.build_search_key(search_type, code)

        # checkin the uploaded file
        version = -1
        result = server.checkout(search_key, context, version=version, to_dir=to_dir)
        print result
    except:
        server.abort()
        raise
    else:
        server.finish()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:44,代码来源:checkout.py

示例6: main

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import build_search_key [as 别名]
def main(args, login=None):
    # USAGE: checkin_shot.py <shot_code> <context> <path>
    shot_code = args[0]
    context = args[1]
    file_path = args[2]

    server = TacticServerStub(login)
    search_key = server.build_search_key(SEARCH_TYPE, shot_code)

    # do the actual work
    server.start("Checked in file [%s]" % file_path)
    try:
        # upload the file
        # server.upload_file(file_path)

        # checkin the uploaded file
        result = server.simple_checkin(search_key, context, file_path, mode="upload")
    except:
        server.abort()
        raise
    else:
        server.finish()
开发者ID:hellios78,项目名称:TACTIC,代码行数:24,代码来源:checkin_shot.py

示例7: _test_create_submission

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import build_search_key [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)
开发者ID:Southpaw-TACTIC,项目名称:TACTIC,代码行数:39,代码来源:sample3d_test.py


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