Index: trunk/gridctl.php
===================================================================
--- trunk/gridctl.php	(revision 6)
+++ trunk/gridctl.php	(revision 10)
@@ -1,8 +1,3 @@
 <?php
-
-$us3bin = exec( "ls -d ~us3/bin" );
-include_once "$us3bin/listen-config.php";
-include "$us3bin/cleanup_aira.php";
-include "$us3bin/cleanup_gfac.php";
 
 // Global variables
@@ -74,5 +69,4 @@
    {
       $status_in  = $status;
-//write_log( "$loghdr status_in=$status_in" );
       $status     = aira_status( $gfacID, $status_in );
 if($status != $status_in )
@@ -155,8 +149,8 @@
       case "FINISHED":
       case "DONE":
-         if ( is_aira_job( $gfacID ) )
-         {
-            complete();
-         }
+//         if ( is_aira_job( $gfacID ) )
+//         {
+//            complete();
+//         }
       case "PROCESSING":
       default:
@@ -437,4 +431,5 @@
    global $us3_db;
    global $loghdr;
+   global $class_dir;
 
    // Double check that the gfacID exists
@@ -460,8 +455,14 @@
    if ( $requestID == 0 ) return;
 
-   if ( preg_match( "/US3-AIRA/i", $gfacID ) )
-   {
+   if ( preg_match( "/US3-A/i", $gfacID ) )
+   {
+      $me_devel  = preg_match( "/class_devel/", $class_dir );
+      $job_devel = preg_match( "/US3-ADEV/i", $gfacID );
+      if ( ( !$me_devel  &&  !$job_devel )  ||
+           (  $me_devel  &&   $job_devel ) )
+      {  // If job from appropriate Airavata server, process it
 //write_log( "$loghdr CALLING aira_cleanup()" );
-      aira_cleanup( $us3_db, $requestID, $gLink );
+         aira_cleanup( $us3_db, $requestID, $gLink );
+      }
 //write_log( "$loghdr RTN FR aira_cleanup()" );
    }
@@ -625,5 +626,5 @@
    global $cluster;
 
-   if ( preg_match( "/US3-AIRA/i", $gfacID )  &&
+   if ( preg_match( "/US3-A/i", $gfacID )  &&
         ! preg_match( "/juropa/i", $cluster ) )
    {
@@ -997,4 +998,5 @@
    global $self;
    global $loghdr;
+   global $class_dir;
 //echo "a_st: st_in$status_in : $gfacID\n";
    //$status_gw = standard_status( $status_in );
@@ -1002,8 +1004,15 @@
 //echo "a_st:  st_db=$status_gw\n";
    $status    = $status_gw;
-
-   if ( preg_match( "/US3-AIRA/i", $gfacID ) )
-   {
+   $me_devel  = preg_match( "/class_devel/", $class_dir );
+   $job_devel = preg_match( "/US3-ADEV/i", $gfacID );
+   $devmatch  = ( ( !$me_devel  &&  !$job_devel )  ||
+                  (  $me_devel  &&   $job_devel ) );
+
+//write_log( "$loghdr  gfacID=$gfacID  devmatch=$devmatch" );
+//write_log( "$loghdr   me_d=$me_devel  jo_d=$job_devel  cd=$class_dir" );
+   if ( preg_match( "/US3-A/i", $gfacID )  &&  $devmatch )
+   {  // Airavata job and development/production type is right
       $status_ex = getExperimentStatus( $gfacID );
+//write_log( "$loghdr status_ex $status_ex" );
 
       if ( $status_ex == 'COMPLETED' )
@@ -1047,5 +1056,6 @@
       }
 
-write_log( "$loghdr status/_in/_gw/_ex=$status/$status_in/$status_gw/$status_ex" );
+//write_log( "$loghdr status/_in/_gw/_ex=$status/$status_in/$status_gw/$status_ex" );
+//write_log( "  me_d=$me_devel jo_d=$job_devel dm=$devmatch cd=$class_dir" );
       if ( $status != $status_gw )
       {
