What is the most logical course of action if your P.I does not write you a letter of recommendation in time even though s/he said that s/he would? Context:
I am an undergrad, and working in a research group over 7 months now. I have asked my P.I (group leader) whether he would write me a recommendation letter one month before the deadline of Master's programs, and he said that he would.

Now, the deadline was yesterday, and he haven't write me any letter. I have reminded him the letter regularly via email, and he responded positively, and when I reminded him again just one day before the deadline, he said that he will write it after finishing a report, and still there is no letter.

What is the most logical course of action in this case?
I'd say your best course of action is to notify the institution that you are applying to that there has been a delay, and to find someone else who can write you a recommendation within a week's time. The admissions department is likely to have a little bit of grace period for you to work with, but probably not more than a few working days. That said, they may not accept the late recommendation, but it is worth trying.