use of edu.snu.mist.formats.avro.AvroPhysicalOperatorChain in project mist by snuspl.
the class AvroExecutionVertexStore method loadAvroPhysicalOperatorChain.
/**
* Loads the AvroPhysicalOperatorChain with the chainId.
*/
public AvroPhysicalOperatorChain loadAvroPhysicalOperatorChain(final String chainId) throws IOException {
try {
final File storedChain = getAvroPhysicalOperatorChainFile(chainId);
final DataFileReader<AvroPhysicalOperatorChain> dataFileReader = new DataFileReader<>(storedChain, operatorChainDatumReader);
AvroPhysicalOperatorChain avroPhysicalOperatorChain = null;
avroPhysicalOperatorChain = dataFileReader.next(avroPhysicalOperatorChain);
return avroPhysicalOperatorChain;
} catch (final IOException e) {
LOG.log(Level.SEVERE, "An exception occurred while loading the AvroPhysicalOperatorChain with ID {0}.", new Object[] { chainId });
throw e;
}
}
use of edu.snu.mist.formats.avro.AvroPhysicalOperatorChain in project mist by snuspl.
the class AvroExecutionVertexStore method saveAvroPhysicalOperatorChain.
/**
* Saves the AvroPhysicalOperatorChain as operatorChainId.chain to disk.
*/
public void saveAvroPhysicalOperatorChain(final Tuple<String, AvroPhysicalOperatorChain> tuple) {
try {
final AvroPhysicalOperatorChain avroPhysicalOperatorChain = tuple.getValue();
// Create file with the name of the PhysicalOperatorChain Id.
final File avroPhysicalOperatorChainFile = getAvroPhysicalOperatorChainFile(tuple.getKey());
final DataFileWriter<AvroPhysicalOperatorChain> dataFileWriter = new DataFileWriter<>(operatorChainDatumWriter);
dataFileWriter.create(avroPhysicalOperatorChain.getSchema(), avroPhysicalOperatorChainFile);
dataFileWriter.append(avroPhysicalOperatorChain);
dataFileWriter.close();
} catch (IOException e) {
throw new RuntimeException("Writing AvroPhysicalOperatorChain has failed.");
}
}
Aggregations