@scrypted/server 0.123.33 → 0.123.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cluster/cluster-labels.d.ts +5 -0
- package/dist/cluster/cluster-labels.js +15 -5
- package/dist/cluster/cluster-labels.js.map +1 -1
- package/dist/cluster/cluster-setup.js +12 -5
- package/dist/cluster/cluster-setup.js.map +1 -1
- package/dist/plugin/plugin-host.d.ts +1 -0
- package/dist/plugin/plugin-host.js +8 -2
- package/dist/plugin/plugin-host.js.map +1 -1
- package/dist/plugin/plugin-remote-worker.js +2 -2
- package/dist/plugin/plugin-remote-worker.js.map +1 -1
- package/dist/plugin/runtime/cluster-fork-worker.js +1 -1
- package/dist/plugin/runtime/cluster-fork-worker.js.map +1 -1
- package/dist/scrypted-cluster-main.d.ts +13 -3
- package/dist/scrypted-cluster-main.js +97 -77
- package/dist/scrypted-cluster-main.js.map +1 -1
- package/dist/scrypted-server-main.js +19 -8
- package/dist/scrypted-server-main.js.map +1 -1
- package/dist/services/cluster-fork.d.ts +3 -3
- package/dist/services/cluster-fork.js +54 -14
- package/dist/services/cluster-fork.js.map +1 -1
- package/package.json +1 -1
- package/python/cluster_labels.py +4 -1
- package/python/cluster_setup.py +16 -7
- package/python/plugin_console.py +1 -0
- package/python/plugin_pip.py +14 -8
- package/python/plugin_remote.py +120 -38
- package/python/plugin_repl.py +42 -15
- package/python/plugin_volume.py +17 -11
- package/python/rpc-iterator-test.py +11 -8
- package/python/rpc.py +242 -154
- package/python/rpc_reader.py +35 -28
- package/src/cluster/cluster-labels.ts +16 -5
- package/src/cluster/cluster-setup.ts +12 -5
- package/src/plugin/plugin-host.ts +11 -3
- package/src/plugin/plugin-remote-worker.ts +4 -5
- package/src/plugin/runtime/cluster-fork-worker.ts +1 -1
- package/src/scrypted-cluster-main.ts +123 -91
- package/src/scrypted-server-main.ts +24 -11
- package/src/services/cluster-fork.ts +64 -18
    
        package/python/plugin_volume.py
    CHANGED
    
    | @@ -1,20 +1,24 @@ | |
| 1 1 | 
             
            import os
         | 
| 2 2 | 
             
            from pathlib import Path
         | 
| 3 3 |  | 
| 4 | 
            +
             | 
| 4 5 | 
             
            def get_scrypted_volume():
         | 
