tdugard

Members
  • Content Count

    14
  • Joined

  • Last visited

  1. tdugard

    Event_hub history

    I managed to do it another way not using the event but just the ftrack id of the entity and recurse creation of its ancestors. But last thing the : session.get('Context', id) returns a correct value for Project, Task, Shot, AssetBuild but return None for Note, AssetVersion, Asset how can i know exactly the type of object with only the id ?
  2. tdugard

    Event_hub history

    Hello, i've got a new problem trying to use the event table. When i create shot with a shot template (shot + task) the task are registering event before the shot, here is the output of my tool : 2020-11-23 18:40:44,118 - [ERROR] [#117319] Can't create the task "FX" <ftrack_id:fafc2d40-2db2-11eb-b45c-6e9c55d3c1f9>, missing parent in database <ftrack_id:ed267a70-2daa-11eb-a478-6e9c55d3c1f9> 2020-11-23 18:40:44,359 - [ERROR] [#117320] Can't create the task "Compositing" <ftrack_id:fafbcb16-2db2-11eb-b45c-6e9c55d3c1f9>, missing parent in database <ftrack_id:ed267a70-2daa-11eb-a478-6e9c55d3c1f9> 2020-11-23 18:40:44,631 - [ERROR] [#117321] Can't create the task "Cloth" <ftrack_id:fafb6400-2db2-11eb-b45c-6e9c55d3c1f9>, missing parent in database <ftrack_id:ed267a70-2daa-11eb-a478-6e9c55d3c1f9> 2020-11-23 18:40:44,891 - [INFO] [#117322] Shot "test_project/3000" created <id:5fbbf41cac16c5229f32aa67, ftrack_id:faeffd18-2db2-11eb-b45c-6e9c55d3c1f9> 2020-11-23 18:40:45,233 - [INFO] [#117323] Task "test_project/3000/Animation" created <id:5fbbf41dac16c5229f32aa68, ftrack_id:fafac54a-2db2-11eb-b45c-6e9c55d3c1f9> 2020-11-23 18:40:45,551 - [INFO] [#117324] Task "test_project/3000/Lighting" created <id:5fbbf41dac16c5229f32aa69, ftrack_id:fafe5f84-2db2-11eb-b45c-6e9c55d3c1f9> 2020-11-23 18:40:45,892 - [INFO] [#117325] Task "test_project/3000/Post_Animation" created <id:5fbbf41dac16c5229f32aa6a, ftrack_id:faf84144-2db2-11eb-b45c-6e9c55d3c1f9> 2020-11-23 18:40:46,220 - [INFO] [#117326] Task "test_project/3000/Matte_Painting" created <id:5fbbf41eac16c5229f32aa6b, ftrack_id:fafd8708-2db2-11eb-b45c-6e9c55d3c1f9> 2020-11-23 18:40:46,608 - [INFO] [#117327] Task "test_project/3000/Mocap" created <id:5fbbf41eac16c5229f32aa6c, ftrack_id:fafd2a60-2db2-11eb-b45c-6e9c55d3c1f9> 2020-11-23 18:40:46,944 - [INFO] [#117328] Task "test_project/3000/Assembly" created <id:5fbbf41eac16c5229f32aa6d, ftrack_id:fafdea18-2db2-11eb-b45c-6e9c55d3c1f9> You can see the first 3 events : 117319, 117320, 117321 are tasks related to the shot created at event 117322. All remaining task (event 117323-117328) are cloned correcty.
  3. tdugard

    Event_hub history

    The problem is i can't rely on session.get('Context', id) because of the delete operation. When i check a 'delete' event, i can't use that fonction because this entity no longer exists. So i can't check its type when it's a deletion. I managed with lot's of if/else to identify the entity (actually i don't need to reproduce every table of ftrack db just the main ones). Do you planned to rework the event in db so the event hub and event in db are formatted the same way ? That's strange about the users because the eventhub fires an event for user creation/deletion/update. Maybe i can make a second script to watch the user table instead of Events
  4. tdugard

    Event_hub history

    OK i see how to do that, thanks, but when i tried to manage shot and user events doing queries to the database, i found some bugs : When i got a "Project' event (insert, remove, update, move) the parent type is a show so i think it's the correct behavior but when i got a "Shot" event (insert, remove, update, move) the parent type is a task ? Why a task ? Maybe i'm doing it wrong to know the entity concerned by the event. When i create a user there is no event added to the Events table in ftrack database ! When i used the eventhub callback (my previous solution), user's events (create, delete, update) were triggered. Is it normal ?
  5. tdugard

    Event_hub history

    I successfully replaced the connection to the eventhub with a custom script querying the ftrack database event using the api but i have one last simple question : Actually i am doing 2 requests to the database : event = session.query('Event where id is "{}"'.format(event_id)).first() events = session.query('Event where created_at > "{}"'.format(event['created_at'])) Is it possible to merge it as one query ?
  6. tdugard

    Event_hub history

    Yes that's what i was looking for ! I can save the last processed event id and then when i reopen my callback i just have to process events that are newer than this id
  7. tdugard

    Event_hub history

    So it's not possible to have the event history with an online ftrack setup ? I came from an another production management software where all the events are stored in logs which was really useful. I think this is a must have feature to develop a strong pipeline.
  8. tdugard

    Event_hub history

    Hello everyone, I'm trying to use the eventHub to replicate ftrack actions into a local database. Everything is working fine but i have 2 questions : It is possible to subscribe to the event_hub with a debug flag to show crashes ? because actually when something went wrong, no exception is raised. To make it solid i need to access the event history. Because if my callback program crashes( (internet failure, machine crashes, or code crashes) i need to know what happenned since the last event I had replicated in my local database. So i can process all the missing events when the callback script is running again. Thanks for reading this,
  9. The user is just running the tool with a custom launcher written in python (so it's like running a command line) . I have a program called explorer which query ftrack to get all the projects/shot/task information for the user. Once he have choose a task the explorer launch the correct software with the correct context. I don't use ftrack connect. I have my own database for our projects, the goal is to work with the local DB and replicate the data in the ftrack one to use the Web UI to manage projects easily
  10. I want the user to query the ftrack database using my python tool (listing projects, pick a shot, task, etc...) but i need this user to be bounded to his permissions. The global API keys aren't limited to the user's role so i need to use the user's key but i don't know how to get it to set the environment variable. The best way in my opinion is to ask the user for his ftrack login/pass to request his API key. But maybe i'm wrong...
  11. Hello, i've tried again but still stuck. If someone can help me with this problem My previous message explains everything. I can't find in the help file the way to use the user api key, so in the session creation i use a global one that I've created. But when i use it the queries aren't bounded to the user's permission
  12. That's the problem, i've tested my code with 2 differents users : me : I can see every project user2 : who can see only one project in his web browser And the result of the query Project where status is active is the same for both user. That's why i'm asking for help to know where is the problem. Is it because i use the same global api_key i've created ? Do i need to use user's api key ? if its the only way how can i get this key by code ?
  13. Thanks for the quick reply, but the problem i see here is that a user with some coding skill can easily create a function using environment variables that can show the entire project list and can query everything ? Even if in webview he can't see all the projects.. The better solution is to use the user auth_key to connect to the session but i have no clue how to request it via user/password because actually i'm using a global API_key that i have created in Security > Api Keys Like you said i need the result bounded to the user permissions. How can i acheive that ?
  14. Hello everyone, I've recently begin to connect my studio tool to ftrack via the ftrack python API, but something is bothering me. I've generate an API key for the pipeline tool and i'm using it with a user account Here is a part of my code import ftrack_api import os os.environ['FTRACK_SERVER'] = 'https://myserver.ftrackapp.com' # the generic API key os.environ['FTRACK_API_KEY'] = 'my_api_key' # the user name session = ftrack_api.Session(api_user='the_user') def get_project_id_by_name(project_name): project_id = session.query('select id from Project where name is "{0}"'.format(project_name)).first() return project_id def get_shots_by_project(project_id=None): shots = session.query('Shot where project.id is "{0}" order by name asc'.format(project_id)) return shots project_id = get_project_id_by_name("project_name") shots = get_shots_by_project(project_id) for shot in shots: print(shot['name']) The problem i'm facing is that everything returned by the querie is always the same for all users because of the API_key (all project, all task). Is there a way to restrict the result the the user scope (like the user can see in the we interface, only project he can see). It may be because i'm not using user's API key, i really don't know how to manage to work with it. Because i haven't found a way to retreive this user's key with a user/pass function. If you have a clue ? Do i really have to filter everything by the user (it will be my next step if i can't find another way) ? Thanks