示例#1
0
def create_event(e, v):
    de = TEvent()
    de.imported = True
    de.started = e.get('started', False)
    de.start_ts = e.get('start_ts', None)
    de.completed = e.get('completed', False)
    de.errored = e.get('errored', False)
    de.error_message = e.get('error_message', "")
    de.video_id = v.pk
    de.operation = e.get('operation', "")
    de.created = e['created']
    if 'seconds' in e:
        de.duration = e.get('seconds', -1)
    else:
        de.duration = e.get('duration', -1)
    de.arguments = e.get('arguments', {})
    de.task_id = e.get('task_id', "")
    return de
def create_event(e, v, dt):
    de = TEvent()
    de.imported = dt
    de.id = e['id']  # id is a uuid
    de.results = e.get('results', None)
    de.started = e.get('started', False)
    de.start_ts = e.get('start_ts', None)
    # Completed is set to False since we it will be completed only when task performing import uploads all the data.
    de.completed = False
    de.errored = e.get('errored', False)
    de.error_message = e.get('error_message', "")
    de.video_id = v.pk
    de.operation = e.get('operation', "")
    de.created = e['created']
    de.min_frame_index = e.get('min_frame_index', None)
    de.max_frame_index = e.get('max_frame_index', None)
    de.duration = e.get('duration', -1)
    de.arguments = e.get('arguments', {})
    de.task_id = e.get('task_id', "")
    return de