~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 *  Written by Danny Auble <da@llnl.gov>
10
10
 *  
11
11
 *  This file is part of SLURM, a resource management program.
12
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
12
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
13
 *  Please also read the included file: DISCLAIMER.
13
14
 *  
14
15
 *  SLURM is free software; you can redistribute it and/or modify it under
15
16
 *  the terms of the GNU General Public License as published by the Free
250
251
{
251
252
        jobacct_step_rec_t *jobacct_step = create_jobacct_step_rec();
252
253
        
253
 
        jobacct_step->jobid = filetxt_step->header.jobnum;
254
254
        jobacct_step->elapsed = filetxt_step->elapsed;
255
255
        jobacct_step->end = filetxt_step->header.timestamp;
256
256
        jobacct_step->exitcode = filetxt_step->exitcode;
257
257
        jobacct_step->ncpus = filetxt_step->ncpus;
 
258
        if(filetxt_step->nodes) {
 
259
                hostlist_t hl = hostlist_create(filetxt_step->nodes);
 
260
                jobacct_step->nnodes = hostlist_count(hl);
 
261
                hostlist_destroy(hl);
 
262
        }
258
263
        jobacct_step->nodes = xstrdup(filetxt_step->nodes);
259
264
        jobacct_step->requid = filetxt_step->requid;
260
265
        memcpy(&jobacct_step->sacct, &filetxt_step->sacct, sizeof(sacct_t));
315
320
        jobacct_job->partition = xstrdup(filetxt_job->header.partition);
316
321
        jobacct_job->req_cpus = filetxt_job->ncpus;
317
322
        jobacct_job->alloc_cpus = filetxt_job->ncpus;
 
323
        if(filetxt_job->nodes) {
 
324
                hostlist_t hl = hostlist_create(filetxt_job->nodes);
 
325
                jobacct_job->alloc_nodes = hostlist_count(hl);
 
326
                hostlist_destroy(hl);
 
327
        }
318
328
        jobacct_job->nodes = xstrdup(filetxt_job->nodes);
319
329
        jobacct_job->priority = filetxt_job->priority;
320
330
        jobacct_job->requid = filetxt_job->requid;
328
338
        if(filetxt_job->steps) {
329
339
                itr = list_iterator_create(filetxt_job->steps);
330
340
                while((filetxt_step = list_next(itr))) {
331
 
                        list_append(jobacct_job->steps,
332
 
                                    _create_jobacct_step_rec(filetxt_step));
 
341
                        jobacct_step_rec_t *step =
 
342
                                _create_jobacct_step_rec(filetxt_step);
 
343
                        if(step) {
 
344
                                step->job_ptr = jobacct_job;
 
345
                                if(!jobacct_job->first_step_ptr)
 
346
                                        jobacct_job->first_step_ptr = step;
 
347
                                list_append(jobacct_job->steps, step);
 
348
                        }
333
349
                }
334
350
                list_iterator_destroy(itr);
335
351
        }
1382
1398
        
1383
1399
        if (new_file) {  /* By default, the expired file looks like the log */
1384
1400
                chmod(logfile_name, prot);
1385
 
                chown(logfile_name, uid, gid);
 
1401
                if(chown(logfile_name, uid, gid) == -1)
 
1402
                        error("Couldn't change ownership of %s to %u:%u",
 
1403
                              logfile_name, uid, gid);
1386
1404
        }
1387
1405
        xfree(logfile_name);
1388
1406
 
1395
1413
                goto finished;
1396
1414
        }
1397
1415
        chmod(logfile_name, prot);     /* preserve file protection */
1398
 
        chown(logfile_name, uid, gid); /* and ownership */
 
1416
        if(chown(logfile_name, uid, gid) == -1)/* and ownership */
 
1417
                error("2 Couldn't change ownership of %s to %u:%u",
 
1418
                      logfile_name, uid, gid);
1399
1419
        /* Use line buffering to allow us to safely write
1400
1420
         * to the log file at the same time as slurmctld. */ 
1401
1421
        if (setvbuf(new_logfile, NULL, _IOLBF, 0)) {