Gen. David H. Petraeus warned at a pomp-filled retirement ceremony on Wednesday that the nation’s leaders, faced with tough budget decisions, should be careful not to cut the military’s budget too deeply in the years ahead. The vast majority of the hour-long ceremony at Fort Myer in Arlington celebrated Petraeus’s 37 years of military service and his six years of leading troops in Iraq and Afghanistan since 2003.