SPARK-3874, Provide stable TaskContext API

Actually this looks good - we use isCompleted elsewhere already in user-facing code.