Does this mean that any cop who does not give up his life in the line of fire can be prosecuted?
The question is not whether a cop is duty bound to sacrifice his life. The question is, just what do we demand from those to whom we entrust the public safety? And I believe that you know that.
In this case, answer honestly. Why was an armed cop in the school in the first place?
If the answer is, "To stop anyone who tries to harm the teachers and children", you have the answer to your question.
If the answer is to hide and clean up the carnage, inevitably the question becomes, "Why give him a gun and have him patrol the grounds"? I do believe you support the idea that with the use of a firearm comes responsibility. In this case, we armed a security officer and gave him responsibility to protect the children. It should be clear when a person accepts that responsibility if we expect him to put himself in danger or if it's acceptable to hide when a stand gunman shows up.