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

« back to all changes in this revision

Viewing changes to src/slurmd/slurmstepd/slurmstepd_job.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:
1
1
/*****************************************************************************\
2
 
 * src/slurmd/slurmstepd/slurmstepd_job.c - slurmd_job_t routines
3
 
 * $Id: slurmstepd_job.c 15043 2008-09-09 23:45:19Z jette $
 
2
 *  src/slurmd/slurmstepd/slurmstepd_job.c - slurmd_job_t routines
 
3
 *  $Id: slurmstepd_job.c 18092 2009-07-09 14:38:56Z jette $
4
4
 *****************************************************************************
5
 
 *  Copyright (C) 2002 The Regents of the University of California.
 
5
 *  Copyright (C) 2002-2007 The Regents of the University of California.
 
6
 *  Copyright (C) 2008-2009 Lawrence Livermore National Security.
6
7
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
7
8
 *  Written by Mark Grondona <mgrondona@llnl.gov>.
8
 
 *  LLNL-CODE-402394.
 
9
 *  CODE-OCEC-09-009. All rights reserved.
9
10
 *  
10
11
 *  This file is part of SLURM, a resource management program.
11
 
 *  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.
12
14
 *  
13
15
 *  SLURM is free software; you can redistribute it and/or modify it under
14
16
 *  the terms of the GNU General Public License as published by the Free
44
46
#  include <string.h>
45
47
#endif
46
48
 
 
49
#include <grp.h>
47
50
#include <signal.h>
48
51
#include <sys/types.h>
49
 
#include <grp.h>
50
52
 
51
 
#include "src/common/xmalloc.h"
52
 
#include "src/common/xassert.h"
53
 
#include "src/common/xstring.h"
 
53
#include "src/common/eio.h"
54
54
#include "src/common/fd.h"
55
55
#include "src/common/log.h"
56
 
#include "src/common/eio.h"
 
56
#include "src/common/node_select.h"
57
57
#include "src/common/slurm_jobacct_gather.h"
58
58
#include "src/common/slurm_protocol_api.h"
 
59
#include "src/common/xassert.h"
 
60
#include "src/common/xmalloc.h"
 
61
#include "src/common/xstring.h"
59
62
 
60
63
#include "src/slurmd/slurmd/slurmd.h"
61
 
#include "src/slurmd/slurmstepd/slurmstepd_job.h"
62
64
#include "src/slurmd/slurmstepd/io.h"
63
65
#include "src/slurmd/slurmstepd/fname.h"
64
66
#include "src/slurmd/slurmstepd/multi_prog.h"
 
67
#include "src/slurmd/slurmstepd/slurmstepd_job.h"
65
68
 
66
69
static char ** _array_copy(int n, char **src);
67
70
static void _array_free(char ***array);
196
199
        job->stepid     = msg->job_step_id;
197
200
 
198
201
        job->job_mem    = msg->job_mem;
199
 
        job->task_mem   = msg->task_mem;
200
202
        if (job->job_mem)
201
203
                jobacct_common_set_mem_limit(job->jobid, job->job_mem);
202
 
        else if (job->task_mem && job->ntasks) {
203
 
                jobacct_common_set_mem_limit(job->jobid, 
204
 
                                             (job->task_mem * job->ntasks));
205
 
        }
206
204
        
207
205
        job->uid        = (uid_t) msg->uid;
208
206
        job->gid        = (gid_t) msg->gid;
209
207
        job->cwd        = xstrdup(msg->cwd);
210
208
        job->task_dist  = msg->task_dist;
211
 
        job->plane_size = msg->plane_size;
212
209
        
213
210
        job->cpu_bind_type = msg->cpu_bind_type;
214
211
        job->cpu_bind = xstrdup(msg->cpu_bind);
215
212
        job->mem_bind_type = msg->mem_bind_type;
216
213
        job->mem_bind = xstrdup(msg->mem_bind);
217
 
        job->ckpt_path = xstrdup(msg->ckpt_path);
 
214
        job->ckpt_dir = xstrdup(msg->ckpt_dir);
 
215
        job->restart_dir = xstrdup(msg->restart_dir);
218
216
        job->cpus_per_task = msg->cpus_per_task;
219
217
 
220
218
        job->env     = _array_copy(msg->envc, msg->env);
237
235
        job->envtp->nodeid = -1;
238
236
 
239
237
        job->envtp->distribution = 0;
240
 
        job->envtp->plane_size = 0;
241
 
 
242
238
        job->envtp->cpu_bind_type = 0;
243
239
        job->envtp->cpu_bind = NULL;
244
240
        job->envtp->mem_bind_type = 0;
245
241
        job->envtp->mem_bind = NULL;
246
 
        job->envtp->ckpt_path = NULL;
 
242
        job->envtp->ckpt_dir = NULL;
247
243
        
248
244
        memcpy(&resp_addr, &msg->orig_addr, sizeof(slurm_addr));
249
245
        slurm_set_addr(&resp_addr,
260
256
        srun = srun_info_create(msg->cred, &resp_addr, &io_addr);
261
257
 
262
258
        job->buffered_stdio = msg->buffered_stdio;
 
259
        job->labelio = msg->labelio;
263
260
 
264
261
        job->task_prolog = xstrdup(msg->task_prolog);
265
262
        job->task_epilog = xstrdup(msg->task_epilog);
350
347
        job->gid     = (gid_t) msg->gid;
351
348
        job->cwd     = xstrdup(msg->work_dir);
352
349
 
 
350
        job->ckpt_dir = xstrdup(msg->ckpt_dir);
 
351
        job->restart_dir = xstrdup(msg->restart_dir);
 
352
 
353
353
        job->env     = _array_copy(msg->envc, msg->environment);
354
354
        job->eio     = eio_handle_create();
355
355
        job->sruns   = list_create((ListDelF) _srun_info_destructor);
361
361
        job->envtp->nodeid = -1;
362
362
 
363
363
        job->envtp->distribution = 0;
364
 
        job->envtp->plane_size = 0;
365
 
 
366
 
        job->envtp->cpu_bind_type = 0;
367
 
        job->envtp->cpu_bind = NULL;
 
364
        job->cpu_bind_type = msg->cpu_bind_type;
 
365
        job->cpu_bind = xstrdup(msg->cpu_bind);
368
366
        job->envtp->mem_bind_type = 0;
369
367
        job->envtp->mem_bind = NULL;
370
 
        job->envtp->ckpt_path = NULL;
 
368
        job->envtp->ckpt_dir = NULL;
 
369
        job->envtp->restart_cnt = msg->restart_cnt;
 
370
 
371
371
        job->cpus_per_task = msg->cpus_per_node[0];
372
372
 
373
373
        srun = srun_info_create(NULL, NULL, NULL);
382
382
                /* job script has not yet been written out to disk --
383
383
                 * argv will be filled in later by _make_batch_script()
384
384
                 */
385
 
                job->argv    = (char **) xmalloc(sizeof(char *));
 
385
                job->argv    = (char **) xmalloc(2 * sizeof(char *));
386
386
        }
387
387
 
388
388
        job->task = (slurmd_task_info_t **)
402
402
        job->task[0]->argc = job->argc;
403
403
        job->task[0]->argv = job->argv;
404
404
 
 
405
#ifdef HAVE_CRAY_XT
 
406
        select_g_get_jobinfo(msg->select_jobinfo, SELECT_DATA_RESV_ID,
 
407
                             &job->resv_id);
 
408
#endif
 
409
 
405
410
        return job;
406
411
}
407
412