MLeap 序列化
In order to serialize to a zip file, make sure the URI begins with and ends with a .zip
.
For example jar:file:/tmp/mleap-bundle.zip
.
pipeline.writeBundle.format(SerializationFormat.Json).save(bundle)
}
Protobuf 格式
为了序列化为目录,需要确保 URL 以 file
开头。
}
Protobuf 格式
反序列化和序列化一样简单,你无需事先知道 MLeap Bundle 的序列化格式,唯一需要了解的,是这个包的路径。
// Deserialize a zip bundle
// Use Scala ARM to make sure resources are managed properly
val zipBundle = (for(bundle <- managed(BundleFile("jar:file:/tmp/mleap-examples/simple-json.zip"))) yield {
bundle.loadMleapBundle().get