def finish_task(state, result)
      @task.refresh
      @task.state = state
      @task.result = truncate(result.to_s)
      @task.timestamp = Time.now
      @task.save
    end
def finish_task(state, result)
      @task.refresh
      @task.state = state
      @task.result = truncate(result.to_s)
      @task.timestamp = Time.now
      @task.save
    end
Marks task completion
 @param [Symbol] state Task completion state
 @param [#to_s] result