コード例 #1
0
def maybe_build(
    node: DeploymentNode, use_build: bool
) -> Union[Application, DeploymentNode]:
    if use_build:
        return Application.from_dict(build_app(node).to_dict())
    else:
        return node
コード例 #2
0
    async def put_all_deployments(self, req: Request) -> Response:
        from ray import serve
        from ray.serve.application import Application

        app = Application.from_dict(await req.json())
        serve.run(app, _blocking=False)

        return Response()
コード例 #3
0
ファイル: serve_head.py プロジェクト: afzalmushtaque/ray
    async def put_all_deployments(self, req: Request) -> Response:
        app = Application.from_dict(await req.json())
        app.deploy(blocking=False)

        new_names = set()
        for deployment in app:
            new_names.add(deployment.name)

        all_deployments = serve.list_deployments()
        all_names = set(all_deployments.keys())
        names_to_delete = all_names.difference(new_names)
        for name in names_to_delete:
            all_deployments[name].delete()

        return Response()
コード例 #4
0
ファイル: serve_head.py プロジェクト: tchordia/ray
    async def put_all_deployments(self, req: Request) -> Response:
        from ray import serve
        from ray.serve.context import get_global_client
        from ray.serve.schema import ServeApplicationSchema
        from ray.serve.application import Application

        config = ServeApplicationSchema.parse_obj(await req.json())

        if config.import_path is not None:
            client = get_global_client(_override_controller_namespace="serve")
            client.deploy_app(config)
        else:
            # TODO (shrekris-anyscale): Remove this conditional path
            app = Application.from_dict(await req.json())
            serve.run(app, _blocking=False)

        return Response()
コード例 #5
0
ファイル: serve_head.py プロジェクト: krfricke/ray
    async def put_all_deployments(self, req: Request) -> Response:
        from ray import serve
        from ray.serve.context import get_global_client
        from ray.serve.application import Application

        app = Application.from_dict(await req.json())
        serve.run(app, _blocking=False)

        new_names = set()
        for deployment in app.deployments.values():
            new_names.add(deployment.name)

        all_deployments = serve.list_deployments()
        all_names = set(all_deployments.keys())
        names_to_delete = all_names.difference(new_names)
        get_global_client().delete_deployments(names_to_delete)

        return Response()
コード例 #6
0
    def test_deploy_from_dict(self, serve_instance):
        config_file_name = os.path.join(os.path.dirname(__file__),
                                        "test_config_files",
                                        "two_deployments.yaml")

        with open(config_file_name, "r") as config_file:
            config_dict = yaml.safe_load(config_file)

        app = Application.from_dict(config_dict)
        app_dict = app.to_dict()

        compare_specified_options(config_dict, app_dict)

        serve.run(app.from_dict(app_dict))

        assert (requests.get("http://localhost:8000/shallow").text ==
                "Hello shallow world!")
        assert requests.get("http://localhost:8000/one").text == "2"