Jump to content

New Timelog does not generate Event.


Recommended Posts

Hi everyone!

I'm creating bridge between ftrack and Jira and have a little problem with events generated in ftrack.

I've written daemon, that periodically pulls all Events from ftrack, filters them and passes to appropriate plugins.

The problem is that I also need to transfer timelogs between those two systems and ftrack doesn't generate event when creating one.

Is this normal behaviour or I messed something up? :)

 

Thx for any feedback!

Link to comment
Share on other sites

Hi @Pelle Persson

 timelogs events should appears under ftrack.update topic as following:

{
    'id': 'dda8175c9de94b91a8022ea59a336218', 
    'data': {
        'entities': [
            {'entity_type': 'Timelog', 
            'keys': ['duration', 'user_id', 'context_id', 'start', 'comment', 'time_zone_offset', 'id'], 
            'objectTypeId': 'timelog', 
            'entityType': 'timelog', 
            'parents': [
                {'entityId': '98b91a33-5ece-4b3d-8d60-f864b9ddfea0', 'entityType': 'timelog', 'entity_type': 'Timelog', 'parentId': None}, 
                {'entityId': 'fd9f5470-f8f2-4311-9c9b-47bc2fd1d6da', 'entityType': 'task', 'entity_type': 'Task', 'parentId': '784dbb7a-56e1-4121-93bd-daf6c9f42c0d'}, 
                {'entityId': '784dbb7a-56e1-4121-93bd-daf6c9f42c0d', 'entityType': 'task', 'entity_type': 'Shot', 'parentId': 'e36e4409-995e-4654-97d3-db59d31aa8cf'}, 
                {'entityId': 'e36e4409-995e-4654-97d3-db59d31aa8cf', 'entityType': 'task', 'entity_type': 'Sequence', 'parentId': '801cf9df-08b0-43d8-aba6-d4e2f63bbca9'}, 
                {'entityId': '801cf9df-08b0-43d8-aba6-d4e2f63bbca9', 'entityType': 'show', 'entity_type': 'Project', 'parentId': None}
            ], 
            'parentId': None, 
            'action': 'add', 
            'entityId': '98b91a33-5ece-4b3d-8d60-f864b9ddfea0', 
            'changes': {
                'comment': {'new': '', 'old': None}, 
                'time_zone_offset': {'new': -7200, 'old': None}, 
                'user_id': {'new': 'bcdf57b0-acc6-11e1-a554-f23c91df1211', 'old': None}, 
                'context_id': {'new': 'fd9f5470-f8f2-4311-9c9b-47bc2fd1d6da', 'old': None}, 
                'start': {'new': '2024-05-27T12:33:50', 'old': None}, 
                'duration': {'new': 600, 'old': None}, 
                'id': {'new': '98b91a33-5ece-4b3d-8d60-f864b9ddfea0', 'old': None}
            }
        }
    ], 
    'pushToken': None, 
    'parents': ['e36e4409-995e-4654-97d3-db59d31aa8cf', '784dbb7a-56e1-4121-93bd-daf6c9f42c0d', 'fd9f5470-f8f2-4311-9c9b-47bc2fd1d6da', '801cf9df-08b0-43d8-aba6-d4e2f63bbca9', '98b91a33-5ece-4b3d-8d60-f864b9ddfea0'], 
    'user': {'userid': 'bcdf57b0-acc6-11e1-a554-f23c91df1211', 'name': 'lorenzo angeli'}, 
    'clientToken': '0c9d7a0b-14f7-4e78-903c-d2ecf5fa94e8-1716813211993'}, 
    'topic': 'ftrack.update', 
    'sent': None, 
    'source': {'clientToken': '0c9d7a0b-14f7-4e78-903c-d2ecf5fa94e8-1716813211993', 'applicationId': 'ftrack.client.web', 'id': '0c9d7a0b-14f7-4e78-903c-d2ecf5fa94e8-1716813211993', 
    'user': {'username': 'lorenzo', 'id': 'bcdf57b0-acc6-11e1-a554-f23c91df1211'}
    },
    'target': '', 
    'in_reply_to_event': None
}

Hope it helps.

Link to comment
Share on other sites

Hi @Lorenzo Angeli!

Thank you for quick response.

Yes, it works if I subscribe to event_hub, but to be honest I hoped I could get it by querring for the Event object like this:

all_events = session.query('Event where created_at >= "{0}" and created_at < "{1}" order by created_at asc'.format(start_date, end_date))

So I guess not every activity in ftrack is saved in history to be querried like above. Is it for platform efficiency or you just didn't think anyone would need it?

Link to comment
Share on other sites

@Pawel Starzynski

if yuo are after timelogs, you can try something like this:
 

import ftrack_api
import arrow


session = ftrack_api.Session()
now = arrow.now()
then = now.shift(days=-100)

all_events = session.query('Timelog where start >= "{0}" and start < "{1}" order by start asc'.format(then, now)).all()
print(list(all_events))

hope it helps.
L.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...