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.

    1. pipeline.writeBundle.format(SerializationFormat.Json).save(bundle)
    2. }

    Protobuf 格式

    为了序列化为目录,需要确保 URL 以 file 开头。

    1. }

    Protobuf 格式

    反序列化和序列化一样简单,你无需事先知道 MLeap Bundle 的序列化格式,唯一需要了解的,是这个包的路径。

    1. // Deserialize a zip bundle
    2. // Use Scala ARM to make sure resources are managed properly
    3. val zipBundle = (for(bundle <- managed(BundleFile("jar:file:/tmp/mleap-examples/simple-json.zip"))) yield {
    4. bundle.loadMleapBundle().get

    反序列化目录 Bundle