__init__(login=None, setup=True, protocol=None, server=None, project=None, ticket=None, user=None, password="")
Initialize the TacticServerStub
keyparam:
login - login_code
setup - if set to True, it runs the protocol set-up
protocol - xmlrpc or local. it defaults to xmlrpc
server - tactic server
project - targeted project
ticket - login ticket key
user - tactic login_code that overrides the login
password - password for login
site - site for portal set-up
abort(ignore_files=False)
Abort the transaction. This undos all commands that occurred from the beginning of the transactions
keyparam:
ignore_files: (boolean) - determines if any files moved into the
repository are left as is. This is useful for very long processes
where it is desireable to keep the files in the repository
even on abort.
example:
A full transaction inserting 10 shots. If an error occurs, all 10
inserts will be aborted.
server.start('Start adding shots') try: for i in range(0,10): server.insert("prod/shot", { 'code': 'XG%0.3d'%i } ) except: server.abort() else: server.finish("10 shots added")
add_config_element(search_type, view, name, class_name=None, display_options={}, action_class_name=None, action_options={}, element_attrs={},login=None, unique=True, auto_unique_name=False, auto_unique_view=False)
This method adds an element into a config. It is used by various UI components to add new widget element to a particular view.
param:
search_type - the search type that this config belongs to
view - the specific view of the search type
name - the name of the element
keyparam:
class_name - the fully qualified class of the display
action_class_name - the fully qualified class of the action
display_options - keyward options in a dictionary to construct the specific display
action_options - keyward options in a dictionary to construct the specific action
element_attrs - element attributes in a dictionary
login - login name if it is for a specific user
unique - add an unique element if True. update the element if False.
auto_unique_name - auto generate a unique element and display view name
auto_unique_view - auto generate a unique display view name
return:
boolean - True
example:
This will add a new element to the "character" view for a 3D asset
search_type = 'prod/asset' view = 'characters' class_name = 'tactic.ui.common.SimpleElementWdg' server.add_config_element(search_type, view, class_name)
This will add a new element named "user" to the "definition" view. It contains detailed display and action nodes
data_dict = {} # some data here search_type = 'prod/asset' server.add_config_element(search_type, 'definition', 'user', class_name = data_dict['class_name'], display_options=data_dict['display_options'], element_attrs=data_dict['element_attrs'], unique=True, action_class_name=data_dict['action_class_name'], action_options=data_dict['action_options'])
add_dependency(snapshot_code, file_path, type=ref)
Append a dependency referent to an existing check-in. All files are uniquely containe by a particular snapshot. Presently, this method does a reverse lookup by file name. This assumes that the filename is unique within the system, so it is not recommended unless it is known that naming conventions will produce unique file names for every this particular file. If this is not the case, it is recommended that add_dependency_by_code() is used.
param:
snapshot_code - the unique code identifier of a snapshot
file_path - the path of the dependent file. This function is able
reverse map the file_path to the appropriate snapshot
keyparam:
type - type of dependency. Values include ref and input_ref
ref = hierarchical reference: ie A contains B
input_ref = input reference: ie: A was used to create B
tag - a tagged keyword can be added to a dependency to categorize
the different dependencies that exist in a snapshot
return:
dictionary - the resulting snapshot
add_dependency_by_code(to_snapshot_code, from_snapshot_code, type=ref)
Append a dependency reference to an existing checkin. This dependency is used to connect various checkins together creating a separate dependency tree for each checkin.
param:
to_snapshot_code: the snapshot code which the dependency will be
connected to
from_snapshot_code: the snapshot code which the dependency will be
connected from
type - type of dependency. Values include ref and input_ref
ref = hierarchical reference: ie A contains B
input_ref - input reference: ie: A was used to create B
tag - a tagged keyword can be added to a dependency to categorize
the different dependencies that exist in a snapshot
return:
dictionary - the resulting snapshot
add_directory(snapshot_code, dir, file_type=main, mode="copy", dir_naming=', file_naming=')
Add a full directory to an already existing checkin. This informs TACTIC to treat the entire directory as single entity without regard to the structure of the contents. TACTIC will not know about the individual files and the directory hierarchy within the base directory and it it left up to the and external program to intepret and understand this.
This is often used when logic on the exact file structure exists in some external source outside of TACTIC and it is deemed to complictaed to map this into TACTIC’s snapshot definition.
param:
snapshot_code - a unique identifier key representing an sobject
dir - the directory that needs to be checked in
keyparam:
file_type - file type is used more as snapshot type here
mode - copy, move, preallocate, manual, inplace
dir_naming - explicitly set a dir_naming expression to use
file_naming - explicitly set a file_naming expression to use
return:
dictionary - snapshot
example:
This will create a new snapshot for a search_key and add a directory using manual mode
dir = 'C:/images' handoff_dir = my.server.get_handoff_dir() shutil.copytree('%s/subfolder' %dir, '%s/images/subfolder' %handoff_dir) snapshot_dict = my.server.create_snapshot(search_key, context='render') snapshot_code = snapshot_dict.get('code') my.server.add_directory(snapshot_code, dir, file_type='dir', mode='manual')
add_file(snapshot_code, file_path, file_type=main, use_handoff_dir=False, mode=None, create_icon=False)
Add a file to an already existing snapshot. This method is used in piecewise checkins. A blank snapshot can be created using create_snapshot(). This method can then be used to successively add files to the snapshot.
In order to check in the file, the server will need to have access to these files. There are a number of ways of getting the files to the server. When using copy or move mode, the files are either copied or moved to the "handoff_dir". This directory is an agreed upon directory in which to handoff the files to the server. This mode is generally used for checking in user files. For heavy bandwidth checkins, it is recommended to user preallocated checkins.
param:
snapshot_code - the unique code identifier of a snapshot
file_path - path of the file to add to the snapshot.
Optional: this can also be an array to add multiple files at once.
This has much faster performance that adding one file at a time.
Also, note that in this case, file_types must be an array
of equal size.
keyparam:
file_type - type of the file to be added.
Optional: this can also be an array. See file_path argument
for more information.
use_handoff_dir - DEPRECATED: (use mode arg) use handoff dir to checkin
file. The handoff dir is an agreed upon directory between the
client and server to transfer files.
mode - upload|copy|move|manual|inplace - determine the protocol which delievers
the file to the server.
create_icon - (True|False) determine whether to create an icon for
this appended file. Only 1 icon should be created for each
snapshot.
dir_naming - explicitly set a dir_naming expression to use
file_naming - explicitly set a file_naming expression to use
checkin_type - auto or strict which controls whether to auto create versionless and adopt some default dir/file naming
return:
dictionary - the resulting snapshot
example:
This will create a blank model snapshot for character chr001 and
add a file
search_type = 'prod/asset' code = 'chr001' search_key = server.build_search_type(search_type, code) context = 'model' path = "./my_model.ma" snapshot = server.create_snapshot(search_key, context) server.add_file( snapshot.get('code'), path )
Different files should be separated by file type. For example,
to check in both a maya and houdin file in the same snapshot:
maya_path = "./my_model.ma" houdini_path = "./my_model.hip" server.add_file( snapshot_code, maya_path, file_type='maya' ) server.add_file( snapshot_code, houdini_path, file_type='houdini' )
To transfer files by uploading (using http protocol):
server.add_file( snapshot_code, maya_path, mode='upload' )
To create an icon for this file
path = 'image.jpg' server.add_file( snapshot_code, path, mode='upload', create_icon=True )
To add multiple files at once
file_paths = [maya_path, houdini_path] file_types ['maya', 'houdini'] server.add_file( snapshot_code, file_paths, file_types=file_types, mode='upload')
add_group(snapshot_code, file_path, file_type, file_range, use_handoff_dir=False, mode=None)
Add a file range to an already existing snapshot
param:
snapshot_code - the unique code identifier of a snapshot
file_path - path of the file to add to the snapshot
file_type - type of the file to be added.
file_range - range with format s-e/b
keyparam:
use_handoff_dir - use handoff dir to checkin file
mode - one of copy,move,preallocate
return:
dictionary - the resulting snapshot
add_initial_tasks(search_key, pipeline_code=None, processes=[], skip_duplicate=True, offset=0)
Add initial tasks to an sobject
param:
search_key - the key identifying a type of sobject as registered in
the search_type table.
keyparam:
pipeline_code - override the sobject’s pipeline and use this one instead
processes - create tasks for the given list of processes
skip_duplicate - boolean to skip duplicated task
offset - a number to offset the start date from today’s date
return:
list - tasks created
build_search_key(search_type, code, project_code=None, column=code)
Convenience method to build a search key from its components. A search_key uniquely indentifies a specific sobject. This string that is returned is heavily used as an argument in the API to identify an sobject to operate one
A search key has the form: "prod/shot?project=bar&code=XG001" where search_type = "prod/shot", project_code = "bar" and code = "XG001"
param:
search_type - the unique identifier of a search type: ie prod/asset
code - the unique code of the sobject
keyparam:
project_code - an optional project code. If this is not
included, the project from get_ticket() is added.
return:
string - search key
example:
search_type = "prod/asset" code = "chr001" search_key = server.build_search_key(search_type, code) e.g. search_key = prod/asset?project=code=chr001
search_type = "sthpw/login" code = "admin" search_key = server.build_search_key(search_type, code, column='code') e.g. search_key = sthpw/login?code=admin
build_search_type(search_type, project_code=None)
Convenience method to build a search type from its components. It is a simple method that build the proper format for project scoped search types. A full search type has the form: prod/asset?project=bar. It uniquely defines a type of sobject in a project.
param:
search_type - the unique identifier of a search type: ie prod/asset
project_code (optional) - an optional project code. If this is not
included, the project from get_ticket() is added.
return:
string - search type
example:
search_type = "prod/asset" full_search_type = server.build_search_type(search_type)
check_access(access_group, key, access, value, is_match, default="edit")
check the access for a specified access_group name like search_type, sobject, project, or builtin. It can also be custom-defined.
param:
access_group - it can be custom-defined or predefined like search_type, sobject, project, or builtin
key - usually in a dictionary or list of dictionary that maps to the parameters in the xml access rule
access - allow, delete, retire, insert, edit, view, deny
keyparam:
value - an extra modifier to the key. Rarely used.
is_match - boolean to specify whether you want to match exactly the access string as defined in access_rules.
The default is to return True if the specified access is equal or lower than the one defined.
default - default access like allow or view can be specified. The default access is "edit"
return:
boolean - True or False
example:
# check if one is allowed to view the project called workflow1
server.check_access(project, [{code,workflow1},{code,*}], 'allow)
# check if one has retire_delete access
access_key1 = {
key: retire_delete,
project: project_code
}
access_key2 = {
key: retire_delete
}
access_keys = [access_key1, access_key2]
server.check_access(builtin, access_keys, allow)
checkout(search_key, context, version=-1, file_type=main, dir=', level_key=None, to_sandbox_dir=False, mode='copy)
Check out files defined in a snapshot from the repository. This will copy files to a particular directory so that a user can work on them.
param:
search_key - a unique identifier key representing an sobject
context - context of the snapshot
keyparam:
version - version of the snapshot
file_type - file type defaults to main. If set to *, all paths are checked out
level_key - the unique identifier of the level in the form of a search key
to_dir - destination directory defaults to .
to_sandbox_dir - (True|False) destination directory defaults to
sandbox_dir (overrides "to_dir" arg)
mode - (copy|download) - determines the protocol that will be used
to copy the files to the destination location
return:
list - a list of paths that were checked out
clear_upload_dir()
Clear the upload directory to ensure clean checkins
param:
None
keyparam:
None
return:
None
connect_sobjects(src_sobject, dst_sobject, context=default)
Connect two sobjects together
param:
src_sobject - the original sobject from which the connection starts
dst_sobject - the sobject to which the connection connects to
keyparam:
context - an arbirarty parameter which defines type of connection
return:
dictionary - the last connection sobject created
create_note(search_key, note, process="publish", subcontext=None, user=None)
Add a note for a particular sobject
params:
search_key - the key identifying a type of sobject as registered in
the search_type table.
note - detailed description of the task
process - process that this task belongs to
subcontext - the subcontex of the process (context = procsss/subcontext
user - the user the note is attached to
return
note that was created
create_search_type(search_type, title, description="", has_pipeline=False)
Create a new search type
param:
search_type - Newly defined search_type
title - readable title to display this search type as
keyparam:
description - a brief description of this search type
has_pipeline - determines whether this search type goes through a
pipeline. Simply puts a pipeline_code column in the table.
return
string - the newly created search type
create_snapshot(search_key, context, snapshot_type="file", description="No description", is_current=True, level_key=None, is_revision=False, triggers=True )
Create an empty snapshot
param:
search_key - a unique identifier key representing an sobject
context - the context of the checkin
keyparam:
snapshot_type - [optional] descibes what kind of a snapshot this is.
More information about a snapshot type can be found in the
prod/snapshot_type sobject
description - [optional] optional description for this checkin
is_current - flag to determine if this checkin is to be set as current
is_revision - flag to set this as a revision instead of a version
level_key - the unique identifier of the level that this
is to be checked into
triggers - boolean to fire triggers on insert
return:
dictionary - representation of the snapshot created for this checkin
create_task(search_key, process="publish", subcontext=None, description=None, bid_start_date=None, bid_end_date=None, bid_duration=None, assigned=None)
Create a task for a particular sobject
param:
search_key - the key identifying a type of sobject as registered in
the search_type table.
keyparam:
process - process that this task belongs to
subcontext - the subcontext of the process (context = procsss/subcontext)
description - detailed description of the task
bid_start_date - the expected start date for this task
bid_end_date - the expected end date for this task
bid_duration - the expected duration for this task
assigned - the user assigned to this task
return:
dictionary - task created
delete_sobject(search_key, include_dependencies=False)
Invoke the delete method. Note: this function may fail due to dependencies. Tactic will not cascade delete. This function should be used with extreme caution because, if successful, it will permanently remove the existence of an sobject
param:
search_key - a unique identifier key representing an sobject.
Note: this can also be an array.
keyparam:
include_dependencies - True/False
return:
dictionary - a sobject that represents values of the sobject in the
form name:value pairs
directory_checkin(search_key, context, dir, snapshot_type="directory", description="No description", file_type=main, is_current=True, level_key=None, metadata={}, mode="copy", is_revision=False, checkin_type="strict")
Check in a directory of files. This informs TACTIC to treat the entire directory as single entity without regard to the structure of the contents. TACTIC will not know about the individual files and the directory hierarchy within the base directory and it it left up to the and external program to intepret and understand this.
This is often used when logic on the exact file structure exists in some external source outside of TACTIC and it is deemed too complicated to map this into TACTIC’s snapshot definition.
param:
search_key - a unique identifier key representing an sobject
dir - the directory that needs to be checked in
keyparam:
snapshot_type - type of snapshot this checkin will have
description - description related to this checkin
file_type - the type of file that will be associated with this group
is_current - makes this snapshot current
level_key - the search key of the level if used
metadata - add metadata to snapshot
mode - determines whether the files passed in should be copied, moved
or uploaded. By default, this is copy
is_revision - flag to set this as a revision instead of a version
checkin_type - auto or strict which controls whether to auto create versionless
return:
dictionary - snapshot
download(my, url, to_dir=".", filename='', md5_checksum="")
Download a file from a given url
param:
url - the url source location of the file
keyparam:
to_dir - the directory to download to
filename - the filename to download to, defaults to original filename
md5_checksum - an md5 checksum to match the file against
return:
string - path of the file donwloaded
eval(expression, search_keys=[], mode=None, single=False, vars={}, show_retired=False)
Evaluate the expression. This expression uses the TACTIC expression language to retrieve results. For more information, refer to the expression language documentation.
param:
expression - string expression
keyparam:
search_keys - the starting point for the expression.
mode - string|expression - determines the starting mode of the expression
single - True|False - True value forces a single return value
vars - user defined variable
show_retired - defaults to False to not return retired items
return:
results of the expression. The results depend on the exact nature
of the expression.
example:
#1. Search for snapshots with context beginning with model for the asset with the search key prod/asset?project=sample3d&id=96
server = TacticServerStub.get() exp = "@SOBJECT(sthpw/snapshot['context','EQ','^model'])" result = server.eval(exp, search_keys=['prod/asset?project=sample3d&id=96'])
Please refer to the expression language documentation for numerous
examples on how to use the expression language.
execute_cmd(class_name, args={}, values={})
Execute a command
param:
class_name - the fully qualified class name of the widget
keyparam:
args - keyword arguments required to create a specific widget
values - form values that are passed in from the interface
return:
string - description of command
execute_js_script(script_path, kwargs)
Execute a js script defined in Script Editor
param:
script_path - script path in Script Editor, e.g. test/eval_sobj
keyparam:
*kwargs * - keyword arguments for this script
return:
dictionary - returned data structure
execute_pipeline(pipeline_xml, package)
Spawn an execution of a pipeline as delivered from get_pipeline_xml(). The pipeline is a xml document that describes a set of processes and their handlers
param:
pipeline_xml - an xml document describing a standard Tactic pipeline.
package - a dictionary of data delivered to the handlers
return:
instance - a reference to the interpreter
execute_python_script(script_path, kwargs)
Execute a python script defined in Script Editor
param:
script_path - script path in Script Editor, e.g. test/eval_sobj
keyparam:
*kwargs * - keyword arguments for this script
return:
dictionary - returned data structure
finish(description='')
End the current transaction and cleans it up
keyparam:
description: this will be recorded in the transaction log as the
description of the transction
example:
A full transaction inserting 10 shots. If an error occurs, all 10
inserts will be aborted.
server.start('Start adding shots') try: for i in range(0,10): server.insert("prod/shot", { 'code': 'XG%0.3d'%i } ) except: server.abort() else: server.finish("10 shots added")
generate_ticket()
Ask the server to generate a ticket explicity used for your own commands
return:
string - representing the transaction ticket
get_all_children(search_key, child_type, filters=[], columns=[])
Get all children of a particular child type of an sobject
param:
search_key - a unique identifier key representing an sobject
child_type - the search_type of the children to search for
keyparam:
filters - extra filters on the query : see query method for examples
columns - list of column names to be included in the returned dictionary
return:
list of dictionary - a list of sobjects dictionaries
get_all_dependencies(snapshot_code, mode=explicit, type=ref, include_paths=False, include_paths_dict=False, include_files=False, repo_mode=client_repo, show_retired=False):
Retrieve the latest dependent snapshots of the given snapshot
param:
snapshot_code - the unique code of the snapshot
keyparam:
mode - explicit (get version as defined in snapshot)
type - one of ref or input_ref
include_paths - flag to specify whether to include a paths property
containing all of the paths in the dependent snapshots
include_paths_dict - flag to specify whether to include a
paths_dict property containing a dict of all paths in the
dependent snapshots
include_files - includes all of the file objects referenced in the
snapshots
repo_mode - client_repo, web, lib, relative
show_retired - defaults to False so that it doesn’t show retired dependencies
return:
list - snapshots
get_all_paths_from_snapshot(snapshot_code, mode=client_repo, expand_paths=False, filename_mode='')
Get all paths from snapshot
param:
snapshot_code - the unique code of the snapshot
keyparam:
mode - forces the type of folder path returned to use the value from the
appropriate tactic_<SERVER_OS>-conf.xml configuration file.
Values include lib, web, local_repo, sandbox, client_repo, relative
lib = the NFS asset directory from the server point of view
web = the http asset directory from the client point of view
local_repo = the local sync of the TACTIC repository
sandbox = the local sandbox (work area) designated by TACTIC
client_repo (default) = the asset directory from the client point of view
If there is no value for win32_client_repo_dir or linux_client_repo_dir
in the config, then the value for asset_base_dir will be used instead.
relative = the relative direcory without any base
expand_paths - expand the paths of a sequence check-in or for a directory check-in, it will list the contents of the directory as well
filename_mode - source or '', where source reveals the source_path of the check-in
file_types - list: only return files in snapshot with these types
return:
list - paths
get_base_dirs()
Get all of the base directories defined on the server
return:
dictionary of all the important configured base directories
with their keys
get_by_code(search_type, search_code)
Get the info on an sobject based on search code
param:
search_type - the search_type of the sobject to search for
code - the code of the sobject to search for
return:
sobject - a dictionary that represents values of the sobject in the
form name/value pairs
get_by_search_key(search_key)
Get the info on an sobject based on search key param:
search_key - the key identifying a type of sobject as registered in
the search_type table.
return:
list of dictionary - sobjects that represent values of the sobject in the
form of name:value pairs
get_child_types(search_key)
Get all the child search types
param:
search_key - a unique identifier key representing an sobject
return:
list - the child search types
get_client_dir(snapshot_code, file_type=main, mode=client_repo)
Get a dir segment from a snapshot
param:
snapshot_code - the unique code of the snapshot
keyparam:
file_type - each file in a snapshot is identified by a file type.
This parameter specifies which type. Defaults to main
mode - Forces the type of folder path returned to use the value from the
appropriate tactic_<SERVER_OS>-conf.xml configuration file.
Values include lib, web, local_repo, sandbox, client_repo, relative
lib = the NFS asset directory from the server point of view
web = the http asset directory from the client point of view
local_repo = the local sync of the TACTIC repository
sandbox = the local sandbox (work area) designated by TACTIC
client_repo (default) = the asset directory from the client point of view
If there is no value for win32_client_repo_dir or linux_client_repo_dir
in the config, then the value for asset_base_dir will be used instead.
relative = the relative direcory without any base
return:
string - directory segment for a snapshot and file type
example:
If the tactic_<SERVER_OS>-conf.xml configuration file contains the following:
<win32_client_repo_dir>T:/assets</win32_client_repo_dir>
and if the call to the method is as follows:
snapshot = server.create_snapshot(search_key, context) code = snapshot.get('code') server.get_path_from_snapshot(snapshot.get('code'))
Then, on a Windows client, get_client_dir() will return:
T:/assets/sample3d/asset/chr/chr003/scenes
get_client_version()
return:
string - Version of TACTIC that this client came from
get_column_info(search_type)
Get column information of the table given a search type
param:
search_type - the key identifying a type of sobject as registered in
the search_type table.
return - a dictionary of info for each column
get_column_names(search_type)
This method will get all of the column names associated with a search type
param:
search_type - the search type used to query the columns for
return
list of columns names
get_config_definition(search_type, view, element_name, personal=False)
Get the widget configuration definition for an element
param:
search_type - search type that this config relates to
view - view to look for the element
element_name - name of the element
keyparam:
personal - True if it is a personal definition
return:
string - xml of the configuration
get_connected_sobject(src_sobject, context=default)
Get the connected sobject
params
src_sobject - the original sobject from which the connection starts
keyparam:
context - an arbirarty parameter which defines type of connection
return:
dict - a single connected sobject
get_connected_sobjects(src_sobject, context=default)
Get all of the connected sobjects
param:
src_sobject - the original sobject from which the connection starts
keyparam:
context - an arbitrary parameter which defines type of connection
return:
list - a list of connected sobjects
get_dependencies(snapshot_code, mode=explicit, tag=main, include_paths=False, include_paths_dict=False, include_files=False, repo_mode=client_repo, show_retired=False):
Return the dependent snapshots of a certain tag
params:
snapshot_code - unique code of a snapshot
keyparams:
mode - explict (get version as defined in snapshot)
tag - retrieve only dependencies that have this named tag
include_paths - flag to specify whether to include a paths property
containing all of the paths in the dependent snapshots
include_paths_dict - flag to specify whether to include a
paths_dict property containing a dict of all paths in the
dependent snapshots
include_files - includes all of the file objects referenced in the
snapshots
repo_mode - client_repo, web, lib, relative
show_retired - defaults to False so that it doesn’t show retired dependencies
return:
a list of snapshots
get_expanded_paths_from_snapshot(snapshot_code, file_type=main)
Return the expanded path of a snapshot (used for ranges of files)
param:
snapshot_code - the unique code of the snapshot
keyparam:
file_type - each file in a snapshot is identified by a file type.
This parameter specifies which type. Defaults to main
return:
string - path
get_full_snapshot_xml(snapshot_code)
Retrieve a full snapshot xml. This snapshot definition contains all the information about a snapshot in xml
param:
snapshot_code - unique code of snapshot
return:
string - the resulting snapshot xml
get_handoff_dir()
Return a temporary path that files can be copied to
return:
string - the directory to copy a file to handoff to TACTIC
without having to go through http protocol
get_home_dir()
OS independent method to Get the home directory of the current user.
return:
string - home directory
get_info_from_user(force=False)
Get input from the user about the users environment. Questions asked pertain to the location of the tactic server, the project worked on and the user’s login and password. This information is stored in an .<login>.tacticrc file.
keyparam:
force - if set to True, it will always ask for new infomation from the
command prompt again
get_input_tasks(search_key)
Get the input tasks of a task based on the pipeline associated with the sobject parent of the task
param:
search_key - the key identifying an sobject as registered in
the search_type table.
return:
list of input tasks
get_interaction_count(key)
Get the interaction count given a key
params
key - key string for interaction count
return:
integer - interaction count
get_md5_info(md5_list, texture_codes, new_paths, parent_code, texture_cls, file_group_dict, project_code)
Get md5 info for a given list of texture paths, mainly returning if this md5 is a match or not param:
md5_list - md5_list
new_paths - list of file_paths
parent_code - parent code
texture_cls - Texture or ShotTexture
file_group_dict - file group dictionary storing all the file groups
project_code - project_code
mode - texture matching mode (md5, file_name)
return:
dictionary - a dictionary of path and a subdictionary of is_match, repo_file_code, repo_path, repo_file_range
get_message(key)
Get the message with the appropriate key
param:
key - unique key for this message
return:
string - message
get_output_tasks(search_key)
Get the output tasks of a task based on the pipeline associated with the sobject parent of the task
param:
search_key - the key identifying an sobject as registered in
the search_type table.
return:
list of output tasks
get_parent(search_key, columns=[], show_retired=True)
Get the parent of an sobject.
param:
search_key - a unique identifier key representing an sobject
keyparam:
columns - the columns that will be returned in the sobject
show_retired - it defaults to False so it does not show retired parent if that’s the case
return:
dictionary - the parent sobject
get_parent_type(search_key)
Get of the parent search type
param:
search_key - a unique identifier key representing an sobject
return:
list - a list of child search_types
get_path_from_snapshot(snapshot_code, file_type=main, mode=client_repo)
Get a full path from a snapshot
param:
snapshot_code - the unique code / search_key of the snapshot
keyparam:
file_type - each file in a snapshot is identified by a file type.
This parameter specifies which type. Defaults to main
mode - Forces the type of folder path returned to use the value from the
appropriate tactic_<SERVER_OS>-conf.xml configuration file.
Values include lib, web, local_repo, sandbox, client_repo, relative
lib = the NFS asset directory from the server point of view
web = the http asset directory from the client point of view
local_repo = the local sync of the TACTIC repository
sandbox = the local sandbox (work area) designated by TACTIC
client_repo (default) = the asset directory from the client point of view
If there is no value for win32_client_repo_dir or linux_client_repo_dir
in the config, then the value for asset_base_dir will be used instead.
relative = the relative direcory without any base
return:
string - the directory to copy a file to handoff to Tactic without having to
go through http protocol
example:
If the tactic_<SERVER_OS>-conf.xml configuration file contains the following:
<win32_client_repo_dir>T:/assets</win32_client_repo_dir>
and if the call to the method is as follows:
snapshot = server.create_snapshot(search_key, context) code = snapshot.get('code') server.get_path_from_snapshot(snapshot.get('code')) # in a trigger snapshot_key = my.get_input_value("search_key") server.get_path_from_snapshot(snapshot_key)
Then, on a Windows client, get_path_from_snapshot() will return:
T:/assets/sample3d/asset/chr/chr003/scenes/chr003_rig_v003.txt
get_paths( search_key, context="publish", version=-1, file_type=main, level_key=None, single=False, versionless=False)
Get paths from an sobject
params:
search_key - a unique identifier key representing an sobject
keyparams:
context - context of the snapshot
version - version of the snapshot
file_type - file type defined for the file node in the snapshot
level_key - the unique identifier of the level that this
was checked into
single - If set to True, the first of each path set is returned
versionless - boolean to return the versionless snapshot, which takes a version of -1 (latest) or 0 (current)
process - the process of the snapshot
return
A dictionary of lists representing various paths. The paths returned
are as follows:
get_pipeline_processes(search_key, recurse=False)
DEPRECATED: use get_pipeline_processes_info()
Retrieve the pipeline processes information of a specific sobject.
param:
search_key - a unique identifier key representing an sobject
keyparams:
recurse - boolean to control whether to display sub pipeline processes
return:
list - process names of the pipeline
get_pipeline_processes_info(search_key, recurse=False, related_process=None)
Retrieve the pipeline processes information of a specific sobject. It provides information from the perspective of a particular process if related_process is specified.
param:
search_key - a unique identifier key representing an sobject
keyparams:
recurse - boolean to control whether to display sub pipeline processes
related_process - given a process, it shows the input and output processes and contexts
return:
dictionary - process names of the pipeline or a dictionary if related_process is specified
get_pipeline_xml(search_key)
DEPRECATED: use get_pipeline_xml_info()
Retrieve the pipeline of a specific sobject. The pipeline return is an xml document and an optional dictionary of information.
param:
search_key - a unique identifier key representing an sobject
return:
dictionary - xml and the optional hierarachy info
get_pipeline_xml_info(search_key, include_hierarchy=False)
Retrieve the pipeline of a specific sobject. The pipeline returned is an xml document and an optional dictionary of information.
param:
search_key - a unique identifier key representing an sobject
keyparam:
include_hierarchy - include a list of dictionary with key info on each process of the pipeline
return:
dictionary - xml and the optional hierarachy info
get_plugin_dir(plugin)
Return the web path for the specfied plugin
params:
plugin - plugin name
return:
string - the web path for the specified plugin
get_preallocated_path(snapshot_code, file_type=main, file_name=', mkdir=True, protocol='client_repo, ext=', checkin_type='strict)
Get the preallocated path for this snapshot. It assumes that this checkin actually exists in the repository and will create virtual entities to simulate a checkin. This method can be used to determine where a checkin will go. However, the snapshot must exist using create_snapshot() or some other method. For a pure virtual naming simulator, use get_virtual_snapshot_path().
param:
snapshot_code - the code of a preallocated snapshot. This can be
create by get_snapshot()
keyparam:
file_type - the type of file that will be checked in. Some naming
conventions make use of this information to separate directories
for different file types
file_name - the desired file name of the preallocation. This information
may be ignored by the naming convention or it may use this as a
base for the final file name
mkdir - an option which determines whether the directory of the
preallocation should be created
protocol - It’s either client_repo, sandbox, or None. It determines whether the
path is from a client or server perspective
ext - force the extension of the file name returned
checkin_type - strict, auto , or '' can be used.. A naming entry in the naming, if found, will be used to determine the checkin type
return:
string - the path where add_file() expects the file to be checked into
example:
it saves time if you get the path and copy it to the final destination first.
snapshot = my.server.create_snapshot(search_key, context) snapshot_code = snapshot.get('code') file_name = 'input_file_name.txt' orig_path = 'C:/input_file_name.txt' path = my.server.get_preallocated_path(snapshot_code, file_type, file_name) # the path where it is supposed to go is generated new_dir = os.path.dirname(path) if not os.path.exists(new_dir): os.makedirs(new_dir) shutil.copy(orig_path, path) my.server.add_file(snapshot_code, path, file_type, mode='preallocate')
get_preference(key)
Get the user’s preference for this project
param:
key - unique key to identify preference
return:
string - current value of preference
get_related_types(search_type)
Get related search types given a search type
param:
search_type - the key identifying a type of sobject as registered in
the search_type table.
return - list of search_types
get_resource_path(login=None)
Get the resource path of the current user. It differs from create_resource_paths() which actually create dir. The resource path identifies the location of the file which is used to cache connection information. An exmple of the contents is shown below:
login=admin server=localhost ticket=30818057bf561429f97af59243e6ef21 project=unittest site=vfx_site
The contents in the resource file represent the defaults to use when connection to the TACTIC server, but may be overriden by the API methods: set_ticket(), set_server(), set_project() or the environment variables: TACTIC_TICKET, TACTIC_SERVER, and TACTIC_PROJECT
Typically this method is not explicitly called by API developers and is used automatically by the API server stub. It attempts to get from home dir first and then from temp_dir is it fails.
The site key is optional and used for a portal setup.
param:
login (optional) - login code. If not provided, it gets the current system user
return:
string - resource file path
get_snapshot(search_key, context="publish", version=-1, level_key=None, include_paths=False, include_full_xml=False, include_paths_dict=False, include_files=False, include_web_paths_dict=False, versionless=False)
Method to retrieve an sobject’s snapshot Retrieve the latest snapshot
param:
search_key - unique identifier of sobject whose snapshot we are
looking for
keyparam:
process - the process of the snapshot
context - the context of the snapshot
version - snapshot version
revision - snapshot revision
level_key - the unique identifier of the level in the form of a search key
include_paths - flag to include a list of paths to the files in this
snapshot.
include_full_xml - whether to include full xml in the return
include_paths_dict - flag to specify whether to include a
paths_dict property containing a dict of all paths in the
dependent snapshots
include_web_paths_dict - flag to specify whether to include a
web_paths_dict property containing a dict of all web paths in
the returned snapshots
include_files - includes all of the file objects referenced in the
snapshots
versionless - boolean to return the versionless snapshot, which takes a version of -1 (latest) or 0 (current)
return:
dictionary - the resulting snapshot
example:
search_key = 'prod/asset?project=sample3d&code=chr001' snapshot = server.get_snapshot(search_key, context='icon', include_files=True)
# get the versionless snapshot search_key = 'prod/asset?project=sample3d&code=chr001' snapshot = server.get_snapshot(search_key, context='anim', include_paths_dict=True, versionless=True)
get_table_info(search_type)
Get column information of the table given a search type
param:
search_type - the key identifying a type of sobject as registered in
the search_type table.
return - a dictionary of info for each column
get_ticket(login, password, site=None)
Get an authentication ticket based on a login and password. This function first authenticates the user and the issues a ticket. The returned ticket is used on subsequent calls to the client api
param:
login - the user that is used for authentications
password - the password of that user
keyparam:
site - name of the site used in a portal setup
return:
string - ticket key
get_types_from_instance(instance_type)
Get the connector types from an instance type
param:
instance_type - the search type of the instance
return:
tuple - (from_type, parent_type)
a tuple with the from_type and the parent_type. The from_type is
the connector type and the parent type is the search type of the
parent of the instance
get_unique_sobject(search_type, data={})
This is a special convenience function which will query for an sobject and if it doesn’t exist, create it. It assumes that this object should exist and spares the developer the logic of having to query for the sobject, test if it doesn’t exist and then create it.
param:
search_type - the type of the sobject
data - a dictionary of name/value pairs that uniquely identify this
sobject
return:
sobject - unique sobject matching the critieria in data
get_virtual_snapshot_path(search_key, context, snapshot_type="file", level_key=None, file_type=main, file_name=', mkdirs=False, protocol='client_repo, ext=', checkin_type='strict)
Create a virtual snapshot and returns a path that this snapshot would generate through the naming conventions. This is most useful testing naming conventions.
param:
snapshot creation:
*search_key* - a unique identifier key representing an sobject *context* - the context of the checkin *keyparam:* *snapshot_type* - [optional] descibes what kind of a snapshot this is. More information about a snapshot type can be found in the prod/snapshot_type sobject *description* - [optional] optional description for this checkin *level_key* - the unique identifier of the level that this is to be checked into *keyparam:* path creation:
file_type - the type of file that will be checked in. Some naming
conventions make use of this information to separate directories
for different file types
file_name - the desired file name of the preallocation. This information
may be ignored by the naming convention or it may use this as a
base for the final file name
mkdir - an option which determines whether the directory of the
preallocation should be created
protocol - It’s either client_repo, sandbox, or None. It determines whether the
path is from a client or server perspective
ext - force the extension of the file name returned
checkin_type - strict, auto, '' can be used to preset the checkin_type
return:
string - path as determined by the naming conventions
get_widget(class_name, args={}, values={})
Get a defined widget
params:
class_name - the fully qualified class name of the widget
keyparams:
args - keyword arguments required to create a specific widget
values - form values that are passed in from the interface
return:
string - html form of the widget
example:
class_name = tactic.ui.panel.TableLayoutWdg
args = {
view: task_list,
search_type: sthpw/task,
}
filter = [{"prefix":"main_body","main_body_enabled":"on","main_body_column":"project_code","main_body_relation":"is","main_body_value":"{$PROJECT}"}, {"prefix":"main_body","main_body_enabled":"on","main_body_column":"search_type","main_body_relation":"is not","main_body_value":"sthpw/project"}]
from simplejson import dumps
values = {json: dumps(filter)}
widget_html = server.get_widget(class_name, args, values)
group_checkin(search_key, context, file_path, file_range, snapshot_type="sequence", description="", file_type=main, metadata={}, mode=None, is_revision=False, info={} )
Check in a range of files. A range of file is defined as any group of files that have some sequence of numbers grouping them together. An example of this includes a range frames that are rendered.
Although it is possible to add each frame in a range using add_file, adding them as as sequence is lightweight, often significantly reducing the number of database entries required. Also, it is understood that test files form a range of related files, so that other optimizations and manipulations can be operated on these files accordingly.
param:
search_key - a unique identifier key representing an sobject
file_path - expression for file range: ./blah.##.jpg
file_type - the typ of file this is checked in as. Default = main
file_range - string describing range of frames in the form 1-5/1
keyparam:
snapshot_type - type of snapshot this checkin will have
description - description related to this checkin
file_type - the type of file that will be associated with this group
metadata - add metadata to snapshot
mode - determines whether the files passed in should be copied, moved
or uploaded. By default, this is a manual process (for backwards
compatibility)
is_revision - flag to set this as a revision instead of a version
info - dict of info to pass to the ApiClientCmd
return:
dictionary - snapshot
insert(search_type, data, metadata={}, parent_key=None, info={}, use_id=False, triggers=True)
General insert for creating a new sobject
param:
search_type - the search_type attribute of the sType
data - a dictionary of name/value pairs which will be used to update
the sobject defined by the search_key.
parent_key - set the parent key for this sobject
keyparam:
metadata - a dictionary of values that will be stored in the metadata attribute
if available
info - a dictionary of info to pass to the ApiClientCmd
use_id - use id in the returned search key
triggers - boolean to fire trigger on insert
return:
dictionary - represent the sobject with it’s current data
example:
insert a new asset
search_type = "prod/asset" data = { 'code': chr001, 'description': 'Main Character' } server.insert( search_type, data )
insert a new note with a shot parent
# get shot key shot_key = server.build_search_key(search_type='prod/shot',code='XG001') data = { 'context': 'model', 'note': 'This is a modelling note', 'login': server.get_login() } server.insert( search_type, data, parent_key=shot_key)
insert a note without firing triggers
search_type = "sthpw/note" data = { 'process': 'roto', 'context': 'roto', 'note': 'The keys look good.', 'project_code': 'art' } server.insert( search_type, data, triggers=False )
insert_multiple(data, metadata=[], parent_key=None, use_id=False, triggers=True)
Insert for several sobjects in one function call. The data structure contains all the infon needed to update and is formated as follows:
data = [ { column1: value1, column2: value2, column3: value3 }, { column1: value1, column2: value2, column3: value3 } }
metadata = [ { color: blue, height: 180 }, { color: orange, height: 170 } ]
params:
search_type - the search_type attribute of the sType
data - a dictionary of name/value pairs which will be used to update
the sobject defined by the search_key
Note: this can also be an array. Each data dictionary element in
the array will be applied to the corresponding search key
keyparam:
parent_key - set the parent key for this sobject
use_id - boolean to control if id is used in the search_key in returning sobject dict
triggers - boolean to fire trigger on insert
return:
a list of all the inserted sobjects
insert_update(search_key, data, metadata={}, parent_key=None, info={}, use_id=False, triggers=True)
Insert if the entry does not exist, update otherwise
param:
search_key - a unique identifier key representing an sobject.
data - a dictionary of name/value pairs which will be used to update
the sobject defined by the search_key
keyparam:
metadata - a dictionary of values that will be stored in the metadata attribute if available
parent_key - set the parent key for this sobject
info - a dictionary of info to pass to the ApiClientCmd
use_id - use id in the returned search key
triggers - boolean to fire trigger on insert
return:
dictionary - represent the sobject with its current data.
log(level, message, category="default")
Log a message in the logging queue. It is often difficult to see output of a trigger unless you are running the server in debug mode. In production mode, the server sends the output to log files. The log files are general buffered. It cannot be predicted exactly when buffered output will be dumped to a file.
This log() method will make a request to the server. The message will be immediately stored in the database in the debug log table.
param:
level - critical|error|warning|info|debug - arbitrary debug level category
message - freeform string describing the entry
keyparam:
category - a label for the type of message being logged.
It defaults to "default"
log_message(key, message, status=None, category="default")
Log a message which will be seen by all who are subscribed to the message "key". Messages are often JSON strings of data.
params:
key - unique key for this message
message - the message to be sent
keyparam:
status - arbitrary status for this message
category - value to categorize this message
return:
string - "OK"
query(search_type, filters=[], columns=[], order_bys=[], show_retired=False, limit=None, offset=None, single=False, distinct=None, return_sobjects=False)
General query for sobject information
param:
search_type - the key identifying a type of sobject as registered in
the search_type table.
keyparam:
filters - an array of filters to alter the search
columns - an array of columns whose values should be
retrieved
order_bys - an array of order_by to alter the search
show_retired - sets whether retired sobjects are also
returned
limit - sets the maximum number of results returned
single - returns only a single object
distinct - specify a distinct column
return_sobjects - return sobjects instead of dictionary. This
works only when using the API on the server.
parent_key - filter to specify a parent sobject
return:
list of dictionary/sobjects - Each array item represents an sobject
and is a dictionary of name/value pairs
example:
filters = [] filters.append( ("code", "XG002") ) order_bys = ['timestamp desc'] columns = ['code'] server.query(ticket, "prod/shot", filters, columns, order_bys)
The arguments "filters", "columns", and "order_bys" are optional
The "filters" argument is a list. Each list item represents an
individual filter. The forms are as follows:
(column, value) -> where column = value (column, (value1,value2)) -> where column in (value1, value2) (column, op, value) -> where column op value where op is ('like', '<=', '>=', '>', '<', 'is', '~', '!~','~*','!~*) (value) -> where value
query_snapshots(filters=None, columns=None, order_bys=[], show_retired=False, limit=None, offset=None, single=False, include_paths=False, include_full_xml=False, include_paths_dict=False, include_parent=False, include_files=False, include_web_paths=False)
thin wrapper around query, but is specific to querying snapshots with some useful included flags that are specific to snapshots
params:
ticket - authentication ticket
filters - (optional) an array of filters to alter the search
columns - (optional) an array of columns whose values should be
retrieved
order_bys - (optional) an array of order_by to alter the search
show_retired - (optional) - sets whether retired sobjects are also
returned
limit - sets the maximum number of results returned
single - returns a single sobject that is not wrapped up in an array
include_paths - flag to specify whether to include a paths property
containing a list of all paths in the dependent snapshots
include_paths_dict - flag to specify whether to include a
paths_dict property containing a dict of all paths in the
dependent snapshots
include_web_paths_dict - flag to specify whether to include a
web_paths_dict property containing a dict of all web paths in
the returned snapshots
include_full_xml - flag to return the full xml definition of a snapshot
include_parent - includes all of the parent attributes in a parent dictionary
include_files - includes all of the file objects referenced in the
snapshots
return:
list of snapshots
reactivate_sobject(search_key)
Invoke the reactivate method.
param:
search_key - the unige key identifying the sobject.
return:
dictionary - sobject that represents values of the sobject in the
form name:value pairs
redo(transaction_ticket=None, transaction_id=None)
Redo an operation. If no transaction id is given, then the last undone operation of this user on this project is redone
keyparam:
transaction_ticket - explicitly redo a specific transaction
transaction_id - explicitly redo a specific transaction by id
retire_sobject(search_key)
Invoke the retire method. This is preferred over delete_sobject if you are not sure whether other sobjects has dependency on this.
param:
search_key - the unige key identifying the sobject.
return:
dictionary - sobject that represents values of the sobject in the
form name:value pairs
set_config_definition(search_type, element_name, config_xml="", login=None)
Set the widget configuration definition for an element
param:
search_type - search type that this config relates to
element_name - name of the element
keyparam:
config_xml - The configuration xml to be set
login - A user’s login name, if specifically choosing one
return:
True on success, exception message on failure
set_current_snapshot(snapshot_code)
Set this snapshot as a "current" snapshot
param:
snapshot_code - unique code of snapshot
return:
string - the resulting snapshot xml
set_preference(key, value)
Set the user’s preference for this project
param:
key - unique key to identify preference
value - value to set the preference
set_widget_settings(key, value)
Get widget setting for current user and project
param
key - unique key to identify this setting
return
value of setting
set_widget_settings(key, value)
Get widget setting for current user and project
param
key - unique key to identify this setting
return
value of setting
simple_checkin( search_key, context, file_path, snapshot_type="file", description="No description", use_handoff_dir=False, file_type="main", is_current=True, level_key=None, breadcrumb=False, metadata={}, mode=None, is_revision=False, info={}, keep_file_name=False, create_icon=True, checkin_cls=pyasm.checkin.FileCheckin, context_index_padding=None, checkin_type="strict", source_path=None, version=None )
Simple method that checks in a file.
param:
search_key - a unique identifier key representing an sobject
context - the context of the checkin
file_path - path of the file that was previously uploaded
keyparam:
snapshot_type - [optional] descibes what kind of a snapshot this is.
More information about a snapshot type can be found in the
prod/snapshot_type sobject
description - [optional] optional description for this checkin
file_type - [optional] optional description for this file_type
is_current - flag to determine if this checkin is to be set as current
level_key - the unique identifier of the level that this
is to be checked into
breadcrumb - flag to leave a .snapshot breadcrumb file containing
information about what happened to a checked in file
metadata - a dictionary of values that will be stored as metadata
on the snapshot
mode - inplace, upload, copy, move
is_revision - flag to set this as a revision instead of a version
create_icon - flag to create an icon on checkin
info - dict of info to pass to the ApiClientCmd
keep_file_name - keep the original file name
checkin_cls - checkin class
context_index_padding - determines the padding used for context
indexing: ie: design/0001
checkin_type - auto or strict which controls whether to auto create versionless
source_path - explicitly give the source path
version - force a version for this check-in
return:
dictionary - representation of the snapshot created for this checkin
split_search_key(search_key)
Convenience method to split a search_key in into its search_type and search_code/id components. Note: only accepts the new form prod/asset?project=sample3d&code=chr001
param:
search_key - the unique identifier of a sobject
return:
tuple - search type, search code/id
start(title, description=', transaction_ticket=')
Start a transaction. All commands using the client API are bound in a transaction. The combination of start(), finish() and abort() makes it possible to group a series of API commands in a single transaction. The start/finish commands are not necessary for query operations (like query(…), get_snapshot(…), etc).
keyparam:
title - the title of the command to be executed. This will show up on
transaction log
description - the description of the command. This is more detailed.
transaction_ticket - optionally, one can provide the transaction ticket sequence
example:
A full transaction inserting 10 shots. If an error occurs, all 10
inserts will be aborted.
server.start('Start adding shots') try: for i in range(0,10): server.insert("prod/shot", { 'code': 'XG%0.3d'%i } ) except: server.abort() else: server.finish("10 shots added")
subscribe(key, category="default")
Allow a user to subscribe to this message key. All messages belonging to the corresponding key will be available to users subscribed to it.
param:
key - unique key for this message
keyparam:
category - value to categorize this message
return:
dict - subscription sobject
undo(transaction_ticket=None, transaction_id=None, ignore_files=False)
undo an operation. If no transaction id is given, then the last operation of this user on this project is undone
keyparam:
transaction_ticket - explicitly undo a specific transaction
transaction_id - explicitly undo a specific transaction by id
ignore_files - flag which determines whether the files should
also be undone. Useful for large preallcoated checkins.
unsubscribe(key)
Allow a user to unsubscribe from this message key.
param:
key - unique key for this message
return:
dictionary - the values of the subscription sobject in the
form name:value pairs
update(search_key, data={}, metadata={}, parent_key=None, info={}, use_id=False, triggers=True)
General update for updating sobject
param:
search_key - a unique identifier key representing an sobject.
Note: this can also be an array, in which case, the data will
be updated to each sobject represented by this search key
keyparam:
data - a dictionary of name/value pairs which will be used to update
the sobject defined by the search_key
Note: this can also be an array. Each data dictionary element in
the array will be applied to the corresponding search key
parent_key - set the parent key for this sobject
info - a dictionary of info to pass to the ApiClientCmd
metadata - a dictionary of values that will be stored in the metadata attribute if available
use_id - use id in the returned search key
triggers - boolean to fire trigger on update
return:
dictionary - represent the sobject with its current data.
If search_key is an array, This will be an array of dictionaries
update_config(search_type, view, element_names)
Update the widget configuration like ordering for a view
param:
search_type - search type that this config relates to
view - view to look for the element
element_names - element names in a list
return:
string - updated config xml snippet
update_multiple(data, triggers=True)
Update for several sobjects with different data in one function call. The data structure contains all the information needed to update and is formated as follows:
data = { search_key1: { column1: value1, column2: value2 } search_key2: { column1: value1, column2: value2 } }
params:
data - data structure containing update information for all
sobjects
keyparam:
data - a dictionary of name/value pairs which will be used to update
the sobject defined by the search_key
Note: this can also be an array. Each data dictionary element in
the array will be applied to the corresponding search key
triggers - boolean to fire trigger on insert
return:
None