You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2014/07/10 23:11:38 UTC
git commit: more php samples
Repository: airavata
Updated Branches:
refs/heads/master ea7c19be0 -> 672d146dd
more php samples
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/672d146d
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/672d146d
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/672d146d
Branch: refs/heads/master
Commit: 672d146dd3c96733f7bb4c95ad6139d971b7d6a0
Parents: ea7c19b
Author: Suresh Marru <sm...@apache.org>
Authored: Thu Jul 10 17:11:28 2014 -0400
Committer: Suresh Marru <sm...@apache.org>
Committed: Thu Jul 10 17:11:28 2014 -0400
----------------------------------------------------------------------
.../php-cli-samples/deleteComputeResource.php | 49 ++++++++++++++++++++
.../getAllComputeResourceNames.php | 39 ++++++++++++++++
.../php-cli-samples/getComputeResource.php | 46 ++++++++++++++++++
.../updateApplicationInterface.php | 32 +++++++++----
4 files changed, 157 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/672d146d/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/deleteComputeResource.php
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/deleteComputeResource.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/deleteComputeResource.php
new file mode 100644
index 0000000..eb2738f
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/deleteComputeResource.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way.
+ * Contributions welcome to improve writing PHP Client Samples.
+ *
+ */
+include 'getAiravataClient.php';
+global $airavataclient;
+global $transport;
+
+use Airavata\API\Error\AiravataClientException;
+use Airavata\API\Error\AiravataSystemException;
+use Airavata\API\Error\InvalidRequestException;
+use Thrift\Exception\TTransportException;
+
+use Airavata\Model\AppCatalog\AppDeployment\ApplicationModule;
+
+try {
+
+ if (count($argv) != 2) {
+ exit("\n Incorrect Arguments \n. Usage: deleteComputeResource.php <compute resource id>. \n");
+ } else {
+
+ $computeResourceId = $argv[1];
+
+ $success = $airavataclient->deleteComputeResource($computeResourceId);
+
+ if ($success) {
+ echo "Application Interface $computeResourceId successfully deleted";
+ } else {
+ echo "\n Failed to delete application interface $computeResourceId \n";
+ }
+ }
+} catch (InvalidRequestException $ire) {
+ print 'InvalidRequestException: ' . $ire->getMessage() . "\n";
+} catch (AiravataClientException $ace) {
+ print 'Airavata System Exception: ' . $ace->getMessage() . "\n";
+} catch (AiravataSystemException $ase) {
+ print 'Airavata System Exception: ' . $ase->getMessage() . "\n";
+} catch (TTransportException $tte) {
+ echo 'TTransportException!<br><br>' . $tte->getMessage();
+} catch (\Exception $e) {
+ echo 'Exception!<br><br>' . $e->getMessage();
+}
+
+$transport->close();
+
+?>
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/672d146d/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllComputeResourceNames.php
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllComputeResourceNames.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllComputeResourceNames.php
new file mode 100755
index 0000000..62bb8d5
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllComputeResourceNames.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way.
+ * Contributions welcome to improve writing PHP Client Samples.
+ *
+ */
+include 'getAiravataClient.php';
+global $airavataclient;
+global $transport;
+
+use Airavata\API\Error\AiravataClientException;
+use Airavata\API\Error\AiravataSystemException;
+use Airavata\API\Error\InvalidRequestException;
+use Thrift\Exception\TTransportException;
+
+try {
+ $appInterfaceComputeResources = $airavataclient->getAllComputeResourceNames();
+
+ if ($appInterfaceComputeResources) {
+ var_dump($appInterfaceComputeResources);
+ } else {
+ echo "\n Failed to fetch compute resources. \n";
+ }
+} catch (InvalidRequestException $ire) {
+ print 'InvalidRequestException: ' . $ire->getMessage() . "\n";
+} catch (AiravataClientException $ace) {
+ print 'Airavata System Exception: ' . $ace->getMessage() . "\n";
+} catch (AiravataSystemException $ase) {
+ print 'Airavata System Exception: ' . $ase->getMessage() . "\n";
+} catch (TTransportException $tte) {
+ echo 'TTransportException!<br><br>' . $tte->getMessage();
+} catch (\Exception $e) {
+ echo 'Exception!<br><br>' . $e->getMessage();
+}
+
+$transport->close();
+
+?>
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/672d146d/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getComputeResource.php
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getComputeResource.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getComputeResource.php
new file mode 100644
index 0000000..05bb08d
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getComputeResource.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way.
+ * Contributions welcome to improve writing PHP Client Samples.
+ *
+ */
+include 'getAiravataClient.php';
+global $airavataclient;
+global $transport;
+
+use Airavata\API\Error\AiravataClientException;
+use Airavata\API\Error\AiravataSystemException;
+use Airavata\API\Error\InvalidRequestException;
+use Thrift\Exception\TTransportException;
+
+use Airavata\Model\AppCatalog\AppDeployment\ApplicationModule;
+
+try {
+ if ($argc < 1) {
+ echo 'php getComputeResource.php <Compute Resource Id>';
+ } else {
+ $computeResourceId = $argv[1];
+
+ $computeResource = $airavataclient->getComputeResource($computeResourceId);
+
+ if ($computeResource) {
+ var_dump($computeResource);
+ } else {
+ echo "\n Failed to fetch compute resource description. \n";
+ }
+ }
+
+} catch (InvalidRequestException $ire) {
+ echo 'InvalidRequestException!<br><br>' . $ire->getMessage();
+} catch (AiravataClientException $ace) {
+ echo 'AiravataClientException!<br><br>' . $ace->getMessage();
+} catch (AiravataSystemException $ase) {
+ echo 'AiravataSystemException!<br><br>' . $ase->getMessage();
+} catch (TTransportException $tte) {
+ echo 'TTransportException!<br><br>' . $tte->getMessage();
+} catch (\Exception $e) {
+ echo 'Exception!<br><br>' . $e->getMessage();
+}
+
+?>
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/672d146d/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateApplicationInterface.php
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateApplicationInterface.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateApplicationInterface.php
index 9594c0a..baccbc3 100755
--- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateApplicationInterface.php
+++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateApplicationInterface.php
@@ -30,18 +30,32 @@ try
//$appModuleId = $argv[3];
- $appInputs = new InputDataObjectType();
- $appInputs->name = "Input_to_Echo";
- $appInputs->userFriendlyDescription = "A string to test echo application";
- $appInputs->type = DataType::STRING;
+ $appInput1 = new InputDataObjectType();
+ $appInput1->name = "Namelist_File";
+ $appInput1->userFriendlyDescription = "Namelist file";
+ $appInput1->type = DataType::URI;
- $appOutputs = new OutputDataObjectType();
- $appOutputs->name = "Echoed_Output";
- $appOutputs->type = DataType::STRING;
+ $appInput2 = new InputDataObjectType();
+ $appInput2->name = "WRF Boundary File";
+ $appInput2->userFriendlyDescription = "Boundary file";
+ $appInput2->type = DataType::URI;
+
+ $appInput3 = new InputDataObjectType();
+ $appInput3->name = "WRF_Initial_Condition";
+ $appInput3->userFriendlyDescription = "Input Data file";
+ $appInput3->type = DataType::URI;
+
+ $appOutput1 = new OutputDataObjectType();
+ $appOutput1->name = "WRF Standard Out";
+ $appOutput1->type = DataType::STRING;
+
+ $appOutput2 = new OutputDataObjectType();
+ $appOutput2->name = "WRF RSL Out";
+ $appOutput2->type = DataType::STRING;
$appInterface = $airavataclient->getApplicationInterface($appInterfaceId);
- $appInterface->applicationInputs = array($appInputs);
- $appInterface->applicationOutputs = array($appOutputs);
+ $appInterface->applicationInputs = array($appInput1, $appInput2, $appInput3);
+ $appInterface->applicationOutputs = array($appOutput1, $appOutput2);
var_dump($appInterface);
$status = $airavataclient->updateApplicationInterface($appInterfaceId, $appInterface);