-
Notifications
You must be signed in to change notification settings - Fork 3
/
slurm_showq.h
96 lines (75 loc) · 2.52 KB
/
slurm_showq.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// -*-c++-*-
//-------------------------------------------------------------------------
// Copyright (c) 2012 The Regents of the University of Texas System.
// All rights reserved.
//
// Redistribution and use in source and binary forms are permitted
// provided that the above copyright notice and this paragraph are
// duplicated in all such forms and that any documentation,
// advertising materials, and other materials related to such
// distribution and use acknowledge that the software was developed by
// the University of Texas. The name of the University may not be
// used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
// WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
//-------------------------------------------------------------------------
// A SLURM derived showq for summarizing user jobs.
//
// Originally: 7/29/2012 (refactor of original LSF version)
//
// Karl W. Schulz- Texas Advanced Computing Center ([email protected])
//
// $Id: slurm_showq.C 1473 2012-12-02 20:34:38Z karl $
//-------------------------------------------------------------------------*/
#include <iostream>
#include <set>
#include <string>
#include "GetPot"
using namespace std;
#include <sys/types.h>
#include <pwd.h>
#include <libgen.h>
#include <cstdio>
#include <limits.h>
#include <unistd.h>
#include <time.h>
#include <slurm/slurm.h>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <sstream>
#define VERSION 1.0
class Slurm_Showq {
public:
Slurm_Showq();
void query_running_jobs();
void parse_supported_options(int argc, char *argv[]);
void check_maintenance();
void get_etcpwd_unames ();
bool cache_etcpwd_unames;
private:
std::string uid_to_string(uid_t id);
std::string get_executable_path();
void print_usage();
void print_version();
char *getusername();
void read_runtime_config(std::string config_file, bool conf_sm);
string GetStdoutFromCommand(string cmd);
// Command line controls
bool long_listing;
bool user_jobs_only;
bool named_user_jobs_only;
std::string named_user;
bool show_all_reserv;
bool show_utilization;
float RES_LEAD_WINDOW;
//bool cache_etcpwd_unames;
map <int,string> uid_uname;
std::string progname; // binary name for stdout
int total_avail_nodes; // max # of nodes (for utilization calculations)
};