Updates to PHP Samples
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6a4b162f Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6a4b162f Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6a4b162f Branch: refs/heads/workflow-support Commit: 6a4b162fb8617b31e2698bc13d048d93b8417d13 Parents: 92244d6 Author: Suresh Marru <[email protected]> Authored: Sun Jul 13 00:25:24 2014 -0400 Committer: Suresh Marru <[email protected]> Committed: Sun Jul 13 00:25:24 2014 -0400 ---------------------------------------------------------------------- .../conf/airavata-client-properties.ini | 4 +- .../resources/conf/app-catalog-identifiers.ini | 20 ++- .../php-cli-samples/createExperiment.php | 168 ++++++++----------- .../resources/php-cli-samples/createProject.php | 44 ++--- .../getAllExperimentsInProject.php | 46 ++--- .../php-cli-samples/getAllUserProjects.php | 35 ++-- .../getApplicationDeployedResources.php | 32 +--- .../php-cli-samples/getApplicationInputs.php | 37 ++-- .../php-cli-samples/getApplicationModule.php | 23 +-- .../php-cli-samples/getApplicationOutputs.php | 37 ++-- .../resources/php-cli-samples/getExperiment.php | 72 +++----- .../php-cli-samples/getExperimentOutputs.php | 76 +++------ .../php-cli-samples/getExperimentStatus.php | 64 ++----- .../php-cli-samples/launchExperiment.php | 49 ++---- .../resources/php-cli-samples/updateProject.php | 42 ++--- .../tools/RegisterSampleApplications.java | 34 ++-- 16 files changed, 282 insertions(+), 501 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/airavata-client-properties.ini ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/airavata-client-properties.ini b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/airavata-client-properties.ini index b16d3c4..0f298da 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/airavata-client-properties.ini +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/airavata-client-properties.ini @@ -8,7 +8,7 @@ THRIFT_LIB_DIR = "../lib/Thrift/" AIRAVATA_PHP_STUBS_DIR = "../lib/Airavata/" ; Host which runs the Airavata Server -AIRAVATA_SERVER = "gw111.iu.xsede.org" +AIRAVATA_SERVER = "gw127.iu.xsede.org" ;AIRAVATA_SERVER = "localhost" ; Airavata Server thrift port @@ -17,3 +17,5 @@ AIRAVATA_PORT = 9930 ; Time out value to give enough breathing room for client to get synchronous responses back AIRAVATA_TIMEOUT = 50000 + +AIRAVATA_CREDENTIAL_STORE_TOKEN = 2c308fa9-99f8-4baa-92e4-d062e311483c http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/app-catalog-identifiers.ini ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/app-catalog-identifiers.ini b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/app-catalog-identifiers.ini index ee2ddd3..3b3cb85 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/app-catalog-identifiers.ini +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/app-catalog-identifiers.ini @@ -1,8 +1,14 @@ #Apache Airavata Gateway to Airavata Deployment Identifiers -#Fri Jul 11 18:09:20 EDT 2014 -trestlesResourceId=trestles.sdsc.xsede.org_be1e9355-467c-4e71-b030-1f0ac76091d5 -bigredResourceId=bigred2.uits.iu.edu_866a6c6a-1387-4f87-b7e3-ba6f95c5c652 -stampedeResourceId=stampede.tacc.xsede.org_4a92a63c-be81-422d-a9be-121d35e04af9 -amberInterfaceId=Amber_26a0dec3-eb94-4f2c-9dfc-8a837bf4fbba -wrfInterfaceId=WRF_9a1de5fb-8f90-4e32-96cb-c06bc1333274 -echoInterfaceId=Echo_b35ac096-808a-494e-94d1-0d20021c43f9 +#Sat Jul 12 18:13:37 EDT 2014 +espressoInterfaceId=ESPRESSO_a9c3acd6-4403-445b-b555-d4dbcc53afdb +amberInterfaceId=Amber_26a8a2eb-a5a1-460f-a9c3-9bc5899433b3 +gromacsInterfaceId=GROMACS_c720c8f6-8b70-40be-b228-5f9ea72869f9 +trinityInterfaceId=Trinity_6068b270-157e-4ea0-9ec8-b2757b33a147 +stampedeResourceId=stampede.tacc.xsede.org_3da3cb46-851e-4124-a7bd-37449ca057a8 +bigredResourceId=bigred2.uits.iu.edu_fa40aa10-3703-48c6-a14c-c186d772cd58 +trestlesResourceId=trestles.sdsc.xsede.org_30fb9af6-7cd3-4373-87e4-9987e43cc904 +wrfInterfaceId=WRF_c3c67d74-5e60-4ec6-b50d-9a5d61843296 +autoDockInterfaceId=AutoDock_22c4cbbf-7785-4f96-85c6-8fe8404df6c8 +nwChemInterfaceId=NWChem_574c944e-b376-4e83-9871-96e4c9559a89 +lammpsInterfaceId=LAMMPS_752f3ea6-4ae5-4636-9dba-a6efeb1c4da9 +echoInterfaceId=Echo_c024a9c1-29b2-444d-b523-0729c6679ebb http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createExperiment.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createExperiment.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createExperiment.php index e765c91..fef338f 100755 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createExperiment.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createExperiment.php @@ -24,118 +24,94 @@ use Airavata\Model\Workspace\Experiment\UserConfigurationData; use Airavata\Model\Workspace\Experiment\ComputationalResourceScheduling; use Airavata\Model\Workspace\Experiment\DataType; -$appId = 'SimpleEcho3_ca40f7c6-69ba-4f89-918d-9937cea0ca8f'; -$hostID = 'stampede.tacc.xsede.org_8f20b832-c11a-444b-8e73-bf15f4760b9a'; +try { + if ($argc < 4) { + echo "Usage: php createExperiment.php <username> <experiment_name> <project_ID> \n"; + } else { + + /* User provides input values */ + $userName = $argv[1]; + $experimentName = $argv[2]; + $projectId = $argv[3]; + + /** + * Configure Experiment by selecting application and configuring its input values. + * This sample scripts executes a simple Echo command on one of the remote machines as a illustrations. + * The getAllApplicationInterfaceNames.php scripts will list other available samples applications. + * Examples include Amber, AutoDock, ESPRESSO, GROMACS, LAMMPS, NWChem, Trinity and WRF. + */ + + $applicationId = $appcatalogdocs['echoInterfaceId']; + + $applicationInput = new DataObjectType(); + $applicationInput->key = "Input_to_Echo"; + $applicationInput->value = "Hello World"; + $experimentInputs = array($applicationInput); + + /** + * NOTE: For convenience, all the computational hosts are provided. + * Comment/Uncomment appropriately to schedule on alternative resources + * If all hosts are uncommented, the last one will be picked. + */ + + $scheduling = new ComputationalResourceScheduling(); + + /* IU BigRed II Cluster */ + $scheduling->resourceHostId = $appcatalogdocs['bigredResourceId']; + + /* TACC Stampede Cluster */ + $scheduling->resourceHostId = $appcatalogdocs['stampedeResourceId']; + $scheduling->ComputationalProjectAccount = "TG-STA110014S"; + + /* SDSC Trestles Cluster */ + $scheduling->resourceHostId = $appcatalogdocs['trestlesResourceId']; + $scheduling->ComputationalProjectAccount = "sds128"; + + /* Job dimensions and resource queue */ + $scheduling->totalCPUCount = 1; + $scheduling->nodeCount = 1; + $scheduling->wallTimeLimit = 15; + $scheduling->queueName = "normal"; -$stampedeResourceId = $appcatalogdocs['stampedeResourceId']; - -echo "stampede resource if $stampedeResourceId \n"; - -try -{ - if ($argc != 4) - { - echo 'php createExperiment.php <username> <experiment_name> <project_ID>'; - } - else - { - /* ComputationalResourceScheduling data for Trestles*/ - $cmRST = new ComputationalResourceScheduling(); - $cmRST->resourceHostId = $hostID; - $cmRST->ComputationalProjectAccount = "sds128"; - $cmRST->totalCPUCount = 1; - $cmRST->nodeCount = 1; - $cmRST->numberOfThreads = 0; - $cmRST->queueName = "normal"; - $cmRST->wallTimeLimit = 15; - $cmRST->jobStartTime = 0; - $cmRST->totalPhysicalMemory = 0; - - /* ComputationalResourceScheduling data for Stampede */ - $cmRSS = new ComputationalResourceScheduling(); - $cmRSS->resourceHostId = $hostID; - $cmRSS->ComputationalProjectAccount = "TG-STA110014S"; - $cmRSS->totalCPUCount = 1; - $cmRSS->nodeCount = 1; - $cmRSS->numberOfThreads = 0; - $cmRSS->queueName = "normal"; - $cmRSS->wallTimeLimit = 15; - $cmRSS->jobStartTime = 0; - $cmRSS->totalPhysicalMemory = 0; - - /* UserConfigurationData using either Trestles or Stampede*/ - $cmRS = $cmRSS; - // $cmRS = $cmRST; $userConfigurationData = new UserConfigurationData(); $userConfigurationData->airavataAutoSchedule = 0; $userConfigurationData->overrideManualScheduledParams = 0; - $userConfigurationData->computationalResourceScheduling = $cmRS; - //var_dump($cmRS); - //var_dump($userConfigurationData); - - /*Application ID for Trestles or Stamepede */ - //$appId_trestles = "SimpleEcho2"; - //$appId_stampede = "SimpleEcho3"; - //$appId = $appId_stampede; - //$appId = $appId_trestles; - - /* Experiment input and output data. */ - $input = new DataObjectType(); - $input->key = "echo_input"; - $input->value = "echo_output=Hello World"; - $input->type = DataType::STRING; - $exInputs = array($input); - - $output = new DataObjectType(); - $output->key = "echo_output"; - $output->value = ""; - $output->type = DataType::STRING; - $exOutputs = array($output); - - /* Create Experiment: needs to update using unique project ID. */ - $user = $argv[1]; - $exp_name = $argv[2]; - $proj = $argv[3]; + $userConfigurationData->computationalResourceScheduling = $scheduling; + + /** + * An experiment is created within Airavata and all the provided inputs and configurations are persisted + * within the Airavata Registry. + * + * NOTE: Airavata uses a 2 step launch process. The creation just creates the experiment. The launch step + * executes the created experiment. + */ $experiment = new Experiment(); - $experiment->projectID = $proj; - $experiment->userName = $user; - $experiment->name = $exp_name; - $experiment->applicationId = $appId; + $experiment->projectID = $projectId; + $experiment->userName = $userName; + $experiment->name = $experimentName; + $experiment->applicationId = $applicationId; $experiment->userConfigurationData = $userConfigurationData; - $experiment->experimentInputs = $exInputs; - $experiment->experimentOutputs = $exOutputs; + $experiment->experimentInputs = $experimentInputs; - $expId = $airavataclient->createExperiment($experiment); + $experimentId = $airavataclient->createExperiment($experiment); - if ($expId) - { + if ($experimentId) { var_dump($experiment); - echo "Experiment $expId created! \n "; - } - else - { + echo "Experiment $experimentId is created! \n "; + } else { echo "Failed to create experiment. \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 (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"; } - $transport->close(); ?> - http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php index da631c8..a5e0b75 100755 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php @@ -14,46 +14,30 @@ use Airavata\API\Error\InvalidRequestException; use Airavata\Model\Workspace\Project; -try -{ - if ($argc != 3) - { - echo 'php createProject.php <owner> <project_name>'; - } - else - { +try { + if ($argc < 3) { + echo 'php createProject.php <user_name> <project_name>'; + echo 'php createProject.php <user_name> <project_name>'; + } else { $project = new Project(); $project->owner = $argv[1]; $project->name = $argv[2]; $projId = $airavataclient->createProject($project); - if ($projId) - { - echo "Project $projId is created!\n"; - } - else - { + if ($projId) { + echo "Project $projId is successfully created!\n"; + } else { echo "Project creation Failed.\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 (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"; -} - - - - $transport->close(); http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllExperimentsInProject.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllExperimentsInProject.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllExperimentsInProject.php index 07cd96d..1590053 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllExperimentsInProject.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllExperimentsInProject.php @@ -17,37 +17,23 @@ use Thrift\Transport\TBufferedTransport; use Thrift\Transport\TSocket; use Airavata\API\AiravataClient; -try -{ - - if ($argc != 2) { - echo 'php getAllExperimentsInProject.php <project_ID>'; - } - - else { - $projectExperiments = $airavataclient->getAllExperimentsInProject($argv[1]); - echo '# of project experiments = ' . sizeof($projectExperiments) . ' <br><br>'; - var_dump($projectExperiments); - } - - -} -catch (InvalidRequestException $ire) -{ - print 'InvalidRequestException: ' . $ire->getMessage()."\n"; -} -catch (AiravataClientException $ace) -{ - print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +try { + + if ($argc != 2) { + echo 'Usage: php getAllExperimentsInProject.php <project_ID>'; + } else { + $projectExperiments = $airavataclient->getAllExperimentsInProject($argv[1]); + echo '# of project experiments = ' . sizeof($projectExperiments); + var_dump($projectExperiments); + } + +} 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 (AiravataSystemException $ase) -{ - print 'Airavata System Exception: ' . $ase->getMessage()."\n"; -} - - - - $transport->close(); http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllUserProjects.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllUserProjects.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllUserProjects.php index c8c43da..3088435 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllUserProjects.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllUserProjects.php @@ -17,37 +17,22 @@ use Thrift\Transport\TBufferedTransport; use Thrift\Transport\TSocket; use Airavata\API\AiravataClient; -try -{ - if ($argc != 2) - { - echo 'php getAllUserProjects.php <user>'; - } - else - { +try { + if ($argc != 2) { + echo "Usage: php getAllUserProjects.php <user> \n"; + } else { $userProjects = $airavataclient->getAllUserProjects($argv[1]); echo '# of user projects = ' . sizeof($userProjects) . ' '; var_dump($userProjects); } +} 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 (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"; -} - - - - $transport->close(); ?> - http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationDeployedResources.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationDeployedResources.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationDeployedResources.php index ccad572..e12bb9e 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationDeployedResources.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationDeployedResources.php @@ -21,9 +21,8 @@ use Thrift\Transport\TBufferedTransport; use Thrift\Transport\TSocket; use Airavata\API\AiravataClient; -if ($argc != 2) -{ - exit("php getApplicationDeployedResources.php <appModuleID> \n"); +if ($argc != 2) { + exit("Usage: php getApplicationDeployedResources.php <appModuleID> \n"); } $appModuleId = $argv[1]; @@ -52,32 +51,19 @@ function get_application_deployed_resources($appModuleId) { global $airavataclient; - try - { + try { return $airavataclient->getAppModuleDeployedResources($appModuleId); - } - catch (InvalidRequestException $ire) - { + } catch (InvalidRequestException $ire) { echo 'InvalidRequestException!<br><br>' . $ire->getMessage(); - } - catch (ExperimentNotFoundException $enf) - { + } catch (ExperimentNotFoundException $enf) { echo 'ExperimentNotFoundException!<br><br>' . $enf->getMessage(); - } - catch (AiravataClientException $ace) - { + } catch (AiravataClientException $ace) { echo 'AiravataClientException!<br><br>' . $ace->getMessage(); - } - catch (AiravataSystemException $ase) - { + } catch (AiravataSystemException $ase) { echo 'AiravataSystemException!<br><br>' . $ase->getMessage(); - } - catch (TTransportException $tte) - { + } catch (TTransportException $tte) { echo 'TTransportException!<br><br>' . $tte->getMessage(); - } - catch (\Exception $e) - { + } catch (\Exception $e) { echo 'Exception!<br><br>' . $e->getMessage(); } http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationInputs.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationInputs.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationInputs.php index 433dcb0..c8d853a 100755 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationInputs.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationInputs.php @@ -14,14 +14,11 @@ use Airavata\API\Error\InvalidRequestException; use Thrift\Exception\TTransportException; use Airavata\Model\AppCatalog\AppInterface\DataType; -try -{ +try { - if ($argc < 1) - { + if ($argc < 1) { echo 'php getApplicationInputs.php <appInterfaceId>'; - } - else { + } else { $appInterfaceId = $argv[1]; @@ -36,26 +33,16 @@ try } else { echo "\n Failed to fetch application interface Inputs. \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) -{ + } +} 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) -{ +} catch (\Exception $e) { echo 'Exception!<br><br>' . $e->getMessage(); } http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationModule.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationModule.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationModule.php index e28dbac..dfbc650 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationModule.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationModule.php @@ -37,28 +37,17 @@ function get_appModule($appModuleId) { global $airavataclient; - try - { + try { return $airavataclient->getApplicationModule($appModuleId); - } - catch (InvalidRequestException $ire) - { + } catch (InvalidRequestException $ire) { echo 'InvalidRequestException!<br><br>' . $ire->getMessage(); - } - catch (AiravataClientException $ace) - { + } catch (AiravataClientException $ace) { echo 'AiravataClientException!<br><br>' . $ace->getMessage(); - } - catch (AiravataSystemException $ase) - { + } catch (AiravataSystemException $ase) { echo 'AiravataSystemException!<br><br>' . $ase->getMessage(); - } - catch (TTransportException $tte) - { + } catch (TTransportException $tte) { echo 'TTransportException!<br><br>' . $tte->getMessage(); - } - catch (\Exception $e) - { + } catch (\Exception $e) { echo 'Exception!<br><br>' . $e->getMessage(); } http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationOutputs.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationOutputs.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationOutputs.php index fd8e83f..ed57ac1 100755 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationOutputs.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationOutputs.php @@ -14,14 +14,11 @@ use Airavata\API\Error\InvalidRequestException; use Thrift\Exception\TTransportException; use Airavata\Model\AppCatalog\AppInterface\DataType; -try -{ +try { - if ($argc < 1) - { + if ($argc < 1) { echo 'php getApplicationOutputs.php <appInterfaceId>'; - } - else { + } else { $appInterfaceId = $argv[1]; @@ -35,26 +32,16 @@ try } else { echo "\n Failed to fetch application interface Outputs. \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) -{ + } +} 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) -{ +} catch (\Exception $e) { echo 'Exception!<br><br>' . $e->getMessage(); } http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperiment.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperiment.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperiment.php index 24371bd..bdda534 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperiment.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperiment.php @@ -20,61 +20,29 @@ use Thrift\Transport\TBufferedTransport; use Thrift\Transport\TSocket; use Airavata\API\AiravataClient; - -if (count($argv) < 2) { - exit("Please provide an experimentID. \n"); +try { + if (count($argv) < 2) { + exit("Please provide an experimentID. Usage: \n"); + } else { + $experimentId = $argv[1]; + $experiment = $airavataclient->getExperiment($experimentId); + var_dump($experiment); + } +} catch (InvalidRequestException $ire) { + echo 'InvalidRequestException!<br><br>' . $ire->getMessage(); +} catch (ExperimentNotFoundException $enf) { + echo 'ExperimentNotFoundException!<br><br>' . $enf->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(); } -$expId = $argv[1]; - - -$experiment = get_experiment($expId); - -var_dump($experiment); - - $transport->close(); - -/** - * Get the experiment with the given ID - * @param $expId - * @return null - */ -function get_experiment($expId) -{ - global $airavataclient; - - try - { - return $airavataclient->getExperiment($expId); - } - catch (InvalidRequestException $ire) - { - echo 'InvalidRequestException!<br><br>' . $ire->getMessage(); - } - catch (ExperimentNotFoundException $enf) - { - echo 'ExperimentNotFoundException!<br><br>' . $enf->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/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php index d8bc0df..e9fc30c 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php @@ -14,65 +14,35 @@ use Airavata\API\Error\ExperimentNotFoundException; use Airavata\API\Error\InvalidRequestException; use Thrift\Exception\TTransportException; -if ($argc != 2) -{ - exit("php getExperimentOutputs.php <experiment_id> \n"); -} +try { + if ($argc != 2) { + exit("Please specify a Experiment Id. Usage: php getExperimentOutputs.php <experiment_id> \n"); + } else { -$expId = $argv[1]; + $experimentId = $argv[1]; + $experimentOutputs = $airavataclient->getExperimentOutputs($experimentId); -$outputs = get_experiment_outputs($expId); + var_dump($experimentOutputs); -foreach ($outputs as $output) -{ - echo "$output->type: $output->value <br><br>"; + foreach ($experimentOutputs as $output) { + echo "\n$output->key: $output->value \n"; + } + } +} catch (InvalidRequestException $ire) { + echo 'InvalidRequestException!<br><br>' . $ire->getMessage(); +} catch (ExperimentNotFoundException $enf) { + echo 'ExperimentNotFoundException!<br><br>' . $enf->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(); } -var_dump($outputs); - - $transport->close(); - -/** - * Get the experiment with the given ID - * @param $expId - * @return null - */ -function get_experiment_outputs($expId) -{ - global $airavataclient; - - try - { - return $airavataclient->getExperimentOutputs($expId); - } - catch (InvalidRequestException $ire) - { - echo 'InvalidRequestException!<br><br>' . $ire->getMessage(); - } - catch (ExperimentNotFoundException $enf) - { - echo 'ExperimentNotFoundException!<br><br>' . $enf->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/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentStatus.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentStatus.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentStatus.php index babda01..f357a56 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentStatus.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentStatus.php @@ -19,55 +19,27 @@ use Thrift\Transport\TBufferedTransport; use Thrift\Transport\TSocket; use Airavata\API\AiravataClient; -if (count($argv) < 2) { - exit("Please provide an experimentID. \n"); -} - -$expId = $argv[1]; - -$experimentStatusString = get_experiment_status($expId); -echo "experiment status = " . $experimentStatusString . " \n<br>"; - +try { + if (count($argv) < 2) { + exit("Please provide an experimentID. Usage: php getExperimentStatus.php <experimentId> \n"); + } else { -$transport->close(); - - -/** - * Get a string containing the given experiment's status - * @param $expId - * @return mixed - */ -function get_experiment_status($expId) -{ - global $airavataclient; + $experimentId = $argv[1]; + $experimentStatus = $airavataclient->getExperimentStatus($experimentId); - try - { - $experimentStatus = $airavataclient->getExperimentStatus($expId); - } - catch (InvalidRequestException $ire) - { - echo 'InvalidRequestException!<br><br>' . $ire->getMessage(); - } - catch (ExperimentNotFoundException $enf) - { - echo 'ExperimentNotFoundException!<br><br>' . $enf->getMessage(); - } - catch (AiravataClientException $ace) - { - echo 'AiravataClientException!<br><br>' . $ace->getMessage(); - } - catch (AiravataSystemException $ase) - { - echo 'AiravataSystemException!<br><br>' . $ase->getMessage(); - } - catch (\Exception $e) - { - echo 'Exception!<br><br>' . $e->getMessage(); + echo "experiment status = " . ExperimentState::$__names[$experimentStatus->experimentState] . " \n<br>"; } - return ExperimentState::$__names[$experimentStatus->experimentState]; +} catch (InvalidRequestException $ire) { + echo 'InvalidRequestException!<br><br>' . $ire->getMessage(); +} catch (ExperimentNotFoundException $enf) { + echo 'ExperimentNotFoundException!<br><br>' . $enf->getMessage(); +} catch (AiravataClientException $ace) { + echo 'AiravataClientException!<br><br>' . $ace->getMessage(); +} catch (AiravataSystemException $ase) { + echo 'AiravataSystemException!<br><br>' . $ase->getMessage(); +} catch (\Exception $e) { + echo 'Exception!<br><br>' . $e->getMessage(); } -?> - +$transport->close(); http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/launchExperiment.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/launchExperiment.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/launchExperiment.php index b2e7108..49542c4 100755 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/launchExperiment.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/launchExperiment.php @@ -21,39 +21,26 @@ use Airavata\API\AiravataClient; use Airavata\Model\Workspace\Project; use Airavata\Model\Workspace\Experiment\Experiment; -try -{ - if (count($argv) < 2) { - exit("Please provide an experimentID. \n"); - } - - $expId = $argv[1]; - $airavataclient->launchExperiment($expId, '7a8b801f-23e7-465f-b5e4-3cf1e8bee2ab'); - echo "Experiment $expId is launched."; -} -catch (InvalidRequestException $ire) -{ - print 'InvalidRequestException: ' . $ire->getMessage()."\n"; -} -catch (AiravataClientException $ace) -{ - print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +try { + if (count($argv) < 2) { + exit("Please provide the experimentId to be launched. Usage: php launchExperiment.php <experimentId> \n"); + } else { + $experimentId = $argv[1]; + $airavataclient->launchExperiment($experimentId, $airavataconfig['AIRAVATA_CREDENTIAL_STORE_TOKEN']); + echo "Experiment $experimentId is launched. \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 (ExperimentNotFoundException $enf) { + print 'Experiment Not Found Exception: ' . $enf->getMessage() . "\n"; +} catch (LaunchValidationException $lve) { + print 'Experiment Validation Failed: ' . $lve->getMessage() . "\n"; } -catch (AiravataSystemException $ase) -{ - print 'Airavata System Exception: ' . $ase->getMessage()."\n"; -} -catch (ExperimentNotFoundException $enf) -{ - print 'Experiment Not Found Exception: ' . $enf->getMessage()."\n"; -} - - - - - $transport->close(); ?> - http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateProject.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateProject.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateProject.php index 1b9847a..9d870c1 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateProject.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/updateProject.php @@ -17,35 +17,23 @@ use Thrift\Transport\TBufferedTransport; use Thrift\Transport\TSocket; use Airavata\API\AiravataClient; -try -{ - if($argc != 3) - { - echo 'php updateProject.php <project_id> <project_description>'; - } - else - { - $project=$airavataclient->getProject($argv[1]); - $project->description = $argv[2]; - $airavataclient->updateProject($argv[1], $project); - echo 'Project '.$argv[1] . ' succesfully modified.'; - } -} - -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"; +try { + if ($argc != 3) { + echo 'php updateProject.php <project_id> <project_description>'; + } else { + $project = $airavataclient->getProject($argv[1]); + $project->description = $argv[2]; + $airavataclient->updateProject($argv[1], $project); + echo 'Project ' . $argv[1] . ' successfully modified.'; + } +} 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"; } $transport->close(); ?> - http://git-wip-us.apache.org/repos/asf/airavata/blob/6a4b162f/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java index 5c2c0c3..ddc4848 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java @@ -47,7 +47,7 @@ import org.apache.thrift.TException; public class RegisterSampleApplications { - public static final String THRIFT_SERVER_HOST = "gw111.iu.xsede.org"; + public static final String THRIFT_SERVER_HOST = "gw127.iu.xsede.org"; // public static final String THRIFT_SERVER_HOST = "localhost"; public static final int THRIFT_SERVER_PORT = 9930; // public static final int THRIFT_SERVER_PORT = 8930; @@ -87,10 +87,10 @@ public class RegisterSampleApplications { private static String amberModuleId; private static String autoDockModuleId; private static String espressoModuleId; - private static String gromacsModuleId; + private static String gromacsModuleId = "GROMACS_417271fd-7ac1-4f40-b2a5-ed0908a743eb"; private static String lammpsModuleId; private static String nwChemModuleId; - private static String trinityModuleId; + private static String trinityModuleId = "Trinity_8af45ca0-b628-4614-9087-c7b73f5f2fb6"; private static String wrfModuleId; //App Interface Id's @@ -245,22 +245,22 @@ public class RegisterSampleApplications { registerAmberInterface(); //Registering AutoDock -// registerAutoDockInterface(); + registerAutoDockInterface(); //Registering Espresso -// registerEspressoInterface(); + registerEspressoInterface(); //Registering Gromacs -// registerGromacsInterface(); + registerGromacsInterface(); //Registering Lammps registerLammpsInterface(); //Registering NWChem -// registerNWChemInterface(); + registerNWChemInterface(); //Registering Trinity -// registerTrinityInterface(); + registerTrinityInterface(); //Registering WRF registerWRFInterface(); @@ -418,14 +418,21 @@ public class RegisterSampleApplications { InputDataObjectType input1 = RegisterSampleApplicationsUtils.createAppInput("Portable_Input_Binary_File", null, DataType.URI, null, false, "Coordinates velocities, molecular topology and simulation parameters", null); + InputDataObjectType input2 = RegisterSampleApplicationsUtils.createAppInput("GROMOS_Coordinate_File", null, + DataType.URI, null, false, "Trajectory Coordinates Molecular Structure in Gromos87 format", null); + List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>(); applicationInputs.add(input1); + applicationInputs.add(input2); - OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("Echoed_Output", - "", DataType.STRING); + OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("GROMACS_Execution_Log",null,DataType.URI); + OutputDataObjectType output2 = RegisterSampleApplicationsUtils.createAppOutput("Full_Precision_Trajectory_file",null,DataType.URI); + OutputDataObjectType output3 = RegisterSampleApplicationsUtils.createAppOutput("Portable_Energy_file",null,DataType.URI); List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>(); applicationOutputs.add(output1); + applicationOutputs.add(output2); + applicationOutputs.add(output3); gromacsInterfaceId = airavataClient.registerApplicationInterface( RegisterSampleApplicationsUtils.createApplicationInterfaceDescription(gromacsName, gromacsDescription, @@ -505,18 +512,19 @@ public class RegisterSampleApplications { InputDataObjectType input1 = RegisterSampleApplicationsUtils.createAppInput("RNA_Seq_Left_Input", null, DataType.URI, null, false, "RNA-Seq Left Library", null); - InputDataObjectType input2 = RegisterSampleApplicationsUtils.createAppInput("RNA_Seq_Left_Input", null, + InputDataObjectType input2 = RegisterSampleApplicationsUtils.createAppInput("RNA_Seq_Right_Input", null, DataType.URI, null, false, "RNA-Seq Right Library", null); List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>(); applicationInputs.add(input1); applicationInputs.add(input2); - OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("Echoed_Output", - "", DataType.STRING); + OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("Trinity_Execution_Log",null,DataType.URI); + OutputDataObjectType output2 = RegisterSampleApplicationsUtils.createAppOutput("Trinity_FASTA_File",null,DataType.URI); List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>(); applicationOutputs.add(output1); + applicationOutputs.add(output2); trinityInterfaceId = airavataClient.registerApplicationInterface( RegisterSampleApplicationsUtils.createApplicationInterfaceDescription(trinityName, trinityDescription,
