-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cancel workload when OpenAI request client disconnects (both unary an…
…d streaming) (#2610) * Patch tensorflow net_http to allow for installing client disconnection callbacks * Use new genai, add tests, fix building without mediapipe, disconnect unary as well * Tests CVS-148134 Modifications to GenAI: openvinotoolkit/openvino.genai#732
- Loading branch information
1 parent
03579fe
commit ee7dda2
Showing
15 changed files
with
362 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//***************************************************************************** | ||
// Copyright 2024 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#pragma once | ||
|
||
#include <functional> | ||
|
||
namespace ovms { | ||
|
||
class ClientConnection { | ||
public: | ||
virtual bool isDisconnected() const = 0; | ||
virtual void registerDisconnectionCallback(std::function<void()> fn) = 0; | ||
}; | ||
|
||
} // namespace ovms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//***************************************************************************** | ||
// Copyright 2024 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
//***************************************************************************** | ||
#pragma once | ||
|
||
#include <utility> | ||
|
||
#include "../client_connection.hpp" | ||
|
||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wall" | ||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable" | ||
#include "tensorflow_serving/util/net_http/server/public/server_request_interface.h" | ||
#pragma GCC diagnostic pop | ||
|
||
namespace ovms { | ||
|
||
class HttpClientConnection : public ClientConnection { | ||
tensorflow::serving::net_http::ServerRequestInterface* serverReaderWriter; | ||
|
||
public: | ||
HttpClientConnection(tensorflow::serving::net_http::ServerRequestInterface* serverReaderWriter) : | ||
serverReaderWriter(serverReaderWriter) {} | ||
|
||
bool isDisconnected() const override { | ||
return this->serverReaderWriter->IsDisconnected(); | ||
} | ||
|
||
void registerDisconnectionCallback(std::function<void()> fn) override { | ||
serverReaderWriter->RegisterDisconnectionCallback(std::move(fn)); | ||
} | ||
}; | ||
|
||
} // namespace ovms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.