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 2015/07/29 19:49:19 UTC

[47/50] [abbrv] airavata-php-gateway git commit: Merge branch '0.15-release-branch' of https://git-wip-us.apache.org/repos/asf/airavata-php-gateway

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6a84103e/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --cc app/libraries/ExperimentUtilities.php
index aeda63e,c166a55..5a216d6
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@@ -27,7 -26,7 +25,7 @@@ class ExperimentUtilitie
      {
          try {
              $hardCodedToken = Config::get('pga_config.airavata')['credential-store-token'];
--            Airavata::launchExperiment($expId, $hardCodedToken);
++            Airavata::launchExperiment(Session::get('authz-token'), $expId, $hardCodedToken);
          } catch (InvalidRequestException $ire) {
              CommonUtilities::print_error_message('<p>There was a problem launching the experiment.
              Please try again later or submit a bug report using the link in the Help menu.</p>' .
@@@ -101,7 -100,7 +99,7 @@@
      {
  
          try {
--            return Airavata::getExperiment($expId);
++            return Airavata::getExperiment(Session::get('authz-token'), $expId);
          } catch (InvalidRequestException $ire) {
              CommonUtilities::print_error_message('<p>There was a problem getting the experiment.
              Please try again later or submit a bug report using the link in the Help menu.</p>' .
@@@ -160,23 -159,21 +158,23 @@@
              ExperimentUtilities::create_experiment_folder_path();
          }
  
 -        $advHandling = new AdvancedOutputDataHandling();
 +//        $advHandling = new AdvancedOutputDataHandling();
          $hostName = $_SERVER['SERVER_NAME'];
-         $expPathConstant = 'file://' . ExperimentUtilities::$sshUser . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path'];
+         $expPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path'];
  
 -        $advHandling->outputDataDir = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'],
 -            $expPathConstant, ExperimentUtilities::$experimentPath);
 -        $userConfigData->advanceOutputDataHandling = $advHandling;
 +//        $advHandling->outputDataDir = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'],
 +//            $expPathConstant, ExperimentUtilities::$experimentPath);
 +//        $userConfigData->advanceOutputDataHandling = $advHandling;
  
          //TODO: replace constructor with a call to airvata to get a prepopulated experiment template
 -        $experiment = new Experiment();
 +        $experiment = new ExperimentModel();
  
          // required
 -        $experiment->projectID = $_POST['project'];
 +        $experiment->projectId = $_POST['project'];
          $experiment->userName = Session::get('username');
          $experiment->name = $_POST['experiment-name'];
 +        $experiment->gatewayId = "default";
 +        $experiment->experimentName = $_POST['experiment-name'];
  
          // optional
          $experiment->description = $_POST['experiment-description'];
@@@ -370,7 -367,7 +368,7 @@@
      public static function update_experiment($expId, $updatedExperiment)
      {
          try {
--            Airavata::updateExperiment($expId, $updatedExperiment);
++            Airavata::updateExperiment(Session::get('authz-token'), $expId, $updatedExperiment);
          } catch (InvalidRequestException $ire) {
              CommonUtilities::print_error_message('<p>There was a problem updating the experiment.
              Please try again later or submit a bug report using the link in the Help menu.</p>' .
@@@ -399,14 -396,32 +397,32 @@@
      {
          try {
              //create new experiment to receive the clone
--            $experiment = Airavata::getExperiment($expId);
- 
-             $cloneId = Airavata::cloneExperiment($expId, 'Clone of ' . $experiment->experimentName);
 -            $cloneId = Airavata::cloneExperiment($expId, 'Clone of ' . $experiment->name);
++            $experiment = Airavata::getExperiment(Session::get('authz-token'), $expId);
++            $cloneId = Airavata::cloneExperiment(Session::get('authz-token'), $expId, 'Clone of ' . $experiment->name);
  
-             CommonUtilities::print_success_message("<p>Experiment cloned!</p>" .
-                 '<p>You will be redirected to the edit page shortly, or you can
-                 <a href="edit_experiment.php?expId=' . $cloneId . '">go directly</a> to the edit experiment page.</p>');
-             //redirect('edit_experiment.php?expId=' . $cloneId);
+             //updating the experiment inputs and output path
 -            $experiment = Airavata::getExperiment($cloneId);
++            $experiment = Airavata::getExperiment(Session::get('authz-token'), $cloneId);
+             $experimentInputs = $experiment->experimentInputs;
+             ExperimentUtilities::create_experiment_folder_path();
+             $hostName = $_SERVER['SERVER_NAME'];
+             $expPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path'];
+             $outputDataDir = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'],
+                 $expPathConstant, ExperimentUtilities::$experimentPath);
+             $experiment->userConfigurationData->advanceOutputDataHandling->outputDataDir = $outputDataDir;
+ 
+             foreach ($experimentInputs as $experimentInput) {
+                 if ($experimentInput->type == DataType::URI) {
+                     $currentInputPath = $experimentInput->value;
+                     $hostPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':';
+                     $currentInputPath = str_replace($hostPathConstant, '', $currentInputPath);
+                     $parts = explode('/', rtrim($currentInputPath, '/'));
+                     $fileName = array_pop($parts);
+                     $newInputPath = ExperimentUtilities::$experimentPath . $fileName;
+                     copy($currentInputPath, $newInputPath);
+                     $experimentInput->value = $hostPathConstant . $newInputPath;
+                 }
+             }
 -            Airavata::updateExperiment($cloneId, $experiment);
++            Airavata::updateExperiment(Session::get('authz-token'), $cloneId, $experiment);
              return $cloneId;
          } catch (InvalidRequestException $ire) {
              CommonUtilities::print_error_message('<p>There was a problem cloning the experiment.
@@@ -439,7 -454,7 +455,7 @@@
      {
  
          try {
--            Airavata::terminateExperiment($expId, Config::get('pga_config.airavata')["credential-store-token"]);
++            Airavata::terminateExperiment(Session::get('authz-token'), $expId, Config::get('pga_config.airavata')["credential-store-token"]);
  
              CommonUtilities::print_success_message("Experiment canceled!");
          } catch (InvalidRequestException $ire) {
@@@ -543,7 -558,7 +559,7 @@@
  
          try {
              if ($experiment) {
--                $expId = Airavata::createExperiment(Session::get("gateway_id"), $experiment);
++                $expId = Airavata::createExperiment(Session::get('authz-token'), Session::get("gateway_id"), $experiment);
              }
  
              if ($expId) {
@@@ -721,31 -735,31 +737,31 @@@
              $filters = array();
              if(!empty($inputs["status-type"])){
                  if ($inputs["status-type"] != "ALL") {
-                     $filters[\Airavata\Model\Experiment\ExperimentSearchFields::STATUS] = $inputs["status-type"];
 -                    $filters[\Airavata\Model\Workspace\Experiment\ExperimentSearchFields::STATUS] = $inputs["status-type"];
++                    $filters[ExperimentSearchFields::STATUS] = $inputs["status-type"];
                  }
              }
              if(!empty($inputs["search-key"])){
                  switch ($inputs["search-key"]) {
                      case 'experiment-name':
 -                        $filters[\Airavata\Model\Workspace\Experiment\ExperimentSearchFields::EXPERIMENT_NAME] = $inputs["search-value"];
 +                        $filters[\Airavata\Model\Experiment\ExperimentSearchFields::EXPERIMENT_NAME] = $inputs["search-value"];
                          break;
                      case 'experiment-description':
-                         $filters[\Airavata\Model\Experiment\ExperimentSearchFields::EXPERIMENT_DESC] = $inputs["search-value"];
 -                        $filters[\Airavata\Model\Workspace\Experiment\ExperimentSearchFields::EXPERIMENT_DESC] = $inputs["search-value"];
++                        $filters[ExperimentSearchFields::EXPERIMENT_DESC] = $inputs["search-value"];
                          break;
                      case 'application':
-                         $filters[\Airavata\Model\Experiment\ExperimentSearchFields::APPLICATION_ID] = $inputs["search-value"];
 -                        $filters[\Airavata\Model\Workspace\Experiment\ExperimentSearchFields::APPLICATION_ID] = $inputs["search-value"];
++                        $filters[ExperimentSearchFields::APPLICATION_ID] = $inputs["search-value"];
                          break;
                      case 'creation-time':
-                         $filters[\Airavata\Model\Experiment\ExperimentSearchFields::FROM_DATE] = strtotime($inputs["from-date"]) * 1000;
-                         $filters[\Airavata\Model\Experiment\ExperimentSearchFields::TO_DATE] = strtotime($inputs["to-date"]) * 1000;
 -                        $filters[\Airavata\Model\Workspace\Experiment\ExperimentSearchFields::FROM_DATE] = strtotime($inputs["from-date"]) * 1000;
 -                        $filters[\Airavata\Model\Workspace\Experiment\ExperimentSearchFields::TO_DATE] = strtotime($inputs["to-date"]) * 1000;
++                        $filters[ExperimentSearchFields::FROM_DATE] = strtotime($inputs["from-date"]) * 1000;
++                        $filters[ExperimentSearchFields::TO_DATE] = strtotime($inputs["to-date"]) * 1000;
                          break;
                      case '':
                  }
              }else{
 -                $filters[\Airavata\Model\Workspace\Experiment\ExperimentSearchFields::EXPERIMENT_NAME] = "*";
 +                $filters[\Airavata\Model\Experiment\ExperimentSearchFields::EXPERIMENT_NAME] = "*";
              }
  
--            $experiments = Airavata::searchExperiments(
++            $experiments = Airavata::searchExperiments(Session::get('authz-token'),
                  Session::get('gateway_id'), Session::get('username'), $filters, $limit, $offset);
          } catch (InvalidRequestException $ire) {
              CommonUtilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
@@@ -791,16 -805,16 +807,16 @@@
          try {
              switch ($inputs["search-key"]) {
                  case 'experiment-name':
--                    $experiments = Airavata::searchExperimentsByName(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
++                    $experiments = Airavata::searchExperimentsByName(Session::get('authz-token'), Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
                      break;
                  case 'experiment-description':
--                    $experiments = Airavata::searchExperimentsByDesc(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
++                    $experiments = Airavata::searchExperimentsByDesc(Session::get('authz-token'), Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
                      break;
                  case 'application':
--                    $experiments = Airavata::searchExperimentsByApplication(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
++                    $experiments = Airavata::searchExperimentsByApplication(Session::get('authz-token'), Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
                      break;
                  case 'creation-time':
--                    $experiments = Airavata::searchExperimentsByCreationTime(Session::get('gateway_id'), Session::get('username'), strtotime($inputs["from-date"]) * 1000, strtotime($inputs["to-date"]) * 1000);
++                    $experiments = Airavata::searchExperimentsByCreationTime(Session::get('authz-token'), Session::get('gateway_id'), Session::get('username'), strtotime($inputs["from-date"]) * 1000, strtotime($inputs["to-date"]) * 1000);
                      break;
                  case '':
              }
@@@ -847,7 -861,7 +863,7 @@@
          $experiments = array();
  
          try {
--            $experiments = Airavata::getAllUserExperimentsWithPagination(
++            $experiments = Airavata::getAllUserExperimentsWithPagination(Session::get('authz-token'),
                  Session::get('gateway_id'), Session::get('username'), $limit, $offset
              );
          } catch (InvalidRequestException $ire) {
@@@ -958,17 -971,17 +974,17 @@@
  
      public static function get_job_details($experimentId)
      {
--        return Airavata::getJobDetails($experimentId);
++        return Airavata::getJobDetails(Session::get('authz-token'), $experimentId);
      }
  
      public static function get_transfer_details($experimentId)
      {
--        return Airavata::getDataTransferDetails($experimentId);
++        return Airavata::getDataTransferDetails(Session::get('authz-token'), $experimentId);
      }
  
      public static function getQueueDatafromResourceId($crId)
      {
--        $resourceObject = Airavata::getComputeResource($crId);
++        $resourceObject = Airavata::getComputeResource(Session::get('authz-token'), $crId);
          return $resourceObject->batchQueues;
      }
  

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6a84103e/app/libraries/ProjectUtilities.php
----------------------------------------------------------------------
diff --cc app/libraries/ProjectUtilities.php
index 7f00a8f,61e5a80..47a640e
--- a/app/libraries/ProjectUtilities.php
+++ b/app/libraries/ProjectUtilities.php
@@@ -53,7 -53,7 +53,7 @@@ class ProjectUtilitie
      {
  
          try {
--            return Airavata::getProject($projectId);
++            return Airavata::getProject(Session::get('authz-token'), $projectId);
          } catch (InvalidRequestException $ire) {
              CommonUtilities::print_error_message('<p>There was a problem getting the project.
              Please try again later or submit a bug report using the link in the Help menu.</p>' .
@@@ -110,7 -106,7 +106,7 @@@
          $projectId = null;
  
          try {
--            $projectId = Airavata::createProject(Config::get('pga_config.airavata')['gateway-id'], $project);
++            $projectId = Airavata::createProject(Session::get('authz-token'), Config::get('pga_config.airavata')['gateway-id'], $project);
  
              if ($projectId) {
                  CommonUtilities::print_success_message("<p>Project {$_POST['project-name']} created!</p>" .
@@@ -130,6 -126,31 +126,31 @@@
          return $projectId;
      }
  
+     public static function create_default_project($username)
+     {
+         $project = new Project();
+         $project->owner = $username;
+         $project->name = "Default Project";
+         $project->description = "This is the default project for user " . $project->owner;
+ 
+ 
+         $projectId = null;
+ 
+         try {
 -            $projectId = Airavata::createProject(Config::get('pga_config.airavata')['gateway-id'], $project);
++            $projectId = Airavata::createProject(Session::get('authz-token'), Config::get('pga_config.airavata')['gateway-id'], $project);
+ 
+         } catch (InvalidRequestException $ire) {
+             CommonUtilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
+         } catch (AiravataClientException $ace) {
+             CommonUtilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
+         } catch (AiravataSystemException $ase) {
+             CommonUtilities::print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
+         }
+ 
+         return $projectId;
+     }
+ 
+ 
      /**
       * Get experiments in project
       * @param $projectId
@@@ -141,7 -162,7 +162,7 @@@
          $experiments = array();
  
          try {
--            $experiments = Airavata::getAllExperimentsInProject($projectId);
++            $experiments = Airavata::getAllExperimentsInProject(Session::get('authz-token'), $projectId);
          } catch (InvalidRequestException $ire) {
              CommonUtilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
          } catch (AiravataClientException $ace) {
@@@ -164,7 -185,7 +185,7 @@@
          $updatedProject->description = $projectDetails["description"];
  
          try {
--            Airavata::updateProject($projectId, $updatedProject);
++            Airavata::updateProject(Session::get('authz-token'), $projectId, $updatedProject);
  
              //Utilities::print_success_message('Project updated! Click <a href="project_summary.php?projId=' . $projectId . '">here</a> to view the project summary.');
          } catch (InvalidRequestException $ire) {
@@@ -185,7 -206,7 +206,7 @@@
          $projects = array();
  
          try {
--            $projects = Airavata::getAllUserProjectsWithPagination(Session::get("gateway_id"),
++            $projects = Airavata::getAllUserProjectsWithPagination(Session::get('authz-token'), Session::get("gateway_id"),
                  Session::get("username"), $limit, $offset);
          } catch (InvalidRequestException $ire) {
              CommonUtilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
@@@ -216,11 -237,11 +237,11 @@@
          try {
              switch ($searchKey) {
                  case 'project-name':
--                    $projects = Airavata::searchProjectsByProjectNameWithPagination(Session::get("gateway_id"),
++                    $projects = Airavata::searchProjectsByProjectNameWithPagination(Session::get('authz-token'), Session::get("gateway_id"),
                          Session::get("username"), $searchValue, $limit, $offset);
                      break;
                  case 'project-description':
--                    $projects = Airavata::searchProjectsByProjectDescWithPagination(Session::get("gateway_id"),
++                    $projects = Airavata::searchProjectsByProjectDescWithPagination(Session::get('authz-token'), Session::get("gateway_id"),
                          Session::get("username"), $searchValue, $limit, $offset);
                      break;
              }
@@@ -253,10 -274,10 +274,10 @@@
          try {
              switch ($searchKey) {
                  case 'project-name':
--                    $projects = Airavata::searchProjectsByProjectName(Session::get("gateway_id"), Session::get("username"), $searchValue);
++                    $projects = Airavata::searchProjectsByProjectName(Session::get('authz-token'), Session::get("gateway_id"), Session::get("username"), $searchValue);
                      break;
                  case 'project-description':
--                    $projects = Airavata::searchProjectsByProjectDesc(Session::get("gateway_id"), Session::get("username"), $searchValue);
++                    $projects = Airavata::searchProjectsByProjectDesc(Session::get('authz-token'), Session::get("gateway_id"), Session::get("username"), $searchValue);
                      break;
              }
          } catch (InvalidRequestException $ire) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6a84103e/app/libraries/Wsis/Stubs/UserStoreManager.php
----------------------------------------------------------------------
diff --cc app/libraries/Wsis/Stubs/UserStoreManager.php
index 6fa719d,c986653..479b320
--- a/app/libraries/Wsis/Stubs/UserStoreManager.php
+++ b/app/libraries/Wsis/Stubs/UserStoreManager.php
@@@ -39,7 -39,7 +39,7 @@@ class UserStoreManager 
      public function authenticate($username, $password){
          $parameters = new Authenticate();
          $parameters->userName = $username;
--        $parameters->credential = $password;        
++        $parameters->credential = $password;
          return $this->serviceStub->authenticate($parameters)->return;
      }
      

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6a84103e/app/libraries/Wsis/Wsis.php
----------------------------------------------------------------------
diff --cc app/libraries/Wsis/Wsis.php
index 7ce131f,f8ee3fb..456b02b
--- a/app/libraries/Wsis/Wsis.php
+++ b/app/libraries/Wsis/Wsis.php
@@@ -121,7 -137,7 +137,6 @@@ class Wsis 
          try {
              return $this->userStoreManager->authenticate($username, $password);
          } catch (Exception $ex) {
--            var_dump( $ex); exit;
              throw new Exception("Unable to authenticate user", 0, $ex);
          }
      }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6a84103e/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --cc app/views/partials/experiment-info.blade.php
index a396b71,802dccb..fa25f23
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@@ -130,21 -150,29 +150,29 @@@
                     class="btn btn-success"
                     value="Launch"
                     title="Launch the experiment" <?php if (!$expVal["editable"]) echo 'style="display: none"' ?>>
-             <a href="{{URL::to('/') }}/experiment/cancel?expId={{ $experiment->experimentId }}"
-                class="btn btn-default"
 -            <a id="cancel_exp_link" href="{{URL::to('/') }}/experiment/cancel?expId={{ $experiment->experimentID }}"
++            <a id="cancel_exp_link" href="{{URL::to('/') }}/experiment/cancel?expId={{ $experiment->experimentId }}"
+                class="btn btn-default" onclick="return confirm('Are you sure you want to cancel this experiment?')"
                 role="button"
                 tit  le="Edit the experiment's settings" <?php if (!$expVal["cancelable"]) echo 'style="display: none"' ?>>
                  <input name="cancel" type="submit" class="btn btn-warning"
                         value="Cancel" <?php if (!$expVal["cancelable"]) echo 'disabled'; ?> >
              </a>
-             <input name="clone"
-                    type="submit"
-                    class="btn btn-primary"
-                    value="Clone"
-                    title="Create a clone of the experiment. Cloning is the only way to change an experiment's settings
-                     after it has been launched.">
+ <!--            <input name="clone"-->
+ <!--                   type="submit"-->
+ <!--                   class="btn btn-primary"-->
+ <!--                   value="Clone"-->
+ <!--                   title="Create a clone of the experiment. Cloning is the only way to change an experiment's settings-->
+ <!--                    after it has been launched.">-->
 -            <a href="{{URL::to('/') }}/experiment/clone?expId={{ $experiment->experimentID }}"
++            <a href="{{URL::to('/') }}/experiment/clone?expId={{ $experiment->experimentId }}"
+                class="btn btn-primary"
+                role="button"
+                title="Create a clone of the experiment. Cloning is the only way to change an experiment's settings
+                     after it has been launched." target="_blank">
+                 <span class="glyphicon glyphicon-pencil"></span>
+                 Clone
+             </a>
              <input type="hidden" name="expId" value="{{ Input::get('expId') }}"/>
 -            <a href="{{URL::to('/') }}/experiment/edit?expId={{ $experiment->experimentID }}"
 +            <a href="{{URL::to('/') }}/experiment/edit?expId={{ $experiment->experimentId }}"
                 class="btn btn-default"
                 role="button"
                 title="Edit the experiment's settings" <?php if (!$expVal["editable"]) echo 'style="display: none"' ?>>