boinc icon indicating copy to clipboard operation
boinc copied to clipboard

Add not-in-use computing prefs

Open davidpanderson opened this issue 2 years ago • 13 comments

Fixes #41 (!) Previously there were single prefs for

  • % of CPUs
  • % of CPU time
  • suspend if non-BOINC CPU load above X These applied whether or not the computer was in use. This PR adds separate prefs for when the computer is not in use. It includes both web-based and Manager interfaces for editing them. Backwards compatible; if the new prefs are not specified, it uses the old ones for both cases.

davidpanderson avatar Aug 07 '22 04:08 davidpanderson

On Windows it's failing on this:

         sim.cpp
    27>D:\a\boinc\boinc\client\sim.cpp(302,24): error C2065: 'ncpus': undeclared identifier [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]
    27>D:\a\boinc\boinc\client\sim.cpp(350,24): warning C4459: declaration of 'delta' hides global declaration [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]
       D:\a\boinc\boinc\client\sim.cpp(91,26): message : see declaration of 'delta' [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]
    27>D:\a\boinc\boinc\client\sim.cpp(405,26): warning C4458: declaration of 'apps' hides class member [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]
       D:\a\boinc\boinc\client\client_state.h(75,18): message : see declaration of 'CLIENT_STATE::apps' [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]
    27>D:\a\boinc\boinc\client\sim.cpp(415,36): error C2065: 'ncpus': undeclared identifier [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]
    27>D:\a\boinc\boinc\client\sim.cpp(456,32): warning C4477: '_snprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'unsigned __int64' [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]
       D:\a\boinc\boinc\client\sim.cpp(456,32): message : consider using '%zu' in the format string [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]
    27>D:\a\boinc\boinc\client\sim.cpp(1498,12): error C2039: 'set_ncpus': is not a member of 'CLIENT_STATE' [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]
       D:\a\boinc\boinc\client\client_state.h(71): message : see declaration of 'CLIENT_STATE' [D:\a\boinc\boinc\win_build\sim_vs2019.vcxproj]

On linux it's failing on:

DlgAdvPreferencesBase.cpp: In member function ‘wxPanel* CDlgAdvPreferencesBase::createProcessorTab(wxNotebook*)’:
DlgAdvPreferencesBase.cpp:335:9: error: cannot bind non-const lvalue reference of type ‘wxString&’ to an rvalue of type ‘wxString’
 335 |         wxString (_("Suspend computing when your computer is busy running other programs.")),
     |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DlgAdvPreferencesBase.cpp:205:45: note:   initializing argument 2 of ‘void CDlgAdvPreferencesBase::addNewRowToSizer(wxSizer*, wxString&, wxWindow*, wxWindow*, wxWindow*, wxWindow*, wxWindow*)’
 205 |                 wxSizer* toSizer, wxString& toolTipText,
     |                                   ~~~~~~~~~~^~~~~~~~~~~
make[2]: *** [Makefile:1158: boincmgr-DlgAdvPreferencesBase.o] Error 1

AenBleidd avatar Aug 07 '22 08:08 AenBleidd

@CharlieFenton, I completely agree with you. I don't push you to make it just immediately. But this change is quite significant so I believe your review is essential.

AenBleidd avatar Aug 07 '22 08:08 AenBleidd

It would reassure me while testing if the scheduler at SETI@home (or another project with the provisional web selection tools) could be re-activated so that I can test the automatic propagation of global preferences from project to project (propagation considers the time and project of the most recent update).

RichardHaselgrove avatar Aug 07 '22 10:08 RichardHaselgrove

I fixed the compile error. Oddly, it wasn't an error in VS

davidpanderson avatar Aug 07 '22 16:08 davidpanderson

I fixed the sim build error

davidpanderson avatar Aug 07 '22 16:08 davidpanderson

Codecov Report

Merging #4871 (f627b09) into master (a036709) will decrease coverage by 0.01%. The diff coverage is 0.00%.

@@             Coverage Diff              @@
##             master    #4871      +/-   ##
============================================
- Coverage     10.43%   10.42%   -0.02%     
  Complexity     1046     1046              
============================================
  Files           278      278              
  Lines         35827    35864      +37     
  Branches       8113     8127      +14     
============================================
  Hits           3739     3739              
- Misses        31717    31754      +37     
  Partials        371      371              
Impacted Files Coverage Δ
lib/prefs.cpp 0.00% <0.00%> (ø)
lib/prefs.h 0.00% <ø> (ø)
lib/cc_config.cpp 0.00% <0.00%> (ø)
sched/db_dump.cpp 0.00% <0.00%> (ø)
sched/validator.cpp 0.00% <0.00%> (ø)
sched/sched_main.cpp 0.00% <0.00%> (ø)
sched/sched_util.cpp 0.00% <0.00%> (ø)
sched/sched_types.cpp 0.00% <0.00%> (ø)
sched/sched_resend.cpp 0.00% <0.00%> (ø)
sched/sched_result.cpp 0.00% <0.00%> (ø)
... and 4 more

