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

« back to all changes in this revision

Viewing changes to src/slurmctld/state_save.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:
2
2
 *  state_save.c - Keep saved slurmctld state current 
3
3
 *****************************************************************************
4
4
 *  Copyright (C) 2004-2007 The Regents of the University of California.
 
5
 *  Copyright (C) 2008-2009 Lawrence Livermore National Security.
5
6
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
6
7
 *  Written by Morris Jette <jette1@llnl.gov>
7
 
 *  LLNL-CODE-402394.
 
8
 *  CODE-OCEC-09-009. All rights reserved.
8
9
 *  
9
10
 *  This file is part of SLURM, a resource management program.
10
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
11
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
12
 *  Please also read the included file: DISCLAIMER.
11
13
 *  
12
14
 *  SLURM is free software; you can redistribute it and/or modify it under
13
15
 *  the terms of the GNU General Public License as published by the Free
44
46
#endif                          /* WITH_PTHREADS */
45
47
 
46
48
#include "src/common/macros.h"
 
49
#include "src/slurmctld/reservation.h"
47
50
#include "src/slurmctld/slurmctld.h"
48
51
#include "src/slurmctld/trigger_mgr.h"
49
52
 
50
53
static pthread_mutex_t state_save_lock = PTHREAD_MUTEX_INITIALIZER;
51
54
static pthread_cond_t  state_save_cond = PTHREAD_COND_INITIALIZER;
52
 
static int save_jobs = 0, save_nodes = 0, save_parts = 0, save_triggers = 0;
 
55
static int save_jobs = 0, save_nodes = 0, save_parts = 0;
 
56
static int save_triggers = 0, save_resv = 0;
53
57
static bool run_save_thread = true;
54
58
 
55
59
/* Queue saving of job state information */
79
83
        pthread_cond_broadcast(&state_save_cond);
80
84
}
81
85
 
 
86
/* Queue saving of reservation state information */
 
87
extern void schedule_resv_save(void)
 
88
{
 
89
        slurm_mutex_lock(&state_save_lock);
 
90
        save_resv++;
 
91
        slurm_mutex_unlock(&state_save_lock);
 
92
        pthread_cond_broadcast(&state_save_cond);
 
93
}
 
94
 
82
95
/* Queue saving of trigger state information */
83
96
extern void schedule_trigger_save(void)
84
97
{
113
126
                slurm_mutex_lock(&state_save_lock);
114
127
                while (1) {
115
128
                        if (save_jobs + save_nodes + save_parts + 
116
 
                            save_triggers)
 
129
                            save_resv + save_triggers)
117
130
                                break;          /* do the work */
118
131
                        else if (!run_save_thread) {
119
132
                                run_save_thread = true;
157
170
                if (run_save)
158
171
                        (void)dump_all_part_state();
159
172
 
 
173
                /* save reservation info if necessary */
 
174
                run_save = false;
 
175
                slurm_mutex_lock(&state_save_lock);
 
176
                if (save_resv) {
 
177
                        run_save = true;
 
178
                        save_resv = 0;
 
179
                }
 
180
                slurm_mutex_unlock(&state_save_lock);
 
181
                if (run_save)
 
182
                        (void)dump_all_resv_state();
 
183
 
160
184
                /* save trigger info if necessary */
161
185
                run_save = false;
162
186
                slurm_mutex_lock(&state_save_lock);