From 3c54daf9e8bba0bcf40eeaff39a1c005d82cf0a8 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Fri, 3 Jun 2005 23:33:48 +0000 Subject: [PATCH] Add info on new slurm.conf parameters for job accounting. Sacct now reports right away if accounting is disabled. --- doc/man/man5/slurm.conf.5 | 18 +++++++++++++++++- src/sacct/sacct.c | 21 ++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/doc/man/man5/slurm.conf.5 b/doc/man/man5/slurm.conf.5 index 7a51ca60fdf..e276b171f11 100644 --- a/doc/man/man5/slurm.conf.5 +++ b/doc/man/man5/slurm.conf.5 @@ -1,4 +1,4 @@ -.TH "slurm.conf" "5" "March 2005" "slurm.conf 0.5" "Slurm configuration file" +.TH "slurm.conf" "5" "June 2005" "slurm.conf 0.5" "Slurm configuration file" .SH "NAME" slurm.conf \- Slurm configuration file .SH "DESCRIPTION" @@ -122,6 +122,22 @@ This value should reflect the possibility that the srun command may stopped by a debugger or considerable time could be required for batch job pre- and post-processing. The default value is unlimited (zero). .TP +\fBJobAcctType\fR +Define the job accounting mechanism type. +Acceptable values at present include "jobacct/log" and "jobacct/none". +The default value is "jobacct/none". +In order to use the \fBsacct\fR tool, "jobacct/log" must be configured.a +\fBJobAcctLoc\fR +Define the location where job accounting logs are to be written. +For jobacct/none this parameter is ignored. +For jobacct/log this is the fully-qualified file name for the data file.a +\fBJobAcctParameters\fR +Define any parameters to pass to the job accounting plugin. +For jobacct/none this parameter is ignored. +For jobacct/log the only parameter available at this time is +"Frequency=N", where N is the number of seconds between +sampling the memory usage stats (psize, vsize). If N=0, no sampling +is done and psize and vsize are returned as 0. \fBJobCompLoc\fR The interpretation of this value depends upon the logging mechanism specified by the \fBJobCompType\fR parameter. diff --git a/src/sacct/sacct.c b/src/sacct/sacct.c index 049cee3703c..85ee30a5174 100644 --- a/src/sacct/sacct.c +++ b/src/sacct/sacct.c @@ -25,6 +25,10 @@ /* * HISTORY * $Log$ + * Revision 1.4 2005/06/03 23:33:48 jette + * Add info on new slurm.conf parameters for job accounting. + * Sacct now reports right away if accounting is disabled. + * * Revision 1.3 2005/06/03 20:35:52 jette * Fix several sacct bugs. * @@ -1230,7 +1234,9 @@ void getData(void) void getOptions(int argc, char **argv) { int c, i, optionIndex = 0; - char *end, *start; + char *end, *start, *acct_type; + struct stat stat_buf; + if ((i=getuid())) /* default to current user unless root*/ opt_uid = i; static struct option long_options[] = { @@ -1518,6 +1524,17 @@ void getOptions(int argc, char **argv) opt_verbose); } + /* check if we have accounting data to view */ + if (opt_filein == NULL) + opt_filein = slurm_get_jobacct_loc(); + acct_type = slurm_get_jobacct_type(); + if ((strcmp(acct_type, "jobacct/none") == 0) + && (stat(opt_filein, &stat_buf) != 0)) { + fprintf(stderr, "SLURM accounting is disabled\n"); + exit(1); + } + free(acct_type); + /* specific partitions requested? */ if (opt_partition_list) { @@ -1915,8 +1932,6 @@ void linkJobstep(long j, long js) void openLogFile(void) { - if (opt_filein == NULL) - opt_filein = slurm_get_jobacct_loc(); logfile = fopen(opt_filein, "r"); if (logfile == NULL) { perror(opt_filein); -- GitLab