Add search experiment scripts.
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/3f898307 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/3f898307 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/3f898307 Branch: refs/heads/master Commit: 3f89830732a907061b56fa58afe4def10e6d2ab8 Parents: d8bd3d1 Author: dmreagan <[email protected]> Authored: Thu Jun 12 18:03:58 2014 -0400 Committer: dmreagan <[email protected]> Committed: Thu Jun 12 18:03:58 2014 -0400 ---------------------------------------------------------------------- .../search_experiments_by_application.php | 82 ++++++++++++++++++++ .../search_experiments_by_description.php | 82 ++++++++++++++++++++ client-samples/search_experiments_by_name.php | 82 ++++++++++++++++++++ 3 files changed, 246 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/3f898307/client-samples/search_experiments_by_application.php ---------------------------------------------------------------------- diff --git a/client-samples/search_experiments_by_application.php b/client-samples/search_experiments_by_application.php new file mode 100644 index 0000000..cd98694 --- /dev/null +++ b/client-samples/search_experiments_by_application.php @@ -0,0 +1,82 @@ +<?php +namespace Airavata\Client\Samples; + +$GLOBALS['THRIFT_ROOT'] = '../lib/Thrift/'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TBufferedTransport.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'] . 'Exception/TTransportException.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'] . 'Model/Workspace/Experiment/Types.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; + +require_once '../lib/AiravataClientFactory.php'; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; +use Airavata\Client\AiravataClientFactory; +use Thrift\Protocol\TBinaryProtocol; +use Thrift\Transport\TBufferedTransport; +use Thrift\Transport\TSocket; +use Airavata\API\AiravataClient; + +$airavataconfig = parse_ini_file("airavata-client-properties.ini"); + +$transport = new TSocket($airavataconfig['AIRAVATA_SERVER'], $airavataconfig['AIRAVATA_PORT']); +$transport->setRecvTimeout($airavataconfig['AIRAVATA_TIMEOUT']); + +$protocol = new TBinaryProtocol($transport); +$transport->open(); +$airavataclient = new AiravataClient($protocol); + + +try +{ + + if ($argc != 3) { + echo 'php search_experiments_by_application.php <username> <project_ID>'; + } + + else { + $experiments = $airavataclient->searchExperimentsByApplication($argv[1], $argv[2]); + echo '# results = ' . sizeof($experiments) . ' <br><br>'; + var_dump($experiments); + } + + +} +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/3f898307/client-samples/search_experiments_by_description.php ---------------------------------------------------------------------- diff --git a/client-samples/search_experiments_by_description.php b/client-samples/search_experiments_by_description.php new file mode 100644 index 0000000..8243c0b --- /dev/null +++ b/client-samples/search_experiments_by_description.php @@ -0,0 +1,82 @@ +<?php +namespace Airavata\Client\Samples; + +$GLOBALS['THRIFT_ROOT'] = '../lib/Thrift/'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TBufferedTransport.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'] . 'Exception/TTransportException.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'] . 'Model/Workspace/Experiment/Types.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; + +require_once '../lib/AiravataClientFactory.php'; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; +use Airavata\Client\AiravataClientFactory; +use Thrift\Protocol\TBinaryProtocol; +use Thrift\Transport\TBufferedTransport; +use Thrift\Transport\TSocket; +use Airavata\API\AiravataClient; + +$airavataconfig = parse_ini_file("airavata-client-properties.ini"); + +$transport = new TSocket($airavataconfig['AIRAVATA_SERVER'], $airavataconfig['AIRAVATA_PORT']); +$transport->setRecvTimeout($airavataconfig['AIRAVATA_TIMEOUT']); + +$protocol = new TBinaryProtocol($transport); +$transport->open(); +$airavataclient = new AiravataClient($protocol); + + +try +{ + + if ($argc != 3) { + echo 'php search_experiments_by_description.php <username> <project_ID>'; + } + + else { + $experiments = $airavataclient->searchExperimentsByDesc($argv[1], $argv[2]); + echo '# results = ' . sizeof($experiments) . ' <br><br>'; + var_dump($experiments); + } + + +} +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/3f898307/client-samples/search_experiments_by_name.php ---------------------------------------------------------------------- diff --git a/client-samples/search_experiments_by_name.php b/client-samples/search_experiments_by_name.php new file mode 100644 index 0000000..4a51a15 --- /dev/null +++ b/client-samples/search_experiments_by_name.php @@ -0,0 +1,82 @@ +<?php +namespace Airavata\Client\Samples; + +$GLOBALS['THRIFT_ROOT'] = '../lib/Thrift/'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TBufferedTransport.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'] . 'Exception/TTransportException.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'] . 'Model/Workspace/Experiment/Types.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; + +require_once '../lib/AiravataClientFactory.php'; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; +use Airavata\Client\AiravataClientFactory; +use Thrift\Protocol\TBinaryProtocol; +use Thrift\Transport\TBufferedTransport; +use Thrift\Transport\TSocket; +use Airavata\API\AiravataClient; + +$airavataconfig = parse_ini_file("airavata-client-properties.ini"); + +$transport = new TSocket($airavataconfig['AIRAVATA_SERVER'], $airavataconfig['AIRAVATA_PORT']); +$transport->setRecvTimeout($airavataconfig['AIRAVATA_TIMEOUT']); + +$protocol = new TBinaryProtocol($transport); +$transport->open(); +$airavataclient = new AiravataClient($protocol); + + +try +{ + + if ($argc != 3) { + echo 'php search_experiments_by_name.php <username> <project_ID>'; + } + + else { + $experiments = $airavataclient->searchExperimentsByName($argv[1], $argv[2]); + echo '# results = ' . sizeof($experiments) . ' <br><br>'; + var_dump($experiments); + } + + +} +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(); + +?> +
