'Determine overall state of a task.'

def _fixup_task_state(self, tip):

    if tip.complete:
        tip.state = 'succeeded'
    elif tip.failed:
        if (not tip.execStartTime):
            tip.state = 'killed'
        else:
            tip.state = 'failed'
    elif tip.execStartTime:
        tip.state = 'running'
    else:
        tip.state = 'pending'
    global VALID_TASK_STATES
    assert (tip.state in VALID_TASK_STATES)
