Skip to content

Commit

Permalink
Merge pull request #5076 from BOINC/dpa_prefs3
Browse files Browse the repository at this point in the history
Manager: don't clear in-use prefs when disable in-use computing
  • Loading branch information
davidpanderson authored Feb 7, 2023
2 parents 179aa32 + 8c0502b commit 891f481
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
2 changes: 1 addition & 1 deletion client/cs_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ int CLIENT_STATE::handle_scheduler_reply(
// BAM! currently has mixed http, https; trim off
char* p = strchr(global_prefs.source_project, '/');
char* q = strchr(gstate.acct_mgr_info.master_url, '/');
if (gstate.acct_mgr_info.using_am() && p && q && !strcmp(p, q)) {
if (!global_prefs.override_file_present && gstate.acct_mgr_info.using_am() && p && q && !strcmp(p, q)) {
if (log_flags.sched_op_debug) {
msg_printf(project, MSG_INFO,
"[sched_op] ignoring prefs from project; using prefs from AM"
Expand Down
46 changes: 19 additions & 27 deletions clientgui/DlgAdvPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,26 +277,23 @@ void CDlgAdvPreferences::DisplayValue(double value, wxTextCtrl* textCtrl, wxChec
textCtrl->Enable();
}

void CDlgAdvPreferences::EnableDisableInUseItem(wxTextCtrl* textCtrl, bool doEnable, double value) {
void CDlgAdvPreferences::EnableDisableInUseItem(wxTextCtrl* textCtrl, bool doEnable) {
if (doEnable) {
if (! textCtrl->IsEnabled()) {
textCtrl->Enable();
DisplayValue(value, textCtrl);
}
} else {
textCtrl->Clear();
textCtrl->Disable();
}
}

void CDlgAdvPreferences::EnableDisableInUseItems() {
bool doEnable = !(m_chkProcInUse->IsChecked());
EnableDisableInUseItem(m_txtProcUseProcessors, doEnable,
prefs.max_ncpus_pct > 0.0 ? prefs.max_ncpus_pct : 100.0);
EnableDisableInUseItem(m_txtProcUseCPUTime, doEnable, prefs.cpu_usage_limit);
EnableDisableInUseItem(m_txtProcUseProcessors, doEnable);
EnableDisableInUseItem(m_txtProcUseCPUTime, doEnable);
m_chkMaxLoad->Enable(doEnable);
EnableDisableInUseItem(m_txtMaxLoad, doEnable && m_chkMaxLoad->IsChecked(), prefs.suspend_cpu_usage);
EnableDisableInUseItem(m_txtMemoryMaxInUse, doEnable, prefs.ram_max_used_busy_frac*100.0);
EnableDisableInUseItem(m_txtMaxLoad, doEnable && m_chkMaxLoad->IsChecked());
EnableDisableInUseItem(m_txtMemoryMaxInUse, doEnable);
}

// read preferences from core client and initialize control values
Expand Down Expand Up @@ -475,33 +472,30 @@ bool CDlgAdvPreferences::SavePreferencesSettings() {
mask.clear();

// ######### proc usage page
if (m_txtProcUseProcessors->IsEnabled()) {
m_txtProcUseProcessors->GetValue().ToDouble(&td);
prefs.max_ncpus_pct = RoundToHundredths(td);
mask.max_ncpus_pct=true;
}
m_txtProcUseProcessors->GetValue().ToDouble(&td);
prefs.max_ncpus_pct = RoundToHundredths(td);
mask.max_ncpus_pct=true;
m_txtProcUseProcessorsNotInUse->GetValue().ToDouble(&td);
prefs.niu_max_ncpus_pct = RoundToHundredths(td);
mask.niu_max_ncpus_pct=true;

if (m_txtProcUseCPUTime->IsEnabled()) {
m_txtProcUseCPUTime->GetValue().ToDouble(&td);
prefs.cpu_usage_limit=RoundToHundredths(td);
mask.cpu_usage_limit=true;
}
m_txtProcUseCPUTime->GetValue().ToDouble(&td);
prefs.cpu_usage_limit=RoundToHundredths(td);
mask.cpu_usage_limit=true;

m_txtProcUseCPUTimeNotInUse->GetValue().ToDouble(&td);
prefs.niu_cpu_usage_limit = RoundToHundredths(td);
mask.niu_cpu_usage_limit = true;

prefs.run_on_batteries = ! (m_chkProcOnBatteries->GetValue());
mask.run_on_batteries=true;
//

prefs.run_if_user_active = (! m_chkProcInUse->GetValue());
mask.run_if_user_active=true;

prefs.run_gpu_if_user_active = (! m_chkGPUProcInUse->GetValue());
mask.run_gpu_if_user_active=true;
//

if(m_txtProcIdleFor->IsEnabled()) {
m_txtProcIdleFor->GetValue().ToDouble(&td);
prefs.idle_time_to_run=RoundToHundredths(td);
Expand Down Expand Up @@ -620,13 +614,11 @@ bool CDlgAdvPreferences::SavePreferencesSettings() {
}
mask.disk_max_used_pct=true;
//Memory
if (m_txtMemoryMaxInUse->IsEnabled()) {
m_txtMemoryMaxInUse->GetValue().ToDouble(&td);
td = RoundToHundredths(td);
td = td / 100.0;
prefs.ram_max_used_busy_frac=td;
mask.ram_max_used_busy_frac=true;
}
m_txtMemoryMaxInUse->GetValue().ToDouble(&td);
td = RoundToHundredths(td);
td = td / 100.0;
prefs.ram_max_used_busy_frac=td;
mask.ram_max_used_busy_frac=true;
//
m_txtMemoryMaxOnIdle->GetValue().ToDouble(&td);
td = RoundToHundredths(td);
Expand Down
2 changes: 1 addition & 1 deletion clientgui/DlgAdvPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CDlgAdvPreferences : public CDlgAdvPreferencesBase {
void OnHelp(wxCommandEvent& event);
void OnClear(wxCommandEvent& event);
void DisplayValue(double value, wxTextCtrl* textCtrl, wxCheckBox* checkBox=NULL);
void EnableDisableInUseItem(wxTextCtrl* textCtrl, bool doEnable, double value);
void EnableDisableInUseItem(wxTextCtrl* textCtrl, bool doEnable);
void EnableDisableInUseItems();
bool OKToShow() { return m_bOKToShow; }
private:
Expand Down

0 comments on commit 891f481

Please sign in to comment.