UPDATE: since updating to macOS 10.14 this issue is not occurring to me anymore.

I have a long running Python process (using multiprocessing), run from Terminal, and regularly come back to it realizing that it has been suspended for several hours while I was away from the Mac. The moment I get back to it it's running again at normal speed (it's displaying a progress bar in Terminal). This is despite:

  • checking "prevent computer from going to sleep automatically when the display is off" in the Energy Saver preferences panel
  • running caffeinate from the parent process (Popen('caffeinate')), which does show up in the Energy section of Activity Monitor
  • Using appnope to begin an activity with NSActivityUserInitiated | NSActivityLatencyCritical

This happens on multiple Computers, but has only started happening recently, i.e. I don't think it occurred before 10.13.

Why could this be occurring, and what other means are there to investigate or prevent it?

  • 1
    Not sure what's going wrong despite running caffeinate command. Installing and running a dedicated app that prevents the Mac from sleeping does the trick for me. You can give KeepingYouAwake Menu Bar app (github.com/newmarcel/KeepingYouAwake) a try and see if that resolves your problem. – Nimesh Neema May 2 '18 at 13:19
  • 2
    I don't think the computer is going to sleep – I suspect it might be App Nap. I am trying whether appnope helps. – christianbrodbeck May 2 '18 at 18:16
  • 1
    Have you had any luck with appnope? – jmh May 2 '18 at 18:49
  • 1
    I won't know until I leave the computer alone for a while :) , I will report back – christianbrodbeck May 2 '18 at 18:56
  • 1
    I suspect the reason was that I designated my processes as daemon. Since I removed that designation I haven’t seen the issue. – christianbrodbeck May 4 '18 at 14:48

You must log in to answer this question.

Browse other questions tagged .