airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata-php-gateway git commit: adding updated code for the job command ordering
Date Fri, 23 Oct 2015 04:56:44 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/master 2fc02c053 -> 9315f3cd5


adding updated code for the job command ordering


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/9315f3cd
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/9315f3cd
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/9315f3cd

Branch: refs/heads/master
Commit: 9315f3cd5d26ddd6ac2cac89e6d1a97a15e5e8d6
Parents: 2fc02c0
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Fri Oct 23 00:56:39 2015 -0400
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Fri Oct 23 00:56:39 2015 -0400

----------------------------------------------------------------------
 app/controllers/ApplicationController.php       |  20 ---
 .../Model/AppCatalog/AppDeployment/Types.php    | 175 +++++++++++++++++--
 app/libraries/AppUtilities.php                  |  32 +++-
 app/views/partials/deployment-block.blade.php   |   6 +-
 4 files changed, 187 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9315f3cd/app/controllers/ApplicationController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ApplicationController.php b/app/controllers/ApplicationController.php
index 0106331..c111141 100644
--- a/app/controllers/ApplicationController.php
+++ b/app/controllers/ApplicationController.php
@@ -131,26 +131,6 @@ class ApplicationController extends BaseController {
 		{
 			$update = true;
 			$appDeploymentValues = Input::all();
-            switch($appDeploymentValues["parallelism"]){
-                case "MPI":
-                    $appDeploymentValues["parallelism"] = \Airavata\Model\AppCatalog\AppDeployment\ApplicationParallelismType::MPI;
-                    break;
-                case "SERIAL":
-                    $appDeploymentValues["parallelism"] = \Airavata\Model\AppCatalog\AppDeployment\ApplicationParallelismType::SERIAL;
-                    break;
-                case "OPENMP":
-                    $appDeploymentValues["parallelism"] = \Airavata\Model\AppCatalog\AppDeployment\ApplicationParallelismType::OPENMP;
-                    break;
-                case "OPENMP_MPI":
-                    $appDeploymentValues["parallelism"] = \Airavata\Model\AppCatalog\AppDeployment\ApplicationParallelismType::OPENMP_MPI;
-                    break;
-				case "CRAY_MPI":
-					$appDeploymentValues["parallelism"] = \Airavata\Model\AppCatalog\AppDeployment\ApplicationParallelismType::CRAY_MPI;
-					break;
-				case "CCM":
-					$appDeploymentValues["parallelism"] = \Airavata\Model\AppCatalog\AppDeployment\ApplicationParallelismType::CCM;
-					break;
-            }
 			AppUtilities::create_or_update_appDeployment( $appDeploymentValues, $update);
 			$message = "Application Deployment has been updated!";
 		}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9315f3cd/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php b/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
index 61d4c5a..a9cc409 100644
--- a/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
+++ b/app/libraries/Airavata/Model/AppCatalog/AppDeployment/Types.php
@@ -58,6 +58,9 @@ final class ApplicationParallelismType {
  * 
  * value:
  *   Value of the environment variable to set
+ * 
+ * envOrder:
+ *   The order of the setting of the env variables when there are multiple env variables
  */
 class SetEnvPaths {
   static $_TSPEC;
@@ -70,6 +73,10 @@ class SetEnvPaths {
    * @var string
    */
   public $value = null;
+  /**
+   * @var int
+   */
+  public $envPathOrder = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -82,6 +89,10 @@ class SetEnvPaths {
           'var' => 'value',
           'type' => TType::STRING,
           ),
+        3 => array(
+          'var' => 'envPathOrder',
+          'type' => TType::I32,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -91,6 +102,9 @@ class SetEnvPaths {
       if (isset($vals['value'])) {
         $this->value = $vals['value'];
       }
+      if (isset($vals['envPathOrder'])) {
+        $this->envPathOrder = $vals['envPathOrder'];
+      }
     }
   }
 
@@ -127,6 +141,13 @@ class SetEnvPaths {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 3:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->envPathOrder);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -150,6 +171,118 @@ class SetEnvPaths {
       $xfer += $output->writeString($this->value);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->envPathOrder !== null) {
+      $xfer += $output->writeFieldBegin('envPathOrder', TType::I32, 3);
+      $xfer += $output->writeI32($this->envPathOrder);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+/**
+ * Job commands to be used in Pre Job, Post Job and Module Load Commands
+ * 
+ * command:
+ *   The actual command in string format
+ * 
+ * commandOrder:
+ *   Order of the command in the multiple command situation
+ */
+class CommandObject {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $command = null;
+  /**
+   * @var int
+   */
+  public $commandOrder = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'command',
+          'type' => TType::STRING,
+          ),
+        2 => array(
+          'var' => 'commandOrder',
+          'type' => TType::I32,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['command'])) {
+        $this->command = $vals['command'];
+      }
+      if (isset($vals['commandOrder'])) {
+        $this->commandOrder = $vals['commandOrder'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'CommandObject';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->command);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->commandOrder);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('CommandObject');
+    if ($this->command !== null) {
+      $xfer += $output->writeFieldBegin('command', TType::STRING, 1);
+      $xfer += $output->writeString($this->command);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->commandOrder !== null) {
+      $xfer += $output->writeFieldBegin('commandOrder', TType::I32, 2);
+      $xfer += $output->writeI32($this->commandOrder);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -370,7 +503,7 @@ class ApplicationDeploymentDescription {
    */
   public $appDeploymentDescription = null;
   /**
-   * @var string[]
+   * @var \Airavata\Model\AppCatalog\AppDeployment\CommandObject[]
    */
   public $moduleLoadCmds = null;
   /**
@@ -386,11 +519,11 @@ class ApplicationDeploymentDescription {
    */
   public $setEnvironment = null;
   /**
-   * @var string[]
+   * @var \Airavata\Model\AppCatalog\AppDeployment\CommandObject[]
    */
   public $preJobCommands = null;
   /**
-   * @var string[]
+   * @var \Airavata\Model\AppCatalog\AppDeployment\CommandObject[]
    */
   public $postJobCommands = null;
 
@@ -424,9 +557,10 @@ class ApplicationDeploymentDescription {
         7 => array(
           'var' => 'moduleLoadCmds',
           'type' => TType::LST,
-          'etype' => TType::STRING,
+          'etype' => TType::STRUCT,
           'elem' => array(
-            'type' => TType::STRING,
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\AppCatalog\AppDeployment\CommandObject',
             ),
           ),
         8 => array(
@@ -459,17 +593,19 @@ class ApplicationDeploymentDescription {
         11 => array(
           'var' => 'preJobCommands',
           'type' => TType::LST,
-          'etype' => TType::STRING,
+          'etype' => TType::STRUCT,
           'elem' => array(
-            'type' => TType::STRING,
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\AppCatalog\AppDeployment\CommandObject',
             ),
           ),
         12 => array(
           'var' => 'postJobCommands',
           'type' => TType::LST,
-          'etype' => TType::STRING,
+          'etype' => TType::STRUCT,
           'elem' => array(
-            'type' => TType::STRING,
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\AppCatalog\AppDeployment\CommandObject',
             ),
           ),
         );
@@ -584,7 +720,8 @@ class ApplicationDeploymentDescription {
             for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
             {
               $elem5 = null;
-              $xfer += $input->readString($elem5);
+              $elem5 = new \Airavata\Model\AppCatalog\AppDeployment\CommandObject();
+              $xfer += $elem5->read($input);
               $this->moduleLoadCmds []= $elem5;
             }
             $xfer += $input->readListEnd();
@@ -655,7 +792,8 @@ class ApplicationDeploymentDescription {
             for ($_i28 = 0; $_i28 < $_size24; ++$_i28)
             {
               $elem29 = null;
-              $xfer += $input->readString($elem29);
+              $elem29 = new \Airavata\Model\AppCatalog\AppDeployment\CommandObject();
+              $xfer += $elem29->read($input);
               $this->preJobCommands []= $elem29;
             }
             $xfer += $input->readListEnd();
@@ -672,7 +810,8 @@ class ApplicationDeploymentDescription {
             for ($_i34 = 0; $_i34 < $_size30; ++$_i34)
             {
               $elem35 = null;
-              $xfer += $input->readString($elem35);
+              $elem35 = new \Airavata\Model\AppCatalog\AppDeployment\CommandObject();
+              $xfer += $elem35->read($input);
               $this->postJobCommands []= $elem35;
             }
             $xfer += $input->readListEnd();
@@ -729,11 +868,11 @@ class ApplicationDeploymentDescription {
       }
       $xfer += $output->writeFieldBegin('moduleLoadCmds', TType::LST, 7);
       {
-        $output->writeListBegin(TType::STRING, count($this->moduleLoadCmds));
+        $output->writeListBegin(TType::STRUCT, count($this->moduleLoadCmds));
         {
           foreach ($this->moduleLoadCmds as $iter36)
           {
-            $xfer += $output->writeString($iter36);
+            $xfer += $iter36->write($output);
           }
         }
         $output->writeListEnd();
@@ -797,11 +936,11 @@ class ApplicationDeploymentDescription {
       }
       $xfer += $output->writeFieldBegin('preJobCommands', TType::LST, 11);
       {
-        $output->writeListBegin(TType::STRING, count($this->preJobCommands));
+        $output->writeListBegin(TType::STRUCT, count($this->preJobCommands));
         {
           foreach ($this->preJobCommands as $iter40)
           {
-            $xfer += $output->writeString($iter40);
+            $xfer += $iter40->write($output);
           }
         }
         $output->writeListEnd();
@@ -814,11 +953,11 @@ class ApplicationDeploymentDescription {
       }
       $xfer += $output->writeFieldBegin('postJobCommands', TType::LST, 12);
       {
-        $output->writeListBegin(TType::STRING, count($this->postJobCommands));
+        $output->writeListBegin(TType::STRUCT, count($this->postJobCommands));
         {
           foreach ($this->postJobCommands as $iter41)
           {
-            $xfer += $output->writeString($iter41);
+            $xfer += $iter41->write($output);
           }
         }
         $output->writeListEnd();

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9315f3cd/app/libraries/AppUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AppUtilities.php b/app/libraries/AppUtilities.php
index 3dff384..b239280 100644
--- a/app/libraries/AppUtilities.php
+++ b/app/libraries/AppUtilities.php
@@ -9,6 +9,7 @@ use Airavata\Model\AppCatalog\AppInterface\ApplicationInterfaceDescription;
 use Airavata\Model\Application\Io\DataType;
 use Airavata\Model\Application\Io\InputDataObjectType;
 use Airavata\Model\Application\Io\OutputDataObjectType;
+use Airavata\Model\AppCatalog\AppDeployment\CommandObject;
 
 
 class AppUtilities
@@ -139,11 +140,19 @@ class AppUtilities
 
     public static function create_or_update_appDeployment($inputs, $update = false)
     {
-
         $appDeploymentValues = $inputs;
 
-        if (isset($appDeploymentValues["moduleLoadCmds"]))
-            $appDeploymentValues["moduleLoadCmds"] = array_unique(array_filter($appDeploymentValues["moduleLoadCmds"]));
+        if (isset($appDeploymentValues["moduleLoadCmds"])) {
+            $moduleLoadCmds = array_unique(array_filter($appDeploymentValues["moduleLoadCmds"],
"trim"));
+            $processedModuleLoadCommands = array();
+            foreach ($moduleLoadCmds as $index => $loadCmd) {
+                $cmdObject = new CommandObject();
+                $cmdObject->command = $loadCmd;
+                $cmdObject->commandOrder = $index;
+                $processedModuleLoadCommands[] = $cmdObject;
+            }
+            $appDeploymentValues["moduleLoadCmds"] = $processedModuleLoadCommands;
+        }
 
         if (isset($appDeploymentValues["libraryPrependPathName"])) {
             $libPrependPathNames = array_unique(array_filter($appDeploymentValues["libraryPrependPathName"],
"trim"));
@@ -175,16 +184,29 @@ class AppUtilities
                     "name" => $envName,
                     "value" => $appDeploymentValues["environmentValue"][$index]
                 ));
+                $envPath->envPathOrder = $index;
                 $appDeploymentValues["setEnvironment"][] = $envPath;
             }
         }
 
         if (isset($appDeploymentValues["preJobCommand"])) {
-            $appDeploymentValues["preJobCommands"] = array_unique(array_filter($appDeploymentValues["preJobCommand"],
"trim"));
+            $preJobCmds = array_unique(array_filter($appDeploymentValues["preJobCommand"],
"trim"));
+            foreach ($preJobCmds as $index => $preJobCmd) {
+                $cmdObject = new CommandObject();
+                $cmdObject->command = $preJobCmd;
+                $cmdObject->commandOrder = $index;
+                $appDeploymentValues["preJobCommands"][] = $cmdObject;
+            }
         }
 
         if (isset($appDeploymentValues["postJobCommand"])) {
-            $appDeploymentValues["postJobCommands"] = array_unique(array_filter($appDeploymentValues["postJobCommand"],
"trim"));
+            $postJobCmds = array_unique(array_filter($appDeploymentValues["postJobCommand"],
"trim"));
+            foreach ($postJobCmds as $index => $postJobCmd) {
+                $cmdObject = new CommandObject();
+                $cmdObject->command = $postJobCmd;
+                $cmdObject->commandOrder = $index;
+                $appDeploymentValues["postJobCommands"][] = $cmdObject;
+            }
         }
 
         if (isset($appDeploymentValues["parallelism"])) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9315f3cd/app/views/partials/deployment-block.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/deployment-block.blade.php b/app/views/partials/deployment-block.blade.php
index 649cf07..5dcf5ff 100644
--- a/app/views/partials/deployment-block.blade.php
+++ b/app/views/partials/deployment-block.blade.php
@@ -54,7 +54,7 @@
         @if( isset( $deploymentObject))
         @foreach( (array)$deploymentObject->moduleLoadCmds as $index => $cmd)
         <input name="moduleLoadCmds[]" type="text" class="form-control" placeholder="Module
Load Command"
-               value="{{$cmd}}" readonly/>
+               value="{{$cmd->command}}" readonly/>
         @endforeach
         @endif
     </div>
@@ -121,7 +121,7 @@
         @foreach( (array)$deploymentObject->preJobCommands as $preJobCommand)
         <div class="col-md-12 well">
             <input name="preJobCommand[]" type="text" class="col-md-12" placeholder="Pre
Job Command"
-                   value="{{ htmlentities( $preJobCommand)}}" readonly/>
+                   value="{{ htmlentities( $preJobCommand->command)}}" readonly/>
         </div>
         @endforeach
         @endif
@@ -136,7 +136,7 @@
         @foreach( (array)$deploymentObject->postJobCommands as $postJobCommand)
         <div class="col-md-12 well">
             <input name="postJobCommand[]" type="text" class="col-md-12" placeholder="Post
Job Command"
-                   value="{{htmlentities( $postJobCommand )}}" readonly/>
+                   value="{{htmlentities( $postJobCommand->command )}}" readonly/>
         </div>
         @endforeach
         @endif


Mime
View raw message