3 require_once ("paths.php");
4 require_once ($smarty_path."Smarty.class.php");
5 require_once ("bweb.inc.php");
6 require_once ("config.inc.php");
8 $smarty = new Smarty();
13 // Smarty configuration
14 $smarty->compile_check = true;
15 $smarty->debugging = false;
16 $smarty->force_compile = true;
18 $smarty->template_dir = "./templates";
19 $smarty->compile_dir = "./templates_c";
20 $smarty->config_dir = "./configs";
22 // Get the last 10 failed jobs
24 $failed_jobs = array();
26 switch( $dbSql->driver )
29 $query = "SELECT SEC_TO_TIME( UNIX_TIMESTAMP(Job.EndTime)-UNIX_TIMESTAMP(Job.StartTime) ) AS elapsed, Job.JobId, Job.Name AS job_name, Job.StartTime, Job.EndTime, Job.Level, Pool.Name AS pool_name, Job.JobStatus ";
30 $query .= "FROM Job ";
31 $query .= "LEFT JOIN Pool ON Job.PoolId=Pool.PoolId ";
32 $query .= "WHERE Job.JobStatus = 'f' ";
33 //$query .= "WHERE Job.EndTime BETWEEN <= NOW() and UNIX_TIMESTAMP(EndTime) >UNIX_TIMESTAMP(NOW())-86400 ";
34 $query .= "ORDER BY Job.EndTime DESC ";
40 $query = "SELECT (Job.EndTime - Job.StartTime ) AS elapsed, Job.Name, Job.StartTime, Job.EndTime, Job.Level, Pool.Name, Job.JobStatus ";
41 $query .= "FROM Job ";
42 $query .= "LEFT JOIN Pool ON Job.PoolId=Pool.PoolId ";
43 $query .= "WHERE Job.JobStatus = 'f' ";
44 //$query .= "WHERE EndTime <= NOW() and EndTime > NOW() - 86400 * interval '1 second' AND ";
45 $query .= "ORDER BY Job.EndTime DESC";
49 $jobsresult = $dbSql->db_link->query( $query );
51 if( PEAR::isError( $jobsresult ) ) {
52 echo "SQL query = $query <br />";
53 die("Unable to get last failed jobs from catalog" . $jobsresult->getMessage() );
55 while( $job = $jobsresult->fetchRow( DB_FETCHMODE_ASSOC ) ) {
56 array_push( $failed_jobs, $job);
59 $smarty->assign( 'failed_jobs', $failed_jobs );
61 // Get the last completed jobs (last 24 hours)
63 $completed_jobs = array();
65 // Interval calculation
67 $start_date = $end_date - LAST_DAY;
69 $start_date = date( "Y-m-d H:i:s", $start_date );
70 $end_date = date( "Y-m-d H:i:s", $end_date );
72 switch( $dbSql->driver )
75 $query = "SELECT SEC_TO_TIME( UNIX_TIMESTAMP(Job.EndTime)-UNIX_TIMESTAMP(Job.StartTime) ) AS elapsed, Job.JobId, Job.Name AS job_name, Job.StartTime, Job.EndTime, Job.Level, Pool.Name AS pool_name, Job.JobStatus ";
76 $query .= "FROM Job ";
77 $query .= "LEFT JOIN Pool ON Job.PoolId=Pool.PoolId ";
78 $query .= "WHERE Job.JobStatus = 'T' AND ";
79 $query .= "Job.EndTime BETWEEN '$start_date' AND '$end_date' ";
80 $query .= "ORDER BY Job.EndTime DESC ";
85 $query = "SELECT (Job.EndTime - Job.StartTime ) AS elapsed, Job.Name, Job.StartTime, Job.EndTime, Job.Level, Pool.Name, Job.JobStatus ";
86 $query .= "FROM Job ";
87 $query .= "LEFT JOIN Pool ON Job.PoolId=Pool.PoolId ";
88 $query .= "WHERE EndTime BETWEEN '$start_date' and '$end_date' ";
89 $query .= "ORDER BY Job.EndTime DESC";
93 $jobsresult = $dbSql->db_link->query( $query );
95 if( PEAR::isError( $jobsresult ) ) {
96 echo "SQL query = $query <br />";
97 die("Unable to get last failed jobs from catalog" . $jobsresult->getMessage() );
99 while( $job = $jobsresult->fetchRow( DB_FETCHMODE_ASSOC ) ) {
100 array_push( $completed_jobs, $job);
103 $smarty->assign( 'completed_jobs', $completed_jobs );
105 $smarty->display('jobs.tpl');