Skip to content

Commit 2ea85d6

Browse files
pymumutau233
authored andcommitted
java: Support modelbox flow JNI API.
1 parent 90ad2ea commit 2ea85d6

File tree

95 files changed

+7007
-352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+7007
-352
lines changed

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,5 @@ Checks: >
6868
# clang-analyzer-optin.cplusplus.VirtualCall,
6969

7070
# Turn all the warnings from the checks above into errors.
71-
HeaderFilterRegex: '(src|test/unit|test/drivers|test/mock)/*'
71+
HeaderFilterRegex: '((?!build/)src|test/unit|test/drivers|test/function|test/mock)/*'
7272
FormatStyle: file

.github/workflows/merge-request-ascend.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
concurrency:
9+
group: ${{ github.head_ref && github.workflow}}
10+
cancel-in-progress: true
11+
812
env:
913
BUILD_TYPE: Release
1014

@@ -17,16 +21,32 @@ jobs:
1721
steps:
1822
- uses: actions/checkout@v3
1923
- run: apt update
24+
- name: Set up JDK 11
25+
uses: actions/setup-java@v1
26+
with:
27+
java-version: 11
28+
maven-version: '3.6.2'
29+
cache: 'maven'
30+
- name: Set up Maven
31+
uses: stCarolas/setup-maven@v4.4
32+
with:
33+
maven-version: 3.8.2
34+
- uses: actions/cache@v1
35+
with:
36+
path: /root/.m2/repository
37+
key: ${{ runner.os }}-maven-${{ hashFiles('src/java/pom.xml') }}
38+
restore-keys: |
39+
${{ runner.os }}-maven-
2040
- name: ccache
2141
uses: hendrikmuhs/ccache-action@v1.2
2242
with:
2343
key: ubuntu-latest
24-
max-size: 1024M
44+
max-size: 512M
2545
- name: Configure CMake
2646
run: |
2747
mkdir build
2848
cd build
29-
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_WEBUI=off -DCLANG_TIDY=on -DCLANG_TIDY_AS_ERROR=on
49+
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_WEBUI=off -DCLANG_TIDY=on -DCLANG_TIDY_AS_ERROR=on -DWITH_JAVA=on
3050
3151
- name: Build
3252
working-directory: build

.github/workflows/merge-request-cuda.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
concurrency:
9+
group: ${{ github.head_ref && github.workflow}}
10+
cancel-in-progress: true
11+
812
env:
913
BUILD_TYPE: Release
1014

@@ -16,17 +20,33 @@ jobs:
1620

1721
steps:
1822
- uses: actions/checkout@v3
19-
- run: apt update
23+
- run: apt update
24+
- name: Set up JDK 11
25+
uses: actions/setup-java@v1
26+
with:
27+
java-version: 11
28+
maven-version: '3.6.2'
29+
cache: 'maven'
30+
- name: Set up Maven
31+
uses: stCarolas/setup-maven@v4.4
32+
with:
33+
maven-version: 3.8.2
34+
- uses: actions/cache@v1
35+
with:
36+
path: /root/.m2/repository
37+
key: ${{ runner.os }}-maven-${{ hashFiles('src/java/pom.xml') }}
38+
restore-keys: |
39+
${{ runner.os }}-maven-
2040
- name: ccache
2141
uses: hendrikmuhs/ccache-action@v1.2
2242
with:
2343
key: ubuntu-latest
24-
max-size: 1024M
44+
max-size: 512M
2545
- name: Configure CMake
2646
run: |
2747
mkdir build
2848
cd build
29-
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_WEBUI=off -DCLANG_TIDY=on -DCLANG_TIDY_AS_ERROR=on
49+
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_WEBUI=off -DCLANG_TIDY=on -DCLANG_TIDY_AS_ERROR=on -DWITH_JAVA=on
3050
3151
- name: Build
3252
working-directory: build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ModelBox是一个适用于端边云场景的AI推理应用开发框架,提供
99
## ModelBox特点
1010

1111
1. **易于开发**
12-
AI推理业务可视化编排开发,功能模块化,丰富组件库;c++,python多语言支持
12+
AI推理业务可视化编排开发,功能模块化,丰富组件库;c++,python, Java多语言支持
1313

1414
1. **易于集成**
1515
集成云上对接的组件,云上对接更容易。

README_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ModelBox is an AI application development framework featuring device-edge-cloud
77
## ModelBox Highlights
88

99
1. **Easy to develop**
10-
Simplified orchestration and development of inference applications via a graphical interface, modularized functions, rich component libraries, and multi-language support (C++, Python).
10+
Simplified orchestration and development of inference applications via a graphical interface, modularized functions, rich component libraries, and multi-language support (C++, Python, Java).
1111

1212
1. **Easy to integrate**
1313
Easy to integrate different components on the cloud.

src/demo/hello_world/flowunit/hello_world/hello_world.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def process(self, data_context):
3434
out_data = data_context.output("out_data")
3535

3636
for buffer in in_data:
37-
request_body = json.loads(buffer.as_object().strip(chr(0)))
37+
request_body = json.loads(str(buffer))
3838
msg = request_body.get("msg")
3939
msg = msg.title()
4040
msg = addTimestamp(msg)

src/drivers/virtual/inference/virtualdriver_inference.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ class VirtualInferenceFlowUnitDesc : public modelbox::FlowUnitDesc {
4949
std::shared_ptr<modelbox::Configuration> config_;
5050
};
5151

52-
class InferenceVirtualDriver
53-
: public modelbox::VirtualDriver,
54-
public std::enable_shared_from_this<InferenceVirtualDriver> {
52+
class InferenceVirtualDriver : public modelbox::VirtualDriver {
5553
public:
5654
InferenceVirtualDriver() = default;
5755
~InferenceVirtualDriver() override = default;

src/drivers/virtual/java/virtualdriver_java.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ class VirtualJavaFlowUnitDesc : public modelbox::FlowUnitDesc {
5454
std::string jar_file_path_;
5555
};
5656

57-
class JavaVirtualDriver
58-
: public modelbox::VirtualDriver,
59-
public std::enable_shared_from_this<JavaVirtualDriver> {
57+
class JavaVirtualDriver : public modelbox::VirtualDriver {
6058
public:
6159
JavaVirtualDriver() = default;
6260
~JavaVirtualDriver() override = default;

src/drivers/virtual/python/virtualdriver_python.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ class VirtualPythonFlowUnitDesc : public modelbox::FlowUnitDesc {
5454
std::string python_file_path_;
5555
};
5656

57-
class PythonVirtualDriver
58-
: public modelbox::VirtualDriver,
59-
public std::enable_shared_from_this<PythonVirtualDriver> {
57+
class PythonVirtualDriver : public modelbox::VirtualDriver {
6058
public:
6159
PythonVirtualDriver() = default;
6260
~PythonVirtualDriver() override = default;

src/drivers/virtual/yolobox/virtualdriver_yolobox.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ class YoloBoxVirtualFlowUnitDesc : public modelbox::FlowUnitDesc {
4646
std::shared_ptr<modelbox::Configuration> config_;
4747
};
4848

49-
class YoloBoxVirtualDriver
50-
: public modelbox::VirtualDriver,
51-
public std::enable_shared_from_this<YoloBoxVirtualDriver> {
49+
class YoloBoxVirtualDriver : public modelbox::VirtualDriver {
5250
public:
5351
YoloBoxVirtualDriver() = default;
5452
~YoloBoxVirtualDriver() override = default;

0 commit comments

Comments
 (0)