Search in sources :

Example 11 with HyracksException

use of org.apache.hyracks.api.exceptions.HyracksException in project asterixdb by apache.

the class TestStorageManagerComponentHolder method getLocalResourceRepository.

public static synchronized ILocalResourceRepository getLocalResourceRepository() {
    if (localResourceRepository == null) {
        try {
            ILocalResourceRepositoryFactory localResourceRepositoryFactory = new TransientLocalResourceRepositoryFactory();
            localResourceRepository = localResourceRepositoryFactory.createRepository();
        } catch (HyracksException e) {
            //In order not to change the IStorageManagerInterface due to the test code, throw runtime exception.
            throw new IllegalArgumentException();
        }
    }
    return localResourceRepository;
}
Also used : ILocalResourceRepositoryFactory(org.apache.hyracks.storage.common.file.ILocalResourceRepositoryFactory) TransientLocalResourceRepositoryFactory(org.apache.hyracks.storage.common.file.TransientLocalResourceRepositoryFactory) HyracksException(org.apache.hyracks.api.exceptions.HyracksException)

Example 12 with HyracksException

use of org.apache.hyracks.api.exceptions.HyracksException in project asterixdb by apache.

the class TestStorageManagerComponentHolder method getResourceIdFactory.

public static synchronized ResourceIdFactory getResourceIdFactory() {
    if (resourceIdFactory == null) {
        try {
            ResourceIdFactoryProvider resourceIdFactoryFactory = new ResourceIdFactoryProvider(getLocalResourceRepository());
            resourceIdFactory = resourceIdFactoryFactory.createResourceIdFactory();
        } catch (HyracksException e) {
            //In order not to change the IStorageManagerInterface due to the test code, throw runtime exception.
            throw new IllegalArgumentException();
        }
    }
    return resourceIdFactory;
}
Also used : ResourceIdFactoryProvider(org.apache.hyracks.storage.common.file.ResourceIdFactoryProvider) HyracksException(org.apache.hyracks.api.exceptions.HyracksException)

Example 13 with HyracksException

use of org.apache.hyracks.api.exceptions.HyracksException in project asterixdb by apache.

the class NodeManagerTest method testException.

@Test
public void testException() throws HyracksException {
    IResourceManager resourceManager = new ResourceManager();
    INodeManager nodeManager = new NodeManager(makeCCConfig(), resourceManager);
    NodeControllerState ncState1 = mockNodeControllerState(NODE1, true);
    boolean invalidNetworkAddress = false;
    // Verifies states after a failure during adding nodes.
    try {
        nodeManager.addNode(NODE1, ncState1);
    } catch (HyracksException e) {
        invalidNetworkAddress = e.getErrorCode() == ErrorCode.INVALID_NETWORK_ADDRESS;
    }
    Assert.assertTrue(invalidNetworkAddress);
    // Verifies that the cluster is empty.
    verifyEmptyCluster(resourceManager, nodeManager);
}
Also used : IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) ResourceManager(org.apache.hyracks.control.cc.scheduler.ResourceManager) IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) NodeControllerState(org.apache.hyracks.control.cc.NodeControllerState) Test(org.junit.Test)

Example 14 with HyracksException

use of org.apache.hyracks.api.exceptions.HyracksException in project asterixdb by apache.

the class NodeManagerTest method testNullNode.

@Test
public void testNullNode() throws HyracksException {
    IResourceManager resourceManager = new ResourceManager();
    INodeManager nodeManager = new NodeManager(makeCCConfig(), resourceManager);
    boolean invalidParameter = false;
    // Verifies states after a failure during adding nodes.
    try {
        nodeManager.addNode(null, null);
    } catch (HyracksException e) {
        invalidParameter = e.getErrorCode() == ErrorCode.INVALID_INPUT_PARAMETER;
    }
    Assert.assertTrue(invalidParameter);
    // Verifies that the cluster is empty.
    verifyEmptyCluster(resourceManager, nodeManager);
}
Also used : IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) ResourceManager(org.apache.hyracks.control.cc.scheduler.ResourceManager) IResourceManager(org.apache.hyracks.control.cc.scheduler.IResourceManager) Test(org.junit.Test)

Example 15 with HyracksException

use of org.apache.hyracks.api.exceptions.HyracksException in project asterixdb by apache.

the class JobCleanupWork method run.

@Override
public void run() {
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("Cleanup for JobRun with id: " + jobId);
    }
    try {
        JobRun jobRun = jobManager.get(jobId);
        jobManager.prepareComplete(jobRun, status, exceptions);
    } catch (HyracksException e) {
        // Fail the job with the caught exception during final completion.
        JobRun run = jobManager.get(jobId);
        run.getExceptions().add(e);
        run.setStatus(JobStatus.FAILURE, run.getExceptions());
    }
}
Also used : HyracksException(org.apache.hyracks.api.exceptions.HyracksException) JobRun(org.apache.hyracks.control.cc.job.JobRun)

Aggregations

HyracksException (org.apache.hyracks.api.exceptions.HyracksException)48 IOException (java.io.IOException)10 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)8 JobId (org.apache.hyracks.api.job.JobId)8 HashMap (java.util.HashMap)7 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 Map (java.util.Map)5 IJobCapacityController (org.apache.hyracks.api.job.resource.IJobCapacityController)5 INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)5 JobRun (org.apache.hyracks.control.cc.job.JobRun)5 URL (java.net.URL)4 AlgebricksException (org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)4 NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)4 File (java.io.File)3 HashSet (java.util.HashSet)3 NodeControllerInfo (org.apache.hyracks.api.client.NodeControllerInfo)3 JobSpecification (org.apache.hyracks.api.job.JobSpecification)3 PrintWriter (java.io.PrintWriter)2 StringWriter (java.io.StringWriter)2