You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/01/14 16:43:33 UTC

[37/50] [abbrv] airavata-php-gateway git commit: setting experiment data dir from pga

setting experiment data dir from pga


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/93775fea
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/93775fea
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/93775fea

Branch: refs/heads/develop
Commit: 93775fea1f62fea1b218e160ebe50ebf131471bd
Parents: 99d146a
Author: scnakandala <su...@gmail.com>
Authored: Mon Jan 11 12:03:46 2016 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Mon Jan 11 12:03:46 2016 -0500

----------------------------------------------------------------------
 app/libraries/Airavata/API/Airavata.php         | 427 +++++++++++++++++++
 .../Airavata/Model/Experiment/Types.php         |  23 +
 app/libraries/Airavata/Model/Process/Types.php  |  23 +
 app/libraries/ExperimentUtilities.php           |   6 +-
 4 files changed, 478 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/93775fea/app/libraries/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php
index 4cc073b..e9cec60 100644
--- a/app/libraries/Airavata/API/Airavata.php
+++ b/app/libraries/Airavata/API/Airavata.php
@@ -3176,6 +3176,19 @@ interface AiravataIf {
    * @throws \Airavata\API\Error\AuthorizationException
    */
   public function copyDataResource(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $destStorageResourceId, $destinationParentPath);
+  /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $resourceId
+   * @param string $replicaId
+   * @param string $destStorageResourceId
+   * @param string $destinationParentPath
+   * @return string
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function copyDataReplica(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $replicaId, $destStorageResourceId, $destinationParentPath);
 }
 
 class AiravataClient implements \Airavata\API\AiravataIf {
@@ -12051,6 +12064,73 @@ class AiravataClient implements \Airavata\API\AiravataIf {
     throw new \Exception("copyDataResource failed: unknown result");
   }
 
+  public function copyDataReplica(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $replicaId, $destStorageResourceId, $destinationParentPath)
+  {
+    $this->send_copyDataReplica($authzToken, $resourceId, $replicaId, $destStorageResourceId, $destinationParentPath);
+    return $this->recv_copyDataReplica();
+  }
+
+  public function send_copyDataReplica(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $replicaId, $destStorageResourceId, $destinationParentPath)
+  {
+    $args = new \Airavata\API\Airavata_copyDataReplica_args();
+    $args->authzToken = $authzToken;
+    $args->resourceId = $resourceId;
+    $args->replicaId = $replicaId;
+    $args->destStorageResourceId = $destStorageResourceId;
+    $args->destinationParentPath = $destinationParentPath;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'copyDataReplica', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('copyDataReplica', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_copyDataReplica()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_copyDataReplica_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \Airavata\API\Airavata_copyDataReplica_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->ire !== null) {
+      throw $result->ire;
+    }
+    if ($result->ace !== null) {
+      throw $result->ace;
+    }
+    if ($result->ase !== null) {
+      throw $result->ase;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("copyDataReplica failed: unknown result");
+  }
+
 }
 
 // HELPER FUNCTIONS AND STRUCTURES
@@ -53987,4 +54067,351 @@ class Airavata_copyDataResource_result {
 
 }
 
+class Airavata_copyDataReplica_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $resourceId = null;
+  /**
+   * @var string
+   */
+  public $replicaId = null;
+  /**
+   * @var string
+   */
+  public $destStorageResourceId = null;
+  /**
+   * @var string
+   */
+  public $destinationParentPath = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'authzToken',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\Security\AuthzToken',
+          ),
+        2 => array(
+          'var' => 'resourceId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'replicaId',
+          'type' => TType::STRING,
+          ),
+        4 => array(
+          'var' => 'destStorageResourceId',
+          'type' => TType::STRING,
+          ),
+        5 => array(
+          'var' => 'destinationParentPath',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['resourceId'])) {
+        $this->resourceId = $vals['resourceId'];
+      }
+      if (isset($vals['replicaId'])) {
+        $this->replicaId = $vals['replicaId'];
+      }
+      if (isset($vals['destStorageResourceId'])) {
+        $this->destStorageResourceId = $vals['destStorageResourceId'];
+      }
+      if (isset($vals['destinationParentPath'])) {
+        $this->destinationParentPath = $vals['destinationParentPath'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_copyDataReplica_args';
+  }
+
+  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::STRUCT) {
+            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
+            $xfer += $this->authzToken->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->resourceId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->replicaId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->destStorageResourceId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->destinationParentPath);
+          } 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('Airavata_copyDataReplica_args');
+    if ($this->authzToken !== null) {
+      if (!is_object($this->authzToken)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
+      $xfer += $this->authzToken->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->resourceId !== null) {
+      $xfer += $output->writeFieldBegin('resourceId', TType::STRING, 2);
+      $xfer += $output->writeString($this->resourceId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->replicaId !== null) {
+      $xfer += $output->writeFieldBegin('replicaId', TType::STRING, 3);
+      $xfer += $output->writeString($this->replicaId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->destStorageResourceId !== null) {
+      $xfer += $output->writeFieldBegin('destStorageResourceId', TType::STRING, 4);
+      $xfer += $output->writeString($this->destStorageResourceId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->destinationParentPath !== null) {
+      $xfer += $output->writeFieldBegin('destinationParentPath', TType::STRING, 5);
+      $xfer += $output->writeString($this->destinationParentPath);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_copyDataReplica_result {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $success = null;
+  /**
+   * @var \Airavata\API\Error\InvalidRequestException
+   */
+  public $ire = null;
+  /**
+   * @var \Airavata\API\Error\AiravataClientException
+   */
+  public $ace = null;
+  /**
+   * @var \Airavata\API\Error\AiravataSystemException
+   */
+  public $ase = null;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRING,
+          ),
+        1 => array(
+          'var' => 'ire',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\InvalidRequestException',
+          ),
+        2 => array(
+          'var' => 'ace',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataClientException',
+          ),
+        3 => array(
+          'var' => 'ase',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AiravataSystemException',
+          ),
+        4 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['ire'])) {
+        $this->ire = $vals['ire'];
+      }
+      if (isset($vals['ace'])) {
+        $this->ace = $vals['ace'];
+      }
+      if (isset($vals['ase'])) {
+        $this->ase = $vals['ase'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_copyDataReplica_result';
+  }
+
+  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 0:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->ire = new \Airavata\API\Error\InvalidRequestException();
+            $xfer += $this->ire->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->ace = new \Airavata\API\Error\AiravataClientException();
+            $xfer += $this->ace->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRUCT) {
+            $this->ase = new \Airavata\API\Error\AiravataSystemException();
+            $xfer += $this->ase->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->read($input);
+          } 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('Airavata_copyDataReplica_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
+      $xfer += $output->writeString($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ire !== null) {
+      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
+      $xfer += $this->ire->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ace !== null) {
+      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
+      $xfer += $this->ace->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ase !== null) {
+      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
+      $xfer += $this->ase->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/93775fea/app/libraries/Airavata/Model/Experiment/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Experiment/Types.php b/app/libraries/Airavata/Model/Experiment/Types.php
index fdca5bd..7180c44 100644
--- a/app/libraries/Airavata/Model/Experiment/Types.php
+++ b/app/libraries/Airavata/Model/Experiment/Types.php
@@ -85,6 +85,10 @@ class UserConfigurationDataModel {
    * @var string
    */
   public $storageId = null;
+  /**
+   * @var string
+   */
+  public $experimentDataDir = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -122,6 +126,10 @@ class UserConfigurationDataModel {
           'var' => 'storageId',
           'type' => TType::STRING,
           ),
+        9 => array(
+          'var' => 'experimentDataDir',
+          'type' => TType::STRING,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -149,6 +157,9 @@ class UserConfigurationDataModel {
       if (isset($vals['storageId'])) {
         $this->storageId = $vals['storageId'];
       }
+      if (isset($vals['experimentDataDir'])) {
+        $this->experimentDataDir = $vals['experimentDataDir'];
+      }
     }
   }
 
@@ -228,6 +239,13 @@ class UserConfigurationDataModel {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 9:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->experimentDataDir);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -284,6 +302,11 @@ class UserConfigurationDataModel {
       $xfer += $output->writeString($this->storageId);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->experimentDataDir !== null) {
+      $xfer += $output->writeFieldBegin('experimentDataDir', TType::STRING, 9);
+      $xfer += $output->writeString($this->experimentDataDir);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/93775fea/app/libraries/Airavata/Model/Process/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Process/Types.php b/app/libraries/Airavata/Model/Process/Types.php
index 120c078..c0000d0 100644
--- a/app/libraries/Airavata/Model/Process/Types.php
+++ b/app/libraries/Airavata/Model/Process/Types.php
@@ -113,6 +113,10 @@ class ProcessModel {
    * @var bool
    */
   public $generateCert = false;
+  /**
+   * @var string
+   */
+  public $experimentDataDir = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -223,6 +227,10 @@ class ProcessModel {
           'var' => 'generateCert',
           'type' => TType::BOOL,
           ),
+        22 => array(
+          'var' => 'experimentDataDir',
+          'type' => TType::STRING,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -289,6 +297,9 @@ class ProcessModel {
       if (isset($vals['generateCert'])) {
         $this->generateCert = $vals['generateCert'];
       }
+      if (isset($vals['experimentDataDir'])) {
+        $this->experimentDataDir = $vals['experimentDataDir'];
+      }
     }
   }
 
@@ -504,6 +515,13 @@ class ProcessModel {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 22:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->experimentDataDir);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -679,6 +697,11 @@ class ProcessModel {
       $xfer += $output->writeBool($this->generateCert);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->experimentDataDir !== null) {
+      $xfer += $output->writeFieldBegin('experimentDataDir', TType::STRING, 22);
+      $xfer += $output->writeString($this->experimentDataDir);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/93775fea/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 8d428b4..06351b4 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -196,6 +196,8 @@ class ExperimentUtilities
         if (ExperimentUtilities::$experimentPath == null) {
             ExperimentUtilities::create_experiment_folder_path();
         }
+        $userConfigData->experimentDataDir = ExperimentUtilities::$experimentPath;
+
         $experiment = new ExperimentModel();
         // required
         $experiment->projectId = $_POST['project'];
@@ -452,6 +454,7 @@ class ExperimentUtilities
                     $experimentInput->value = $hostPathConstant . $newInputPath;
                 }
             }
+            $experiment->userConfigurationData->experimentDataDir = ExperimentUtilities::$experimentPath;
             Airavata::updateExperiment(Session::get('authz-token'), $cloneId, $experiment);
             return $cloneId;
         } catch (InvalidRequestException $ire) {
@@ -633,7 +636,7 @@ class ExperimentUtilities
      *
     */
 
-    public static function list_output_files($outputs, $status, $process)
+    public static function list_ouatput_files($outputs, $status, $process)
     {
         if( $process)
         {
@@ -1108,6 +1111,7 @@ class ExperimentUtilities
         $experimentInputs = $experiment->experimentInputs; // get current inputs
         //var_dump($experimentInputs);
         $experimentInputs = ExperimentUtilities::process_inputs($applicationInputs, $experimentInputs); // get new inputs
+        $experiment->userConfigurationData->experimentDataDir = ExperimentUtilities::$experimentPath;
         //var_dump($experimentInputs);
 
         if ($experimentInputs) {