Search in sources :

Example 71 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project tez by apache.

the class TezConverterUtils method getURIFromYarnURL.

/**
 * return a {@link URI} from a given url
 *
 * @param url
 *          url to convert
 * @return path from {@link URL}
 * @throws URISyntaxException
 */
@Private
public static URI getURIFromYarnURL(URL url) throws URISyntaxException {
    String scheme = url.getScheme() == null ? "" : url.getScheme();
    String authority = "";
    if (url.getHost() != null) {
        authority = url.getHost();
        if (url.getUserInfo() != null) {
            authority = url.getUserInfo() + "@" + authority;
        }
        if (url.getPort() > 0) {
            authority += ":" + url.getPort();
        }
    }
    return new URI(scheme, authority, url.getFile(), null, null).normalize();
}
Also used : URI(java.net.URI) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 72 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project tez by apache.

the class VertexImpl method constructFinalFullcounters.

@Private
public void constructFinalFullcounters() {
    this.fullCounters = new TezCounters();
    this.fullCounters.incrAllCounters(counters);
    this.vertexStats = new VertexStats();
    for (Task t : this.tasks.values()) {
        vertexStats.updateStats(t.getReport());
        TezCounters counters = t.getCounters();
        this.fullCounters.incrAllCounters(counters);
    }
}
Also used : TaskEventScheduleTask(org.apache.tez.dag.app.dag.event.TaskEventScheduleTask) Task(org.apache.tez.dag.app.dag.Task) TezCounters(org.apache.tez.common.counters.TezCounters) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 73 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project tez by apache.

the class DAGImpl method constructFinalFullcounters.

@Private
public void constructFinalFullcounters() {
    this.fullCounters = new TezCounters();
    this.fullCounters.incrAllCounters(dagCounters);
    for (Vertex v : this.vertices.values()) {
        this.fullCounters.incrAllCounters(v.getAllCounters());
    }
}
Also used : VertexEventRecoverVertex(org.apache.tez.dag.app.dag.event.VertexEventRecoverVertex) Vertex(org.apache.tez.dag.app.dag.Vertex) TezCounters(org.apache.tez.common.counters.TezCounters) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 74 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project tez by apache.

the class TezUtilsInternal method setSecurityUtilConfigration.

@Private
public static void setSecurityUtilConfigration(Logger log, Configuration conf) {
    // Use reflection to invoke SecurityUtil.setConfiguration when available, version 2.6.0 of
    // hadoop does not support it, it is currently available from 2.9.0.
    // Remove this when the minimum supported hadoop version has the above method.
    Class<SecurityUtil> clz = SecurityUtil.class;
    try {
        Method method = clz.getMethod("setConfiguration", Configuration.class);
        method.invoke(null, conf);
    } catch (NoSuchMethodException e) {
    // This is not available, so ignore it.
    } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        log.warn("Error invoking SecurityUtil.setConfiguration: ", e);
        throw new TezUncheckedException("Error invoking SecurityUtil.setConfiguration", e);
    }
}
Also used : TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) SecurityUtil(org.apache.hadoop.security.SecurityUtil) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 75 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project hive by apache.

the class TezTask method collectCommitInformation.

