airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [4/4] airavata-php-gateway git commit: fixing AIRAVATA-1773
Date Wed, 15 Jul 2015 16:47:57 GMT
fixing AIRAVATA-1773


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

Branch: refs/heads/0.15-release-branch
Commit: 1a6fa4b467a4345813e8f2c2947ccd4ef22d3b75
Parents: 2b05920
Author: Supun Nakandala <scnakandala@apache.org>
Authored: Wed Jul 15 22:17:17 2015 +0530
Committer: Supun Nakandala <scnakandala@apache.org>
Committed: Wed Jul 15 22:17:17 2015 +0530

----------------------------------------------------------------------
 app/libraries/ExperimentUtilities.php | 31 ++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/1a6fa4b4/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 344b58d..ff61473 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -399,16 +399,31 @@ class ExperimentUtilities
         try {
             //create new experiment to receive the clone
             $experiment = Airavata::getExperiment($expId);
-
-            //Fixme - Input Files Dir
-
-
             $cloneId = Airavata::cloneExperiment($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);
+            $experimentInputs = $experiment->experimentInputs;
+            ExperimentUtilities::create_experiment_folder_path();
+            $hostName = $_SERVER['SERVER_NAME'];
+            $expPathConstant = 'file://' . ExperimentUtilities::$sshUser . '@' . $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://' . ExperimentUtilities::$sshUser . '@' .
$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);
             return $cloneId;
         } catch (InvalidRequestException $ire) {
             CommonUtilities::print_error_message('<p>There was a problem cloning the
experiment.


Mime
View raw message