ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/tags/owl-for-cmview-1.9.4/modelit/server/wait_for_templates.php
Revision: 1440
Committed: Thu Aug 18 07:03:28 2011 UTC (10 years, 10 months ago) by jmduarteg
File size: 2327 byte(s)
Log Message:
Tagging from bug fix branch for bug fixed version of CMView 1.9.4 (released as 1.1.1). Important bug fix of DaliRunner
Line User Rev File contents
1 hstehr 1299 <?php
2     include_once("inc/settings.php");
3    
4     function get_report_file($job_name) {
5     return $GLOBALS['server_root']."results/".$job_name."/".$job_name.".report";
6     }
7    
8     function get_output_url($job_name) {
9     return "results/".$job_name."/";
10     }
11    
12     function get_ts_job_name($job_name) {
13     return 'TS-'.$job_name;
14     }
15    
16     function is_ts_job_running($job_name) {
17     global $server_user;
18     $u = escapeshellcmd($server_user);
19     $j = escapeshellcmd(get_ts_job_name($job_name));
20     $cmd = 'qstat -u '.$u.' -xml | grep "<JB_name>'.$j.'</JB_name>"';
21     $fullresult = array();
22     $retval = 0;
23     $result = exec($cmd, $fullresult, $retval);
24     if (strpos($result, $j) !== false) {
25     return true;
26     } else {
27     return false;
28     }
29     }
30    
31     if(isset($_GET['job_name'])) {
32     $job_name = $_GET['job_name'];
33     }
34    
35     if(!isset($job_name)) {
36     $errors['no_job_name'] = 1;
37     } else {
38     if(file_exists(get_report_file($job_name))) {
39     header("Location: select_templates.php?job_name=".$job_name);
40     }
41     }
42    
43     # auto-refresh
44     header('Refresh: '.$refresh_rate);
45     ?>
46     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
47     <html xmlns="http://www.w3.org/1999/xhtml">
48    
49     <head>
50     <title>Structure prediction server</title>
51     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
52     <link rel="stylesheet" type="text/css" href="css/default.css" />
53     </head>
54     <body>
55     <?php include_once("inc/owl_header.inc.php") ?>
56     <?php
57     if(isset($errors['no_job_name'])) {
58     echo '<font color="red">Error. No job name specified</font><br/>';
59     } else {
60     echo 'Job name='.$job_name.' [<a href="'.get_output_url($job_name).'">see raw output</a>] <br/>';
61    
62     if(is_ts_job_running($job_name)) {
63     echo '<p><b>Your calculation is still running.</b></p><p>This may take a few minutes. You can bookmark this page to visit again later. <br/>When the calculation is done the output will appear here and in the result list. <br/>You may need to refresh the page to see the output.</p>';
64     } else {
65     echo '<p><font color="red"><b>Your job seems to be not running anymore and probably failed. </b></font></p>';
66     }
67     }
68     ?>
69     <div class="buttons">
70     <a href="results.php"><img src="images/application_view_list.png" alt="" /> View result list</a>
71     <a href="index.php"><img src="images/new.png" alt="" /> Start new job</a>
72     </div>
73     <div style="clear:both;"></div>
74     <p></p>
75     </body>
76     </html>