Ejemplo n.º 1
0
void Interactor::DoConfig(boolean parentReversed) {
    boolean reversed = parentReversed;
    if (parent != nil) {
	/* cast to workaround DEC C++ compiler bug */
	output = ((Interactor*)parent)->output;
    }
    DefaultConfig(reversed);
    Resource::ref(output);

    Interactor* children[100];
    Interactor** a;
    int n;
    GetComponents(children, sizeof(children) / sizeof(Interactor*), a, n);
    if (n > 0) {
	for (Interactor** ii = a; ii < &a[n]; ii++) {
	    Interactor* i = *ii;
	    i->parent = (Scene*)this;
	    i->world = world;
	    i->DoConfig(reversed);
	}
	if (a != children) {
	    delete a;
	}
    }

    Reconfig();
}
Ejemplo n.º 2
0
ApplicationMaster::ApplicationMaster(string &schedHost, string &schedPort,
                                     UserInfo &user, const string &tokenService) {
    Yarn::Internal::shared_ptr<Yarn::Config> conf = DefaultConfig().getConfig();
    Yarn::Internal::SessionConfig sessionConfig(*conf);
    RpcAuth rpcAuth(user, AuthMethod::TOKEN);
    rmClient = (void*) new ApplicationMasterProtocol(schedHost,
               schedPort, tokenService, sessionConfig, rpcAuth);
}
Ejemplo n.º 3
0
ApplicationMaster::ApplicationMaster(string &schedHost, string &schedPort,
        UserInfo &user, const string &tokenService) {
    Yarn::Internal::shared_ptr<Yarn::Config> conf = DefaultConfig().getConfig();
    Yarn::Internal::SessionConfig sessionConfig(*conf);
    RpcAuth rpcAuth(user, AuthMethod::TOKEN);

    std::vector<RMInfo> rmInfos = RMInfo::getHARMInfo(*conf, YARN_RESOURCEMANAGER_SCHEDULER_HA);

    if (rmInfos.size() <= 1) {
        LOG(INFO, "ApplicationClient RM Scheduler HA is disable.");
        enableRMSchedulerHA = false;
        maxRMHARetry = 0;
    } else {
        LOG(INFO, "ApplicationClient RM Scheduler HA is enable. Number of RM scheduler: %d", rmInfos.size());
        enableRMSchedulerHA = true;
        maxRMHARetry = sessionConfig.getRpcMaxHaRetry();
    }

    if (!enableRMSchedulerHA)
    {
        appMasterProtos.push_back(
            std::shared_ptr<ApplicationMasterProtocol>(
                new ApplicationMasterProtocol(schedHost, schedPort, tokenService, sessionConfig, rpcAuth)));
    }
    else {
        /*
         * iterate RMInfo vector and create 1-1 applicationMasterProtocol for each standby RM scheduler.
         */
        for (size_t i = 0; i < rmInfos.size(); ++i) {
            appMasterProtos.push_back(
                std::shared_ptr<ApplicationMasterProtocol>(
                    new ApplicationMasterProtocol(rmInfos[i].getHost(),
                        rmInfos[i].getPort(), tokenService, sessionConfig, rpcAuth)));
            LOG(INFO, "ApplicationMaster finds a standby RM scheduler, host:%s, port:%s",
                      rmInfos[i].getHost().c_str(), rmInfos[i].getPort().c_str());
        }
    }
    currentAppMasterProto = 0;
}
ApplicationClient::ApplicationClient(string &user, string &host, string &port) {
    std::string tokenService = "";
    Yarn::Internal::shared_ptr<Yarn::Config> conf = DefaultConfig().getConfig();
    Yarn::Internal::SessionConfig sessionConfig(*conf);
    LOG(INFO, "ApplicationClient session auth method : %s", sessionConfig.getRpcAuthMethod().c_str());

    std::vector<RMInfo> rmInfos = RMInfo::getHARMInfo(*conf, YARN_RESOURCEMANAGER_HA);

    if (rmInfos.size() <= 1) {
        LOG(INFO, "ApplicationClient Resource Manager HA is disable.");
        enableRMHA = false;
        maxRMHARetry = 0;
    } else {
        LOG(INFO, "ApplicationClient Resource Manager HA is enable. Number of RM: %d", rmInfos.size());
        enableRMHA = true;
        maxRMHARetry = sessionConfig.getRpcMaxHaRetry();
    }

    if (!enableRMHA)
    {
        appClientProtos.push_back(
            std::shared_ptr<ApplicationClientProtocol>(
                new ApplicationClientProtocol(user, host, port, tokenService, sessionConfig)));
    } else {
        /*
        * iterate RMInfo vector and create 1-1 applicationClientProtocol for each standby RM
        */
        for (size_t i = 0; i < rmInfos.size(); ++i) {
            appClientProtos.push_back(
                std::shared_ptr<ApplicationClientProtocol>(
                    new ApplicationClientProtocol(
                        user, rmInfos[i].getHost(),rmInfos[i].getPort(), tokenService, sessionConfig)));
            LOG(INFO, "ApplicationClient finds a standby RM, host:%s, port:%s",
                      rmInfos[i].getHost().c_str(), rmInfos[i].getPort().c_str());
        }
    }
    currentAppClientProto = 0;
}
Ejemplo n.º 5
0
enum_t
BootLoaderConfig(
    BootLoader_t *pLoader
    )
{
    enum_t rc = (enum_t)BOOT_STATE_FAILURE;
    BOOL* pUpdateMode;
    
    // Get saved or default configuration
    if (!ReadConfigFromDisk(pLoader)) DefaultConfig(pLoader);

    // If we boot in ULDR mode, don't show menu
    pUpdateMode = BootArgsQuery(pLoader, OAL_ARGS_QUERY_UPDATEMODE);
    if ((pUpdateMode != NULL) && (*pUpdateMode != 0))
        {
        rc = BOOT_STATE_LOAD_ULDR;
        }
    else
        {
        // Run menu
        TerminalMenu(pLoader);

        switch (pLoader->bootDevice.type)
            {
            case DeviceTypeEdbg:
                rc = BOOT_STATE_DOWNLOAD;
                break;
            case DeviceTypeStore:
                rc = BOOT_STATE_PRELOAD;
                break;
            }            
        }
    
    // Done
    return rc;
}
Ejemplo n.º 6
0
ApplicationClient::ApplicationClient(string &user, string &host, string &port) {
    std::vector<RMInfo> rmConfInfos, rmInfos;
    RMInfo activeRM;
    std::string tokenService = "";

    Yarn::Internal::shared_ptr<Yarn::Config> conf = DefaultConfig().getConfig();
    Yarn::Internal::SessionConfig sessionConfig(*conf);
    LOG(INFO, "ApplicationClient session auth method : %s",
            sessionConfig.getRpcAuthMethod().c_str());

    activeRM.setHost(host);
    activeRM.setPort(port);
    rmInfos.push_back(activeRM);
    rmConfInfos = RMInfo::getHARMInfo(*conf, YARN_RESOURCEMANAGER_HA);

    /* build a list of candidate RMs without duplicate */
    for (vector<RMInfo>::iterator it = rmConfInfos.begin();
            it != rmConfInfos.end(); it++) {
        bool found = false;
        for (vector<RMInfo>::iterator it2 = rmInfos.begin();
                it2 != rmInfos.end(); it2++) {
            if (it2->getHost() == it->getHost()
                    && it2->getPort() == it->getPort()) {
                found = true;
                break;
            }
        }
        if (!found)
            rmInfos.push_back(*it);
    }

    if (rmInfos.size() <= 1) {
        LOG(INFO, "ApplicationClient Resource Manager HA is disable.");
        enableRMHA = false;
        maxRMHARetry = 0;
    } else {
        LOG(INFO,
                "ApplicationClient Resource Manager HA is enable. Number of RM: %d",
                rmInfos.size());
        enableRMHA = true;
        maxRMHARetry = sessionConfig.getRpcMaxHaRetry();
    }

    if (!enableRMHA)
    {
        appClientProtos.push_back(
            std::shared_ptr<ApplicationClientProtocol>(
                new ApplicationClientProtocol(user, host, port, tokenService, sessionConfig)));
    } else {
        /*
        * iterate RMInfo vector and create 1-1 applicationClientProtocol for each standby RM
        */
        for (size_t i = 0; i < rmInfos.size(); ++i) {
            appClientProtos.push_back(
                std::shared_ptr<ApplicationClientProtocol>(
                    new ApplicationClientProtocol(
                        user, rmInfos[i].getHost(),rmInfos[i].getPort(), tokenService, sessionConfig)));
            LOG(INFO, "ApplicationClient finds a candidate RM, host:%s, port:%s",
                      rmInfos[i].getHost().c_str(), rmInfos[i].getPort().c_str());
        }
    }
    currentAppClientProto = 0;
}