Search in sources :

Example 6 with HyracksException

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

the class ConfigManager method parseIni.

private void parseIni() throws IOException {
    Ini ini = null;
    for (IOption option : iniPointerOptions) {
        Object pointer = get(option);
        if (pointer instanceof String) {
            ini = ConfigUtils.loadINIFile((String) pointer);
        } else if (pointer instanceof URL) {
            ini = ConfigUtils.loadINIFile((URL) pointer);
        } else if (pointer != null) {
            throw new IllegalArgumentException("config file pointer options must be of type String (for file) or " + "URL, instead of " + option.type().targetType());
        }
    }
    if (ini == null) {
        LOGGER.info("no INI file specified; skipping parsing");
        return;
    }
    LOGGER.info("parsing INI file: " + ini);
    for (Profile.Section section : ini.values()) {
        allSections.add(section.getName());
        final Section rootSection = Section.parseSectionName(section.getParent() == null ? section.getName() : section.getParent().getName());
        String node;
        if (rootSection == Section.EXTENSION) {
            parseExtensionIniSection(section);
            continue;
        } else if (rootSection == Section.NC) {
            node = section.getName().equals(section.getSimpleName()) ? null : section.getSimpleName();
        } else if (Section.parseSectionName(section.getName()) != null) {
            node = null;
        } else {
            throw new HyracksException("Unknown section in ini: " + section.getName());
        }
        Map<String, IOption> optionMap = getSectionOptionMap(rootSection);
        for (Map.Entry<String, String> iniOption : section.entrySet()) {
            String name = iniOption.getKey();
            final IOption option = optionMap == null ? null : optionMap.get(name);
            if (option == null) {
                handleUnknownOption(section, name);
                return;
            }
            final String value = iniOption.getValue();
            LOGGER.fine("setting " + option.toIniString() + " to " + value);
            final Object parsed = option.type().parse(value);
            invokeSetters(option, parsed, node);
        }
    }
}
Also used : Ini(org.ini4j.Ini) IOption(org.apache.hyracks.api.config.IOption) HyracksException(org.apache.hyracks.api.exceptions.HyracksException) Section(org.apache.hyracks.api.config.Section) URL(java.net.URL) Profile(org.ini4j.Profile) HashMap(java.util.HashMap) ArrayListValuedHashMap(org.apache.commons.collections4.multimap.ArrayListValuedHashMap) Map(java.util.Map) EnumMap(java.util.EnumMap) TreeMap(java.util.TreeMap) CompositeMap(org.apache.commons.collections4.map.CompositeMap) SortedMap(java.util.SortedMap)

Example 7 with HyracksException

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

the class DeploymentUtils method deserialize.

/**
     * Deserialize bytes to an object according to a specific deployment
     *
     * @param bytes
     *            the bytes to be deserialized
     * @param deploymentId
     *            the deployment id
     * @param serviceCtx
     * @return the deserialized object
     * @throws HyracksException
     */
public static Object deserialize(byte[] bytes, DeploymentId deploymentId, IServiceContext serviceCtx) throws HyracksException {
    try {
        IJobSerializerDeserializerContainer jobSerDeContainer = serviceCtx.getJobSerializerDeserializerContainer();
        IJobSerializerDeserializer jobSerDe = deploymentId == null ? null : jobSerDeContainer.getJobSerializerDeserializer(deploymentId);
        return jobSerDe == null ? JavaSerializationUtils.deserialize(bytes) : jobSerDe.deserialize(bytes);
    } catch (Exception e) {
        throw new HyracksException(e);
    }
}
Also used : HyracksException(org.apache.hyracks.api.exceptions.HyracksException) IJobSerializerDeserializerContainer(org.apache.hyracks.api.job.IJobSerializerDeserializerContainer) IJobSerializerDeserializer(org.apache.hyracks.api.job.IJobSerializerDeserializer) IOException(java.io.IOException) HyracksException(org.apache.hyracks.api.exceptions.HyracksException)

Example 8 with HyracksException

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

the class DatasetPartitionManager method reportPartitionWriteCompletion.

@Override
public void reportPartitionWriteCompletion(JobId jobId, ResultSetId rsId, int partition) throws HyracksException {
    try {
        LOGGER.fine("Reporting partition write completion: JobId: " + jobId + ": ResultSetId: " + rsId + ":partition: " + partition);
        ncs.getClusterController().reportResultPartitionWriteCompletion(jobId, rsId, partition);
    } catch (Exception e) {
        throw new HyracksException(e);
    }
}
Also used : HyracksException(org.apache.hyracks.api.exceptions.HyracksException) HyracksException(org.apache.hyracks.api.exceptions.HyracksException)

Example 9 with HyracksException

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

the class DatasetPartitionManager method reportPartitionFailure.

@Override
public void reportPartitionFailure(JobId jobId, ResultSetId rsId, int partition) throws HyracksException {
    try {
        LOGGER.info("Reporting partition failure: JobId: " + jobId + " ResultSetId: " + rsId + " partition: " + partition);
        ncs.getClusterController().reportResultPartitionFailure(jobId, rsId, partition);
    } catch (Exception e) {
        throw new HyracksException(e);
    }
}
Also used : HyracksException(org.apache.hyracks.api.exceptions.HyracksException) HyracksException(org.apache.hyracks.api.exceptions.HyracksException)

Example 10 with HyracksException

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

the class DatasetPartitionWriter method registerResultPartitionLocation.

void registerResultPartitionLocation(boolean empty) throws HyracksDataException {
    try {
        if (!partitionRegistered) {
            manager.registerResultPartitionLocation(jobId, resultSetId, partition, nPartitions, orderedResult, empty);
            partitionRegistered = true;
        }
    } catch (HyracksException e) {
        if (e instanceof HyracksDataException) {
            throw (HyracksDataException) e;
        } else {
            throw new HyracksDataException(e);
        }
    }
}
Also used : HyracksException(org.apache.hyracks.api.exceptions.HyracksException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

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