You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/02/28 20:57:50 UTC

[airavata-php-gateway] 01/02: AIRAVATA-2992 Ignore non-existent input file replicas when cloning

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git

commit a4d540c838a90b3e023612a6d3c6048ef031782b
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Thu Feb 28 15:57:21 2019 -0500

    AIRAVATA-2992 Ignore non-existent input file replicas when cloning
---
 app/libraries/ExperimentUtilities.php | 41 ++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 4637b49..a59c686 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -679,25 +679,30 @@ class ExperimentUtilities
                     if(parse_url($currentInputPath)){
                         $currentInputPath = parse_url($currentInputPath, PHP_URL_PATH);
                     }
-                    copy($currentInputPath, $newInputPath);
-
-                    $dataProductModel = new DataProductModel();
-                    $dataProductModel->gatewayId = Config::get("pga_config.airavata")["gateway-id"];
-                    $dataProductModel->ownerName = Session::get("username");
-                    $dataProductModel->productName = basename($newInputPath);
-                    $dataProductModel->dataProductType = DataProductType::FILE;
-
-                    $dataReplicationModel = new DataReplicaLocationModel();
-                    $dataReplicationModel->storageResourceId = Config::get("pga_config.airavata")["gateway-data-store-resource-id"];
-                    $dataReplicationModel->replicaName = basename($newInputPath) . " gateway data store copy";
-                    $dataReplicationModel->replicaLocationCategory = ReplicaLocationCategory::GATEWAY_DATA_STORE;
-                    $dataReplicationModel->replicaPersistentType = ReplicaPersistentType::TRANSIENT;
-                    $hostName = $_SERVER['SERVER_NAME'];
-                    $dataReplicationModel->filePath = "file://" . $hostName . ":" . $newInputPath;
+                    if (file_exists($currentInputPath)) {
+                        copy($currentInputPath, $newInputPath);
+                        $dataProductModel = new DataProductModel();
+                        $dataProductModel->gatewayId = Config::get("pga_config.airavata")["gateway-id"];
+                        $dataProductModel->ownerName = Session::get("username");
+                        $dataProductModel->productName = basename($newInputPath);
+                        $dataProductModel->dataProductType = DataProductType::FILE;
+
+                        $dataReplicationModel = new DataReplicaLocationModel();
+                        $dataReplicationModel->storageResourceId = Config::get("pga_config.airavata")["gateway-data-store-resource-id"];
+                        $dataReplicationModel->replicaName = basename($newInputPath) . " gateway data store copy";
+                        $dataReplicationModel->replicaLocationCategory = ReplicaLocationCategory::GATEWAY_DATA_STORE;
+                        $dataReplicationModel->replicaPersistentType = ReplicaPersistentType::TRANSIENT;
+                        $hostName = $_SERVER['SERVER_NAME'];
+                        $dataReplicationModel->filePath = "file://" . $hostName . ":" . $newInputPath;
+
+                        $dataProductModel->replicaLocations[] = $dataReplicationModel;
+                        $uri = Airavata::registerDataProduct(Session::get('authz-token'), $dataProductModel);
+                        $experimentInput->value = $uri;
+                    } else {
+                        Log::warning("Input file no longer available at " . $currentInputPath);
+                        $experimentInput->value = null;
+                    }
 
-                    $dataProductModel->replicaLocations[] = $dataReplicationModel;
-                    $uri = Airavata::registerDataProduct(Session::get('authz-token'), $dataProductModel);
-                    $experimentInput->value = $uri;
                 }
             }
             $experiment->userConfigurationData->experimentDataDir = ExperimentUtilities::$experimentPath;