1 /*****************************************************************************\
2  *  scontrol.h - definitions for all scontrol modules
3  *****************************************************************************
4  *  Copyright (C) 2002-2007 The Regents of the University of California.
5  *  Copyright (C) 2008-2010 Lawrence Livermore National Security.
6  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
7  *  Written by Morris Jette <jette1@llnl.gov>
8  *  CODE-OCEC-09-009. All rights reserved.
9  *
10  *  This file is part of Slurm, a resource management program.
11  *  For details, see <https://slurm.schedmd.com/>.
12  *  Please also read the included file: DISCLAIMER.
13  *
14  *  Slurm is free software; you can redistribute it and/or modify it under
15  *  the terms of the GNU General Public License as published by the Free
16  *  Software Foundation; either version 2 of the License, or (at your option)
17  *  any later version.
18  *
19  *  In addition, as a special exception, the copyright holders give permission
20  *  to link the code of portions of this program with the OpenSSL library under
21  *  certain conditions as described in each individual source file, and
22  *  distribute linked combinations including the two. You must obey the GNU
23  *  General Public License in all respects for all of the code used other than
24  *  OpenSSL. If you modify file(s) with this exception, you may extend this
25  *  exception to your version of the file(s), but you are not obligated to do
26  *  so. If you do not wish to do so, delete this exception statement from your
27  *  version.  If you delete this exception statement from all source files in
28  *  the program, then also delete it here.
29  *
30  *  Slurm is distributed in the hope that it will be useful, but WITHOUT ANY
31  *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
32  *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
33  *  details.
34  *
35  *  You should have received a copy of the GNU General Public License along
36  *  with Slurm; if not, write to the Free Software Foundation, Inc.,
37  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
38 \*****************************************************************************/
39 
40 #ifndef __SCONTROL_H__
41 #define __SCONTROL_H__
42 
43 #include "config.h"
44 
45 #include <ctype.h>
46 #include <errno.h>
47 #include <getopt.h>
48 #include <inttypes.h>
49 #include <stdio.h>
50 #include <stdlib.h>
51 #include <string.h>
52 #include <sys/stat.h>
53 #include <sys/types.h>
54 #include <time.h>
55 #include <unistd.h>
56 
57 #if HAVE_READLINE
58 #  include <readline/readline.h>
59 #  include <readline/history.h>
60 #endif
61 
62 #include "slurm/slurm.h"
63 
64 #include "src/common/hostlist.h"
65 #include "src/common/log.h"
66 #include "src/common/node_select.h"
67 #include "src/common/parse_time.h"
68 #include "src/common/read_config.h"
69 #include "src/common/slurm_protocol_api.h"
70 #include "src/common/xmalloc.h"
71 #include "src/common/xstring.h"
72 #include "src/common/slurmdb_defs.h"
73 
74 #define CKPT_WAIT	10
75 #define	MAX_INPUT_FIELDS 128
76 
77 extern char *command_name;
78 extern List clusters;
79 extern int all_flag;	/* display even hidden partitions */
80 extern int detail_flag;	/* display additional details */
81 extern int future_flag;	/* display future nodes */
82 extern int exit_code;	/* scontrol's exit code, =1 on any error at any time */
83 extern int exit_flag;	/* program to terminate if =1 */
84 extern int federation_flag; /* show federated jobs */
85 extern int input_words;	/* number of words of input permitted */
86 extern int local_flag;	/* show only local jobs -- not remote remote sib jobs */
87 extern int one_liner;	/* one record per line if =1 */
88 extern int quiet_flag;	/* quiet=1, verbose=-1, normal=0 */
89 extern int sibling_flag; /* show sibling jobs (if any fed job). */
90 extern uint32_t cluster_flags; /* what type of cluster are we talking to */
91 extern uint32_t euid; /* send request to the slurmctld in behave of this user */
92 
93 extern front_end_info_msg_t *old_front_end_info_ptr;
94 extern job_info_msg_t *old_job_info_ptr;
95 extern node_info_msg_t *old_node_info_ptr;
96 extern partition_info_msg_t *old_part_info_ptr;
97 extern reserve_info_msg_t *old_res_info_ptr;
98 extern slurm_ctl_conf_info_msg_t *old_slurm_ctl_conf_ptr;
99 
100 extern int	parse_requeue_flags(char *s, uint32_t *flags);
101 extern int	scontrol_batch_script(int argc, char **argv);
102 extern int	scontrol_callerid(int argc, char **argv);
103 extern int	scontrol_create_part(int argc, char **argv);
104 extern int	scontrol_create_res(int argc, char **argv);
105 extern int	scontrol_encode_hostlist(char *hostlist, bool sorted);
106 extern uint16_t	scontrol_get_job_state(uint32_t job_id);
107 extern int	scontrol_hold(char *op, char *job_id_str);
108 extern int	scontrol_job_notify(int argc, char **argv);
109 extern int	scontrol_job_ready(char *job_id_str);
110 extern void	scontrol_list_pids(const char *jobid_str,
111 				   const char *node_name);
112 extern void	scontrol_getent(const char *node_name);
113 extern int	scontrol_load_front_end(front_end_info_msg_t **
114 					front_end_buffer_pptr);
115 extern int	scontrol_load_job(job_info_msg_t ** job_buffer_pptr,
116 				  uint32_t job_id);
117 extern int 	scontrol_load_jobs (job_info_msg_t ** job_buffer_pptr);
118 extern int 	scontrol_load_nodes (node_info_msg_t ** node_buffer_pptr,
119 				     uint16_t show_flags);
120 extern int 	scontrol_load_partitions (partition_info_msg_t **
121 					  part_info_pptr);
122 extern void	scontrol_pid_info(pid_t job_pid);
123 extern void	scontrol_print_assoc_mgr_info(int argc, char **argv);
124 extern void	scontrol_print_bbstat(int argc, char **argv);
125 extern void	scontrol_print_burst_buffer(void);
126 extern void	scontrol_print_completing (void);
127 extern void	scontrol_print_completing_job(job_info_t *job_ptr,
128 					      node_info_msg_t *node_info_msg);
129 extern void	scontrol_print_federation(void);
130 extern void	scontrol_print_front_end_list(char *node_list);
131 extern void	scontrol_print_front_end(char *node_name,
132 					 front_end_info_msg_t  *
133 					 front_end_buffer_ptr);
134 extern void	scontrol_print_job (char * job_id_str);
135 extern void	scontrol_print_hosts (char * node_list);
136 extern void	scontrol_print_licenses(const char *feature);
137 extern void	scontrol_print_node (char *node_name,
138 				     node_info_msg_t *node_info_ptr);
139 extern void	scontrol_print_node_list (char *node_list);
140 extern void	scontrol_print_part (char *partition_name);
141 extern void	scontrol_print_res (char *reservation_name);
142 extern void	scontrol_print_step (char *job_step_id_str);
143 extern void	scontrol_print_topo (char *node_list);
144 extern void	scontrol_print_layout (int argc, char **argv);
145 extern void	scontrol_print_powercap (char *node_list);
146 extern void	scontrol_requeue(uint32_t flags, char *job_str);
147 extern void	scontrol_requeue_hold(uint32_t flags, char *job_str);
148 extern void	scontrol_suspend(char *op, char *job_id_str);
149 extern void	scontrol_top_job(char *job_str);
150 extern int	scontrol_update_front_end (int argc, char **argv);
151 extern int	scontrol_update_job (int argc, char **argv);
152 extern int	scontrol_update_layout (int argc, char **argv);
153 extern int	scontrol_update_node (int argc, char **argv);
154 extern int	scontrol_update_part (int argc, char **argv);
155 extern int	scontrol_update_res (int argc, char **argv);
156 extern int	scontrol_update_step (int argc, char **argv);
157 extern int	scontrol_update_powercap (int argc, char **argv);
158 
159 /* reboot_node.c */
160 extern int      scontrol_cancel_reboot(char *nodes);
161 extern int      scontrol_reboot_nodes(char *node_list, bool asap,
162 				      uint32_t next_state, char *reason);
163 
164 #endif
165