use of com.alibaba.alink.common.io.filesystem.AkUtils.AkMeta in project Alink by alibaba.
the class ModelStreamUtils method getSchemaFromFolder.
public static TableSchema getSchemaFromFolder(FilePath filePath) throws IOException {
List<Timestamp> models = listModels(filePath);
if (models.isEmpty()) {
throw new IllegalArgumentException("Stream model is empty. path: " + filePath.getPath().toString());
}
Timestamp timestamp = models.get(0);
AkMeta meta = AkUtils.getMetaFromPath(new FilePath(new Path(filePath.getPath(), toStringPresentation(timestamp)), filePath.getFileSystem()));
return CsvUtil.schemaStr2Schema(meta.schemaStr);
}
use of com.alibaba.alink.common.io.filesystem.AkUtils.AkMeta in project Alink by alibaba.
the class FileModelStreamSink method open.
public void open(Timestamp modelId, int subId) throws IOException {
BaseFileSystem<?> fileSystem = filePath.getFileSystem();
Path confDirPath = new Path(filePath.getPath(), MODEL_CONF);
Path fileInProgress = new Path(confDirPath, String.format("%s_%d", ModelStreamUtils.toStringPresentation(modelId), subId));
collector = new AkStream(new FilePath(fileInProgress, fileSystem), new AkMeta(schemaStr)).getWriter().getCollector();
}