Skip to content

Commit edc867f

Browse files
committed
EH: CS-173 Job counter should be greater than 10 mio.
1 parent 8a60755 commit edc867f

23 files changed

+73
-65
lines changed

source/clients/common/ocs_client_job.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void cull_show_job(const lListElem *job, int flags, bool show_binding) {
8787

8888
if (!(flags & FLG_QALTER)) {
8989
if (lGetUlong(job, JB_job_number))
90-
printf("job_number: %d\n", (int) lGetUlong(job, JB_job_number));
90+
printf("job_number: " sge_uu32 "\n", lGetUlong(job, JB_job_number));
9191
else
9292
printf("job_number: %s\n", MSG_JOB_UNASSIGNED);
9393
}

source/clients/common/ocs_client_print.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ static int sge_print_job(lListElem *job, lListElem *jatep, lListElem *qep, int p
451451
if (!(full_listing & QSTAT_DISPLAY_FULL)) {
452452
int line_length = queue_name_length - 10 + 1;
453453
char *seperator = sge_malloc(line_length);
454-
const char *part1 = "%s%-7.7s %s %s%s%s%s%s %-10.10s %-12.12s %s%-5.5s %s%s%s%s%s%s%s%s%s%-";
454+
const char *part1 = "%s%-10.10s %s %s%s%s%s%s %-10.10s %-12.12s %s%-5.5s %s%s%s%s%s%s%s%s%s%-";
455455
const char *part3 = ".";
456456
const char *part5 = "s %s %s%s%s%s%s%s";
457457
size_t part6_size = strlen(part1) + strlen(part3) + strlen(part5) + 256;
@@ -490,15 +490,16 @@ static int sge_print_job(lListElem *job, lListElem *jatep, lListElem *qep, int p
490490
/* job number / ja task id */
491491
if (print_jobid) {
492492
if (hide_data) {
493-
sge_dstring_sprintf_append(&output, "%7s ", "*");
493+
// maximum job id is U_LONG32_MAX = 4294967295 = 10 digits
494+
sge_dstring_sprintf_append(&output, "%10s ", "*");
494495
} else {
495-
sge_dstring_sprintf_append(&output, "%7d ", (int)lGetUlong(job, JB_job_number));
496+
sge_dstring_sprintf_append(&output, "%10" sge_fuu32 " ", lGetUlong(job, JB_job_number));
496497
}
497498
} else {
498-
sge_dstring_sprintf_append(&output, " ");
499+
sge_dstring_sprintf_append(&output, " ");
499500
}
500501
} else {
501-
snprintf(jobid, sizeof(jobid) - 1, "%d", (int)lGetUlong(job, JB_job_number));
502+
snprintf(jobid, sizeof(jobid) - 1, sge_uu32, lGetUlong(job, JB_job_number));
502503
ret = report_handler->report_job_begin(report_handler, cqname, jobid, alpp);
503504
if (ret != QHOST_SUCCESS) {
504505
DRETURN(ret);

source/clients/qacct/ocs_qacct.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,8 +1372,8 @@ static void qacct_usage(FILE *err_fp)
13721372
#define SHOWJOB_STRING_NO_DATA "%-35.34s-/-\n"
13731373
#define SHOWJOB_STRING_20 "%-35.34s%-20s\n"
13741374
#define SHOWJOB_STRING_20_NOLF "%-35.34s%-20s"
1375-
#define SHOWJOB_U32_20 "%-35.34s%-20" sge_fu32 "\n"
1376-
#define SHOWJOB_U32_FAILED "%-35.34s%-3" sge_fu32" %s %s\n"
1375+
#define SHOWJOB_U32_20 "%-35.34s%-20" sge_fuu32 "\n"
1376+
#define SHOWJOB_U32_FAILED "%-35.34s%-3" sge_fuu32" %s %s\n"
13771377
#define SHOWJOB_FLOAT_0 "%-35.34s%-13.0f\n"
13781378
#define SHOWJOB_FLOAT_3 "%-35.34s%-13.3f\n"
13791379
#define SHOWJOB_FLOAT_18_0 "%-35.34s%-18.0f\n"

source/clients/qsh/ocs_qsh.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2277,7 +2277,7 @@ static void delete_job(u_long32 job_id, lList *jlp)
22772277
return;
22782278
}
22792279

2280-
snprintf(job_str, sizeof(job_str), sge_u32, job_id);
2280+
snprintf(job_str, sizeof(job_str), sge_uu32, job_id);
22812281
lAddElemStr(&idlp, ID_str, job_str, ID_Type);
22822282

22832283
alp = sge_gdi(SGE_JB_LIST, SGE_GDI_DEL, &idlp, nullptr, nullptr);

source/clients/qstat/ocs_qstat.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ static int job_stdout_job(job_handler_t* handler, u_long32 jid, job_summary_t *s
870870
int i;
871871
int line_length = qstat_env->longest_queue_length-10+1;
872872
char * seperator = sge_malloc(line_length);
873-
const char *part1 = "%s%-7.7s %s %s%s%s%s%s %-10.10s %-12.12s %s%-5.5s %s%s%s%s%s%s%s%s%s%-";
873+
const char *part1 = "%s%-10.10s %s %s%s%s%s%s %-10.10s %-12.12s %s%-5.5s %s%s%s%s%s%s%s%s%s%-";
874874
const char *part3 = ".";
875875
const char *part5 = "s %s %s%s%s%s%s%s";
876876
size_t part6_size = strlen(part1) + strlen(part3) + strlen(part5) + 20;
@@ -936,12 +936,13 @@ static int job_stdout_job(job_handler_t* handler, u_long32 jid, job_summary_t *s
936936
/* job number / ja task id */
937937
if (print_job_id) {
938938
if (hide_data) {
939-
sge_dstring_sprintf_append(&job_output, "%7s ", "*");
939+
// maximum job id is U_LONG32_MAX = 4294967295 = 10 digits
940+
sge_dstring_sprintf_append(&job_output, "%10s ", "*");
940941
} else {
941-
sge_dstring_sprintf_append(&job_output, "%7d ", (int)jid);
942+
sge_dstring_sprintf_append(&job_output, "%10" sge_fuu32 " ", jid);
942943
}
943944
} else {
944-
sge_dstring_sprintf_append(&job_output, " ");
945+
sge_dstring_sprintf_append(&job_output, " ");
945946
}
946947

947948
if (print_job_id) {
@@ -2157,7 +2158,7 @@ qstat_show_job(lList *jid_list, u_long32 isXML, qstat_env_t *qstat_env) {
21572158
for_each_rw(elem1, jlp) {
21582159
char buffer[256];
21592160

2160-
snprintf(buffer, sizeof(buffer), sge_U32CFormat, sge_u32c(lGetUlong(elem1, JB_job_number)));
2161+
snprintf(buffer, sizeof(buffer), sge_uu32, lGetUlong(elem1, JB_job_number));
21612162
elem2 = lGetElemStrRW(jid_list, ST_name, buffer);
21622163

21632164
if (elem2) {

source/clients/qstat/ocs_qstat_xml.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ static int qstat_xml_job(job_handler_t* handler, u_long32 jid, job_summary_t *su
417417
sge_time = !sge_ext;
418418
sge_time = sge_time | tsk_ext | sge_urg | sge_pri;
419419

420-
xml_append_Attr_I(attribute_list, "JB_job_number", jid);
420+
xml_append_Attr_U(attribute_list, "JB_job_number", jid);
421421
xml_append_Attr_D(attribute_list, "JAT_prio", summary->nprior);
422422
if( sge_ext) {
423423
xml_append_Attr_D(attribute_list, "JAT_ntix", summary->ntckts);

source/common/basis_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,14 @@
124124
# define sge_uu32 "%u"
125125
# define sge_x32 "%x"
126126
# define sge_fu32 "d"
127+
# define sge_fuu32 "u"
127128
#else
128129
# define sge_u64 "%llu"
129130
# define sge_u32 "%ld"
130131
# define sge_uu32 "%lu"
131132
# define sge_x32 "%lx"
132133
# define sge_fu32 "ld"
134+
# define sge_fuu32 "lu"
133135
#endif
134136

135137
#define uid_t_fmt "%u"

source/daemons/execd/exec_job.cc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
448448
pe_task_id = lGetString(petep, PET_id);
449449
}
450450

451-
DPRINTF("job: %ld jatask: %ld petask: %s\n", job_id, ja_task_id, pe_task_id != nullptr ? pe_task_id : "none");
451+
DPRINTF("job: " sge_uu32 " jatask: " sge_uu32 " petask: %s\n", job_id, ja_task_id, pe_task_id != nullptr ? pe_task_id : "none");
452452

453453
master_q = responsible_queue(jep, jatep, petep);
454454
SGE_ASSERT((master_q));
@@ -462,8 +462,7 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
462462
DRETURN(-3); /* error only relevant for this user */
463463
}
464464

465-
sge_get_active_job_file_path(&active_dir, job_id,
466-
ja_task_id, pe_task_id, nullptr);
465+
sge_get_active_job_file_path(&active_dir, job_id, ja_task_id, pe_task_id, nullptr);
467466

468467
umask(022);
469468

@@ -806,7 +805,7 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
806805
} else {
807806
if (lGetString(jep, JB_script_file) != nullptr) {
808807
/* JG: TODO: use some function to create path */
809-
str_script_file = sge_dstring_sprintf(&dstr_script_file, "%s/%s/" sge_u32, execd_spool_dir, EXEC_DIR,
808+
str_script_file = sge_dstring_sprintf(&dstr_script_file, "%s/%s/" sge_uu32, execd_spool_dir, EXEC_DIR,
810809
job_id);
811810
} else {
812811
/*
@@ -849,7 +848,7 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
849848
token = sge_strtok(buffer, delim);
850849
while (token != nullptr) {
851850
if (is_first_token) {
852-
sge_dstring_sprintf(&new_qrsh_command, "%s/%s/" sge_u32,
851+
sge_dstring_sprintf(&new_qrsh_command, "%s/%s/" sge_uu32,
853852
execd_spool_dir, EXEC_DIR, job_id);
854853
is_first_token = 0;
855854
} else {
@@ -1489,7 +1488,7 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
14891488
} else {
14901489
fprintf(fp, "job_name=%s\n", lGetString(jep, JB_job_name));
14911490
}
1492-
fprintf(fp, "job_id=" sge_u32 "\n", job_id);
1491+
fprintf(fp, "job_id=" sge_uu32 "\n", job_id);
14931492
fprintf(fp, "ja_task_id=" sge_u32 "\n", job_is_array(jep) ? ja_task_id : 0);
14941493
if (petep != nullptr) {
14951494
fprintf(fp, "pe_task_id=%s\n", pe_task_id);
@@ -1977,13 +1976,13 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
19771976
lGetString(jep, JB_cred)) {
19781977

19791978
char ccname[1024];
1980-
snprintf(ccname, sizeof(ccname), "KRB5CCNAME=FILE:/tmp/krb5cc_%s_" sge_u32, "sge", job_id);
1979+
snprintf(ccname, sizeof(ccname), "KRB5CCNAME=FILE:/tmp/krb5cc_%s_" sge_uu32, "sge", job_id);
19811980
putenv(ccname);
19821981
}
19831982

19841983
DPRINTF("**********************CHILD*********************\n");
19851984
shepherd_name = SGE_SHEPHERD;
1986-
snprintf(ps_name, sizeof(ps_name), "%s-" sge_u32, shepherd_name, job_id);
1985+
snprintf(ps_name, sizeof(ps_name), "%s-" sge_uu32, shepherd_name, job_id);
19871986

19881987
pag_cmd = mconf_get_pag_cmd();
19891988
shepherd_cmd = mconf_get_shepherd_cmd();
@@ -2030,7 +2029,7 @@ int sge_exec_job(lListElem *jep, lListElem *jatep, lListElem *petep, char *err_s
20302029

20312030
fp = fopen("error", "w");
20322031
if (fp) {
2033-
fprintf(fp, "failed to exec shepherd for job" sge_u32"\n", job_id);
2032+
fprintf(fp, "failed to exec shepherd for job" sge_uu32"\n", job_id);
20342033
FCLOSE(fp);
20352034
}
20362035

source/daemons/execd/get_path.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,12 @@ expand_path(dstring *dstr_exp_path, const char *in_path, u_long32 job_id, u_long
226226
s = t + sizeof("$HOME") - 1;
227227
}
228228
if (!strncmp(t, "$JOB_ID", sizeof("$JOB_ID") - 1)) {
229-
sge_dstring_sprintf_append(dstr_exp_path, sge_u32, job_id);
229+
sge_dstring_sprintf_append(dstr_exp_path, sge_uu32, job_id);
230230
s = t + sizeof("$JOB_ID") - 1;
231231
}
232232
if (ja_task_id) {
233233
if (!strncmp(t, "$TASK_ID", sizeof("$TASK_ID") - 1)) {
234-
sge_dstring_sprintf_append(dstr_exp_path, sge_u32, ja_task_id);
234+
sge_dstring_sprintf_append(dstr_exp_path, sge_uu32, ja_task_id);
235235
s = t + sizeof("$TASK_ID") - 1;
236236
}
237237
}

source/daemons/execd/load_avg.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ void update_job_usage(const char* qualified_hostname)
922922
/* search matching job report */
923923
if (!(jr = get_job_report(job_id, ja_task_id, pe_task_id))) {
924924
/* should not happen in theory */
925-
ERROR("could not find job report for job " sge_u32"." sge_u32" " "task " SFN " contained in job usage from ptf", job_id, ja_task_id, pe_task_id);
925+
ERROR("could not find job report for job " sge_uu32"." sge_uu32" " "task " SFN " contained in job usage from ptf", job_id, ja_task_id, pe_task_id);
926926
#ifdef COMPILE_DC
927927
#ifdef DEBUG_DC
928928
ptf_show_registered_jobs();

0 commit comments

Comments
 (0)