Ejemplo n.º 1
0
function register()
{
    $airavataconfig = parse_ini_file("airavata-client-properties.ini");
    $transport = new TSocket($airavataconfig['AIRAVATA_SERVER'], $airavataconfig['AIRAVATA_PORT']);
    $transport->setSendTimeout($airavataconfig['AIRAVATA_TIMEOUT']);
    $protocol = new TBinaryProtocol($transport);
    $transport->open();
    try {
        $airavataclient = new AiravataClient($protocol);
        $registeredModules = getRegisteredModules($airavataclient);
        $modules = getUnregisteredModules($registeredModules);
        // $modules = getModulesNames();
        echo var_dump($registeredModules);
        echo var_dump($modules);
        if (!empty($modules)) {
            $localhostId = registerLocalHost($airavataclient);
            $moduleids = registerApplicationModule($airavataclient, $modules);
            registerApplicationDeployments($airavataclient, $moduleids, $modules, $localhostId);
            registerApplicationInterfaces($airavataclient, $moduleids, $modules, $localhostId);
            // $host = $airavataclient->registerComputeResource();
        }
    } 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();
}
Ejemplo n.º 2
0
function register()
{
    $gatewayId = $GLOBALS['AIRAVATA_GATEWAY'];
    $transport = new TSocket($GLOBALS['AIRAVATA_SERVER'], $GLOBALS['AIRAVATA_PORT']);
    $transport->setSendTimeout($GLOBALS['AIRAVATA_TIMEOUT']);
    $transport->setRecvTimeout($GLOBALS['AIRAVATA_TIMEOUT']);
    $protocol = new TBinaryProtocol($transport);
    try {
        $transport->open();
        $airavataclient = new AiravataClient($protocol);
        if (!$airavataclient->isGatewayExist($gatewayId)) {
            $gateway = new Gateway();
            $gateway->gatewayId = $gatewayId;
            $gateway->gatewayName = "GeanApp_GateWaay";
            $gateway->domain = $GLOBALS['AIRAVATA_SERVER'];
            $gateway->emailAddress = $GLOBALS['AIRAVATA_EMAIL'];
            $airavataclient->addGateway($gateway);
            registerComputeResourceHost($airavataclient, $GLOBALS['COMPUTE_RESOURCE']);
        } else {
            if (isGatewayRegistered($airavataclient, $gatewayId)) {
                $cmrf = $airavataclient->getGatewayResourceProfile($gatewayId)->computeResourcePreferences;
                registerComputeResourceHost($airavataclient, getUnRegisteredHost($airavataclient, $cmrf));
            } else {
                registerComputeResourceHost($airavataclient, $GLOBALS['COMPUTE_RESOURCE']);
            }
        }
        $hostIds = getHostIds($airavataclient, $gatewayId);
        $registeredModules = getRegisteredModules($airavataclient, $gatewayId);
        $modulesHost = getUnregisteredModules($airavataclient, $registeredModules);
        foreach ($modulesHost as $hostName => $modules) {
            if (!empty($modules)) {
                $moduleids = registerApplicationModule($gatewayId, $airavataclient, $modules);
                registerApplicationDeployments($gatewayId, $airavataclient, $moduleids, $modules, $hostIds[$hostName]);
                registerApplicationInterfaces($gatewayId, $airavataclient, $moduleids, $modules, $hostName);
            }
        }
        $transport->close();
    } catch (InvalidRequestException $ire) {
        echo 'InvalidRequestException: ' . $ire->getMessage();
    } catch (AiravataClientException $ace) {
        echo 'Airavata System Exception: ' . $ace->getMessage();
    } catch (AiravataSystemException $ase) {
        echo 'Airavata System Exception: ' . $ase->getMessage();
    } catch (TException $tx) {
        echo 'There is some connection problem, please check if airavata is runnig properly and try again later';
    } catch (\Exception $e) {
        echo 'Exception: ' . $e->getMessage();
    }
}