Changeset 25 for trunk/gridctl.php
- Timestamp:
- Jan 13, 2017, 1:30:29 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gridctl.php
r22 r25 1 1 <?php 2 3 $us3bin = exec( "ls -d ~us3/lims/bin" ); 4 include_once "$us3bin/listen-config.php"; 5 //include "$us3bin/cleanup_aira.php"; 6 //include "$us3bin/cleanup_gfac.php"; 2 7 3 8 // Global variables … … 53 58 if ( ( $me_devel && !$job_devel ) || 54 59 ( !$me_devel && $job_devel ) ) 55 { // If job not from appropriate Airavata server,skip processing60 { // Job type and Airavata server mismatch: skip processing 56 61 continue; 57 62 } 58 }59 else if ( $me_devel )60 { // For non-thrift and development, skip61 continue;62 63 } 63 64 … … 78 79 } 79 80 80 $awork = array(); 81 $awork = explode( "-", $gfacID ); 82 $gfacLabl = $awork[0] . "-" . $awork[1] . "-" . $awork[2]; 81 // $awork = array(); 82 // $awork = explode( "-", $gfacID ); 83 // $gfacLabl = $awork[0] . "-" . $awork[1] . "-" . $awork[2]; 84 $gfacLabl = $gfacID; 83 85 $loghdr = $self . ":" . $gfacLabl . "...:"; 84 $status_in = $status;85 $status_gw = $status;86 86 $status_ex = $status; 87 87 … … 91 91 { 92 92 $status_in = $status; 93 //write_log( "$loghdr status_in=$status_in" ); 93 94 $status = aira_status( $gfacID, $status_in ); 94 95 if($status != $status_in ) 95 96 write_log( "$loghdr Set to $status from $status_in" ); 96 97 } 97 else 98 else if ( is_gfac_job( $gfacID ) ) 98 99 { 99 100 $status_gw = $status; … … 102 103 if ( $status_gw == 'COMPLETE' ) 103 104 $status = $status_gw; 104 write_log( "$loghdr non-AThrift status=$status status_gw=$status_gw" ); 105 //write_log( "$loghdr non-AThrift status=$status status_gw=$status_gw" ); 106 } 107 else 108 { 109 $status_gw = $status; 110 $status = get_local_status( $gfacID ); 111 if ( $status_gw == 'COMPLETE' || $status == 'UNKNOWN' ) 112 $status = $status_gw; 113 //write_log( "$loghdr Local status=$status status_gw=$status_gw" ); 105 114 } 106 115 … … 160 169 case "COMPLETED": 161 170 case "COMPLETE": 171 write_log( "$loghdr COMPLETE gfacID=$gfacID" ); 162 172 complete(); 163 173 break; … … 173 183 if ( is_aira_job( $gfacID ) ) 174 184 { 175 $status_ex = getExperimentStatus( $gfacID ); 176 write_log( "$loghdr status=$status status_ex=$status_ex" ); 177 if ( $status_ex === 'COMPLETED' ) 178 complete(); 185 complete(); 179 186 } 187 write_log( "$loghdr FINISHED gfacID=$gfacID" ); 180 188 case "PROCESSING": 181 189 default: … … 207 215 if ( ! in_array( $job_status, array( 'SUBMITTED', 'INITIALIZED', 'PENDING' ) ) ) 208 216 { 209 //write_log( "$loghdr submitted:job_status=$job_status" );217 write_log( "$loghdr submitted:job_status=$job_status" ); 210 218 update_job_status( $job_status, $gfacID ); 211 219 } … … 242 250 if ( ! in_array( $job_status, array( 'SUBMITTED', 'INITIALIZED', 'PENDING' ) ) ) 243 251 { 244 //write_log( "$loghdr submit_timeout:job_status=$job_status" );245 252 update_job_status( $job_status, $gfacID ); 246 253 return; … … 286 293 287 294 if ( ! in_array( $job_status, array( 'ACTIVE', 'RUNNING', 'STARTED' ) ) ) 288 {289 //write_log( "$loghdr running:job_status=$job_status" );290 295 update_job_status( $job_status, $gfacID ); 291 }292 296 293 297 return; … … 322 326 if ( ! in_array( $job_status, array( 'ACTIVE', 'RUNNING', 'STARTED' ) ) ) 323 327 { 324 //write_log( "$loghdr run_timeout:job_status=$job_status" );325 328 update_job_status( $job_status, $gfacID ); 326 329 return; … … 365 368 if ( $job_status != 'DATA' ) 366 369 { 367 //write_log( "$loghdr wait_data:job_status=$job_status" );368 370 update_job_status( $job_status, $gfacID ); 369 371 return; … … 410 412 if ( $job_status != 'DATA' ) 411 413 { 412 //write_log( "$loghdr data_timeout:job_status=$job_status" );413 414 update_job_status( $job_status, $gfacID ); 414 415 return; … … 463 464 global $us3_db; 464 465 global $loghdr; 465 global $class_dir;466 466 467 467 // Double check that the gfacID exists … … 488 488 489 489 $me_devel = preg_match( "/class_devel/", $class_dir ); 490 $me_local = preg_match( "/class_local/", $class_dir ); 490 491 491 492 if ( preg_match( "/US3-A/i", $gfacID ) ) … … 494 495 if ( ( !$me_devel && !$job_devel ) || 495 496 ( $me_devel && $job_devel ) ) 496 { // If job from appropriate Airavata server,process it497 { // Job is of same type (prod/devel) as Server: process it 497 498 //write_log( "$loghdr CALLING aira_cleanup()" ); 498 499 aira_cleanup( $us3_db, $requestID, $gLink ); … … 500 501 //write_log( "$loghdr RTN FR aira_cleanup()" ); 501 502 } 502 503 else if ( ! $me_devel ) 504 { // If this is gridctl_pro and gfac (jureca), do GFAC cleanup 505 //write_log( "$loghdr CALLING gfac_cleanup()" ); 503 else if ( ! $me_local ) 504 { 505 write_log( "$loghdr CALLING gfac_cleanup() reqID=$requestID" ); 506 506 gfac_cleanup( $us3_db, $requestID, $gLink ); 507 507 } … … 521 521 case 'SUBMITED' : 522 522 case 'INITIALIZED' : 523 case 'UPDATING' : 524 case 'PENDING' : 523 525 $query = "UPDATE analysis SET status='SUBMITTED' WHERE gfacID='$gfacID'"; 524 $message = "Job status request reports job is " . $job_status; 525 //write_log( "$loghdr update_job_status(SUBM) job_status=$job_status" ); 526 $message = "Job status request reports job is SUBMITTED"; 526 527 break; 527 528 … … 569 570 $query = "UPDATE analysis SET status='ERROR' WHERE gfacID='$gfacID'"; 570 571 $message = "Job status request reports job is not in the queue"; 571 break;572 573 case 'UPDATING' :574 case 'PENDING' :575 $message = "Job status request reports job is " . $job_status;576 572 break; 577 573 … … 695 691 696 692 $gfac_status = standard_status( $status_ex ); 697 write_log( "$loghdr get_gfac_status: status_ex=$status_ex gfac_status=$gfac_status" );698 693 return $gfac_status; 699 694 } 700 695 701 696 else if ( ! is_gfac_job( $gfacID ) ) 697 { 702 698 return false; 699 } 703 700 704 701 $url = "$serviceURL/jobstatus/$gfacID"; … … 758 755 { 759 756 // Then it's not a GFAC job 760 return false; 757 $job_status = get_local_status( $gfacID ); 758 return $job_status; 761 759 } 762 760 … … 825 823 global $self; 826 824 827 $system = "$cluster.uthscsa.edu"; 828 $system = preg_replace( "/\-local/", "", $system ); 829 $cmd = "/usr/bin/ssh -x us3@$system qstat -a $gfacID 2>&1"; 825 $cmd = "/usr/bin/qstat -a $gfacID 2>&1|tail -n 1"; 826 if ( ! preg_match( "/us3iab/", $cluster ) ) 827 { 828 $system = "$cluster.uthscsa.edu"; 829 $system = preg_replace( "/\-local/", "", $system ); 830 $cmd = "/usr/bin/ssh -x us3@$system " . $cmd; 831 } 830 832 831 833 $result = exec( $cmd ); … … 834 836 { 835 837 write_log( "$self get_local_status: Local job $gfacID unknown" ); 838 write_log( "$self get_local_status: result=$result" ); 836 839 return 'UNKNOWN'; 837 840 } 838 841 839 842 $values = preg_split( "/\s+/", $result ); 840 // 843 //write_log( "$self: get_local_status: job status = /{$values[9]}/"); 841 844 switch ( $values[ 9 ] ) 842 845 { … … 999 1002 case 'canceled' : 1000 1003 $status = 'CANCELED'; 1004 break; 1005 1006 $status = 'DATA'; 1001 1007 break; 1002 1008 … … 1043 1049 global $self; 1044 1050 global $loghdr; 1045 global $class_dir;1046 1051 //echo "a_st: st_in$status_in : $gfacID\n"; 1047 1052 //$status_gw = standard_status( $status_in ); … … 1054 1059 ( $me_devel && $job_devel ) ); 1055 1060 1056 //write_log( "$loghdr gfacID=$gfacID devmatch=$devmatch" );1057 //write_log( "$loghdr me_d=$me_devel jo_d=$job_devel cd=$class_dir" );1058 1061 if ( preg_match( "/US3-A/i", $gfacID ) && $devmatch ) 1059 { // Airavata job and development/production type is right1062 { 1060 1063 $status_ex = getExperimentStatus( $gfacID ); 1061 //write_log( "$loghdr status_ex $status_ex" );1062 1064 1063 1065 if ( $status_ex == 'COMPLETED' ) … … 1101 1103 } 1102 1104 1103 if(preg_match("/US3-A/i",$gfacID))1104 //if(preg_match("/US3-ADEV/i",$gfacID))1105 write_log( "$loghdr status/_in/_gw/_ex=$status/$status_in/$status_gw/$status_ex" );1106 1105 //write_log( "$loghdr status/_in/_gw/_ex=$status/$status_in/$status_gw/$status_ex" ); 1107 //write_log( " me_d=$me_devel jo_d=$job_devel dm=$devmatch cd=$class_dir" );1108 1106 if ( $status != $status_gw ) 1109 1107 {
Note:
See TracChangeset
for help on using the changeset viewer.