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

« back to all changes in this revision

Viewing changes to src/slurmctld/reservation.h

  • 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
/*****************************************************************************\
 
2
 *  reservation.h - resource reservation management
 
3
 *****************************************************************************
 
4
 *  Copyright (C) 2009 Lawrence Livermore National Security.
 
5
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
 
6
 *  Written by Morris Jette <jette1@llnl.gov> et. al.
 
7
 *  CODE-OCEC-09-009. All rights reserved.
 
8
 *  
 
9
 *  This file is part of SLURM, a resource management program.
 
10
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
11
 *  Please also read the included file: DISCLAIMER.
 
12
 *  
 
13
 *  SLURM is free software; you can redistribute it and/or modify it under
 
14
 *  the terms of the GNU General Public License as published by the Free
 
15
 *  Software Foundation; either version 2 of the License, or (at your option)
 
16
 *  any later version.
 
17
 *
 
18
 *  In addition, as a special exception, the copyright holders give permission 
 
19
 *  to link the code of portions of this program with the OpenSSL library under
 
20
 *  certain conditions as described in each individual source file, and 
 
21
 *  distribute linked combinations including the two. You must obey the GNU 
 
22
 *  General Public License in all respects for all of the code used other than 
 
23
 *  OpenSSL. If you modify file(s) with this exception, you may extend this 
 
24
 *  exception to your version of the file(s), but you are not obligated to do 
 
25
 *  so. If you do not wish to do so, delete this exception statement from your
 
26
 *  version.  If you delete this exception statement from all source files in 
 
27
 *  the program, then also delete it here.
 
28
 *  
 
29
 *  SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
 
30
 *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
31
 *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
32
 *  details.
 
33
 *  
 
34
 *  You should have received a copy of the GNU General Public License along
 
35
 *  with SLURM; if not, write to the Free Software Foundation, Inc.,
 
36
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 
37
\*****************************************************************************/
 
38
 
 
39
#ifndef _RESERVATION_H
 
40
#define _RESERVATION_H
 
41
 
 
42
#include <time.h>
 
43
#include <unistd.h>
 
44
#include <slurm/slurm.h>
 
45
#include "src/common/bitstring.h"
 
46
#include "src/slurmctld/slurmctld.h"
 
47
 
 
48
extern time_t last_resv_update;
 
49
 
 
50
/* Create a resource reservation */
 
51
extern int create_resv(resv_desc_msg_t *resv_desc_ptr);
 
52
 
 
53
/* Update an existing resource reservation */
 
54
extern int update_resv(resv_desc_msg_t *resv_desc_ptr);
 
55
 
 
56
/* Delete an existing resource reservation */
 
57
extern int delete_resv(reservation_name_msg_t *resv_desc_ptr);
 
58
 
 
59
/* Dump the reservation records to a buffer */
 
60
extern void show_resv(char **buffer_ptr, int *buffer_size, uid_t uid);
 
61
 
 
62
/* Save the state of all reservations to file */
 
63
extern int dump_all_resv_state(void);
 
64
 
 
65
/* Purge all reservation data structures */
 
66
extern void resv_fini(void);
 
67
 
 
68
/* send all reservations to accounting.  Only needed at
 
69
 * first registration
 
70
 */
 
71
extern int send_resvs_to_accounting(void);
 
72
 
 
73
/* Set or clear NODE_STATE_MAINT for node_state as needed */
 
74
extern void set_node_maint_mode(void);
 
75
 
 
76
/*
 
77
 * Load the reservation state from file, recover on slurmctld restart. 
 
78
 *      Reset reservation pointers for all jobs.
 
79
 *      Execute this after loading the configuration file data.
 
80
 * IN recover - 0 = validate current reservations ONLY if already recovered, 
 
81
 *                  otherwise recover from disk
 
82
 *              1+ = recover all reservation state from disk
 
83
 * RET SLURM_SUCCESS or error code
 
84
 * NOTE: READ lock_slurmctld config before entry
 
85
 */
 
86
extern int load_all_resv_state(int recover);
 
87
 
 
88
/*
 
89
 * Determine if a job request can use the specified reservations
 
90
 * IN/OUT job_ptr - job to validate, set its resv_id and resv_type
 
91
 * RET SLURM_SUCCESS or error code (not found or access denied)
 
92
*/
 
93
extern int validate_job_resv(struct job_record *job_ptr);
 
94
 
 
95
/*
 
96
 * Determine which nodes a job can use based upon reservations
 
97
 * IN job_ptr      - job to test
 
98
 * IN/OUT when     - when we want the job to start (IN)
 
99
 *                   when the reservation is available (OUT)
 
100
 * IN move_time    - if true, then permit the start time to advance from
 
101
 *                   "when" as needed IF job has no reservervation
 
102
 * OUT node_bitmap - nodes which the job can use, caller must free
 
103
 * RET  SLURM_SUCCESS if runable now
 
104
 *      ESLURM_RESERVATION_ACCESS access to reservation denied
 
105
 *      ESLURM_RESERVATION_INVALID reservation invalid
 
106
 *      ESLURM_INVALID_TIME_VALUE reservation invalid at time "when"
 
107
 *      ESLURM_NODES_BUSY job has no reservation, but required nodes are
 
108
 *                        reserved
 
109
 */
 
110
extern int job_test_resv(struct job_record *job_ptr, time_t *when,
 
111
                         bool move_time, bitstr_t **node_bitmap);
 
112
 
 
113
/*
 
114
 * Determine if a job can start now based only upon reservations
 
115
 * IN job_ptr      - job to test
 
116
 * RET  SLURM_SUCCESS if runable now, otherwise an error code
 
117
 */
 
118
extern int job_test_resv_now(struct job_record *job_ptr);
 
119
 
 
120
/* Begin scan of all jobs for valid reservations */
 
121
extern void begin_job_resv_check(void);
 
122
 
 
123
/* Test a particular job for valid reservation
 
124
 * RET ESLURM_INVALID_TIME_VALUE if reservation is terminated
 
125
 *     SLURM_SUCCESS if reservation is still valid */
 
126
extern int job_resv_check(struct job_record *job_ptr);
 
127
 
 
128
/* Finish scan of all jobs for valid reservations */
 
129
extern void fini_job_resv_check(void);
 
130
 
 
131
#endif /* !_RESERVATION_H */