Jump to content

Search the Community

Showing results for tags 'session'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Company news
    • General announcements
  • ftrack Studio (main app)
    • General discussion
    • Feature requests
    • API
    • Help
    • Actions and Widgets
    • ftrack Go
  • ftrack Review
    • General discussion
    • Feature requests
    • Help
  • Connect and Integrations
    • Releases
    • General discussion
    • Feature requests
    • Early Access Integrations & Connect
    • Help
  • Advisory Forum
  • Tech preview
    • API

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests

Found 4 results

  1. Hey folks, since yesterday I get the following error when trying to connect to the ftrack_api. // ftrack_api.session.Session : Calling server https://[OUR_FTRACK_SITE]/api with '[{"action": "query_server_information"}]' // // ftrack_api.session.Session : Call took: 0.113607 // // ftrack_api.session.Session : Response: u'[{"storage_scenario": {"data": {}, "scenario": "ftrack.automatic"}, "schema_hash": "450f452f8addcd23370a8a90f8156c4a", "version": "4.1.5.4750", "is_timezone_support_enabled": false}]' // // Error: ftrack_api.session.Session : Server reported error in unexpected format. Raw error was: [{"storage_scenario": {"data": {}, "scenario": "ftrack.automatic"}, "schema_hash": "450f452f8addcd23370a8a90f8156c4a", "version": "4.1.5.4750", "is_timezone_support_enabled": false}] // # Traceback (most recent call last): # File "/prod/softprod/apps/maya/2018/linux/lib/python27.zip/logging/__init__.py", line 853, in emit # msg = self.format(record) # File "/prod/softprod/apps/maya/2018/linux/lib/python27.zip/logging/__init__.py", line 726, in format # return fmt.format(record) # File "/users_roaming/tdorfmeister/devel/ppStudio/common/libs/filmmore/logger.py", line 48, in format # logline = super(self.__class__, self).format(record) # File "/prod/softprod/apps/maya/2018/linux/lib/python27.zip/logging/__init__.py", line 465, in format # record.message = record.getMessage() # File "/prod/softprod/apps/maya/2018/linux/lib/python27.zip/logging/__init__.py", line 325, in getMessage # msg = str(self.msg) # File "/prod/softprod/libs/ftrack_api/exception.py", line 42, in __str__ # return str(self.message.format(**keys)) # KeyError: '"storage_scenario"' I'm just trying to connect using `ftrack_api.Session()` with my credentials and `auto_connect_event_hub=True`. Any help is much appreciated, since I really have no clue how to figure this one out on my own. Thanks PS: I should note that my api is on v1.3.3. I know... 😕
  2. Hi, Im kinda new to this so please bear with my newbie questions... Apparently it's good practice to close a session after you're done, but session.close() throws an error that the function doesn't exist and session.closed returns undefined.
  3. Hello everybody! This action populates some custom attributes within a Task that is nested under selected item. These attributes are paths to working directories and render outputs.. I have other actions that rely on these custom paths to do other things such as opening a shot with quicktime / launching the shot folder in explorer /etc.. Everything works as it should.... but I am concerned about the efficiency and speed of my code as populating each task takes about a second... and of course, the more tasks nested under my selection, the longer this process takes. Ideally... I would like to run this action at Project or at least Sequence level and let it update the custom attributes for all tasks nested under it. EpisodicS2 └-- Episode1 └-- Seq001 └-- Shot1 └-- Task1 └-- Task2 └-- Task..10 Am I doing everything right? Are there major deficiencies in my code? Thank you for all the help! Ali import logging import ftrack_api import os import re import ftrack import getpass import time os.environ['FTRACK_SERVER'] = ### os.environ['FTRACK_API_KEY'] = ### #this script will populate parameters of each task and shot nested under selected item with direct paths to file locations. ### prerequisites: #Task should have the following attributes : path, out_path, base_path #Shot should have the following attributes : plate_path #Project should have the following attributes : Project_Path #<----naming will need to be conformed ### class UpdatePaths(object): '''Custom action.''' label = 'Update Paths' identifier = 'update.task.paths' description = 'This updates the path parameter of all tasks nested under selected' icon = 'https://d30y9cdsu7xlg0.cloudfront.net/png/1406969-200.png' def __init__(self, session): '''Initialise action.''' super(UpdatePaths, self).__init__() self.session = session self.logger = logging.getLogger( __name__ + '.' + self.__class__.__name__ ) def register(self): '''Register action.''' try: ftrack.EVENT_HUB.subscribe( 'topic=ftrack.action.discover and source.user.username={0}'.format( getpass.getuser() ), self.discover ) ftrack.EVENT_HUB.subscribe( 'topic=ftrack.action.launch and source.user.username={0} ' 'and data.actionIdentifier={1}'.format( getpass.getuser(), self.identifier ), self.launch ) except: self.session.event_hub.subscribe( 'topic=ftrack.action.discover', self.discover ) self.session.event_hub.subscribe( 'topic=ftrack.action.launch and data.actionIdentifier={0}'.format( self.identifier), self.launch ) def discover(self, event): '''Return action config if triggered on a single asset version.''' data = event['data'] # If selection contains more than one item return early since # this action can only handle a single version. selection = data.get('selection', []) self.logger.info('Got selection: {0}'.format(selection)) #if len(selection) != 1 or selection[0]['entityType'] != 'assetversion': # return return { 'items': [{ 'label': self.label, 'description': self.description, 'actionIdentifier': self.identifier, 'icon': self.icon }] } def launch(self, event): start_time = time.time() data = event['data'] selection = data.get('selection', []) entityTypes = ['Project', 'Episode', 'Sequence', 'Shot', 'Task'] session = ftrack_api.Session() for entity in selection: num = 0 et = entityTypes[num] item = session.query('select name from {0} where id is {1}'.format(et, entity['entityId'])).first() while item == None: num += 1 et = entityTypes[num] item = session.query('select name from {0} where id is {1}'.format(et, entity['entityId'])).first() prj_item_selected = False #If the current selected item is a project, first process it byitself. if item['parent'] == None: project = item prj_item_selected = True project_base = item['custom_attributes']['Project_Path']+item['full_name']+'/' if item['custom_attributes']['base_path']!= project_base: item['custom_attributes']['base_path'] = project_base #now look for the selected items descendants items = item['descendants'][:] #if the selected item is not a project, then we will also need to add taht to the list we will iterate through. if not prj_item_selected: items += [item] project = session.get('Project', item['project_id']) print 'Total nested items:',len(items) for i in items: link_list = i['link'][1:] episode = '' #search for an episode item in the links for l in link_list: link_item = session.get(l['type'], l['id']) if link_item['object_type']['name'] == 'Episode': episode = link_item['name'] project_path = project['custom_attributes']['Project_Path'] project_name = project['full_name'] base_path = project_path+project_name+'/'+episode+'/' base_path = base_path.replace('//','/') if i['custom_attributes']['base_path'] != base_path: i['custom_attributes']['base_path'] = base_path if i['object_type']['name'] == 'Task': shot_name = i['parent']['name'] #this may break when it comes to asset builds since they are not nested under a shot.. task_type = i['type']['name'] task_name = i['name'] path = base_path out_path = base_path if task_type in ['Compositing', 'Precomp', 'Cleanplate', 'Retime', 'Rotoscoping', 'Paintout']: comp_out_dir = '02_OUTPUT/03_comp' if task_type.lower() != task_name.lower(): comp_out_dir = '02_OUTPUT/01_precomp/{task_name}'.format(task_name=task_name) path = '{base_path}{dept_name}/{shot_name}/'.format(base_path=base_path,shot_name=shot_name,dept_name='05_COMP') out_path = '{base_path}{dept_name}/{shot_name}/{comp_out_dir}/'.format(base_path=base_path,shot_name=shot_name,dept_name='05_COMP',comp_out_dir=comp_out_dir) if task_type in ['Matchmove', 'Tracking']: path = '{base_path}{dept_name}/scenes/{shot_name}/tracking/'.format(base_path=base_path,shot_name=shot_name,dept_name='04_3D') out_path = '{base_path}{dept_name}/{shot_name}/TRAC/'.format(base_path=base_path,shot_name=shot_name,dept_name='06_RENDERS') if task_type in ['Animation']: path = '{base_path}{dept_name}/scenes/{shot_name}/anim/'.format(base_path=base_path,shot_name=shot_name,dept_name='04_3D') out_path = '{base_path}{dept_name}/{shot_name}/ANIM/'.format(base_path=base_path,shot_name=shot_name,dept_name='06_RENDERS') if task_type in ['Layout']: path = '{base_path}{dept_name}/scenes/{shot_name}/layout/'.format(base_path=base_path,shot_name=shot_name,dept_name='04_3D') out_path = '{base_path}{dept_name}/{shot_name}/LYT/'.format(base_path=base_path,shot_name=shot_name,dept_name='06_RENDERS') if task_type in ['Lighting']: path = '{base_path}{dept_name}/scenes/{shot_name}/lighting/'.format(base_path=base_path,shot_name=shot_name,dept_name='04_3D') out_path = '{base_path}{dept_name}/{shot_name}/FINL/'.format(base_path=base_path,shot_name=shot_name,dept_name='06_RENDERS') if task_type in ['FX']: path = '{base_path}{dept_name}/scenes/{shot_name}/fx/'.format(base_path=base_path,shot_name=shot_name,dept_name='04_3D') out_path = '{base_path}{dept_name}/{shot_name}/FX/'.format(base_path=base_path,shot_name=shot_name,dept_name='06_RENDERS') path = path.replace('//', '/') out_path = out_path.replace('//', '/') if i['custom_attributes']['path']!= path: #only make changes if they dont already exist i['custom_attributes']['path'] = path if i['custom_attributes']['out_path'] != out_path: #only make changes if they dont already exist i['custom_attributes']['out_path'] = out_path session.commit() print("--- %s seconds ---" % (time.time() - start_time)) return { 'success': True, 'message': 'updated task paths!' } def register(session, **kw): '''Register plugin.''' # Validate that session is an instance of ftrack_api.Session. If not, # assume that register is being called from an incompatible API # and return without doing anything. if not isinstance(session, ftrack_api.Session): # Exit to avoid registering this plugin again. return action = UpdatePaths(session) action.register() if __name__ == '__main__': logging.basicConfig(level=logging.INFO) session = ftrack_api.Session() register(session) # Wait for events. session.event_hub.wait()
  4. Hey everyone, as part of our integration process we would like to be able to make api calls "from outside". Since we need to create a session for this, we noticed a difference between python and javascript api. On python side it is possible to create a session object without giving any parameters, if the corresponding environment-variables are set correctly. In javascript this seems to be not allowed! export class Session { /** * Construct Session instance with API credentials. * * @param {string} serverUrl - ftrack server URL * @param {string} apiUser - ftrack username for API user. * @param {string} apiKey - User API Key * @param {Object} options - options * @param {Boolean} [options.autoConnectEventHub=false] - Automatically connect to event hub, * @param {Array|null} [options.serverInformationValues=null] - List of server information values to retrieve. * @param {Object} [options.eventHubOptions={}] - Options to configure event hub with. * * @constructs Session */ constructor( serverUrl, apiUser, apiKey, { autoConnectEventHub = false, serverInformationValues = null, eventHubOptions = {}, clientToken = null, } = {} ) { if (!serverUrl || !apiUser || !apiKey) { throw new Error( 'Invalid arguments, please construct Session with ' + '*serverUrl*, *apiUser* and *apiKey*.' ); } . . . Why do we have the option to create api-keys without giving it an api-user (on "ftrack-web-ui/system-preferences/API keys") when we cannot use them with the javascript api? How are we supposed to achieve external api-calls? thanks in advance Tim
×
×
  • Create New...