| 5 | 
            -
                volume_dir = os.getenv( | 
| 6 | 
            +
                volume_dir = os.getenv("SCRYPTED_VOLUME") or Path.home() / ".scrypted" / "volume"
         | 
| 6 7 | 
             
                return str(volume_dir)
         | 
| 7 8 |  | 
| 9 | 
            +
             | 
| 8 10 | 
             
            def get_plugins_volume():
         | 
| 9 11 | 
             
                volume = get_scrypted_volume()
         | 
| 10 | 
            -
                plugins_volume = Path(volume) /  | 
| 12 | 
            +
                plugins_volume = Path(volume) / "plugins"
         | 
| 11 13 | 
             
                return str(plugins_volume)
         | 
| 12 14 |  | 
| 15 | 
            +
             | 
| 13 16 | 
             
            def get_plugin_volume(plugin_id):
         | 
| 14 17 | 
             
                volume = get_plugins_volume()
         | 
| 15 18 | 
             
                plugin_volume = Path(volume) / plugin_id
         | 
| 16 19 | 
             
                return str(plugin_volume)
         | 
| 17 20 |  | 
| 21 | 
            +
             | 
| 18 22 | 
             
            def ensure_plugin_volume(plugin_id):
         | 
| 19 23 | 
             
                plugin_volume = get_plugin_volume(plugin_id)
         | 
| 20 24 | 
             
                try:
         | 
| @@ -23,23 +27,25 @@ def ensure_plugin_volume(plugin_id): | |
| 23 27 | 
             
                    pass
         | 
| 24 28 | 
             
                return plugin_volume
         | 
| 25 29 |  | 
| 30 | 
            +
             | 
| 26 31 | 
             
            def create_adm_zip_hash(hash):
         | 
| 27 32 | 
             
                extract_version = "1-"
         | 
| 28 33 | 
             
                return extract_version + hash
         | 
| 29 34 |  | 
| 35 | 
            +
             | 
| 30 36 | 
             
            def prep(plugin_volume, hash):
         | 
| 31 37 | 
             
                hash = create_adm_zip_hash(hash)
         | 
| 32 38 |  | 
| 33 39 | 
             
                zip_filename = f"{hash}.zip"
         | 
| 34 | 
            -
                zip_dir = os.path.join(plugin_volume,  | 
| 40 | 
            +
                zip_dir = os.path.join(plugin_volume, "zip")
         | 
| 35 41 | 
             
                zip_file = os.path.join(zip_dir, zip_filename)
         | 
| 36 | 
            -
                unzipped_path = os.path.join(zip_dir,  | 
| 37 | 
            -
                zip_dir_tmp = zip_dir +  | 
| 42 | 
            +
                unzipped_path = os.path.join(zip_dir, "unzipped")
         | 
| 43 | 
            +
                zip_dir_tmp = zip_dir + ".tmp"
         | 
| 38 44 |  | 
| 39 45 | 
             
                return {
         | 
| 40 | 
            -
                     | 
| 41 | 
            -
                     | 
| 42 | 
            -
                     | 
| 43 | 
            -
                     | 
| 44 | 
            -
                     | 
| 45 | 
            -
                }
         | 
| 46 | 
            +
                    "unzipped_path": unzipped_path,
         | 
| 47 | 
            +
                    "zip_filename": zip_filename,
         | 
| 48 | 
            +
                    "zip_dir": zip_dir,
         | 
| 49 | 
            +
                    "zip_file": zip_file,
         | 
| 50 | 
            +
                    "zip_dir_tmp": zip_dir_tmp,
         | 
| 51 | 
            +
                }
         | 
| @@ -1,22 +1,24 @@ | |
| 1 1 | 
             
            import asyncio
         | 
| 2 2 | 
             
            import rpc
         | 
| 3 | 
            -
            from | 
| 3 | 
            +
            from rpc_reader import prepare_peer_readloop, RpcFileTransport
         | 
| 4 4 | 
             
            import traceback
         | 
| 5 5 |  | 
| 6 | 
            +
             | 
| 6 7 | 
             
            class Bar:
         | 
| 7 8 | 
             
                pass
         | 
| 8 9 |  | 
| 10 | 
            +
             | 
| 9 11 | 
             
            async def main():
         | 
| 10 12 | 
             
                peer, peerReadLoop = await prepare_peer_readloop(loop, RpcFileTransport(4, 3))
         | 
| 11 | 
            -
                peer.params[ | 
| 13 | 
            +
                peer.params["foo"] = 3
         | 
| 12 14 | 
             
                jsoncopy = {}
         | 
| 13 15 | 
             
                jsoncopy[rpc.RpcPeer.PROPERTY_JSON_COPY_SERIALIZE_CHILDREN] = True
         | 
| 14 | 
            -
                jsoncopy[ | 
| 15 | 
            -
                peer.params[ | 
| 16 | 
            +
                jsoncopy["bar"] = Bar()
         | 
| 17 | 
            +
                peer.params["bar"] = jsoncopy
         | 
| 16 18 |  | 
| 17 19 | 
             
                # reader, writer = await asyncio.open_connection(
         | 
| 18 20 | 
             
                #     '127.0.0.1', 6666)
         | 
| 19 | 
            -
             | 
| 21 | 
            +
             | 
| 20 22 | 
             
                # writer.write(bytes('abcd', 'utf8'))
         | 
| 21 23 |  | 
| 22 24 | 
             
                # async def ticker(delay, to):
         | 
| @@ -27,12 +29,12 @@ async def main(): | |
| 27 29 |  | 
| 28 30 | 
             
                # peer.params['ticker'] = ticker(0, 3)
         | 
| 29 31 |  | 
| 30 | 
            -
                print( | 
| 32 | 
            +
                print("python starting")
         | 
| 31 33 | 
             
                # await peerReadLoop()
         | 
| 32 34 | 
             
                asyncio.ensure_future(peerReadLoop())
         | 
| 33 35 |  | 
| 34 36 | 
             
                # print('getting param')
         | 
| 35 | 
            -
                test = await peer.getParam( | 
| 37 | 
            +
                test = await peer.getParam("test")
         | 
| 36 38 | 
             
                print(test)
         | 
| 37 39 | 
             
                try:
         | 
| 38 40 | 
             
                    i = 0
         | 
| @@ -43,7 +45,8 @@ async def main(): | |
| 43 45 | 
             
                        i = i + 1
         | 
| 44 46 | 
             
                except:
         | 
| 45 47 | 
             
                    traceback.print_exc()
         | 
| 46 | 
            -
                print( | 
| 48 | 
            +
                print("all done iterating")
         | 
| 49 | 
            +
             | 
| 47 50 |  | 
| 48 51 | 
             
            loop = asyncio.new_event_loop()
         | 
| 49 52 | 
             
            loop.run_until_complete(main())
         |