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_modeling_result.php
Revision: 1440
Committed: Thu Aug 18 07:03:28 2011 UTC (10 years, 10 months ago) by jmduarteg
File size: 2353 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_pdb_file($job_name) {
5     return get_result_file($job_name, ".reconstructed.pdb");
6     }
7    
8     function get_output_url($job_name) {
9     return "results/".$job_name."/";
10     }
11    
12     function print_qstat() {
13     global $server_user;
14     $cmd = 'qstat -u '.$server_user;
15     system($cmd);
16     }
17    
18     function get_mb_job_name($job_name) {
19     return 'MB-'.$job_name;
20     }
21    
22     function is_mb_job_running($job_name) {
23     global $server_user;
24     $u = escapeshellcmd($server_user);
25     $j = escapeshellcmd(get_mb_job_name($job_name));
26     $cmd = 'qstat -u '.$u.' -xml | grep "<JB_name>'.$j.'</JB_name>"';
27     $result = exec($cmd);
28     if (strpos($result, $j) !== false) {
29     return true;
30     } else {
31     return false;
32     }
33     }
34    
35     if(isset($_GET['job_name'])) {
36     $job_name = $_GET['job_name'];
37     }
38    
39     if(!isset($job_name)) {
40     error("No job name specified");
41     } else {
42     if(file_exists(get_pdb_file($job_name))) {
43     header("Location: show_modeling_result.php?job_name=".$job_name);
44     }
45     }
46    
47     # auto-refresh
48     header('Refresh: '.$refresh_rate);
49     ?>
50     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
51     <html xmlns="http://www.w3.org/1999/xhtml">
52    
53     <head>
54     <title>Structure prediction server</title>
55     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
56     <link rel="stylesheet" type="text/css" href="css/default.css" />
57     </head>
58     <body>
59     <?php include_once("inc/owl_header.inc.php") ?>
60     <?php
61     echo 'Job name='.$job_name.' [<a href="'.get_output_url($job_name).'">see raw output</a>] <br/>';
62    
63     if(is_mb_job_running($job_name)) {
64     echo '<p><b>Your calculation is still running.</b></p><p>This may take a few hours. You can bookmark this page to visit again later. <br/>When the calculation is done the output will appear here. <br/>You may need to refresh the page to see the output.</p>';
65     } else {
66     echo '<p><font color="red"><b>Your job seems to be not running anymore and probably failed. </b></font></p>';
67     }
68     echo "Job queue:<br/><br/> (if you don't know what this is, you can safely ignore it)<br/>";
69     echo '<p><pre>';
70     print_qstat();
71     echo '</pre></p>';
72     ?>
73     <div class="buttons">
74     <a href="results.php"><img src="images/application_view_list.png" alt="" /> View result list</a>
75     <a href="index.php"><img src="images/new.png" alt="" /> Start new job</a>
76     </div>
77     <div style="clear:both;"></div>
78     <p></p>
79     </body>
80     </html>