-
Notifications
You must be signed in to change notification settings - Fork 0
/
queue.php
119 lines (102 loc) · 2.94 KB
/
queue.php
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<HEAD>
<!-- <META HTTP-EQUIV=REFRESH CONTENT=5> -->
<!-- <title>Condor Pool Monitor</title> -->
<link rel="stylesheet" href="style.css">
<title><?php
if(isset($_REQUEST['user']) && !empty($_REQUEST['user']) )
echo $_REQUEST['user']."'s queue - Condor Monitor";
else
echo "QUEUE - Condor Monitor";
?></title>
</HEAD>
<body>
<?php
require_once 'common.php';
require_once 'queue_include.php';
?>
<?php do_refresh_button(); ?>
<h1><?php
if(isset($_REQUEST['user']) && !empty($_REQUEST['user']) )
echo $_REQUEST['user']."'s queue";
else
echo "Global queue";
?></h1>
<?php
// Algorithm
// define attribute list
// for each schedd
// get xml data
// read data into matrix
// format data
// print data
// next schedd
$g_user_list = array(
"ClusterId",
"ProcId",
"Owner", // recommendation: keep uncommented
//"NTDomain",
"JobStatus",
"QDate",
//"JobStartDate", // check job is running and then use this time to calculate how long the job has been running, first running start timestamp
"JobCurrentStartDate", // check job is running and then use this time to calculate how long the job has been running, current running start timestamp
"RemoteHost",
//"Rank",
"JobPrio",
"SC_JOB_DESCRIPTION"
);
$g_admin_list = array(
"EnteredCurrentStatus",
"JobRunCount",
"Iwd"
);
if(isset($_REQUEST['admin']) && !empty($_REQUEST['admin']) ) {
$g_list = array_merge( $g_user_list, $g_admin_list );
} else {
$g_list = $g_user_list;
}
$g_list_length = count( $g_list );
// $g_schedds = get_all_schedds();
$g_schedds = Array();
$g_matrix = Array();
$g_total_jobs = 0;
$g_accounting = Array(0,0,0,0,0);
$cmd = "condor_q -xml -global";
if(isset($_REQUEST['user']) && !empty($_REQUEST['user']) )
$cmd = $cmd . " " . $_REQUEST['user'];
$raw = `$cmd`;
$pieces = explode( "-- Schedd: ", $raw );
for( $ii = 1; $ii < count($pieces); $ii++ )
{
// strip the schedd name and ip line
$pos = strpos( $pieces[$ii], ':' );
$g_schedds[$ii-1] = trim( substr( $pieces[$ii], 0, $pos ) );
$pos = strpos( $pieces[$ii], '<?xml' );
$output = substr( $pieces[$ii], $pos );
$g_xml = simplexml_load_string( $output );
//echo $schedd,' has ',count( $g_xml->c ),' jobs.<br />';
if( $g_xml !== false )
{
read_data( $g_schedds[$ii-1] );
}
else
{
echo '<h2>Error getting xml data from schedd: ',$schedd,'</h2>';
echo '<h3>',$cmd,'</h3>';
echo '<pre>',htmlentities($output),'</pre>';
}
}
data_accounting();
print_accounting();
echo '<hr />';
sort_data();
format_data();
print_data();
?>
<hr>
<p>Last update: <?php echo date(DATE_RFC822); ?></p>
<?php do_refresh_button(); ?>
</body>
</html>