private void collectCommitInformation(TezWork work) throws IOException, TezException {
    for (BaseWork w : work.getAllWork()) {
        JobConf jobConf = workToConf.get(w);
        Vertex vertex = workToVertex.get(w);
        boolean hasIcebergCommitter = Optional.ofNullable(jobConf).map(JobConf::getOutputCommitter).map(Object::getClass).map(Class::getName).filter(name -> name.endsWith("HiveIcebergNoJobCommitter")).isPresent();
        // we should only consider jobs with Iceberg output committer and a data sink
        if (hasIcebergCommitter && !vertex.getDataSinks().isEmpty()) {
            VertexStatus status = dagClient.getVertexStatus(vertex.getName(), EnumSet.of(StatusGetOpts.GET_COUNTERS));
            String[] jobIdParts = status.getId().split("_");
            // status.getId() returns something like: vertex_1617722404520_0001_1_00
            // this should be transformed to a parsable JobID: job_16177224045200_0001
            int vertexId = Integer.parseInt(jobIdParts[jobIdParts.length - 1]);
            String jobId = String.format(JOB_ID_TEMPLATE, jobIdParts[1], vertexId, jobIdParts[2]);
            List<String> tables = new ArrayList<>();
            Map<String, String> icebergProperties = new HashMap<>();
            for (Map.Entry<String, String> entry : jobConf) {
                if (entry.getKey().startsWith(ICEBERG_SERIALIZED_TABLE_PREFIX)) {
                    // get all target tables this vertex wrote to
                    tables.add(entry.getKey().substring(ICEBERG_SERIALIZED_TABLE_PREFIX.length()));
                } else if (entry.getKey().startsWith(ICEBERG_PROPERTY_PREFIX)) {
                    // find iceberg props in jobConf as they can be needed, but not available, during job commit
                    icebergProperties.put(entry.getKey(), entry.getValue());
                }
            }
            // save information for each target table
            tables.forEach(table -> SessionStateUtil.addCommitInfo(jobConf, table, jobId, status.getProgress().getSucceededTaskCount(), icebergProperties));
        }
    }
}
Also used : Metrics(org.apache.hadoop.hive.common.metrics.common.Metrics) MetricsConstant(org.apache.hadoop.hive.common.metrics.common.MetricsConstant) DAGClient(org.apache.tez.dag.api.client.DAGClient) Arrays(java.util.Arrays) TezCounter(org.apache.tez.common.counters.TezCounter) VertexStatus(org.apache.tez.dag.api.client.VertexStatus) LoggerFactory(org.slf4j.LoggerFactory) CallerContext(org.apache.tez.client.CallerContext) FileSinkOperator(org.apache.hadoop.hive.ql.exec.FileSinkOperator) ReduceWork(org.apache.hadoop.hive.ql.plan.ReduceWork) DAGStatus(org.apache.tez.dag.api.client.DAGStatus) JSONObject(org.json.JSONObject) Map(java.util.Map) Configuration(org.apache.hadoop.conf.Configuration) ApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationReport) Path(org.apache.hadoop.fs.Path) Context(org.apache.hadoop.hive.ql.Context) BaseWork(org.apache.hadoop.hive.ql.plan.BaseWork) MergeJoinWork(org.apache.hadoop.hive.ql.plan.MergeJoinWork) CounterGroup(org.apache.tez.common.counters.CounterGroup) Vertex(org.apache.tez.dag.api.Vertex) EnumSet(java.util.EnumSet) PerfLogger(org.apache.hadoop.hive.ql.log.PerfLogger) EdgeType(org.apache.hadoop.hive.ql.plan.TezEdgeProperty.EdgeType) Edge(org.apache.tez.dag.api.Edge) Collection(java.util.Collection) HiveConfUtil(org.apache.hadoop.hive.conf.HiveConfUtil) Set(java.util.Set) TezJobMonitor(org.apache.hadoop.hive.ql.exec.tez.monitoring.TezJobMonitor) DAG(org.apache.tez.dag.api.DAG) SessionNotRunning(org.apache.tez.dag.api.SessionNotRunning) SessionState(org.apache.hadoop.hive.ql.session.SessionState) List(java.util.List) MetastoreConf(org.apache.hadoop.hive.metastore.conf.MetastoreConf) ServerUtils(org.apache.hadoop.hive.common.ServerUtils) MapWork(org.apache.hadoop.hive.ql.plan.MapWork) DAGAccessControls(org.apache.tez.common.security.DAGAccessControls) Optional(java.util.Optional) SessionStateUtil(org.apache.hadoop.hive.ql.session.SessionStateUtil) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) StatusGetOpts(org.apache.tez.dag.api.client.StatusGetOpts) HashMap(java.util.HashMap) MappingInput(org.apache.hadoop.hive.ql.exec.tez.UserPoolMapping.MappingInput) StageType(org.apache.hadoop.hive.ql.plan.api.StageType) ArrayList(java.util.ArrayList) Task(org.apache.hadoop.hive.ql.exec.Task) LinkedHashMap(java.util.LinkedHashMap) Utilities(org.apache.hadoop.hive.ql.exec.Utilities) VertexGroup(org.apache.tez.dag.api.VertexGroup) TezWork(org.apache.hadoop.hive.ql.plan.TezWork) StringUtils(org.apache.hadoop.util.StringUtils) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation) LinkedList(java.util.LinkedList) Nullable(javax.annotation.Nullable) Private(org.apache.hadoop.classification.InterfaceAudience.Private) Ref(org.apache.hive.common.util.Ref) Logger(org.slf4j.Logger) UnionWork(org.apache.hadoop.hive.ql.plan.UnionWork) HiveConf(org.apache.hadoop.hive.conf.HiveConf) IOException(java.io.IOException) OperatorDesc(org.apache.hadoop.hive.ql.plan.OperatorDesc) GroupInputEdge(org.apache.tez.dag.api.GroupInputEdge) TezException(org.apache.tez.dag.api.TezException) Operator(org.apache.hadoop.hive.ql.exec.Operator) TezEdgeProperty(org.apache.hadoop.hive.ql.plan.TezEdgeProperty) JobConf(org.apache.hadoop.mapred.JobConf) TezCounters(org.apache.tez.common.counters.TezCounters) TezClient(org.apache.tez.client.TezClient) WmContext(org.apache.hadoop.hive.ql.wm.WmContext) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Collections(java.util.Collections) LocalResource(org.apache.hadoop.yarn.api.records.LocalResource) TezRuntimeConfiguration(org.apache.tez.runtime.library.api.TezRuntimeConfiguration) Vertex(org.apache.tez.dag.api.Vertex) VertexStatus(org.apache.tez.dag.api.client.VertexStatus) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) BaseWork(org.apache.hadoop.hive.ql.plan.BaseWork) JobConf(org.apache.hadoop.mapred.JobConf) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

Private (org.apache.hadoop.classification.InterfaceAudience.Private)75 VisibleForTesting (com.google.common.annotations.VisibleForTesting)18 IOException (java.io.IOException)15 Path (org.apache.hadoop.fs.Path)13 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)12 ArrayList (java.util.ArrayList)9 FileStatus (org.apache.hadoop.fs.FileStatus)8 FileSystem (org.apache.hadoop.fs.FileSystem)6 Resource (org.apache.hadoop.yarn.api.records.Resource)6 DataInputStream (java.io.DataInputStream)5 EOFException (java.io.EOFException)5 PrintStream (java.io.PrintStream)5 Credentials (org.apache.hadoop.security.Credentials)5 LogReader (org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogReader)5 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)4 LocalResource (org.apache.hadoop.yarn.api.records.LocalResource)4 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)4 ByteString (com.google.protobuf.ByteString)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3