codecov[bot] avatar Aug 07 '22 17:08 codecov[bot]

I put the new web code on Science United.

davidpanderson avatar Aug 07 '22 19:08 davidpanderson

@davidpanderson Since you are still making changes, please let me know when you are done so I can review the code in its final form.

CharlieFenton avatar Aug 10 '22 07:08 CharlieFenton

I'm done AFAIK.

davidpanderson avatar Aug 10 '22 07:08 davidpanderson

For the record, there was not a lot of feedback on the forums, BOINC or on the handful of projects I posted to. This is why I am an engineer and not in marketing. It was mostly good feedback, though.

However, I did like one suggestion:. https://www.worldcommunitygrid.org/forums/wcg/viewthread_thread,44227_offset,0#674683

"Resume when no mouse/keyboard input in last -- minutes"

Vulpine05 avatar Aug 10 '22 13:08 Vulpine05

This window is too big even now on Gnome3: #1872

Maybe we should brainstorm this to redesign Preferences window completely? Since we're not planning a new release next few months, I could find some time to work on this topic.

AenBleidd avatar Aug 12 '22 11:08 AenBleidd

May I add the resolutions of two of my screens:

1920 x 1200 1600 x 1200

They're desktop IPS screens, marketed under the 'DELL Ultrasharp' brand, so not entirely niche. Obviously, the increased height means they are less affected by this issue - but we must remember to design for different aspect ratios, as well as different pixel counts. I've kept an old CRT multisync monitor in the museum to test the edge cases...

RichardHaselgrove avatar Aug 12 '22 11:08 RichardHaselgrove

I can trim 5 lines from the dialog and tighten up the spacing a little; that should restore it to the previous size

davidpanderson avatar Aug 12 '22 18:08 davidpanderson

I shortened the dialog quite a bit; it's just slightly longer than the old one.

I'm not going to selectively disable the in-use items for now. We could eventually do this, but the issue existed before this PR.

davidpanderson avatar Aug 12 '22 23:08 davidpanderson

I'm not going to selectively disable the in-use items for now. We could eventually do this, but the issue existed before this PR.

Before this PR, all items in this dialog still applied whether or not the "Suspend when computer is in use" checkbox was set. While I recognize that doing this requires significant additional effort, I cannot approve this PR without this because good UI practice dictates it and the dialog is confusing without it.

I will resume reviewing this PR when the 2 changes I requested have been completed.

CharlieFenton avatar Aug 13 '22 07:08 CharlieFenton

Actually there were separate memory limits for in use and not in use. The in-use setting was not grayed out if suspend-while-in-use was set.

I think it's fine the way it is. Not confusing.

On Sat, Aug 13, 2022 at 12:28 AM CharlieFenton @.***> wrote:

I'm not going to selectively disable the in-use items for now. We could eventually do this, but the issue existed before this PR.

Before this PR, there were all items in this dialog still applied whether or not the "Suspend when computer is in use" checkbox was set. While I recognize that doing this requires significant additional effort, I cannot approve this PR without this because good UI practice dictates it and the dialog is confusing without it.

I will resume reviewing this PR when the 2 changes I requested have been completed.

— Reply to this email directly, view it on GitHub https://github.com/BOINC/boinc/pull/4871#issuecomment-1213911577, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHQVAJFGLCTUXT3OCCISWLVY5FA3ANCNFSM55ZZSFTA . You are receiving this because you were mentioned.Message ID: @.***>

davidpanderson avatar Aug 13 '22 08:08 davidpanderson

Actually there were separate memory limits for in use and not in use. The in-use setting was not grayed out if suspend-while-in-use was set.

OK, I see that now. But they were not on the same tab / page as the checkbox in question, so this was less of an issue than it is for the new changes. Still, that was definitely an oversight which we should have fixed earlier. It is good that we can fix it now.

CharlieFenton avatar Aug 13 '22 09:08 CharlieFenton

Now that the items in the Advanced Prefs dialog have been rearranged and in some cases two items have been combined into one, they no longer match the arrangement on the new web prefs forms. Is that a problem?

Backward compatibility questions:

  • How will the new web prefs interact with older versions of the BOINC Manager, and how will the new BOINC Manager prefs dialog interact with older web prefs on projects that are slow to upgrade their web interface?
  • How will the changes affect the migration of updated web preferences between projects that have and have not updated their web interface?
  • How will a new version of BOINC Manager work with a remote older version of the client, and vice versa?
  • If a user installs a new version of BOINC Manager and uses the new Advanced Prefs dialog, then reverts to an older version of BOINC, how will the client handle the unrecognized XML tags in global_prefs.xml?

