Jakub Trllo

Members
  • Content Count

    15
  • Joined

  • Last visited

About Jakub Trllo

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I'll extend the question. Is possible to set custom attributes for multiple entities at once? ISSUE: I have dictionary where key represents id of ftrack entity and value represents a value of one specific custom attribute. I would like to set them all at once (or as fast as possible in other words). NOTE: I have also ftrack entities at the moment I need to change values of the custom attribute. But when I'll use `entity["custom_attributes"]["{specific_key}"] = value` to change value it takes on average 0,2 second (60 seconds for whole project). It's probably because every time is used `custom_attributes` key on entity, api is querying values of custom attributes? I assume that it is not possible to use UPDATE of INSERT queries, right? Thanks, Jakub EDITED: Found out that session has recorded_operations where I can put UpdateEntityOperation. With this it takes less then 0.1 for whole project, GREAT Is this usage "kosher"?
  2. Hi, I think one pssibility is to use "hidden" item in interface items (http://ftrack.rtd.ftrack.com/en/stable/developing/actions.html#hidden), where you can store if you are in widget A or widget B so you can regonize from "values" of event which values are you procesing at the moment. Another possibility is to register multiple callbaks. Callback A will always trigger callback B but if item is Sequence then will trigger mid-widget. Example c ode in attachment (not tested nor runned!). Jakub example.py
  3. Jakub Trllo

    Faster querying

    Hi, I have a question: Is there any faster possibility of getting all entities from project than with code below? ```PYTHON # ft_project_id - Project's ID entities_query = ( "select id, name, parent_id, link, custom_attributes" " from TypedContext where project_id is \"{}\"" ) all_project_entities = session.query( entities_query.format(ft_project_id) ).all() ``` It's actually pretty fast (0.027s/entity) but with 4500 entities in project it takes 2 minutes. EDITED: Found out that when custom_attributes are not in query it is much faster (from 2 minutes -> 6 seconds), so it was my fault. Thanks, Jakub
  4. Hi, Thanks! That is very helpful snippet. I have addition question: We need to get all hierarchical values for each entity in project, with this snippet it will probably take ages... Is possible to modify query to be able get values for multiple entities and custom attributes at once. Or when we'll add more query actions to `data` argument to `session.call` method they'll be processed without request to ftrack server for each entity and custom attribute? EDITED: I've modified the query to get all at once and it actually works and returns only data of really set entities. So now I only have to go through parents and find values of attributes that are not set, so I'm happy now. Thanks again Jakub
  5. Hi, have this issue any progress? Any suggestions how hierarchical custom attributes may return expected values or "real" values (not default) through ftrack API? Thanks, Jakub Trllo
  6. Hi, >> If you want it to return None, you simply have to leave the default value empty, tested now and seems to be working as expected. That's what we are recommending now but our clients mess it up sometimes. >> Setting the default value on the custom attribute indeed override the None if the value is not set, that's what is for. I expect the same `only` if it is not hierarchical attribute - hierarchical attributes should have different properties in API because they have different properties in web app and I don't want to get default value if any of parents value is set. Or better I want to get default value of hierarchical attribute only on project entity if do not have set it because that's top entity. On lower entities doesn't make sence return default value because may return nonsence data (like in example upwards). Exist a way how to get information about custom attribute is set or not on entity? Special query or something? That's all I need at the moment... Thanks, Jakub
  7. Hi, I hope this issue is not caused because we don't have newest ftrack_api version and please let me know if we're handling with old issue. Hierarchical custom attributes makes us unhappy at the moment. Api do not return `None` if default value is set which breaks everything with hierachical attributes for us. Example: Hierarchical Custom attribute `hier_attr` with default value `100` in hierarchy: - project_xy - `hier_attr` is set to `50` / API will return `50` -- hier_1 - `hier_attr` is set to `200` / API will return `200` --- hier_1_1 - `hier_attr` is not set / API will return `100` If value is not set, `None` should be returned (which is acceptable possibility), or `200` in this case and only if all parents don't have set that custom attribute's value then default should be returned like values in web app. Second variant is better for us, but first one also make sence and meets the documentation. Is that possible? Thanks, Jakub Trllo
  8. Hi, Yes but it is strange for me because it is 1 frame more. E.g. mov with 120 frames has `frameIn = 0` and `frameOut = 120` which makes 121 frames (with my logic). But it works, Thanks. Jakub
  9. Hi @Remus Avram, may I ask what was the issue and the solution? We have the same issue. Thanks, Jakub
  10. Hi @Lorenzo Angeli, reset helped out . I'm a little bit afraid that something bad will happen when 100 replies will be added at once... Thanks! Jakub
  11. Hi, I've probably found a `bug` in ftrack_api, When I'm creating multiple notes on entity it works correctly but when a reply on one of those notes is added then on next following note commit session crashes. Example code: task = session.query('Task').first() user = session.query('User').first() # This will work as expected task.create_note('Note 1', user) session.commit() task.create_note('Note 2', user) session.commit() # This will crash note3 = task.create_note('Note 3', user) session.commit() note3.create_reply('Reply 1', user) session.commit() task.create_note('Note 4', user) session.commit() # On this line Reason is missing recipient. I've tried to create it manually but I didn't found out what `resource_id` represents. I need it working ASAP, please help. Thanks!
  12. Found out the mistake I've made because of you. I am using same session for all actions. Seems like not good idea when working with "ftrack.server" location, loose it's definition (probably on session.reset()?). Thanks
  13. I've cut off all unnecessary parts of code and modified it to the most basic script that should work(i think): import ftrack_api session = ftrack_api.Session( auto_connect_event_hub=True, server_url='https://myapp.ftrackapp.com', api_key='xxx-xxx-xxx-xxx-xxx', api_user='my.user.name' ) server_location = session.query( 'Location where name is "ftrack.server"' ).one() # just pretend that note with component will be queried... note = session.query('Note').first() for note_component in note['note_components']: component = note_component['component'] download_url = server_location.get_url(component) # This is line where error is raised path = r'C:\Users\my.user.name\test' + component['file_type'] download_file(download_url, path) def download_file(url, path): r = requests.get(url, stream=True).content with open(path, 'wb') as f: f.write(r)
  14. Hi, I've actually tried API documentation part: ``` server_location = session.query( 'Location where name is "ftrack.server"' ).one() for note_component in note['note_components']: print 'Download URL: {0}'.format( server_location.get_url(note_component['component']) ) ```
  15. Hi, I'm trying out how to download images from notes but when I want call Location.get_url(note_component[component]), session crashes with: AttributeError: 'Symbol' object has no attribute 'get_url'. I've found out that "ftrack.server"'s Location accessor stays set to ftrack_api.symbol.NOT_SET. When I tried same code for "ftrack.unmanaged" it worked correctly. Can you help me what can be wrong on my side? Thanks!