airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [24/50] [abbrv] git commit: adding new samples for app catalog
Date Mon, 30 Jun 2014 22:57:03 GMT
adding new samples for app catalog


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2ce9c126
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2ce9c126
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2ce9c126

Branch: refs/heads/master
Commit: 2ce9c126db5614bc4e5782dc7d3777cb260fcbbd
Parents: 3bcac35
Author: Saminda Wijeratne <samindaw@gmail.com>
Authored: Fri May 23 13:05:17 2014 -0700
Committer: Saminda Wijeratne <samindaw@gmail.com>
Committed: Fri May 23 13:05:17 2014 -0700

----------------------------------------------------------------------
 client-samples/add-compute-resources.php       | 75 ++++++++++++++++
 client-samples/list-application-interfaces.php | 73 ++++++++++++++++
 client-samples/list-compute-resources.php      | 97 +++++++++++++++++++++
 3 files changed, 245 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce9c126/client-samples/add-compute-resources.php
----------------------------------------------------------------------
diff --git a/client-samples/add-compute-resources.php b/client-samples/add-compute-resources.php
new file mode 100644
index 0000000..6f5de40
--- /dev/null
+++ b/client-samples/add-compute-resources.php
@@ -0,0 +1,75 @@
+<?php
+namespace Airavata\Client\Samples;
+
+$GLOBALS['THRIFT_ROOT'] = '../lib/Thrift/';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TSocket.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TProtocol.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TBinaryProtocol.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TApplicationException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TProtocolException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Base/TBase.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TType.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TMessageType.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Factory/TStringFuncFactory.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/TStringFunc.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/Core.php';
+
+$GLOBALS['AIRAVATA_ROOT'] = '../lib/Airavata/';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/AppCatalog/ApplicationCatalogAPI.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Experiment/Types.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/AppCatalog/Types.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php';
+
+use Airavata\Model\Workspace\Experiment\ComputationalResourceScheduling;
+use Airavata\Model\Workspace\Experiment\DataObjectType;
+use Airavata\Model\Workspace\Experiment\UserConfigurationData;
+use Airavata\Model\AppCatalog\ComputeResourceDescription;
+use Thrift\Protocol\TBinaryProtocol;
+use Thrift\Transport\TSocket;
+use Airavata\API\AiravataClient;
+use Airavata\API\AppCatalog\ApplicationCatalogAPIClient;
+use Airavata\Model\Workspace\Experiment\Experiment;
+use Airavata\Model\AppCatalog\JobSubmissionProtocol;
+use Airavata\Model\AppCatalog\DataMovementProtocol;
+use Airavata\Model\AppCatalog\GSISSHJobSubmission;
+use Airavata\Model\AppCatalog\ResourceJobManager;
+
+//$transport = new TSocket('gw111.iu.xsede.org', 8930);
+$transport = new TSocket('localhost', 8931);
+$protocol = new TBinaryProtocol($transport);
+
+$airavataclient = new ApplicationCatalogAPIClient($protocol);
+$transport->open();
+
+echo "Airavata Server Version is: " . $airavataclient->getAPIVersion() . "\n";
+
+echo "Add Compute Resources.... "."\n";
+
+$id_list = $airavataclient->listComputeResourceDescriptions();
+$compute_resource = new ComputeResourceDescription();
+$compute_resource->hostName="stampede-host";
+$compute_resource->hostAliases=array("stampede");
+$compute_resource->ipAddresses=array("stampede.tacc.xsede.org");
+$compute_resource->isEmpty=false;
+$compute_resource->scratchLocation="/home1/01437/ogce";
+$compute_resource->jobSubmissionProtocols=array();
+$compute_resource->dataMovementProtocols=array();
+
+echo "Adding ".$compute_resource->hostName."...";
+$compute_resource_id=$airavataclient->addComputeResourceDescription($compute_resource);
+echo "done [saved in the catalog as ".$compute_resource_id."]\n";
+
+$gsissh_protoco_data=new GSISSHJobSubmission();
+$gsissh_protoco_data->resourceJobManager=ResourceJobManager::SLURM;
+$gsissh_protoco_data->installedPath="/usr/bin/";
+$gsissh_protoco_data->sshPort=2222;
+$gsissh_protoco_data->monitorMode="push";
+
+echo "Adding GSISSH protocol data to ".$compute_resource_id."...";
+$airavataclient->addGSISSHJobSubmissionProtocol($compute_resource_id, $gsissh_protoco_data);
+echo "done\n";
+$transport->close();
+?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce9c126/client-samples/list-application-interfaces.php
----------------------------------------------------------------------
diff --git a/client-samples/list-application-interfaces.php b/client-samples/list-application-interfaces.php
new file mode 100644
index 0000000..473e033
--- /dev/null
+++ b/client-samples/list-application-interfaces.php
@@ -0,0 +1,73 @@
+<?php
+namespace Airavata\Client\Samples;
+
+$GLOBALS['THRIFT_ROOT'] = '../lib/Thrift/';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TSocket.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TProtocol.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TBinaryProtocol.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TApplicationException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TProtocolException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Base/TBase.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TType.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TMessageType.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Factory/TStringFuncFactory.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/TStringFunc.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/Core.php';
+
+$GLOBALS['AIRAVATA_ROOT'] = '../lib/Airavata/';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/AppCatalog/ApplicationCatalogAPI.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Experiment/Types.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/AppCatalog/Types.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php';
+
+use Airavata\Model\Workspace\Experiment\ComputationalResourceScheduling;
+use Airavata\Model\Workspace\Experiment\DataObjectType;
+use Airavata\Model\Workspace\Experiment\UserConfigurationData;
+use Airavata\Model\ComputeResourceDescription;
+use Airavata\Model\ApplicationInterface;
+use Thrift\Protocol\TBinaryProtocol;
+use Thrift\Transport\TSocket;
+use Airavata\API\AiravataClient;
+use Airavata\API\AppCatalog\ApplicationCatalogAPIClient;
+use Airavata\Model\Workspace\Experiment\Experiment;
+use Airavata\Model\AppCatalog\JobSubmissionProtocol;
+use Airavata\Model\AppCatalog\DataMovementProtocol;
+
+//$transport = new TSocket('gw111.iu.xsede.org', 8930);
+$transport = new TSocket('localhost', 8931);
+$protocol = new TBinaryProtocol($transport);
+
+$airavataclient = new ApplicationCatalogAPIClient($protocol);
+$transport->open();
+
+echo "Airavata Server Version is: " . $airavataclient->getAPIVersion() . "\n";
+
+echo "Listing Application Interfaces.... "."\n";
+
+$id_list = $airavataclient->listApplicationInterfaceIds();
+
+foreach($id_list as $id){
+	echo "Application Interface Id : ".$id."\n";
+	$app_interface = $airavataclient->getApplicationInterface($id);
+	echo "\t"."Interface Data : " . $app_interface->applicationInterfaceData."\n";
+	echo "\t"."Deployments : ".count($app_interface->applicationDeployments)."\n";
+	foreach($app_interface->applicationDeployments as $deployment){
+		echo "\t\t"."Compute Resource : ".$deployment->computeResourceDescription->hostName."\n";
+		echo "\t\t\t"."Application Data".$deployment->applicationDescriptor->applicationDescriptorData."\n";
+	}
+}
+
+//$compute_resource = new \ComputeResourceDescription();
+//$compute_resource->hostName="localhost";
+//$compute_resource->hostAliases=array("localhost");
+//$compute_resource->ipAddresses=array("127.0.0.1");
+
+//Create a Experiment
+$transport->close();
+
+?>
+
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ce9c126/client-samples/list-compute-resources.php
----------------------------------------------------------------------
diff --git a/client-samples/list-compute-resources.php b/client-samples/list-compute-resources.php
new file mode 100644
index 0000000..4ff8a6f
--- /dev/null
+++ b/client-samples/list-compute-resources.php
@@ -0,0 +1,97 @@
+<?php
+namespace Airavata\Client\Samples;
+
+$GLOBALS['THRIFT_ROOT'] = '../lib/Thrift/';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TSocket.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TProtocol.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TBinaryProtocol.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TApplicationException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TProtocolException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Base/TBase.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TType.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TMessageType.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Factory/TStringFuncFactory.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/TStringFunc.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/Core.php';
+
+$GLOBALS['AIRAVATA_ROOT'] = '../lib/Airavata/';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/AppCatalog/ApplicationCatalogAPI.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Experiment/Types.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/AppCatalog/Types.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php';
+
+use Airavata\Model\Workspace\Experiment\ComputationalResourceScheduling;
+use Airavata\Model\Workspace\Experiment\DataObjectType;
+use Airavata\Model\Workspace\Experiment\UserConfigurationData;
+use Airavata\Model\ComputeResourceDescription;
+use Thrift\Protocol\TBinaryProtocol;
+use Thrift\Transport\TSocket;
+use Airavata\API\AiravataClient;
+use Airavata\API\AppCatalog\ApplicationCatalogAPIClient;
+use Airavata\Model\Workspace\Experiment\Experiment;
+use Airavata\Model\AppCatalog\JobSubmissionProtocol;
+use Airavata\Model\AppCatalog\DataMovementProtocol;
+use Airavata\Model\AppCatalog\ResourceJobManager;
+
+//$transport = new TSocket('gw111.iu.xsede.org', 8930);
+$transport = new TSocket('localhost', 8931);
+$protocol = new TBinaryProtocol($transport);
+
+$airavataclient = new ApplicationCatalogAPIClient($protocol);
+$transport->open();
+
+echo "Airavata Server Version is: " . $airavataclient->getAPIVersion() . "\n";
+
+echo "Listing Compute Resources.... "."\n";
+
+$id_list = $airavataclient->listComputeResourceDescriptions();
+
+foreach($id_list as $id){
+	echo "Compute Resource Id : ".$id."\n";
+	$compute_resource = $airavataclient->getComputeResourceDescription($id);
+	echo "\t"."Host name : " . $compute_resource->hostName ."\n";
+	echo "\t"."Aliases : " . implode(",",array_keys($compute_resource->hostAliases)) ."\n";
+	echo "\t"."Ip addresses : " . implode(",",array_keys($compute_resource->ipAddresses))
."\n";
+	echo "\t"."Job Submission Protocol Data : ".count($compute_resource->jobSubmissionProtocols)."\n";
+	foreach($compute_resource->jobSubmissionProtocols as $protocol_data_id => $protocol_type){
+		echo "\t\t".$protocol_data_id."[".JobSubmissionProtocol::$__names[$protocol_type]. "]"."\n";
+		switch ($protocol_type){
+			case JobSubmissionProtocol::GRAM:
+				$globus_data=$airavataclient->getGlobusJobSubmissionProtocol($protocol_data_id);
+				echo "\t\t\tGate Keeper Endpoint(s) : ".implode(",",($globus_data->globusGateKeeperEndPoint))."\n";
+				break;
+			case JobSubmissionProtocol::GSISSH:
+				$gsissh_data=$airavataclient->getGSISSHJobSubmissionProtocol($protocol_data_id);
+				echo "\t\t\tResource Job Manager : ".ResourceJobManager::$__names[$gsissh_data->resourceJobManager]."\n";
+				echo "\t\t\tInstalled Path : ".$gsissh_data->installedPath."\n";
+				echo "\t\t\tSSH port : ".$gsissh_data->sshPort."\n";
+				echo "\t\t\tMonitor Mode : ".$gsissh_data->monitorMode."\n";
+				break;
+		}
+	}
+	echo "\t"."Data Movement Data : ".count($compute_resource->dataMovementProtocols)."\n";
+	foreach($compute_resource->dataMovementProtocols as $protocol_data_id => $protocol_type){
+		echo "\t\t".$protocol_data_id."[".DataMovementProtocol::$__names[$protocol_type] . "]"."\n";
+			switch ($protocol_type){
+			case DataMovementProtocol::GridFTP:
+				$gridftp_data=$airavataclient->getGridFTPDataMovementProtocol($protocol_data_id);
+				echo "\t\t\tGrid FTP Endpoint(s) : ".implode(",",($gridftp_data->gridFTPEndPoint))."\n";
+				break;
+		}
+	}
+}
+
+//$compute_resource = new \ComputeResourceDescription();
+//$compute_resource->hostName="localhost";
+//$compute_resource->hostAliases=array("localhost");
+//$compute_resource->ipAddresses=array("127.0.0.1");
+
+//Create a Experiment
+$transport->close();
+
+?>
+
+


Mime
View raw message