B2_Command_Line_Tool icon indicating copy to clipboard operation
B2_Command_Line_Tool copied to clipboard

Add --noSleep option

Open monoludic opened this issue 8 years ago • 4 comments

Currently b2 process doesn't prevent computer from getting in sleep (also called stand by) mode. When using sync command for example (which can last for hours) it can be useful to disable sleep, and enabling it again when the command is done.

This could be activated on a set of b2 commands using a flag like --noStandby or --noSleep.

monoludic avatar Feb 23 '17 08:02 monoludic

I'm afraid I don't know how to keep a computer from going to sleep from Python. Do you have any suggestions?

Would you be interested in contributing to the project? We have friendly maintainers who are happy to offer advice.

bwbeach avatar Feb 24 '17 02:02 bwbeach

Enjoyed researching details on this for you.

For linux it looks like you could potentially (w/ the needed privs of course) have the code write into the right file(s) under /sys to set the cpu's "max_cstate" to something low which should keep it from going into the higher-numbered sleep states.

http://www.breakage.org/2012/11/14/processor-max_cstate-intel_idle-max_cstate-and-devcpu_dma_latency/

Kind regards,

Paul Reiberhttp://about.me/reiber

On Thu, Feb 23, 2017 at 6:27 PM, Brian Beach [email protected] wrote:

I'm afraid I don't know how to keep a computer from going to sleep from Python. Do you have any suggestions?

Would you be interested in contributing to the project? We have friendly maintainers who are happy to offer advice.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Backblaze/B2_Command_Line_Tool/issues/327#issuecomment-282185848, or mute the thread https://github.com/notifications/unsubscribe-auth/AADlQMb_4h9uFy-qj_VSiz7eZrqLUGH7ks5rfkAKgaJpZM4MJrE8 .

PaulReiber avatar Feb 24 '17 05:02 PaulReiber

Thanks for the answers.

I don't have much time currently to implement and test this feature on all platforms.

I have some clues for Windows (OS I use most) using ctypes and this function.

monoludic avatar Feb 27 '17 09:02 monoludic

It is better to have this flag with a documented limitation ("for now it only works on Windows"), than to not have it at all. Someone can add support for other systems later.

ppolewicz avatar Feb 27 '17 11:02 ppolewicz