Changeset 25 for trunk/gridctl.php


Ignore:
Timestamp:
Jan 13, 2017, 1:30:29 PM (7 years ago)
Author:
gegorbet
Message:

merge us3iab/airavata gridctl code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gridctl.php

    r22 r25  
    11<?php
     2
     3$us3bin = exec( "ls -d ~us3/lims/bin" );
     4include_once "$us3bin/listen-config.php";
     5//include "$us3bin/cleanup_aira.php";
     6//include "$us3bin/cleanup_gfac.php";
    27
    38// Global variables
     
    5358      if ( (  $me_devel  &&  !$job_devel )  ||
    5459           ( !$me_devel  &&   $job_devel ) )
    55       {  // If job not from appropriate Airavata server, skip processing
     60      {  // Job type and Airavata server mismatch: skip processing
    5661         continue;
    5762      }
    58    }
    59    else if ( $me_devel )
    60    {  // For non-thrift and development, skip
    61       continue;
    6263   }
    6364
     
    7879   }
    7980
    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;
    8385   $loghdr   = $self . ":" . $gfacLabl . "...:";
    84    $status_in = $status;
    85    $status_gw = $status;
    8686   $status_ex = $status;
    8787
     
    9191   {
    9292      $status_in  = $status;
     93//write_log( "$loghdr status_in=$status_in" );
    9394      $status     = aira_status( $gfacID, $status_in );
    9495if($status != $status_in )
    9596write_log( "$loghdr Set to $status from $status_in" );
    9697   }
    97    else
     98   else if ( is_gfac_job( $gfacID ) )
    9899   {
    99100      $status_gw  = $status;
     
    102103      if ( $status_gw == 'COMPLETE' )
    103104         $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" );
    105114   }
    106115
     
    160169      case "COMPLETED":
    161170      case "COMPLETE":
     171write_log( "$loghdr   COMPLETE gfacID=$gfacID" );
    162172         complete();
    163173         break;
     
    173183         if ( is_aira_job( $gfacID ) )
    174184         {
    175             $status_ex    = getExperimentStatus( $gfacID );
    176 write_log( "$loghdr     status=$status status_ex=$status_ex" );
    177             if ( $status_ex === 'COMPLETED' )
    178                complete();
     185            complete();
    179186         }
     187write_log( "$loghdr   FINISHED gfacID=$gfacID" );
    180188      case "PROCESSING":
    181189      default:
     
    207215      if ( ! in_array( $job_status, array( 'SUBMITTED', 'INITIALIZED', 'PENDING' ) ) )
    208216      {
    209 //write_log( "$loghdr submitted:job_status=$job_status" );
     217write_log( "$loghdr submitted:job_status=$job_status" );
    210218         update_job_status( $job_status, $gfacID );
    211219      }
     
    242250   if ( ! in_array( $job_status, array( 'SUBMITTED', 'INITIALIZED', 'PENDING' ) ) )
    243251   {
    244 //write_log( "$loghdr submit_timeout:job_status=$job_status" );
    245252      update_job_status( $job_status, $gfacID );
    246253      return;
     
    286293
    287294      if ( ! in_array( $job_status, array( 'ACTIVE', 'RUNNING', 'STARTED' ) ) )
    288       {
    289 //write_log( "$loghdr running:job_status=$job_status" );
    290295         update_job_status( $job_status, $gfacID );
    291       }
    292296
    293297      return;
     
    322326   if ( ! in_array( $job_status, array( 'ACTIVE', 'RUNNING', 'STARTED' ) ) )
    323327   {
    324 //write_log( "$loghdr run_timeout:job_status=$job_status" );
    325328      update_job_status( $job_status, $gfacID );
    326329      return;
     
    365368      if ( $job_status != 'DATA' )
    366369      {
    367 //write_log( "$loghdr wait_data:job_status=$job_status" );
    368370         update_job_status( $job_status, $gfacID );
    369371         return;
     
    410412   if ( $job_status != 'DATA' )
    411413   {
    412 //write_log( "$loghdr data_timeout:job_status=$job_status" );
    413414      update_job_status( $job_status, $gfacID );
    414415      return;
     
    463464   global $us3_db;
    464465   global $loghdr;
    465    global $class_dir;
    466466
    467467   // Double check that the gfacID exists
     
    488488
    489489   $me_devel  = preg_match( "/class_devel/", $class_dir );
     490   $me_local  = preg_match( "/class_local/", $class_dir );
    490491
    491492   if ( preg_match( "/US3-A/i", $gfacID ) )
     
    494495      if ( ( !$me_devel  &&  !$job_devel )  ||
    495496           (  $me_devel  &&   $job_devel ) )
    496       {  // If job from appropriate Airavata server, process it
     497      {  // Job is of same type (prod/devel) as Server: process it
    497498//write_log( "$loghdr CALLING aira_cleanup()" );
    498499         aira_cleanup( $us3_db, $requestID, $gLink );
     
    500501//write_log( "$loghdr RTN FR aira_cleanup()" );
    501502   }
    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   {
     505write_log( "$loghdr CALLING gfac_cleanup() reqID=$requestID" );
    506506      gfac_cleanup( $us3_db, $requestID, $gLink );
    507507   }
     
    521521    case 'SUBMITED'    :
    522522    case 'INITIALIZED' :
     523    case 'UPDATING'    :
     524    case 'PENDING'     :
    523525      $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";
    526527      break;
    527528
     
    569570      $query   = "UPDATE analysis SET status='ERROR' WHERE gfacID='$gfacID'";
    570571      $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;
    576572      break;
    577573
     
    695691
    696692      $gfac_status  = standard_status( $status_ex );
    697 write_log( "$loghdr get_gfac_status: status_ex=$status_ex gfac_status=$gfac_status" );
    698693      return $gfac_status;
    699694   }
    700695
    701696   else if ( ! is_gfac_job( $gfacID ) )
     697   {
    702698      return false;
     699   }
    703700
    704701   $url = "$serviceURL/jobstatus/$gfacID";
     
    758755   {
    759756      // Then it's not a GFAC job
    760       return false;
     757      $job_status = get_local_status( $gfacID );
     758      return $job_status;
    761759   }
    762760
     
    825823   global $self;
    826824
    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   }
    830832
    831833   $result = exec( $cmd );
     
    834836   {
    835837      write_log( "$self get_local_status: Local job $gfacID unknown" );
     838write_log( "$self get_local_status: result=$result" );
    836839      return 'UNKNOWN';
    837840   }
    838841
    839842   $values = preg_split( "/\s+/", $result );
    840 //   write_log( "$self: get_local_status: job status = /{$values[9]}/");
     843//write_log( "$self: get_local_status: job status = /{$values[9]}/");
    841844   switch ( $values[ 9 ] )
    842845   {
     
    9991002      case 'canceled' :
    10001003         $status      = 'CANCELED';
     1004         break;
     1005
     1006         $status      = 'DATA';
    10011007         break;
    10021008
     
    10431049   global $self;
    10441050   global $loghdr;
    1045    global $class_dir;
    10461051//echo "a_st: st_in$status_in : $gfacID\n";
    10471052   //$status_gw = standard_status( $status_in );
     
    10541059                  (  $me_devel  &&   $job_devel ) );
    10551060
    1056 //write_log( "$loghdr  gfacID=$gfacID  devmatch=$devmatch" );
    1057 //write_log( "$loghdr   me_d=$me_devel  jo_d=$job_devel  cd=$class_dir" );
    10581061   if ( preg_match( "/US3-A/i", $gfacID )  &&  $devmatch )
    1059    {  // Airavata job and development/production type is right
     1062   {
    10601063      $status_ex = getExperimentStatus( $gfacID );
    1061 //write_log( "$loghdr status_ex $status_ex" );
    10621064
    10631065      if ( $status_ex == 'COMPLETED' )
     
    11011103      }
    11021104
    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" );
    11061105//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" );
    11081106      if ( $status != $status_gw )
    11091107      {
Note: See TracChangeset for help on using the changeset viewer.