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);
}
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
}
Aggregations