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/06/01 00:30:35 UTC

[5/5] airavata-php-gateway git commit: Removing app_config.ini property file

Removing app_config.ini property file


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

Branch: refs/heads/master
Commit: ae1ffd07a25f1d3f99d1e45396f8a2c945af907b
Parents: 72857e7
Author: Supun Nakandala <sc...@apache.org>
Authored: Mon Jun 1 04:00:02 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Mon Jun 1 04:00:02 2015 +0530

----------------------------------------------------------------------
 app/config/app_config.ini.template       | 43 ---------------------------
 app/config/pga_config.php                | 41 +++++++++++++++++++++++--
 app/controllers/ExperimentController.php | 40 +++++++++++--------------
 app/libraries/Utilities.php              | 43 ++-------------------------
 4 files changed, 58 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ae1ffd07/app/config/app_config.ini.template
----------------------------------------------------------------------
diff --git a/app/config/app_config.ini.template b/app/config/app_config.ini.template
deleted file mode 100755
index 0d7c97b..0000000
--- a/app/config/app_config.ini.template
+++ /dev/null
@@ -1,43 +0,0 @@
-;--------------------------------------- Airavata Constants ----------------------
-
-
-;development
-airavata-port = 9930;
-airavata-server = 'gw111.iu.xsede.org'
-
-;production
-;airavata-server = 'gw127.iu.xsede.org'
-;airavata-port = 8930; 
-
-airavata-timeout = 100000;
-experiment-data-root = '/../experimentData/'
-ssh-user = 'root'
-data-path = 'file://home/pga/production/experimentData/'
-experiment-data-root-absolute = '/var/www/experimentData/'
-;USER_STORE = 'WSO2','XML'
-user-store = "WSO2"
-admin-role = "admin"
-gateway-admin-role = "gateway_admin"
-user-role = "Internal/everyone"
-;identity server roles assigned for Gateway
-gateway-role-prepend = "gateway_"
-gateway-role-admin-append = "_admin"
-req-url = 'https://gw111.iu.xsede.org:8443/credential-store/acs-start-servlet'
-gateway-name = 'PHP-Reference-Gateway'
-email = 'admin@gw120.iu.xsede.org'
-;file size in MB
-server-allowed-file-size = 64
-
-;Credential Store Token
-credential-store-token="811351f3-7484-4931-b354-24881e7963e9"
-
-;----------------------------------------- Experiment Defaults --------------------
-
-;default Queue name 
-queue-name = 'long'
-;default Node Count
-node-count = '1'
-;default Total Core Count
-total-cpu-count = '4'
-;default Wall Time Limit
-wall-time-limit = '30'

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ae1ffd07/app/config/pga_config.php
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php b/app/config/pga_config.php
index d54bd34..f3c8f59 100644
--- a/app/config/pga_config.php
+++ b/app/config/pga_config.php
@@ -69,12 +69,12 @@ return array(
         /**
          * Airavata API server location
          */
-        'airavata-server' => 'localhost',
+        'airavata-server' => 'gw111.iu.xsede.org',
 
         /**
          * Airavata API server port
          */
-        'airavata-port' => '8930',
+        'airavata-port' => '9930',
 
         /**
          * Airavata API server thrift communication timeout
@@ -84,7 +84,42 @@ return array(
         /**
          * PGA Gateway ID
          */
-        'gateway-id' => 'default'
+        'gateway-id' => 'default',
+
+        /**
+         * Maximum size of a file which is allowed to upload to the server
+         */
+        'server-allowed-file-size' => 64,
+
+        /**
+         * Advanced experiments options
+         */
+        'advanced-experiment-options' => '',
+
+        /**
+         * Credentials Store Token
+         */
+        'credential-store-token' => '811351f3-7484-4931-b354-24881e7963e9',
+
+        /**
+         * Default queue name
+         */
+        'queue-name' => 'long',
+
+        /**
+         * Default node count
+         */
+        'node-count' => '1',
+
+        /**
+         * Default total core count
+         */
+        'total-cpu-count' => '4',
+
+        /**
+         * Default wall time limit
+         */
+        'wall-time-limit' => '30'
     ]
 
 );
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ae1ffd07/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index a2013d1..08a3054 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -34,12 +34,10 @@ class ExperimentController extends BaseController {
 			
 			$computeResources = Utilities::create_compute_resources_select($_POST['application'], null);
 
-			$app_config = Utilities::read_config();
-
-			$queueDefaults = array( "queueName" => $app_config["queue-name"],
-						        	"nodeCount" => $app_config["node-count"],
-						        	"cpuCount" => $app_config["total-cpu-count"],
-						        	"wallTimeLimit" => $app_config["wall-time-limit"]
+			$queueDefaults = array( "queueName" => Config::get('pga_config.airavata')["queue-name"],
+						        	"nodeCount" => Config::get('pga_config.airavata')["node-count"],
+						        	"cpuCount" => Config::get('pga_config.airavata')["total-cpu-count"],
+						        	"wallTimeLimit" => Config::get('pga_config.airavata')["wall-time-limit"]
 							);
 
 			$experimentInputs = array( 
@@ -48,14 +46,14 @@ class ExperimentController extends BaseController {
 						        "experimentDescription" => $_POST['experiment-description'] . ' ',
 						        "project" => $_POST['project'],
 						        "application" => $_POST['application'],
-						        "allowedFileSize" => $app_config["server-allowed-file-size"],
+						        "allowedFileSize" => Config::get('pga_config.airavata')["server-allowed-file-size"],
 						        "echo" => ($_POST['application'] == 'Echo')? ' selected' : '',
 						        "wrf" => ($_POST['application'] == 'WRF')? ' selected' : '',
 						        "queueDefaults" => $queueDefaults,
-						        "advancedOptions" => $app_config["advanced-experiment-options"],
+						        "advancedOptions" => Config::get('pga_config.airavata')["advanced-experiment-options"],
 						        "computeResources" => $computeResources,
 						        "resourceHostId" => null,
-						        "advancedOptions" => $app_config["advanced-experiment-options"]
+						        "advancedOptions" => Config::get('pga_config.airavata')["advanced-experiment-options"]
 					        );
 
 			return View::make( "experiment/create-complete", array( "expInputs" => $experimentInputs) );
@@ -181,11 +179,10 @@ class ExperimentController extends BaseController {
 
 	public function editView()
 	{
-		$app_config = Utilities::read_config();
-		$queueDefaults = array( "queueName" => $app_config["queue-name"],
-						        "nodeCount" => $app_config["node-count"],
-						        "cpuCount" => $app_config["total-cpu-count"],
-						        "wallTimeLimit" => $app_config["wall-time-limit"]
+		$queueDefaults = array( "queueName" => Config::get('pga_config.airavata')["queue-name"],
+						        "nodeCount" => Config::get('pga_config.airavata')["node-count"],
+						        "cpuCount" => Config::get('pga_config.airavata')["total-cpu-count"],
+						        "wallTimeLimit" => Config::get('pga_config.airavata')["wall-time-limit"]
 							);
 
 		$experiment = Utilities::get_experiment($_GET['expId']);
@@ -200,19 +197,19 @@ class ExperimentController extends BaseController {
 						        "experimentName" => $experiment->name,
 						        "experimentDescription" => $experiment->description,
 						        "application" => $experiment->applicationId,
-						      	"allowedFileSize" => $app_config["server-allowed-file-size"],
+						      	"allowedFileSize" => Config::get('pga_config.airavata')["server-allowed-file-size"],
 								'experiment' => $experiment,
 								"queueDefaults" => $queueDefaults,
 								'project' => $project,
 								'expVal' => $expVal,
 								'cloning' => true,
-						        'advancedOptions' => $app_config["advanced-experiment-options"],
+						        'advancedOptions' => Config::get('pga_config.airavata')["advanced-experiment-options"],
 						        'computeResources' => $computeResources,
 						        "resourceHostId" => $expVal['scheduling']->resourceHostId,
 								'project' => $project,
 								'expVal' => $expVal,
 								'cloning' => true,
-						        'advancedOptions' => $app_config["advanced-experiment-options"]
+						        'advancedOptions' => Config::get('pga_config.airavata')["advanced-experiment-options"]
 								);
 		return View::make("experiment/edit", array("expInputs" => $experimentInputs) );
 	}
@@ -282,11 +279,10 @@ class ExperimentController extends BaseController {
 	public function getQueueView()
 	{
 		$queues = Utilities::getQueueDatafromResourceId( Input::get("crId"));
-		$app_config = Utilities::read_config();
-		$queueDefaults = array( "queueName" => $app_config["queue-name"],
-						        "nodeCount" => $app_config["node-count"],
-						        "cpuCount" => $app_config["total-cpu-count"],
-						        "wallTimeLimit" => $app_config["wall-time-limit"]
+		$queueDefaults = array( "queueName" => Config::get('pga_config.airavata')["queue-name"],
+						        "nodeCount" => Config::get('pga_config.airavata')["node-count"],
+						        "cpuCount" => Config::get('pga_config.airavata')["total-cpu-count"],
+						        "wallTimeLimit" => Config::get('pga_config.airavata')["wall-time-limit"]
 							);
 		return View::make("partials/experiment-queue-block", array( "queues" => $queues, "queueDefaults" => $queueDefaults) );
 	}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ae1ffd07/app/libraries/Utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/Utilities.php b/app/libraries/Utilities.php
index 267d724..f18bf31 100644
--- a/app/libraries/Utilities.php
+++ b/app/libraries/Utilities.php
@@ -164,8 +164,7 @@ public static function launch_experiment($expId)
         Utilities::print_success_message('Experiment launched using ' . $tokenString . ' allocation!');
         */
 
-        $app_config = Utilities::read_config();
-        $hardCodedToken = $app_config['credential-store-token'];
+        $hardCodedToken = Config::get('pga_config.airavata')['credential-store-token'];
         Airavata::launchExperiment($expId, $hardCodedToken);
 
         /*
@@ -618,7 +617,6 @@ public static function assemble_experiment()
 {
     $utility = new Utilities();
     $experimentInputs = array();
-    $app_config = Utilities::read_config();
 
     $scheduling = new ComputationalResourceScheduling();
     $scheduling->totalCPUCount = $_POST['cpu-count'];
@@ -1016,13 +1014,10 @@ public static function clone_experiment($expId)
  */
 public static function cancel_experiment($expId)
 {
-    $app_config = Utilities::read_config();
-
-
 
     try
     {
-        Airavata::terminateExperiment($expId, $app_config["credential-store-token"]);
+        Airavata::terminateExperiment($expId, Config::get('pga_config.airavata')["credential-store-token"]);
 
         Utilities::print_success_message("Experiment canceled!");
     }
@@ -2132,40 +2127,6 @@ public static function apply_changes_to_experiment($experiment, $input)
     }
 }
 
-public static function read_config( $fileName = null){
-    $wsis_config = null;
-
-    if( $fileName == null)
-        $fileName = "app_config.ini";
-    try {
-        if (file_exists( app_path() . "/config/" . $fileName ) ) {
-
-            try
-            {
-                $wsis_config = parse_ini_file( app_path() . "/config/" . $fileName );
-            }
-
-            catch( \Exception $e)
-            {
-                print_r( $e); exit;
-            }
-        } 
-        else 
-        {
-            throw new Exception("Error: Cannot open file!");
-        }
-
-        if (!$wsis_config) 
-        {
-            throw new Exception('Error: Unable to read the file!');
-        }
-    }catch (Exception $e) {
-        throw new Exception('Unable to instantiate the client. Try editing the file.', 0, NULL);
-    }
-    return $wsis_config;
-
-}
-
 public static function get_job_details( $experimentId){
     return Airavata::getJobDetails( $experimentId);
 }