Example usage for org.apache.hadoop.yarn.util Clock getTime

List of usage examples for org.apache.hadoop.yarn.util Clock getTime

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.util Clock getTime.

Prototype

long getTime();

Source Link

Usage

From source file:com.datatorrent.stram.StreamingContainerManager.java

License:Apache License

public StreamingContainerManager(LogicalPlan dag, boolean enableEventRecording, Clock clock) {
    this.clock = clock;
    this.vars = new FinalVars(dag, clock.getTime());
    // setup prior to plan creation for event recording
    if (enableEventRecording) {
        this.eventBus = new MBassador<StramEvent>(BusConfiguration.Default(1, 1, 1));
    }/*from   www.  j  ava  2 s  . com*/
    this.plan = new PhysicalPlan(dag, this);
    setupWsClient();
    setupRecording(enableEventRecording);
    setupStringCodecs();
    this.journal = new Journal(this);
    try {
        saveMetaInfo();
    } catch (IOException ex) {
        LOG.error("Error saving meta info to DFS", ex);
    }

    try {
        this.containerFile = new FSJsonLineFile(new Path(this.vars.appPath + "/containers"),
                new FsPermission((short) 0644));
        this.containerFile.append(getAppMasterContainerInfo());
    } catch (IOException ex) {
        LOG.warn("Caught exception when instantiating for container info file. Ignoring", ex);
    }
}

From source file:org.apache.tez.dag.app.DAGAppMaster.java

License:Apache License

public DAGAppMaster(ApplicationAttemptId applicationAttemptId, ContainerId containerId, String nmHost,
        int nmPort, int nmHttpPort, Clock clock, long appSubmitTime, boolean isSession, String workingDirectory,
        String[] localDirs, String[] logDirs, String clientVersion, int maxAppAttempts, Credentials credentials,
        String jobUserName) {/*from  w  w  w.ja  va  2s .  c  o  m*/
    super(DAGAppMaster.class.getName());
    this.clock = clock;
    this.startTime = clock.getTime();
    this.appSubmitTime = appSubmitTime;
    this.appAttemptID = applicationAttemptId;
    this.containerID = containerId;
    this.nmHost = nmHost;
    this.nmPort = nmPort;
    this.nmHttpPort = nmHttpPort;
    this.state = DAGAppMasterState.NEW;
    this.isSession = isSession;
    this.workingDirectory = workingDirectory;
    this.localDirs = localDirs;
    this.logDirs = logDirs;
    this.shutdownHandler = new DAGAppMasterShutdownHandler();
    this.dagVersionInfo = new TezDagVersionInfo();
    this.clientVersion = clientVersion;
    this.maxAppAttempts = maxAppAttempts;
    this.amCredentials = credentials;
    this.appMasterUgi = UserGroupInformation.createRemoteUser(jobUserName);
    this.appMasterUgi.addCredentials(amCredentials);

    // TODO Metrics
    //this.metrics = DAGAppMetrics.create();
    LOG.info("Created DAGAppMaster for application " + applicationAttemptId + ", versionInfo="
            + dagVersionInfo.toString());
}

From source file:org.apache.tez.dag.app.rm.container.AMContainerImpl.java

License:Apache License

private void logStopped(int exitStatus) {
    final Clock clock = appContext.getClock();
    final HistoryEventHandler historyHandler = appContext.getHistoryHandler();
    ContainerStoppedEvent lEvt = new ContainerStoppedEvent(containerId, clock.getTime(), exitStatus,
            appContext.getApplicationAttemptId());
    historyHandler.handle(new DAGHistoryEvent(appContext.getCurrentDAGID(), lEvt));
}