Search in sources :

Example 1 with TezReflectionException

use of org.apache.tez.dag.api.TezReflectionException in project tez by apache.

the class ReflectionUtils method getNewInstance.

private static <T> T getNewInstance(Class<T> clazz, Class<?>[] parameterTypes, Object[] parameters) throws TezReflectionException {
    T instance;
    try {
        Constructor<T> constructor = clazz.getConstructor(parameterTypes);
        instance = constructor.newInstance(parameters);
    } catch (Exception e) {
        throw new TezReflectionException("Unable to instantiate class with " + parameters.length + " arguments: " + clazz.getName(), e);
    }
    return instance;
}
Also used : TezReflectionException(org.apache.tez.dag.api.TezReflectionException) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) TezReflectionException(org.apache.tez.dag.api.TezReflectionException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 2 with TezReflectionException

use of org.apache.tez.dag.api.TezReflectionException in project tez by apache.

the class ATSV15HistoryLoggingService method serviceInit.

@Override
public void serviceInit(Configuration serviceConf) throws Exception {
    Configuration conf = new Configuration(serviceConf);
    String summaryEntityTypesStr = EntityTypes.TEZ_APPLICATION + "," + EntityTypes.TEZ_APPLICATION_ATTEMPT + "," + EntityTypes.TEZ_DAG_ID;
    // Ensure that summary entity types are defined properly for Tez.
    if (conf.getBoolean(TezConfiguration.TEZ_AM_ATS_V15_OVERRIDE_SUMMARY_TYPES, TezConfiguration.TEZ_AM_ATS_V15_OVERRIDE_SUMMARY_TYPES_DEFAULT)) {
        conf.set(YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SUMMARY_ENTITY_TYPES, summaryEntityTypesStr);
    }
    historyLoggingEnabled = conf.getBoolean(TezConfiguration.TEZ_AM_HISTORY_LOGGING_ENABLED, TezConfiguration.TEZ_AM_HISTORY_LOGGING_ENABLED_DEFAULT);
    if (!historyLoggingEnabled) {
        LOG.info("ATSService: History Logging disabled. " + TezConfiguration.TEZ_AM_HISTORY_LOGGING_ENABLED + " set to false");
        return;
    }
    if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED)) {
        timelineClient = TimelineClient.createTimelineClient();
        timelineClient.init(conf);
    } else {
        this.timelineClient = null;
        if (conf.get(TezConfiguration.TEZ_HISTORY_LOGGING_SERVICE_CLASS, "").equals(atsHistoryLoggingServiceClassName)) {
            LOG.warn(atsHistoryLoggingServiceClassName + " is disabled due to Timeline Service being disabled, " + YarnConfiguration.TIMELINE_SERVICE_ENABLED + " set to false");
        }
    }
    maxTimeToWaitOnShutdown = conf.getLong(TezConfiguration.YARN_ATS_EVENT_FLUSH_TIMEOUT_MILLIS, TezConfiguration.YARN_ATS_EVENT_FLUSH_TIMEOUT_MILLIS_DEFAULT);
    maxPollingTimeMillis = conf.getInt(TezConfiguration.YARN_ATS_MAX_POLLING_TIME_PER_EVENT, TezConfiguration.YARN_ATS_MAX_POLLING_TIME_PER_EVENT_DEFAULT);
    if (maxTimeToWaitOnShutdown < 0) {
        waitForeverOnShutdown = true;
    }
    LOG.info("Initializing " + ATSV15HistoryLoggingService.class.getSimpleName() + " with " + ", maxPollingTime(ms)=" + maxPollingTimeMillis + ", waitTimeForShutdown(ms)=" + maxTimeToWaitOnShutdown + ", TimelineACLManagerClass=" + atsHistoryACLManagerClassName);
    try {
        historyACLPolicyManager = ReflectionUtils.createClazzInstance(atsHistoryACLManagerClassName);
        historyACLPolicyManager.setConf(conf);
    } catch (TezReflectionException e) {
        LOG.warn("Could not instantiate object for " + atsHistoryACLManagerClassName + ". ACLs cannot be enforced correctly for history data in Timeline", e);
        if (!conf.getBoolean(TezConfiguration.TEZ_AM_ALLOW_DISABLED_TIMELINE_DOMAINS, TezConfiguration.TEZ_AM_ALLOW_DISABLED_TIMELINE_DOMAINS_DEFAULT)) {
            throw e;
        }
        historyACLPolicyManager = null;
    }
    numDagsPerGroup = conf.getInt(TezConfiguration.TEZ_HISTORY_LOGGING_TIMELINE_NUM_DAGS_PER_GROUP, TezConfiguration.TEZ_HISTORY_LOGGING_TIMELINE_NUM_DAGS_PER_GROUP_DEFAULT);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) TezReflectionException(org.apache.tez.dag.api.TezReflectionException)

Example 3 with TezReflectionException

use of org.apache.tez.dag.api.TezReflectionException in project tez by apache.

the class TestTaskExecution2 method testFailedTask2.

