/**
  * Clone the experiment with the given ID
  * @param $expId
  */
 public static function clone_experiment($expId)
 {
     try {
         //create new experiment to receive the clone
         $experiment = Airavata::getExperiment(Session::get('authz-token'), $expId);
         $cloneId = Airavata::cloneExperiment(Session::get('authz-token'), $expId, 'Clone of ' . $experiment->experimentName);
         //updating the experiment inputs and output path
         $experiment = Airavata::getExperiment(Session::get('authz-token'), $cloneId);
         $experimentInputs = $experiment->experimentInputs;
         ExperimentUtilities::create_experiment_folder_path();
         $hostName = $_SERVER['SERVER_NAME'];
         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(Session::get('authz-token'), $cloneId, $experiment);
         return $cloneId;
     } catch (InvalidRequestException $ire) {
         CommonUtilities::print_error_message('<p>There was a problem cloning the experiment.
         Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
     } catch (ExperimentNotFoundException $enf) {
         CommonUtilities::print_error_message('<p>There was a problem cloning the experiment.
         Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>ExperimentNotFoundException: ' . $enf->getMessage() . '</p>');
     } catch (AiravataClientException $ace) {
         CommonUtilities::print_error_message('<p>There was a problem cloning the experiment.
         Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>AiravataClientException: ' . $ace->getMessage() . '</p>');
     } catch (AiravataSystemException $ase) {
         CommonUtilities::print_error_message('<p>There was a problem cloning the experiment.
         Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
     } catch (TTransportException $tte) {
         CommonUtilities::print_error_message('<p>There was a problem cloning the experiment.
         Please try again later or submit a bug report using the link in the Help menu.</p>' . '<p>TTransportException: ' . $tte->getMessage() . '</p>');
     }
 }
 /**
  * Update the experiment with the given ID
  * @param $expId
  * @param $updatedExperiment
  */
 public static function update_experiment($expId, $updatedExperiment)
 {
     try {
         Airavata::updateExperiment($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>' .
             '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
     } catch (ExperimentNotFoundException $enf) {
         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>' .
             '<p>ExperimentNotFoundException: ' . $enf->getMessage() . '</p>');
     } catch (AiravataClientException $ace) {
         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>' .
             '<p>AiravataClientException: ' . $ace->getMessage() . '</p>');
     } catch (AiravataSystemException $ase) {
         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>' .
             '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>');
     }
 }