Remus Avram

Members
  • Content Count

    486
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Remus Avram

  1. Thanks @Mattias Lagergren for the quick answer. Right! Related issue. Different entity. Nice to hear that you are working on a fix
  2. Hi @Mattias Lagergren, thanks for the advise. This means the database is already indexed by you as you think it's the best for the studios, right?
  3. Thanks @Mattias Lagergren for the explanation. What do you mean by job?
  4. Hi Ftrack Team, I see that there are 5 types of action: add, update, remove, move and job_updated. I am wandering for what job_updated is used for? Best, Remus
  5. Thanks @Mattias Lagergren for you answer. But is it possible to manually re-register all the plugins from a folder? For example i am updating the code of a plugin. In this way the plugin will not be registered again and the new code will not be in use. On the Ftrack server side we are checking every X minutes if there is new code pushed, and if it is, then it is re-launching the actions. Is it possible to do something similar for the Ftrack-Connect?
  6. Hi Ftrack Team, I was checking the Ftrack documentation regarding the database and I didn't find anything about indexing it. Is the database already indexed by you as you think is the best, or do we need to re-index it based on the query logs? Best, Remus
  7. Thanks @Lucas Correia! In this way it works. I didn't think in this way
  8. If I create a new version and then I query the asset again, then the new version is not included in the asset['versions']. Example: asset = session.query("Asset where versions.task.id is '{0}'".format(task['id'])).one() print len(asset['version']) session.create('AssetVersion', {'asset': asset, 'task': task, 'version': 13, 'status': status, } ) session.commit() asset = session.query("Asset where versions.task.id is '{0}'".format(task['id'])).one() print len(asset['version']) ------- Returns 2 2
  9. Hi @Mattias Lagergren can you please give us an example? I tried like this: session.create('AssetVersion', {'asset': asset, 'task': task, 'version': 0, 'status': status } ) self._session.commit() Using version 0 will just create a new version, not version 0.
  10. Remus Avram

    Manage Roles

    Thanks @Mattias Lagergren!
  11. Remus Avram

    Manage Roles

    Hi @Mattias Lagergren any updates regarding this issue?
  12. Hi @keyframe we have this already implemented in our system. Let me know if you need any help with it.
  13. Thanks @Eric Hermelin for taking a look! Cleaning the session or re-populating the data works as a workaround. But for long term I hope it will fetch the right data once we query the shot again. There are too many places where we need to patch it, and for users which don't have experience in programming (artists), it's difficult to explain.
  14. Hi all, I have a shot queried from DB via ftrack_api. I update a custom attribute of the respective shot. Then, in the same session, I query the shot again. The custom attribute of the respective shot is not updated even after I queried the shot again. Please find below an example: def test_query_custom_attributes(self): def update_custom_attribute(test_asset): new_session = ftrack_api.Session() same_test_asset = new_session.query("AssetBuild where id is '{0}'".format(test_asset["id"])).one() same_test_asset['custom_attributes']['delivery_name'] = "unittest" new_session.commit() test_asset = self._session.query("AssetBuild").first() delivery_name = test_asset['custom_attributes']['delivery_name'] update_custom_attribute(test_asset) test_asset = self._session.query("AssetBuild where id is '{0}'".format(test_asset["id"])).one() new_delivery_name = test_asset['custom_attributes']['delivery_name'] self.assertNotEqual(delivery_name, new_delivery_name) self._session.cache.clear() test_asset = self._session.query("AssetBuild where id is '{0}'".format(test_asset["id"])).one() new_delivery_name = test_asset['custom_attributes']['delivery_name'] self.assertNotEqual(delivery_name, new_delivery_name) Clearing the cache and fetching the shot again from the database works.
  15. We were able to reproduce the issue `int() argument must be a string or a number, not 'Symbol'` and I can confirm that this is fixed. Tested in Ftrack version `3.5.6` with ftrack_api version `1.3.2`. Thanks for this fix
  16. Is there a way to refresh the webpage through ftrack_api after the script finished running?
  17. +1 Related: https://forum.ftrack.com/topic/815-csv-import-notes/
  18. Hi @Mattias Lagergren, thanks for the thoughts. Both other ways have downsides. The Ftrack notification system is really nice and using it for custom notifications will be great.
  19. Remus Avram

    Manage Roles

    No, It doesn't. Instead clearing the cache and querying the data again works. > print len(user['user_security_roles']) 2 > del user['user_security_roles'] > user = get_ftrack_user(username="unittest_artist") > print len(user['user_security_roles']) 2 > session.cache.clear() > user = get_ftrack_user(username="unittest_artist") > print len(user['user_security_roles']) 1
  20. As a workaround we run a script every X minutes which adds the uses added only to the groups to the project, too. """ @package bin.check_projects_members @brief Check if the members of the projects have been added to the project. @details If the user has been added to the project group, but not to the project, then we need to add him/her to the project @author remusav """ import logging import ftrack_session_manager log = logging.module_logger(__name__) session = ftrack_session_manager.main_session def get_grouped_users(project): """ @param project: Ftrack Project @return list() of all grouped users from the project """ grouped_users = [] for allocation in project['allocations']: user_or_group = allocation['resource'] if user_or_group.entity_type == "Group": for membership in user_or_group['memberships']: grouped_users.append(membership['user']) return grouped_users def get_project_users(project): """ @param project: Ftrack Project @return list() of all users added to the project """ users = [] for allocation in project['allocations']: user_or_group = allocation['resource'] if user_or_group.entity_type == "User": users.append(user_or_group) return users def add_user_to_project(user, project): """ Add the user to the Ftrack project @param user: Ftrack user @param project: Ftrack project """ try: session.create("Appointment", {"context": project, "resource": user, "type": "allocation" }) session.commit() log.info("user '{0}' added to project '{1}'".format(user['username'], project['name'])) except Exception, e: session.rollback() log.error("user '{0}' couldn't be added to project '{1}'".format(user['username'], project['name'])) log.error(e) def main(): """ Main function. """ projects = session.query("Project where status is 'active'").all() for project in projects: grouped_users = get_grouped_users(project=project) project_users = get_project_users(project=project) users_not_assigned_to_project = set(grouped_users) - set(project_users) for user in users_not_assigned_to_project: add_user_to_project(user, project) if __name__ == '__main__': main()
  21. Remus Avram

    Manage Roles

    Hi @Björn Rydahl, any updates regarding the issue above? "5. Can not add and then get added roles in the same session:"
  22. Hi all, is it possible to send custom notifications via ftrack_api? We are automating a lot with actions. But this creates also a lot of confusion. We need to communicate better to the users. We are using the pop up messages, but these are displayed only for 5 seconds. Sometimes the user is missing them, sometimes the message is going away before he/she finishes reading it. Sending notifications to the user will help a lot in understanding what is happening.
  23. It would be nice to be able to search for the user by username, first name and last name.
  24. Hi all, how can I assign a user to a project via ftrack_api? I tried with: session.create("Appointment", {"context": project, "resource": user, "type": "assignment" }) session.commit() but I get the following error: Server reported error: ValidationError(Appointment of type "assignment" cannot be created for "user" and "show") But if I get an existing appointment of a project and inspect the data: (Pdb) for k in allocation.keys():print k, ': ', allocation[k] resource : <User(55095a4c-4839-11e6-a626-005056a745dd)> resource_id : 55095a4c-4839-11e6-a626-005056a745dd context_id : 28d104b6-8be5-11e7-a763-005056a745de context : <Project(28d104b6-8be5-11e7-a763-005056a745de)> type : allocation id : 0b60299c-a469-11e7-aa6e-005056a745de the context is a project and the resource is a user.