// Test task failed due to Processor class not found
@Test(timeout = 5000)
public void testFailedTask2() throws IOException, InterruptedException, TezException, ExecutionException {
    ListeningExecutorService executor = null;
    try {
        ExecutorService rawExecutor = Executors.newFixedThreadPool(1);
        executor = MoreExecutors.listeningDecorator(rawExecutor);
        ApplicationId appId = ApplicationId.newInstance(10000, 1);
        TaskExecutionTestHelpers.TezTaskUmbilicalForTest umbilical = new TaskExecutionTestHelpers.TezTaskUmbilicalForTest();
        TaskReporter taskReporter = createTaskReporter(appId, umbilical);
        TezTaskRunner2 taskRunner = createTaskRunner(appId, umbilical, taskReporter, executor, "NotExitedProcessor", TestProcessor.CONF_EMPTY, false, true);
        // Setup the executor
        Future<TaskRunner2Result> taskRunnerFuture = taskExecutor.submit(new TaskRunnerCallable2ForTest(taskRunner));
        TaskRunner2Result result = taskRunnerFuture.get();
        verifyTaskRunnerResult(result, EndReason.TASK_ERROR, new TezReflectionException("TezReflectionException"), false, TaskFailureType.NON_FATAL);
        assertNull(taskReporter.currentCallable);
        umbilical.verifyTaskFailedEvent(FAILURE_START_STRING, ":org.apache.tez.dag.api.TezReflectionException: " + "Unable to load class: NotExitedProcessor");
        // Failure detected as a result of fall off from the run method. abort isn't required.
        assertFalse(TestProcessor.wasAborted());
        assertTrue(taskRunner.task.getCounters().countCounters() != 0);
    } finally {
        executor.shutdownNow();
    }
}
Also used : TezReflectionException(org.apache.tez.dag.api.TezReflectionException) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) ExecutorService(java.util.concurrent.ExecutorService) TaskExecutionTestHelpers(org.apache.tez.runtime.task.TaskExecutionTestHelpers) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) Test(org.junit.Test)

Example 4 with TezReflectionException

use of org.apache.tez.dag.api.TezReflectionException in project tez by apache.

the class CartesianProductVertexManagerPartitioned method initialize.

@Override
public void initialize(CartesianProductConfigProto config) throws TezReflectionException {
    this.sourceVertices = config.getSourcesList();
    this.numPartitions = Ints.toArray(config.getNumPartitionsList());
    this.minFraction = config.hasMinFraction() ? config.getMinFraction() : CartesianProductVertexManager.TEZ_CARTESIAN_PRODUCT_SLOW_START_MIN_FRACTION_DEFAULT;
    this.maxFraction = config.hasMaxFraction() ? config.getMaxFraction() : CartesianProductVertexManager.TEZ_CARTESIAN_PRODUCT_SLOW_START_MAX_FRACTION_DEFAULT;
    if (config.hasFilterClassName()) {
        UserPayload userPayload = config.hasFilterUserPayload() ? UserPayload.create(ByteBuffer.wrap(config.getFilterUserPayload().toByteArray())) : null;
        try {
            filter = ReflectionUtils.createClazzInstance(config.getFilterClassName(), new Class[] { UserPayload.class }, new UserPayload[] { userPayload });
        } catch (TezReflectionException e) {
            LOG.error("Creating filter failed");
            throw e;
        }
    }
    for (String sourceVertex : sourceVertices) {
        sourceTaskCompleted.put(sourceVertex, new BitSet());
    }
    for (String vertex : getContext().getInputVertexEdgeProperties().keySet()) {
        if (sourceVertices.indexOf(vertex) != -1) {
            getContext().registerForVertexStateUpdates(vertex, EnumSet.of(VertexState.CONFIGURED));
            numCPSrcNotInConfiguredState++;
        } else {
            getContext().registerForVertexStateUpdates(vertex, EnumSet.of(VertexState.RUNNING));
            numBroadcastSrcNotInRunningState++;
        }
    }
    getContext().vertexReconfigurationPlanned();
}
Also used : UserPayload(org.apache.tez.dag.api.UserPayload) TezReflectionException(org.apache.tez.dag.api.TezReflectionException) BitSet(java.util.BitSet)

Example 5 with TezReflectionException

use of org.apache.tez.dag.api.TezReflectionException in project tez by apache.

the class CartesianProductEdgeManagerPartitioned method initialize.

@Override
public void initialize(CartesianProductConfigProto config) throws Exception {
    this.numPartitions = Ints.toArray(config.getNumPartitionsList());
    this.sources = config.getSourcesList();
    this.positionId = sources.indexOf(getContext().getSourceVertexName());
    if (config.hasFilterClassName()) {
        UserPayload userPayload = config.hasFilterUserPayload() ? UserPayload.create(ByteBuffer.wrap(config.getFilterUserPayload().toByteArray())) : null;
        try {
            filter = ReflectionUtils.createClazzInstance(config.getFilterClassName(), new Class[] { UserPayload.class }, new UserPayload[] { userPayload });
        } catch (TezReflectionException e) {
            throw e;
        }
    }
    generateTaskIdMapping();
}
Also used : UserPayload(org.apache.tez.dag.api.UserPayload) CartesianProductUserPayload(org.apache.tez.runtime.library.cartesianproduct.CartesianProductUserPayload) TezReflectionException(org.apache.tez.dag.api.TezReflectionException)

Aggregations

TezReflectionException (org.apache.tez.dag.api.TezReflectionException)5 UserPayload (org.apache.tez.dag.api.UserPayload)2 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 BitSet (java.util.BitSet)1 ExecutorService (java.util.concurrent.ExecutorService)1 Configuration (org.apache.hadoop.conf.Configuration)1 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)1 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)1 CartesianProductUserPayload (org.apache.tez.runtime.library.cartesianproduct.CartesianProductUserPayload)1 TaskExecutionTestHelpers (org.apache.tez.runtime.task.TaskExecutionTestHelpers)1 Test (org.junit.Test)1