Skip to content

Commit 296b561

Browse files
Copilot suggestions (no functional changes)
1 parent 542d6ee commit 296b561

4 files changed

Lines changed: 16 additions & 7 deletions

File tree

client/acct_mgr.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,11 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) {
801801
if (acct.suspend.present && acct.suspend.value) {
802802
pp->suspend();
803803
}
804+
805+
// The AM supplies initial accounting info
806+
// (in case the client was previously attached,
807+
// then detached).
808+
//
804809
if (gstate.acct_mgr_info.dynamic) {
805810
pp->user_expavg_credit = acct.user_avg_ec;
806811
pp->user_total_credit = acct.user_total_ec;

client/acct_mgr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ struct AM_ACCOUNT {
161161
OPTIONAL_BOOL abort_not_started;
162162
double user_avg_ec;
163163
double user_total_ec;
164-
// the following present if client not already attached
164+
// the following supplied by dynamic AM if client not already attached
165+
// to the project
165166
double cpu_ec;
166167
double cpu_time;
167168
double gpu_ec;

client/project.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ struct PROJECT : PROJ_AM {
121121
// and this should go to 1.
122122
// But we need to keep it around for older projects
123123

124-
// accounting info for dynamic account managers;
124+
// accounting info for use with dynamic account managers;
125+
// obtained from the AM on attach,
126+
// updated by the client, and reported in AM RPCs
125127
//
126128
double cpu_ec; // estimated credit
127129
double cpu_time; // device/seconds

client/scheduler_op.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,10 +614,11 @@ int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) {
614614
}
615615
}
616616

617-
// if project is attached via a dynamic AM (like Science United)
618-
// we get user credit from the AM, not the project
617+
// if project is attached via a dynamic AM (like Science United),
618+
// ignore project-supplied user credit;
619+
// we get it from the AM, not the project
619620
//
620-
bool ignore_host_credit = project->attached_via_acct_mgr && gstate.acct_mgr_info.dynamic;
621+
bool ignore_user_credit = project->attached_via_acct_mgr && gstate.acct_mgr_info.dynamic;
621622

622623
// First line should either be tag (HTTP 1.0) or
623624
// hex length of response (HTTP 1.1)
@@ -673,8 +674,8 @@ int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) {
673674
}
674675
else if (xp.parse_str("symstore", project->symstore, sizeof(project->symstore))) continue;
675676
else if (xp.parse_str("user_name", project->user_name, sizeof(project->user_name))) continue;
676-
else if (!ignore_host_credit && xp.parse_double("user_total_credit", project->user_total_credit)) continue;
677-
else if (!ignore_host_credit && xp.parse_double("user_expavg_credit", project->user_expavg_credit)) continue;
677+
else if (!ignore_user_credit && xp.parse_double("user_total_credit", project->user_total_credit)) continue;
678+
else if (!ignore_user_credit && xp.parse_double("user_expavg_credit", project->user_expavg_credit)) continue;
678679
else if (xp.parse_double("user_create_time", project->user_create_time)) continue;
679680
else if (xp.parse_double("cpid_time", cpid_time)) continue;
680681
else if (xp.parse_str("team_name", project->team_name, sizeof(project->team_name))) continue;

0 commit comments

Comments
 (0)