CharlieFenton avatar Aug 13 '22 09:08 CharlieFenton

Backward compatibility questions:

To which add:

  • compatibility with third-party implementations, like Einstein's Drupal

There's still no scheduler at SETI, so I can't even start testing:

13/08/2022 11:53:23 | SETI@home | Scheduler request failed: HTTP file not found

RichardHaselgrove avatar Aug 13 '22 10:08 RichardHaselgrove

This window is too big even now on Gnome3: #1872

Maybe we should brainstorm this to redesign Preferences window completely? Since we're not planning a new release next few months, I could find some time to work on this topic.

I know in AutoCAD, one of their setting windows has left and right arrows to "flip" through settings on a tab. That could probably be done under the compute tab to cycle between in use, not in use, and general?

Vulpine05 avatar Aug 13 '22 13:08 Vulpine05

The help page for this dialog will also need to be updated. A recent message from the boinc_projects email list also reminded me that this has not been kept up to date; there is no mention of the Suspend when no mouse/keyboard input in last xx minutes item on the current Advanced Computing Preferences dialog.

CharlieFenton avatar Aug 13 '22 22:08 CharlieFenton

I know in AutoCAD, one of their setting windows has left and right arrows to "flip" through settings on a tab. That could probably be done under the compute tab to cycle between in use, not in use, and general?

A simpler and probably clearer option would be to make the dialog wider and put the "when in use" and "when not in use" sections side by side, with a divider line between them. This just requires adding one more boxsizer to the code.

CharlieFenton avatar Aug 14 '22 00:08 CharlieFenton

A simpler and probably clearer option would be to make the dialog wider and put the "when in use" and "when not in use" sections side by side, with a divider line between them. This just requires adding one more boxsizer to the code.

That sounds better to me!

Vulpine05 avatar Aug 14 '22 01:08 Vulpine05

@davidpanderson I got tired of waiting for you so I went ahead and updated the code to disable those items which don't apply when Suspend when computer is in use is set.

To be consistent with the existing code, their values are restored to defaults when they are again enabled. I think it would be better if all items which can selectively be disabled (based on the state of a checkbox) were restored to their last saved values when re-enabled rather than the defaults. Unfortunately, that is beyond the scope of this PR.

I also added the missing /*xgettext:no-c-format*/.

CharlieFenton avatar Aug 14 '22 10:08 CharlieFenton

Richard's compatibility questions need to be addressed.

I'll write to Eric Korpela and Jeff Cobb tomorrow and see if they can help with the missing scheduler.

RichardHaselgrove avatar Aug 14 '22 10:08 RichardHaselgrove

We're not going to revive SETI@home to test a web feature. The feature is deployed on Science United and can be tested there.

davidpanderson avatar Aug 14 '22 20:08 davidpanderson

What is the pixel height of the dialog on the problem system? What is the screen size?

davidpanderson avatar Aug 14 '22 20:08 davidpanderson

AFAIK there are no compatibility issues. If the new client gets a set of prefs from a project that doesn't include the not-in-use prefs, it will use the corresponding in-use prefs, i.e. it will behave like the old client.

If an old client gets a set of web prefs that includes the new prefs, it will ignore them. (the web GUI has a warning to this effect)

All combinations need to be tested, of course.

davidpanderson avatar Aug 14 '22 20:08 davidpanderson

We're not going to revive SETI@home

I'm not asking for the project to be revived. I'm asking for a scheduler to to be in place to respond to random requests. That would have the useful side effect of enforcing the 24 hour delay that was put in place after the hibernation - reducing Berkeley's bandwidth costs.

RichardHaselgrove avatar Aug 14 '22 21:08 RichardHaselgrove

@davidpanderson: On the subject of compatibility: My understanding is that with the current Advanced Computing Preferences Dialog (as of BOINC 7.20.2) these items always apply both when the computer is not in use, and if the suspend when not in use checkbox is not set they also apply when the computer is in use:

  • Use at most xx% of the CPUs - max_ncpus_pct
  • Use at most xx% ofCPU time - cpu_usage_limit
  • Suspend when non-BOINC CPU usage is above xx% - suspend_cpu_usage

Therefore, when a user installs a future version of BOINC to replace 7.20.2, BOINC should propagate these items to the new "when not in use" prefs, to preserve the behavior the user has previously requested without requiring her to run the Advanced Computing Preferences Dialog after upgrading BOINC:

  • Use at most xx% of the CPUs - niu_max_ncpus_pct
  • Use at most xx% ofCPU time - niu_cpu_usage_limit
  • Suspend when non-BOINC CPU usage is above xx% - niu_suspend_cpu_usage

Please make sure that this automatic propagation is in the code for this PR.

CharlieFenton avatar Aug 15 '22 09:08 CharlieFenton