diff --git a/.github/workflows/flex-dummy.yml b/.github/workflows/flex-interactive-dummy.yml similarity index 72% rename from .github/workflows/flex-dummy.yml rename to .github/workflows/flex-interactive-dummy.yml index 00cc8316101d..986db904ef17 100644 --- a/.github/workflows/flex-dummy.yml +++ b/.github/workflows/flex-interactive-dummy.yml @@ -1,4 +1,4 @@ -name: GraphScope Flex CI (Dummy) +name: Flex Interactive CI (Dummy) on: pull_request: @@ -7,15 +7,15 @@ on: paths: - '**' - '!flex/**' - - '!.github/workflows/flex.yml' + - '!.github/workflows/flex-interactive.yml' concurrency: group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }} cancel-in-progress: true jobs: - build-gae: + build: runs-on: ubuntu-20.04 if: ${{ github.repository == 'alibaba/GraphScope' }} steps: - - run: 'echo "No action required" ' \ No newline at end of file + - run: 'echo "No action required" ' diff --git a/.github/workflows/flex-interactive.yml b/.github/workflows/flex-interactive.yml new file mode 100644 index 000000000000..d8663d240c4d --- /dev/null +++ b/.github/workflows/flex-interactive.yml @@ -0,0 +1,64 @@ +name: Flex Interactive CI + +on: + # Trigger the workflow on push or pull request, + # but only for the main branch + workflow_dispatch: + push: + branches: + - main + paths: + - 'flex/**' + - '.github/workflows/flex-interactive.yml' + pull_request: + branches: + - main + paths: + - 'flex/**' + - '.github/workflows/flex-interactive.yml' + +concurrency: + group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + api-test: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Add envs to GITHUB_ENV + run: | + short_sha=$(git rev-parse --short HEAD) + echo "SHORT_SHA=${short_sha}" >> $GITHUB_ENV + + - name: Build Image + run: | + cd ${GITHUB_WORKSPACE}/python + python3 -m pip install --upgrade pip && python3 -m pip install -r requirements.txt && python3 setup.py build_proto + cd ${GITHUB_WORKSPACE} + python3 ./gsctl.py flexbuild interactive --app docker + + - name: Build gsctl Wheel Package + run: | + cd ${GITHUB_WORKSPACE}/python + python3 setup_gsctl.py bdist_wheel + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + if: false + + - name: Test + run: | + # install gsctl + python3 -m pip install ${GITHUB_WORKSPACE}/python/dist/*.whl + # launch service: 8080 for coordinator http port; 7687 for cypher port; + docker run -p 8080:8080 -p 7688:7687 registry.cn-hongkong.aliyuncs.com/graphscope/interactive:${SHORT_SHA}-x86_64 --enable-coordinator & + sleep 20 + # test + python3 -m pip install --no-cache-dir pytest pytest-xdist + python3 -m pytest -d --tx popen//python=python3 \ + -s -v \ + $(dirname $(python3 -c "import graphscope.gsctl as gsctl; print(gsctl.__file__)"))/tests/test_interactive.py diff --git a/.github/workflows/flex.yml b/.github/workflows/flex.yml deleted file mode 100644 index 4690c2ad654e..000000000000 --- a/.github/workflows/flex.yml +++ /dev/null @@ -1,214 +0,0 @@ -name: GraphScope Flex CI - -on: - # Trigger the workflow on push or pull request, - # but only for the main branch - workflow_dispatch: - push: - branches: - - main - paths: - - 'flex/**' - - '.github/workflows/flex.yml' - pull_request: - branches: - - main - paths: - - 'flex/**' - - '.github/workflows/flex.yml' - -concurrency: - group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }} - cancel-in-progress: true - -jobs: - test-build-flex: - runs-on: ubuntu-22.04 - - strategy: - matrix: - os: [ubuntu-22.04] - platform: [x86_64] - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install dependencies - run: | - cd ${GITHUB_WORKSPACE}/flex - bash ./scripts/install_dependencies.sh 4 - - - name: Setup tmate session - if: false - uses: mxschmitt/action-tmate@v2 - - - name: Build - run: | - cd ${GITHUB_WORKSPACE}/flex - git submodule update --init - mkdir build && cd build # only test default build - cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_DOC=OFF && sudo make -j 4 - - # test the different combination of cmake options: -DBUILD_HQPS=ON/OFF -DBUILD_TEST=ON/OFF, -DBUILD_ODPS_FRAGMENT_LOADER=ON/OFF - test-cmake-options: - runs-on: ubuntu-20.04 - container: - image: registry.cn-hongkong.aliyuncs.com/graphscope/hqps-server-base:v0.0.10 - strategy: - matrix: - BUILD_HQPS: [ON, OFF] - BUILD_TEST: [ON, OFF] - BUILD_ODPS_FRAGMENT_LOADER: [ON, OFF] - steps: - - uses: actions/checkout@v3 - - - name: Build - run: | - cd ${GITHUB_WORKSPACE}/flex - git submodule update --init - mkdir build && cd build - cmake .. -DBUILD_HQPS=${{ matrix.BUILD_HQPS }} -DBUILD_TEST=${{ matrix.BUILD_TEST }} \ - -DBUILD_ODPS_FRAGMENT_LOADER=${{ matrix.BUILD_ODPS_FRAGMENT_LOADER }} - sudo make -j4 - - test-AOCC-compilation: - runs-on: ubuntu-20.04 - container: - image: registry.cn-hongkong.aliyuncs.com/graphscope/hqps-server-base:v0.0.10 - steps: - - uses: actions/checkout@v3 - - - name: Download aocc compiler - run: | - cd ${GITHUB_WORKSPACE}/flex - wget https://download.amd.com/developer/eula/aocc/aocc-4-1/aocc-compiler-4.1.0_1_amd64.deb - sudo apt-get update && sudo apt-get install libncurses-dev libncurses5-dev - sudo dpkg -i aocc-compiler-4.1.0_1_amd64.deb - - - name: Test AOCC compiler - env: - CC: clang - CXX: clang++ - OMPI_CC: clang - OMPI_CXX: clang++ - run: | - . /opt/AMD/aocc-compiler-4.1.0/setenv_AOCC.sh - cd ${GITHUB_WORKSPACE}/flex - git submodule update --init - mkdir build && cd build - cmake .. -DBUILD_DOC=OFF -DCMAKE_BUILD_TYPE=DEBUG - sudo make -j4 - - test-flex: - runs-on: ubuntu-20.04 - if: ${{ github.repository == 'alibaba/GraphScope' }} - container: - image: registry.cn-hongkong.aliyuncs.com/graphscope/hqps-server-base:v0.0.10 - steps: - - uses: actions/checkout@v3 - - - name: Install latest libgrape-lite - if: false - run: | - git clone --single-branch https://github.com/alibaba/libgrape-lite.git /tmp/libgrape-lite - cd /tmp/libgrape-lite - mkdir -p build && cd build - cmake .. - make -j$(nproc) - make install - - - name: Build - env: - HOME: /home/graphscope/ - run: | - cd ${GITHUB_WORKSPACE}/flex - git submodule update --init - mkdir build && cd build - cmake .. && sudo make -j$(nproc) - - - name: Test GRIN on mutable csr - run: | - git submodule update --init - cd flex/engines/graph_db/grin - mkdir build && cd build - cmake .. && sudo make -j$(nproc) - export FLEX_DATA_DIR=../../../../interactive/examples/modern_graph/ - ${GITHUB_WORKSPACE}/flex/build/bin/bulk_loader -g ../../../../interactive/examples/modern_graph/graph.yaml -l ../../../../interactive/examples/modern_graph/bulk_load.yaml -d ./data/ - rm -r ./data/wal - rm -r ./data/runtime/* - ./run_grin_test 'flex://schema_file=../../../../interactive/examples/modern_graph/graph.yaml&data_dir=./data/' - - - name: Prepare test dataset - env: - GS_TEST_DIR: ${{ github.workspace }}/gstest/ - run: | - git clone -b master --single-branch --depth=1 https://github.com/GraphScope/gstest.git ${GS_TEST_DIR} - - - name: Test String edge property on modern graph - env: - FLEX_DATA_DIR: ${{ github.workspace }}/flex/interactive/examples/modern_graph/ - run: | - rm -rf /tmp/csr-data-dir/ - cd ${GITHUB_WORKSPACE}/flex/build/ - SCHEMA_FILE=../tests/rt_mutable_graph/modern_graph_string_edge.yaml - BULK_LOAD_FILE=../interactive/examples/modern_graph/bulk_load.yaml - GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ - GLOG_v=10 ./tests/rt_mutable_graph/string_edge_property_test ${SCHEMA_FILE} /tmp/csr-data-dir/ - - - name: Test schema parsing and loading on modern graph - env: - FLEX_DATA_DIR: ${{ github.workspace }}/flex/interactive/examples/modern_graph/ - run: | - rm -rf /tmp/csr-data-dir/ - cd ${GITHUB_WORKSPACE}/flex/build/ - SCHEMA_FILE=../tests/rt_mutable_graph/modern_graph_unified_schema.yaml - BULK_LOAD_FILE=../interactive/examples/modern_graph/bulk_load.yaml - GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ - - - name: Test build empty graph - run: | - rm -rf /tmp/csr-data-dir/ - cd ${GITHUB_WORKSPACE}/flex/build/ - GLOG_v=10 ./tests/rt_mutable_graph/test_empty_graph /tmp/csr-data-dir/ - - name: Test ACID - run: | - rm -rf /tmp/csr-data-dir/ - cd ${GITHUB_WORKSPACE}/flex/build/ - GLOG_v=10 ./tests/rt_mutable_graph/test_acid 8 /tmp/csr-data-dir/ - - - name: Test Graph Loading on modern graph - env: - FLEX_DATA_DIR: ${{ github.workspace }}/flex/interactive/examples/modern_graph/ - run: | - rm -rf /tmp/csr-data-dir/ - cd ${GITHUB_WORKSPACE}/flex/build/ - SCHEMA_FILE=../interactive/examples/modern_graph/graph.yaml - BULK_LOAD_FILE=../interactive/examples/modern_graph/bulk_load.yaml - GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ - - - name: Test Graph Loading on type_test graph - env: - GS_TEST_DIR: ${{ github.workspace }}/gstest/ - FLEX_DATA_DIR: ${{ github.workspace }}/gstest/flex/type_test/ - run: | - # remove modern graph indices - rm -rf /tmp/csr-data-dir/ - - cd ${GITHUB_WORKSPACE}/flex/build/ - SCHEMA_FILE=${GS_TEST_DIR}/flex/type_test/graph.yaml - BULK_LOAD_FILE=${GS_TEST_DIR}/flex/type_test/import.yaml - GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ -p 2 - - - name: Test Graph Loading on LDBC SNB sf0.1 - env: - GS_TEST_DIR: ${{ github.workspace }}/gstest/ - FLEX_DATA_DIR: ${{ github.workspace }}/gstest/flex/ldbc-sf01-long-date/ - run: | - # remove previous graph indices - rm -rf /tmp/csr-data-dir/ - - cd ${GITHUB_WORKSPACE}/flex/build/ - SCHEMA_FILE=${FLEX_DATA_DIR}/audit_graph_schema.yaml - BULK_LOAD_FILE=${FLEX_DATA_DIR}/audit_bulk_load.yaml - GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ -p 2 diff --git a/.github/workflows/hqps-db-ci.yml b/.github/workflows/interactive.yml similarity index 69% rename from .github/workflows/hqps-db-ci.yml rename to .github/workflows/interactive.yml index 76101786e21f..3ebcba777388 100644 --- a/.github/workflows/hqps-db-ci.yml +++ b/.github/workflows/interactive.yml @@ -320,4 +320,193 @@ jobs: bash hqps_adhoc_test.sh ${INTERACTIVE_WORKSPACE} modern_graph \ ${GITHUB_WORKSPACE}/flex/tests/hqps/engine_config_test.yaml gremlin + test-build-flex: + runs-on: ubuntu-22.04 + strategy: + matrix: + os: [ubuntu-22.04] + platform: [x86_64] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install dependencies + run: | + cd ${GITHUB_WORKSPACE}/flex + bash ./scripts/install_dependencies.sh 4 + + - name: Setup tmate session + if: false + uses: mxschmitt/action-tmate@v2 + + - name: Build + run: | + cd ${GITHUB_WORKSPACE}/flex + git submodule update --init + mkdir build && cd build # only test default build + cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_DOC=OFF && sudo make -j 4 + + # test the different combination of cmake options: -DBUILD_HQPS=ON/OFF -DBUILD_TEST=ON/OFF, -DBUILD_ODPS_FRAGMENT_LOADER=ON/OFF + test-cmake-options: + runs-on: ubuntu-20.04 + container: + image: registry.cn-hongkong.aliyuncs.com/graphscope/hqps-server-base:v0.0.10 + strategy: + matrix: + BUILD_HQPS: [ON, OFF] + BUILD_TEST: [ON, OFF] + BUILD_ODPS_FRAGMENT_LOADER: [ON, OFF] + steps: + - uses: actions/checkout@v3 + + - name: Build + run: | + cd ${GITHUB_WORKSPACE}/flex + git submodule update --init + mkdir build && cd build + cmake .. -DBUILD_HQPS=${{ matrix.BUILD_HQPS }} -DBUILD_TEST=${{ matrix.BUILD_TEST }} \ + -DBUILD_ODPS_FRAGMENT_LOADER=${{ matrix.BUILD_ODPS_FRAGMENT_LOADER }} + sudo make -j4 + + test-AOCC-compilation: + runs-on: ubuntu-20.04 + container: + image: registry.cn-hongkong.aliyuncs.com/graphscope/hqps-server-base:v0.0.10 + steps: + - uses: actions/checkout@v3 + + - name: Download aocc compiler + run: | + cd ${GITHUB_WORKSPACE}/flex + wget https://download.amd.com/developer/eula/aocc/aocc-4-1/aocc-compiler-4.1.0_1_amd64.deb + sudo apt-get update && sudo apt-get install libncurses-dev libncurses5-dev + sudo dpkg -i aocc-compiler-4.1.0_1_amd64.deb + + - name: Test AOCC compiler + env: + CC: clang + CXX: clang++ + OMPI_CC: clang + OMPI_CXX: clang++ + run: | + . /opt/AMD/aocc-compiler-4.1.0/setenv_AOCC.sh + cd ${GITHUB_WORKSPACE}/flex + git submodule update --init + mkdir build && cd build + cmake .. -DBUILD_DOC=OFF -DCMAKE_BUILD_TYPE=DEBUG + sudo make -j4 + + test-flex: + runs-on: ubuntu-20.04 + if: ${{ github.repository == 'alibaba/GraphScope' }} + container: + image: registry.cn-hongkong.aliyuncs.com/graphscope/hqps-server-base:v0.0.10 + steps: + - uses: actions/checkout@v3 + + - name: Install latest libgrape-lite + if: false + run: | + git clone --single-branch https://github.com/alibaba/libgrape-lite.git /tmp/libgrape-lite + cd /tmp/libgrape-lite + mkdir -p build && cd build + cmake .. + make -j$(nproc) + make install + + - name: Build + env: + HOME: /home/graphscope/ + run: | + cd ${GITHUB_WORKSPACE}/flex + git submodule update --init + mkdir build && cd build + cmake .. && sudo make -j$(nproc) + + - name: Test GRIN on mutable csr + run: | + git submodule update --init + cd flex/engines/graph_db/grin + mkdir build && cd build + cmake .. && sudo make -j$(nproc) + export FLEX_DATA_DIR=../../../../interactive/examples/modern_graph/ + ${GITHUB_WORKSPACE}/flex/build/bin/bulk_loader -g ../../../../interactive/examples/modern_graph/graph.yaml -l ../../../../interactive/examples/modern_graph/bulk_load.yaml -d ./data/ + rm -r ./data/wal + rm -r ./data/runtime/* + ./run_grin_test 'flex://schema_file=../../../../interactive/examples/modern_graph/graph.yaml&data_dir=./data/' + + - name: Prepare test dataset + env: + GS_TEST_DIR: ${{ github.workspace }}/gstest/ + run: | + git clone -b master --single-branch --depth=1 https://github.com/GraphScope/gstest.git ${GS_TEST_DIR} + + - name: Test String edge property on modern graph + env: + FLEX_DATA_DIR: ${{ github.workspace }}/flex/interactive/examples/modern_graph/ + run: | + rm -rf /tmp/csr-data-dir/ + cd ${GITHUB_WORKSPACE}/flex/build/ + SCHEMA_FILE=../tests/rt_mutable_graph/modern_graph_string_edge.yaml + BULK_LOAD_FILE=../interactive/examples/modern_graph/bulk_load.yaml + GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ + GLOG_v=10 ./tests/rt_mutable_graph/string_edge_property_test ${SCHEMA_FILE} /tmp/csr-data-dir/ + + - name: Test schema parsing and loading on modern graph + env: + FLEX_DATA_DIR: ${{ github.workspace }}/flex/interactive/examples/modern_graph/ + run: | + rm -rf /tmp/csr-data-dir/ + cd ${GITHUB_WORKSPACE}/flex/build/ + SCHEMA_FILE=../tests/rt_mutable_graph/modern_graph_unified_schema.yaml + BULK_LOAD_FILE=../interactive/examples/modern_graph/bulk_load.yaml + GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ + + - name: Test build empty graph + run: | + rm -rf /tmp/csr-data-dir/ + cd ${GITHUB_WORKSPACE}/flex/build/ + GLOG_v=10 ./tests/rt_mutable_graph/test_empty_graph /tmp/csr-data-dir/ + - name: Test ACID + run: | + rm -rf /tmp/csr-data-dir/ + cd ${GITHUB_WORKSPACE}/flex/build/ + GLOG_v=10 ./tests/rt_mutable_graph/test_acid 8 /tmp/csr-data-dir/ + + - name: Test Graph Loading on modern graph + env: + FLEX_DATA_DIR: ${{ github.workspace }}/flex/interactive/examples/modern_graph/ + run: | + rm -rf /tmp/csr-data-dir/ + cd ${GITHUB_WORKSPACE}/flex/build/ + SCHEMA_FILE=../interactive/examples/modern_graph/graph.yaml + BULK_LOAD_FILE=../interactive/examples/modern_graph/bulk_load.yaml + GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ + + - name: Test Graph Loading on type_test graph + env: + GS_TEST_DIR: ${{ github.workspace }}/gstest/ + FLEX_DATA_DIR: ${{ github.workspace }}/gstest/flex/type_test/ + run: | + # remove modern graph indices + rm -rf /tmp/csr-data-dir/ + + cd ${GITHUB_WORKSPACE}/flex/build/ + SCHEMA_FILE=${GS_TEST_DIR}/flex/type_test/graph.yaml + BULK_LOAD_FILE=${GS_TEST_DIR}/flex/type_test/import.yaml + GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ -p 2 + + - name: Test Graph Loading on LDBC SNB sf0.1 + env: + GS_TEST_DIR: ${{ github.workspace }}/gstest/ + FLEX_DATA_DIR: ${{ github.workspace }}/gstest/flex/ldbc-sf01-long-date/ + run: | + # remove previous graph indices + rm -rf /tmp/csr-data-dir/ + + cd ${GITHUB_WORKSPACE}/flex/build/ + SCHEMA_FILE=${FLEX_DATA_DIR}/audit_graph_schema.yaml + BULK_LOAD_FILE=${FLEX_DATA_DIR}/audit_bulk_load.yaml + GLOG_v=10 ./bin/bulk_loader -g ${SCHEMA_FILE} -l ${BULK_LOAD_FILE} -d /tmp/csr-data-dir/ -p 2 diff --git a/Makefile b/Makefile index 7c3ded9b5226..1c48747da292 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ PIP_ARGS = --timeout=1000 --no-cache-dir .PHONY: all graphscope install clean # coordinator relies on client, which relies on learning -all: coordinator analytical interactive +all: coordinator analytical interactive gsctl graphscope: all install: analytical-install interactive-install learning-install coordinator @@ -73,9 +73,17 @@ clean: cd $(COORDINATOR_DIR) && python3 setup.py clean --all ## Modules -.PHONY: client coordinator analytical interactive learning +.PHONY: client coordinator analytical interactive learning gsctl .PHONY: analytical-java + +gsctl: + cd $(CLIENT_DIR) && \ + python3 setup_gsctl.py bdist_wheel && \ + python3 -m pip install dist/gsctl*.whl --force-reinstall && \ + rm -fr build + + client: learning cd $(CLIENT_DIR) && \ python3 -m pip install ${PIP_ARGS} "torch<=2.2.1" "networkx<=3.0" --index-url https://download.pytorch.org/whl/cpu --user && \ diff --git a/README.md b/README.md index 1dc84d9f4b00..61066d45d779 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ GraphScope is a unified distributed graph computing platform that provides a one Visit our website at [graphscope.io](https://graphscope.io) to learn more. ## Latest News +- [30/05/2024] 🏅 GraphScope Flex set new record-breaking [SNB Interactive audit results](https://ldbcouncil.org/benchmarks/snb-interactive/), as announced by LDBC on [X (Twitter)](https://twitter.com/LDBCouncil/status/1795886732950294630)! - [25/03/2024] 🙌🏻 We donated the graph file format [GraphAr](https://graphar.apache.org/) to [Apache Software Foundation](https://www.apache.org/) as an Incubating Project. - [05/02/2024] 🎉 GraphScope Flex [paper](https://arxiv.org/abs/2312.12107) was accepted by [SIGMOD 2024](https://2024.sigmod.org/) Industry Track. See you in 🇨🇱! - [19/12/2023] 📑 A paper introducing GraphScope Flex released on [arXiv.org](https://arxiv.org/abs/2312.12107). diff --git a/analytical_engine/java/grape-demo/src/main/java/com/alibaba/graphscope/example/giraph/MessageAppWithUserWritable.java b/analytical_engine/java/grape-demo/src/main/java/com/alibaba/graphscope/example/giraph/MessageAppWithUserWritable.java new file mode 100644 index 000000000000..7597867b624d --- /dev/null +++ b/analytical_engine/java/grape-demo/src/main/java/com/alibaba/graphscope/example/giraph/MessageAppWithUserWritable.java @@ -0,0 +1,91 @@ +/* + * Copyright 2022 Alibaba Group Holding Limited. + * + * 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. + */ + +package com.alibaba.graphscope.example.giraph; + +import com.alibaba.graphscope.example.giraph.writable.MultipleLongWritable; + +import org.apache.giraph.conf.LongConfOption; +import org.apache.giraph.graph.BasicComputation; +import org.apache.giraph.graph.Vertex; +import org.apache.hadoop.io.LongWritable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.Objects; + +/** + * Only send msg. + */ +public class MessageAppWithUserWritable + extends BasicComputation< + LongWritable, MultipleLongWritable, MultipleLongWritable, MultipleLongWritable> { + + public static LongConfOption MAX_SUPER_STEP; + private static Logger logger = LoggerFactory.getLogger(MessageAppWithUserWritable.class); + + static { + String maxSuperStep = System.getenv("MAX_SUPER_STEP"); + if (Objects.isNull(maxSuperStep) || maxSuperStep.isEmpty()) { + MAX_SUPER_STEP = new LongConfOption("maxSuperStep", 3, "max super step"); + } else { + MAX_SUPER_STEP = + new LongConfOption( + "maxSuperStep", Long.valueOf(maxSuperStep), "max super step"); + } + } + + /** + * Must be defined by user to do computation on a single Vertex. + * + * @param vertex Vertex + * @param messages Messages that were sent to this vertex in the previous superstep. Each + * message is only guaranteed to have + */ + @Override + public void compute( + Vertex vertex, + Iterable messages) + throws IOException { + if (getSuperstep() == 0) { + // logger.info("There should be no messages in step0, " + vertex.getId()); + boolean flag = false; + for (MultipleLongWritable message : messages) { + flag = true; + } + if (flag) { + throw new IllegalStateException( + "Expect no msg received in step 1, but actually received"); + } + MultipleLongWritable msg = new MultipleLongWritable(vertex.getId().get()); + sendMessageToAllEdges(vertex, msg); + } else if (getSuperstep() < MAX_SUPER_STEP.get(getConf())) { + if (vertex.getId().get() < 20) { + logger.info("step [{}] Checking received msg", getSuperstep()); + } + int msgCnt = 0; + for (MultipleLongWritable message : messages) { + msgCnt += 1; + } + vertex.setValue(new MultipleLongWritable(msgCnt)); + } else if (getSuperstep() == MAX_SUPER_STEP.get(getConf())) { + vertex.voteToHalt(); + } else { + logger.info("Impossible: " + getSuperstep()); + } + } +} diff --git a/analytical_engine/java/grape-demo/src/main/java/com/alibaba/graphscope/example/giraph/format/P2PEdgeMultipleLongInputFormat.java b/analytical_engine/java/grape-demo/src/main/java/com/alibaba/graphscope/example/giraph/format/P2PEdgeMultipleLongInputFormat.java new file mode 100644 index 000000000000..a6052f692242 --- /dev/null +++ b/analytical_engine/java/grape-demo/src/main/java/com/alibaba/graphscope/example/giraph/format/P2PEdgeMultipleLongInputFormat.java @@ -0,0 +1,117 @@ +/* + * Copyright 2022 Alibaba Group Holding Limited. + * + * 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. + */ + +package com.alibaba.graphscope.example.giraph.format; + +import com.alibaba.graphscope.example.giraph.writable.MultipleLongWritable; + +import org.apache.giraph.io.EdgeReader; +import org.apache.giraph.io.formats.TextEdgeInputFormat; +import org.apache.hadoop.io.LongWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapreduce.InputSplit; +import org.apache.hadoop.mapreduce.TaskAttemptContext; + +import java.io.IOException; + +public class P2PEdgeMultipleLongInputFormat + extends TextEdgeInputFormat { + + /** + * Create an edge reader for a given split. The framework will call {@link + * EdgeReader#initialize(InputSplit, TaskAttemptContext)} before the split is used. + * + * @param split the split to be read + * @param context the information about the task + * @return a new record reader + * @throws IOException + */ + @Override + public EdgeReader createEdgeReader( + InputSplit split, TaskAttemptContext context) throws IOException { + return new P2PEdgeReader(); + } + + public class P2PEdgeReader extends TextEdgeReaderFromEachLineProcessed { + + String SEPARATOR = " "; + /** + * Cached vertex id for the current line + */ + private LongWritable srcId; + + private LongWritable dstId; + private MultipleLongWritable edgeValue; + + /** + * Preprocess the line so other methods can easily read necessary information for creating + * edge + * + * @param line the current line to be read + * @return the preprocessed object + * @throws IOException exception that can be thrown while reading + */ + @Override + protected String[] preprocessLine(Text line) throws IOException { + // logger.debug("line: " + line.toString()); + String[] tokens = line.toString().split(SEPARATOR); + if (tokens.length != 3) { + throw new IllegalStateException("expect 3 ele in edge line"); + } + // logger.debug(String.join(",", tokens)); + srcId = new LongWritable(Long.parseLong(tokens[0])); + dstId = new LongWritable(Long.parseLong(tokens[1])); + edgeValue = new MultipleLongWritable(Long.parseLong(tokens[2])); + return tokens; + } + + /** + * Reads target vertex id from the preprocessed line. + * + * @param line the object obtained by preprocessing the line + * @return the target vertex id + * @throws IOException exception that can be thrown while reading + */ + @Override + protected LongWritable getTargetVertexId(String[] line) throws IOException { + return dstId; + } + + /** + * Reads source vertex id from the preprocessed line. + * + * @param line the object obtained by preprocessing the line + * @return the source vertex id + * @throws IOException exception that can be thrown while reading + */ + @Override + protected LongWritable getSourceVertexId(String[] line) throws IOException { + return srcId; + } + + /** + * Reads edge value from the preprocessed line. + * + * @param line the object obtained by preprocessing the line + * @return the edge value + * @throws IOException exception that can be thrown while reading + */ + @Override + protected MultipleLongWritable getValue(String[] line) throws IOException { + return edgeValue; + } + } +} diff --git a/analytical_engine/java/grape-demo/src/main/java/com/alibaba/graphscope/example/giraph/format/P2PVertexMultipleLongInputFormat.java b/analytical_engine/java/grape-demo/src/main/java/com/alibaba/graphscope/example/giraph/format/P2PVertexMultipleLongInputFormat.java new file mode 100644 index 000000000000..d6bb19dac955 --- /dev/null +++ b/analytical_engine/java/grape-demo/src/main/java/com/alibaba/graphscope/example/giraph/format/P2PVertexMultipleLongInputFormat.java @@ -0,0 +1,88 @@ +/* + * Copyright 2022 Alibaba Group Holding Limited. + * + * 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. + */ + +package com.alibaba.graphscope.example.giraph.format; + +import com.alibaba.graphscope.example.giraph.writable.MultipleLongWritable; +import com.google.common.collect.Lists; + +import org.apache.giraph.edge.Edge; +import org.apache.giraph.io.formats.TextVertexInputFormat; +import org.apache.hadoop.io.LongWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapreduce.InputSplit; +import org.apache.hadoop.mapreduce.TaskAttemptContext; + +import java.io.IOException; +import java.util.List; + +public class P2PVertexMultipleLongInputFormat + extends TextVertexInputFormat { + + /** + * The factory method which produces the {@link TextVertexReader} used by this input format. + * + * @param split the split to be read + * @param context the information about the task + * @return the text vertex reader to be used + */ + @Override + public TextVertexInputFormat + .TextVertexReader + createVertexReader(InputSplit split, TaskAttemptContext context) throws IOException { + return new P2PVertexReader(); + } + + public class P2PVertexReader extends TextVertexReaderFromEachLineProcessed { + + String SEPARATOR = " "; + + /** + * Cached vertex id for the current line + */ + private LongWritable id; + + private MultipleLongWritable value; + + @Override + protected String[] preprocessLine(Text line) throws IOException { + // logger.debug("line: " + line.toString()); + String[] tokens = line.toString().split(SEPARATOR); + // logger.debug(String.join(",", tokens)); + id = new LongWritable(Long.parseLong(tokens[0])); + value = new MultipleLongWritable(Long.parseLong(tokens[1])); + return tokens; + } + + @Override + protected LongWritable getId(String[] tokens) throws IOException { + return id; + } + + @Override + protected MultipleLongWritable getValue(String[] tokens) throws IOException { + return value; + } + + @Override + protected Iterable> getEdges(String[] tokens) + throws IOException { + List> edges = + Lists.newArrayListWithCapacity(0); + return edges; + } + } +} diff --git a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/context/GiraphComputationAdaptorContext.java b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/context/GiraphComputationAdaptorContext.java index 56f664b0c1d6..43931d6e77fb 100644 --- a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/context/GiraphComputationAdaptorContext.java +++ b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/context/GiraphComputationAdaptorContext.java @@ -23,6 +23,7 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.graphscope.communication.Communicator; import com.alibaba.graphscope.ds.GSVertexArray; +import com.alibaba.graphscope.ds.StringView; import com.alibaba.graphscope.factory.GiraphComputationFactory; import com.alibaba.graphscope.fragment.IFragment; import com.alibaba.graphscope.graph.AggregatorManager; @@ -39,6 +40,7 @@ import com.alibaba.graphscope.serialization.FFIByteVectorInputStream; import com.alibaba.graphscope.serialization.FFIByteVectorOutputStream; import com.alibaba.graphscope.stdcxx.FFIByteVector; +import com.alibaba.graphscope.stdcxx.StdString; import com.alibaba.graphscope.utils.ConfigurationUtils; import com.alibaba.graphscope.utils.FFITypeFactoryhelper; @@ -248,6 +250,22 @@ public void writeBackVertexData() { // This string is not readable. vertexArray.setValue(grapeVertex, new String(bytes)); } + } else if (conf.getGrapeVdataClass().equals(StringView.class)) { + byte[] bytes = new byte[(int) maxOffset]; + for (long lid = 0; lid < innerVerticesNum; ++lid) { + grapeVertex.setValue((VID_T) (Long) lid); + if (inputStream.longAvailable() <= 0) { + throw new IllegalStateException( + "Input stream too short for " + innerVerticesNum + " vertices"); + } + if (inputStream.read(bytes, 0, (int) offsets[(int) lid]) == -1) { + throw new IllegalStateException("read input stream failed"); + } + // This string is not readable. + StdString value = (StdString) vertexArray.get(grapeVertex); + // TODO: can be optimized without creating a java string + value.fromJavaString(new String(bytes)); + } } else { throw new IllegalStateException( "Unrecognized vdata class:" + conf.getGrapeVdataClass().getName()); diff --git a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/graph/impl/GiraphVertexIdManagerImpl.java b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/graph/impl/GiraphVertexIdManagerImpl.java index b058fd3823ed..e2ab384d525b 100644 --- a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/graph/impl/GiraphVertexIdManagerImpl.java +++ b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/graph/impl/GiraphVertexIdManagerImpl.java @@ -147,7 +147,7 @@ private FFIByteVectorInputStream generateVertexIdStream() { } outputStream.finishSetting(); logger.info( - "Vertex data stream size: " + "Vertex id stream size: " + outputStream.bytesWriten() + ", vertices: " + vertexNum); diff --git a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/graph/impl/VertexDataManagerImpl.java b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/graph/impl/VertexDataManagerImpl.java index 0b64dd0cb404..3390dbe3a356 100644 --- a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/graph/impl/VertexDataManagerImpl.java +++ b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/graph/impl/VertexDataManagerImpl.java @@ -15,6 +15,7 @@ */ package com.alibaba.graphscope.graph.impl; +import com.alibaba.graphscope.ds.StringView; import com.alibaba.graphscope.ds.Vertex; import com.alibaba.graphscope.fragment.IFragment; import com.alibaba.graphscope.graph.VertexDataManager; @@ -143,8 +144,13 @@ private void readVertexDataFromIFragment(FFIByteVectorOutputStream outputStream) String value = (String) fragment.getData(vertex); outputStream.writeBytes(value); } + } else if (conf.getGrapeVdataClass().equals(StringView.class)) { + for (Vertex vertex : iterable) { + StringView value = (StringView) fragment.getData(vertex); + outputStream.writeBytes(value); + } } else { - logger.error("Unsupported oid class: " + conf.getGrapeOidClass().getName()); + logger.error("Unsupported vdata class: " + conf.getGrapeVdataClass().getName()); } // else if (conf.getGrapeVdataClass().equals the userDefined class... outputStream.finishSetting(); diff --git a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/utils/ConfigurationUtils.java b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/utils/ConfigurationUtils.java index f3dbd9d36195..7303e47a5413 100644 --- a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/utils/ConfigurationUtils.java +++ b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/utils/ConfigurationUtils.java @@ -20,6 +20,7 @@ import static org.apache.giraph.conf.GiraphConstants.TYPES_HOLDER_CLASS; import com.alibaba.fastjson.JSONObject; +import com.alibaba.graphscope.ds.StringView; import com.alibaba.graphscope.fragment.IFragment; import org.apache.giraph.combiner.MessageCombiner; @@ -295,6 +296,9 @@ public static boolean checkTypeConsistency( if (grapeTypeClass.equals(Float.class)) { return giraphTypeClass.equals(FloatWritable.class); } + if (grapeTypeClass.equals(String.class) || grapeTypeClass.equals(StringView.class)) { + return true; + } logger.error( "Unsupported grape type and giraph type: " + grapeTypeClass.getName() diff --git a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/utils/GrapeTypes.java b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/utils/GrapeTypes.java index b03174c8a35f..1022a56f7cf7 100644 --- a/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/utils/GrapeTypes.java +++ b/analytical_engine/java/grape-giraph/src/main/java/com/alibaba/graphscope/utils/GrapeTypes.java @@ -15,6 +15,7 @@ */ package com.alibaba.graphscope.utils; +import com.alibaba.graphscope.ds.StringView; import com.alibaba.graphscope.fragment.ArrowProjectedFragment; import com.alibaba.graphscope.fragment.IFragment; import com.alibaba.graphscope.fragment.ImmutableEdgecutFragment; @@ -80,6 +81,8 @@ private Class cppType2JavaType(String typeString) { return Double.class; } else if (typeString.equals("float")) { return Float.class; + } else if (typeString.equals("std::string")) { + return StringView.class; } throw new IllegalStateException("Not supported type string" + typeString); } diff --git a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/graph/AbstractEdgeManager.java b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/graph/AbstractEdgeManager.java index 91f330f2b12f..805ca9d0a50f 100644 --- a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/graph/AbstractEdgeManager.java +++ b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/graph/AbstractEdgeManager.java @@ -17,9 +17,7 @@ package com.alibaba.graphscope.graph; import com.alibaba.fastffi.llvm4jni.runtime.JavaRuntime; -import com.alibaba.graphscope.ds.PrimitiveTypedArray; -import com.alibaba.graphscope.ds.PropertyNbrUnit; -import com.alibaba.graphscope.ds.Vertex; +import com.alibaba.graphscope.ds.*; import com.alibaba.graphscope.fragment.ArrowProjectedFragment; import com.alibaba.graphscope.fragment.IFragment; import com.alibaba.graphscope.fragment.adaptor.ArrowProjectedAdaptor; @@ -94,8 +92,12 @@ public void init( } this.vidClass = vidClass; edata_t = grapeEdata2Int(); - PrimitiveTypedArray newTypedArray = - FFITypeFactoryhelper.newPrimitiveTypedArray(edataClass); + BaseTypedArray newTypedArray; + if (edataClass.equals(StringView.class)) { + newTypedArray = (BaseTypedArray) FFITypeFactoryhelper.newStringTypedArray(); + } else { + newTypedArray = FFITypeFactoryhelper.newPrimitiveTypedArray(edataClass); + } newTypedArray.setAddress(this.fragment.getEdataArrayAccessor().getAddress()); csrHolder = new CSRHolder(newTypedArray, consumer); edgeIterable = new TupleIterable(csrHolder); @@ -199,7 +201,7 @@ public class CSRHolder { private BiConsumer> consumer; public CSRHolder( - PrimitiveTypedArray edataArray, + BaseTypedArray edataArray, BiConsumer> consumer) { this.consumer = consumer; totalNumOfEdges = getTotalNumOfEdges(); @@ -215,6 +217,7 @@ public CSRHolder( // totalNumOfEdges); // dstLids = (VID_T[]) Array.newInstance(vidClass, (int) totalNumOfEdges); // dstLids = (VID_T[]) new Object[(int) totalNumOfEdges]; + logger.info("edatas class: {}", bizEdataClass.getClass().getName()); edatas = PrimitiveArray.create(bizEdataClass, (int) totalNumOfEdges); dstOids = PrimitiveArray.create(bizOidClass, (int) totalNumOfEdges); dstLids = PrimitiveArray.create(vidClass, (int) totalNumOfEdges); @@ -233,7 +236,7 @@ private long getTotalNumOfEdges() { return largest - smallest; } - private void initArrays(PrimitiveTypedArray edataArray) throws IOException { + private void initArrays(BaseTypedArray edataArray) throws IOException { int tmpSum = 0; long oeBeginOffset, oeEndOffset; for (long lid = 0; lid < innerVerticesNum; ++lid) { @@ -269,17 +272,24 @@ private void initArrays(PrimitiveTypedArray edataArray) throws IOExc fillInEdataArray(edataArray); } - private void fillInEdataArray(PrimitiveTypedArray edataArray) - throws IOException { + private void fillInEdataArray(BaseTypedArray edataArray) throws IOException { // first try to set directly. int index = 0; if (bizEdataClass.equals(edataClass)) { - logger.info("biz edata {} == grape edata, try to read direct", edata_t); + logger.info( + "biz edata {} == grape edata, try to read direct, biz edata class {}, edata" + + " class {}", + edata_t, + bizEdataClass, + edataClass); + PrimitiveTypedArray primitiveTypedArray = + FFITypeFactoryhelper.newPrimitiveTypedArray(bizEdataClass); + primitiveTypedArray.setAddress(edataArray.getAddress()); for (int lid = 0; lid < innerVerticesNum; ++lid) { long curAddr = nbrUnitAddrs[lid] + VID_SIZE_IN_BYTE; for (int j = 0; j < numOfEdges[lid]; ++j) { long eid = JavaRuntime.getLong(curAddr); - edatas.set(index++, (BIZ_EDATA_T) edataArray.get(eid)); + edatas.set(index++, primitiveTypedArray.get(eid)); curAddr += nbrUnitEleSize; } } @@ -366,21 +376,27 @@ private int grapeEdata2Int() { } else if (edataClass.equals(String.class)) { logger.info("edata: String"); return 4; + } else if (edataClass.equals(StringView.class)) { + logger.info("edata: StringView"); + return 5; } throw new IllegalStateException("Cannot recognize edata type " + edataClass); } private FFIByteVector generateEdataString( - long[] nbrUnitAddrs, long[] numOfEdges, PrimitiveTypedArray edataArray) + long[] nbrUnitAddrs, long[] numOfEdges, BaseTypedArray edataArray) throws IOException { FFIByteVectorOutputStream outputStream = new FFIByteVectorOutputStream(); switch (edata_t) { case 0: + PrimitiveTypedArray longTypedArray = + FFITypeFactoryhelper.newPrimitiveTypedArray(edataClass); + longTypedArray.setAddress(edataArray.getAddress()); for (int lid = 0; lid < innerVerticesNum; ++lid) { long curAddr = nbrUnitAddrs[lid]; for (int j = 0; j < numOfEdges[lid]; ++j) { long eid = JavaRuntime.getLong(curAddr + VID_SIZE_IN_BYTE); - GRAPE_ED_T edata = edataArray.get(eid); + GRAPE_ED_T edata = longTypedArray.get(eid); Long longValue = (Long) edata; outputStream.writeLong(longValue); curAddr += nbrUnitEleSize; @@ -388,11 +404,14 @@ private FFIByteVector generateEdataString( } break; case 1: + PrimitiveTypedArray intTypedArray = + FFITypeFactoryhelper.newPrimitiveTypedArray(edataClass); + intTypedArray.setAddress(edataArray.getAddress()); for (int lid = 0; lid < innerVerticesNum; ++lid) { long curAddr = nbrUnitAddrs[lid]; for (int j = 0; j < numOfEdges[lid]; ++j) { long eid = JavaRuntime.getLong(curAddr + VID_SIZE_IN_BYTE); - GRAPE_ED_T edata = edataArray.get(eid); + GRAPE_ED_T edata = intTypedArray.get(eid); Integer longValue = (Integer) edata; outputStream.writeInt(longValue); curAddr += nbrUnitEleSize; @@ -400,11 +419,14 @@ private FFIByteVector generateEdataString( } break; case 2: + PrimitiveTypedArray doubleTypedArray = + FFITypeFactoryhelper.newPrimitiveTypedArray(edataClass); + doubleTypedArray.setAddress(edataArray.getAddress()); for (int lid = 0; lid < innerVerticesNum; ++lid) { long curAddr = nbrUnitAddrs[lid]; for (int j = 0; j < numOfEdges[lid]; ++j) { long eid = JavaRuntime.getLong(curAddr + VID_SIZE_IN_BYTE); - GRAPE_ED_T edata = edataArray.get(eid); + GRAPE_ED_T edata = doubleTypedArray.get(eid); Double longValue = (Double) edata; outputStream.writeDouble(longValue); curAddr += nbrUnitEleSize; @@ -412,11 +434,14 @@ private FFIByteVector generateEdataString( } break; case 3: + PrimitiveTypedArray floatTypedArray = + FFITypeFactoryhelper.newPrimitiveTypedArray(edataClass); + floatTypedArray.setAddress(edataArray.getAddress()); for (int lid = 0; lid < innerVerticesNum; ++lid) { long curAddr = nbrUnitAddrs[lid]; for (int j = 0; j < numOfEdges[lid]; ++j) { long eid = JavaRuntime.getLong(curAddr + VID_SIZE_IN_BYTE); - GRAPE_ED_T edata = edataArray.get(eid); + GRAPE_ED_T edata = floatTypedArray.get(eid); Float longValue = (Float) edata; outputStream.writeFloat(longValue); curAddr += nbrUnitEleSize; @@ -424,16 +449,31 @@ private FFIByteVector generateEdataString( } break; case 4: + PrimitiveTypedArray stringTypedArray = + FFITypeFactoryhelper.newPrimitiveTypedArray(edataClass); + stringTypedArray.setAddress(edataArray.getAddress()); for (int lid = 0; lid < innerVerticesNum; ++lid) { long curAddr = nbrUnitAddrs[lid]; for (int j = 0; j < numOfEdges[lid]; ++j) { long eid = JavaRuntime.getLong(curAddr + VID_SIZE_IN_BYTE); - GRAPE_ED_T edata = edataArray.get(eid); + GRAPE_ED_T edata = stringTypedArray.get(eid); String longValue = (String) edata; outputStream.writeBytes(longValue); curAddr += nbrUnitEleSize; } } + case 5: + StringTypedArray stringViewTypedArray = FFITypeFactoryhelper.newStringTypedArray(); + stringViewTypedArray.setAddress(edataArray.getAddress()); + for (int lid = 0; lid < innerVerticesNum; ++lid) { + long curAddr = nbrUnitAddrs[lid]; + for (int j = 0; j < numOfEdges[lid]; ++j) { + long eid = JavaRuntime.getLong(curAddr + VID_SIZE_IN_BYTE); + StringView edata = stringViewTypedArray.get(eid); + outputStream.writeBytes(edata); + curAddr += nbrUnitEleSize; + } + } break; default: throw new IllegalStateException("Unexpected edata type: " + edata_t); diff --git a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/serialization/FFIByteVectorOutputStream.java b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/serialization/FFIByteVectorOutputStream.java index c42b89e792fa..8956d8bd87b4 100644 --- a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/serialization/FFIByteVectorOutputStream.java +++ b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/serialization/FFIByteVectorOutputStream.java @@ -15,6 +15,7 @@ */ package com.alibaba.graphscope.serialization; +import com.alibaba.graphscope.ds.StringView; import com.alibaba.graphscope.stdcxx.FFIByteVector; import com.alibaba.graphscope.stdcxx.FFIByteVectorFactory; @@ -274,6 +275,15 @@ public void writeBytes(String s) throws IOException { offset += len; } + public void writeBytes(StringView s) throws IOException { + int len = (int) s.size(); + vector.ensure(offset, len); + for (int i = 0; i < len; i++) { + vector.setRawByte(offset + i, (byte) s.byteAt(i)); + } + offset += len; + } + /** * Writes every character in the string s, to the output stream, in order, two * bytes per character. If s is null, a NullPointerException diff --git a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/AppBaseParser.java b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/AppBaseParser.java index 4359195dd250..0426b0d8fc5d 100644 --- a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/AppBaseParser.java +++ b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/AppBaseParser.java @@ -183,7 +183,9 @@ private static String writableToJava(String typeName) { return "java.lang.Integer"; } else if (typeName.contains("LongWritable")) { return "java.lang.Long"; - } else throw new IllegalStateException("Not recognized writable " + typeName); + } else { + return "com.alibaba.graphscope.ds.StringView"; + } } private static Method getMethod(Class clz) { diff --git a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/FFITypeFactoryhelper.java b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/FFITypeFactoryhelper.java index e881d6eec44d..1e2020cef981 100644 --- a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/FFITypeFactoryhelper.java +++ b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/FFITypeFactoryhelper.java @@ -33,6 +33,7 @@ import com.alibaba.graphscope.ds.GSVertexArray; import com.alibaba.graphscope.ds.PrimitiveTypedArray; import com.alibaba.graphscope.ds.StringTypedArray; +import com.alibaba.graphscope.ds.StringView; import com.alibaba.graphscope.ds.Vertex; import com.alibaba.graphscope.ds.VertexArray; import com.alibaba.graphscope.ds.VertexRange; @@ -80,8 +81,12 @@ public static String javaType2CppType(Class clz) { return "int32_t"; } else if (clz.getName() == Double.class.getName()) { return "double"; + } else if (clz.getName() == String.class.getName()) { + return "std::string"; + } else if (clz.getName() == StringView.class.getName()) { + return "std::string"; } else { - logger.error("Must be one of long, double, integer"); + logger.error("Must be one of long, double, integer, but got: " + clz.getName()); return "null"; } } diff --git a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/JavaClassName.java b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/JavaClassName.java index 803cfdc0a25a..638255a8197b 100644 --- a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/JavaClassName.java +++ b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/JavaClassName.java @@ -17,4 +17,6 @@ public class JavaClassName { public static final String JAVA_FFI_BYTE_STRING = "com.alibaba.fastffi.FFIByteString"; public static final String STRING_VIEW = "com.alibaba.graphscope.ds.StringView"; + + public static final String STD_STRING = "com.alibaba.graphscope.stdcxx.StdString"; } diff --git a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/TypeUtils.java b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/TypeUtils.java index 2156c6814273..be79f0756c01 100644 --- a/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/TypeUtils.java +++ b/analytical_engine/java/grape-jdk/src/main/java/com/alibaba/graphscope/utils/TypeUtils.java @@ -1,5 +1,7 @@ package com.alibaba.graphscope.utils; +import com.alibaba.graphscope.ds.StringView; + public class TypeUtils { public static boolean isPrimitive(Class javaClass) { @@ -29,6 +31,8 @@ public static String primitiveClass2CppStr(Class javaClass, boolean sign) { return "double"; } else if (javaClass.equals(Float.class) || javaClass.equals(float.class)) { return "float"; + } else if (javaClass.equals(StringView.class)) { + return "std::string"; } else { throw new IllegalStateException("Not recognized class " + javaClass.getName()); } diff --git a/analytical_engine/java/grape-runtime/src/main/java/com/alibaba/graphscope/annotation/AnnotationInvoker.java b/analytical_engine/java/grape-runtime/src/main/java/com/alibaba/graphscope/annotation/AnnotationInvoker.java index 2f2d5bc22dfe..e1a6a46fc7da 100644 --- a/analytical_engine/java/grape-runtime/src/main/java/com/alibaba/graphscope/annotation/AnnotationInvoker.java +++ b/analytical_engine/java/grape-runtime/src/main/java/com/alibaba/graphscope/annotation/AnnotationInvoker.java @@ -30,6 +30,7 @@ import static com.alibaba.graphscope.utils.JavaClassName.JAVA_ARROW_PROJECTED_FRAGMENT_GETTER; import static com.alibaba.graphscope.utils.JavaClassName.JAVA_ARROW_PROJECTED_FRAGMENT_MAPPER; import static com.alibaba.graphscope.utils.JavaClassName.LONG; +import static com.alibaba.graphscope.utils.JavaClassName.STD_STRING; import static com.alibaba.graphscope.utils.JavaClassName.STRING; import static com.alibaba.graphscope.utils.JavaClassName.STRING_VIEW; @@ -46,6 +47,7 @@ */ @FFIGenBatch( value = { + @FFIGen(type = "com.alibaba.graphscope.stdcxx.StdString"), @FFIGen(type = "com.alibaba.graphscope.ds.FidPointer"), @FFIGen(type = "com.alibaba.graphscope.ds.DestList"), @FFIGen(type = "com.alibaba.graphscope.stdcxx.CCharPointer"), @@ -142,6 +144,7 @@ @CXXTemplate(cxx = "int64_t", java = "Long"), @CXXTemplate(cxx = "double", java = "Double"), @CXXTemplate(cxx = "int32_t", java = "Integer"), + @CXXTemplate(cxx = "std::string", java = STD_STRING) }), @FFIGen( type = "com.alibaba.graphscope.ds.VertexRange", @@ -1163,6 +1166,25 @@ + ">", "Integer" }), + @CXXTemplate( + cxx = { + CPP_ARROW_PROJECTED_FRAGMENT + + "", + "std::string" + }, + java = { + JAVA_ARROW_PROJECTED_FRAGMENT + + "<" + + LONG + + "," + + LONG + + "," + + STRING_VIEW + + "," + + STRING_VIEW + + ">", + STD_STRING + }), }), @FFIGen( type = "com.alibaba.graphscope.parallel.DefaultMessageManager", diff --git a/analytical_engine/test/app_tests.sh b/analytical_engine/test/app_tests.sh index d6717cd26162..649fb6bd8984 100755 --- a/analytical_engine/test/app_tests.sh +++ b/analytical_engine/test/app_tests.sh @@ -453,6 +453,12 @@ then --edge_input_format_class giraph:com.alibaba.graphscope.example.giraph.format.P2PEdgeInputFormat --vfile "${test_dir}"/p2p-31.v \ --efile "${test_dir}"/p2p-31.e --ipc_socket /tmp/vineyard.sock --lib_path /opt/graphscope/lib/libgrape-jni.so \ --user_app_class com.alibaba.graphscope.example.giraph.SSSP + + echo "Test Giraph app user Customized Writable" + ./giraph_runner --vertex_input_format_class giraph:com.alibaba.graphscope.example.giraph.format.P2PVertexMultipleLongInputFormat \ + --edge_input_format_class giraph:com.alibaba.graphscope.example.giraph.format.P2PEdgeMultipleLongInputFormat --vfile "${test_dir}"/p2p-31.v \ + --efile "${test_dir}"/p2p-31.e --ipc_socket /tmp/vineyard.sock --lib_path /opt/graphscope/lib/libgrape-jni.so \ + --user_app_class com.alibaba.graphscope.example.giraph.MessageAppWithUserWritable fi fi diff --git a/analytical_engine/test/giraph_runner.h b/analytical_engine/test/giraph_runner.h index 9a10f2f0c6de..88eda0c1c553 100644 --- a/analytical_engine/test/giraph_runner.h +++ b/analytical_engine/test/giraph_runner.h @@ -39,6 +39,10 @@ limitations under the License. #include "core/io/property_parser.h" #include "core/java/utils.h" #include "core/loader/arrow_fragment_loader.h" +#include "vineyard/common/util/json.h" + +#include +#include namespace bl = boost::leaf; @@ -46,12 +50,9 @@ namespace gs { using FragmentType = vineyard::ArrowFragment; -using ProjectedFragmentType = - ArrowProjectedFragment; using FragmentLoaderType = ArrowFragmentLoader; -using APP_TYPE = JavaPIEProjectedDefaultApp; // using LOADER_TYPE = grape::GiraphFragmentLoader; void Init(const std::string& params) { @@ -63,6 +64,46 @@ void Init(const std::string& params) { } } +std::pair parse_property_type( + const vineyard::ObjectMeta& metadata) { + vineyard::json json; + metadata.GetKeyValue("schema_json_", json); + LOG(INFO) << "schema_json_: " << json; + std::string vertex_type_name, edge_type_name; + + if (json.contains("types")) { + auto types = json["types"]; + if (types.size() == 2) { + for (auto type : types) { + if (type["label"] == "vertex_label") { + if (type.contains("propertyDefList")) { + auto properties = type["propertyDefList"]; + CHECK_EQ(properties.size(), 1); + auto data_type = properties[0]["data_type"]; + vertex_type_name = data_type.get(); + } else { + LOG(FATAL) << "No propertyDefList found in schema"; + } + } else if (type["label"] == "edge_label") { + if (type.contains("propertyDefList")) { + auto properties = type["propertyDefList"]; + CHECK_EQ(properties.size(), 1); + auto data_type = properties[0]["data_type"]; + edge_type_name = data_type.get(); + } else { + LOG(FATAL) << "No propertyDefList found in schema"; + } + } else { + LOG(FATAL) << "Unknown type label"; + } + } + } + } else { + LOG(FATAL) << "No types found in schema"; + } + return std::make_pair(vertex_type_name, edge_type_name); +} + vineyard::ObjectID LoadGiraphFragment( const grape::CommSpec& comm_spec, const std::string& vfile, const std::string& efile, const std::string& vertex_input_format_class, @@ -75,7 +116,7 @@ vineyard::ObjectID LoadGiraphFragment( graph->retain_oid = false; auto vertex = std::make_shared(); - vertex->label = "label1"; + vertex->label = "vertex_label"; vertex->vid = "0"; vertex->protocol = "file"; vertex->values = vfile; @@ -84,11 +125,11 @@ vineyard::ObjectID LoadGiraphFragment( graph->vertices.push_back(vertex); auto edge = std::make_shared(); - edge->label = "label2"; + edge->label = "edge_label"; auto subLabel = std::make_shared(); - subLabel->src_label = "label1"; + subLabel->src_label = "vertex_label"; subLabel->src_vid = "0"; - subLabel->dst_label = "label1"; + subLabel->dst_label = "vertex_label"; subLabel->dst_vid = "0"; subLabel->protocol = "file"; subLabel->values = efile; @@ -129,6 +170,7 @@ void Query(grape::CommSpec& comm_spec, std::shared_ptr fragment, int query_times) { std::vector query_time(query_times, 0.0); double total_time = 0.0; + using APP_TYPE = JavaPIEProjectedDefaultApp; for (auto i = 0; i < query_times; ++i) { auto app = std::make_shared(); @@ -169,6 +211,20 @@ void Query(grape::CommSpec& comm_spec, std::shared_ptr fragment, VLOG(1) << "Separate time: " << oss.str(); } +template +void ProjectAndQuery(grape::CommSpec& comm_spec, + std::shared_ptr fragment, + const std::string& frag_name, + const std::string& new_params, + const std::string& user_lib_path, int query_times) { + // Project + std::shared_ptr projected_fragment = + ProjectedFragmentType::Project(fragment, 0, 0, 0, 0); + + Query(comm_spec, projected_fragment, new_params, + user_lib_path, query_times); +} + void CreateAndQuery(std::string params) { grape::CommSpec comm_spec; comm_spec.Init(MPI_COMM_WORLD); @@ -221,18 +277,22 @@ void CreateAndQuery(std::string params) { } int query_times = getFromPtree(pt, OPTION_QUERY_TIMES); + vineyard::ObjectMeta metadata; + VINEYARD_CHECK_OK(client.GetMetaData(fragment_id, metadata)); + + // chose different type according to the schema + std::string vertex_data_type, edge_data_type; + std::tie(vertex_data_type, edge_data_type) = parse_property_type(metadata); + std::shared_ptr fragment = std::dynamic_pointer_cast(client.GetObject(fragment_id)); - VLOG(10) << "fid: " << fragment->fid() << "fnum: " << fragment->fnum() << "v label num: " << fragment->vertex_label_num() << "e label num: " << fragment->edge_label_num() << "total v num: " << fragment->GetTotalVerticesNum(); VLOG(1) << "inner vertices: " << fragment->GetInnerVerticesNum(0); - - std::string frag_name = - "gs::ArrowProjectedFragment"; - pt.put("frag_name", frag_name); + VLOG(1) << "vertex_data_type: " << vertex_data_type + << " edge_data_type: " << edge_data_type; std::string jar_name; if (getenv("USER_JAR_PATH")) { @@ -249,19 +309,31 @@ void CreateAndQuery(std::string params) { return; } pt.put("jar_name", jar_name); - - std::stringstream ss; - boost::property_tree::json_parser::write_json(ss, pt); - std::string new_params = ss.str(); - std::string user_lib_path = getFromPtree(pt, OPTION_LIB_PATH); - // Project - std::shared_ptr projected_fragment = - ProjectedFragmentType::Project(fragment, 0, 0, 0, 0); - - Query(comm_spec, projected_fragment, new_params, - user_lib_path, query_times); + if (vertex_data_type == "STRING" && edge_data_type == "STRING") { + std::string frag_name = + "gs::ArrowProjectedFragment"; + pt.put("frag_name", frag_name); + std::stringstream ss; + boost::property_tree::json_parser::write_json(ss, pt); + std::string new_params = ss.str(); + using ProjectedFragmentType = + ArrowProjectedFragment; + ProjectAndQuery( + comm_spec, fragment, frag_name, new_params, user_lib_path, query_times); + } else { + std::string frag_name = + "gs::ArrowProjectedFragment"; + pt.put("frag_name", frag_name); + std::stringstream ss; + boost::property_tree::json_parser::write_json(ss, pt); + std::string new_params = ss.str(); + using ProjectedFragmentType = + ArrowProjectedFragment; + ProjectAndQuery( + comm_spec, fragment, frag_name, new_params, user_lib_path, query_times); + } } void Finalize() { grape::FinalizeMPIComm(); diff --git a/charts/graphscope-store/templates/configmap.yaml b/charts/graphscope-store/templates/configmap.yaml index 40eaa708e844..53f72855e4be 100644 --- a/charts/graphscope-store/templates/configmap.yaml +++ b/charts/graphscope-store/templates/configmap.yaml @@ -73,6 +73,7 @@ data: gaia.rpc.port=60000 gaia.engine.port=60001 + gaia.write.timeout.ms={{ .Values.pegasus.timeout }} ## Secondary config secondary.instance.enabled={{ .Values.secondary.enabled }} diff --git a/coordinator/gscoordinator/coordinator.py b/coordinator/gscoordinator/coordinator.py index 90e855a11808..f4955102d8bf 100644 --- a/coordinator/gscoordinator/coordinator.py +++ b/coordinator/gscoordinator/coordinator.py @@ -24,12 +24,15 @@ import os import signal import sys +import threading from concurrent import futures +import connexion import grpc from graphscope.config import Config from graphscope.proto import coordinator_service_pb2_grpc +from gscoordinator.flex.encoder import JSONEncoder from gscoordinator.monitor import Monitor from gscoordinator.servicer import init_graphscope_one_service_servicer from gscoordinator.utils import GS_GRPC_MAX_MESSAGE_LENGTH @@ -121,6 +124,17 @@ def get_servicer(config: Config): return initializer(config) +def start_http_service(config): + app = connexion.App(__name__, specification_dir="./flex/openapi/") + app.app.json_encoder = JSONEncoder + app.add_api( + "openapi.yaml", + arguments={"title": "GraphScope FLEX HTTP SERVICE API"}, + pythonic_params=True, + ) + app.run(port=config.coordinator.http_port) + + def start_server( coordinator_service_servicer: coordinator_service_pb2_grpc.CoordinatorServiceServicer, config: Config, @@ -144,6 +158,11 @@ def start_server( server.start() + # OpenApi server + httpservice_t = threading.Thread(target=start_http_service, args=(config,)) + httpservice_t.daemon = True + httpservice_t.start() + if config.coordinator.monitor: try: Monitor.startServer(config.coordinator.monitor_port, "127.0.0.1") diff --git a/coordinator/gscoordinator/flex/__init__.py b/coordinator/gscoordinator/flex/__init__.py new file mode 100644 index 000000000000..9a4b5a1c36b9 --- /dev/null +++ b/coordinator/gscoordinator/flex/__init__.py @@ -0,0 +1,17 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2020 Alibaba Group Holding Limited. +# +# 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. +# diff --git a/coordinator/gscoordinator/flex/controllers/__init__.py b/coordinator/gscoordinator/flex/controllers/__init__.py new file mode 100644 index 000000000000..9a4b5a1c36b9 --- /dev/null +++ b/coordinator/gscoordinator/flex/controllers/__init__.py @@ -0,0 +1,17 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2020 Alibaba Group Holding Limited. +# +# 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. +# diff --git a/coordinator/gscoordinator/flex/controllers/alert_controller.py b/coordinator/gscoordinator/flex/controllers/alert_controller.py new file mode 100644 index 000000000000..33cf91a99565 --- /dev/null +++ b/coordinator/gscoordinator/flex/controllers/alert_controller.py @@ -0,0 +1,161 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from gscoordinator.flex.models.create_alert_receiver_request import CreateAlertReceiverRequest # noqa: E501 +from gscoordinator.flex.models.create_alert_rule_request import CreateAlertRuleRequest # noqa: E501 +from gscoordinator.flex.models.error import Error # noqa: E501 +from gscoordinator.flex.models.get_alert_message_response import GetAlertMessageResponse # noqa: E501 +from gscoordinator.flex.models.get_alert_receiver_response import GetAlertReceiverResponse # noqa: E501 +from gscoordinator.flex.models.get_alert_rule_response import GetAlertRuleResponse # noqa: E501 +from gscoordinator.flex.models.update_alert_message_status_request import UpdateAlertMessageStatusRequest # noqa: E501 +from gscoordinator.flex import util + + +def create_alert_receiver(create_alert_receiver_request): # noqa: E501 + """create_alert_receiver + + Create a new alert receiver # noqa: E501 + + :param create_alert_receiver_request: + :type create_alert_receiver_request: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + create_alert_receiver_request = CreateAlertReceiverRequest.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def delete_alert_message_in_batch(message_ids): # noqa: E501 + """delete_alert_message_in_batch + + Delete alert message in batch # noqa: E501 + + :param message_ids: A list of message id separated by comma, e.g. id1,id2,id3 + :type message_ids: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return 'do some magic!' + + +def delete_alert_receiver_by_id(receiver_id): # noqa: E501 + """delete_alert_receiver_by_id + + Delete the alert receiver by ID # noqa: E501 + + :param receiver_id: + :type receiver_id: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return 'do some magic!' + + +def delete_alert_rule_by_id(rule_id): # noqa: E501 + """delete_alert_rule_by_id + + # noqa: E501 + + :param rule_id: + :type rule_id: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return 'do some magic!' + + +def list_alert_messages(alert_type=None, status=None, severity=None, start_time=None, end_time=None, limit=None): # noqa: E501 + """list_alert_messages + + List all alert messages # noqa: E501 + + :param alert_type: + :type alert_type: str + :param status: + :type status: str + :param severity: + :type severity: str + :param start_time: format with \"2023-02-21-11-56-30\" + :type start_time: str + :param end_time: format with \"2023-02-21-11-56-30\" + :type end_time: str + :param limit: + :type limit: int + + :rtype: Union[List[GetAlertMessageResponse], Tuple[List[GetAlertMessageResponse], int], Tuple[List[GetAlertMessageResponse], int, Dict[str, str]] + """ + return 'do some magic!' + + +def list_alert_receivers(): # noqa: E501 + """list_alert_receivers + + List all alert receivers # noqa: E501 + + + :rtype: Union[List[GetAlertReceiverResponse], Tuple[List[GetAlertReceiverResponse], int], Tuple[List[GetAlertReceiverResponse], int, Dict[str, str]] + """ + return 'do some magic!' + + +def list_alert_rules(): # noqa: E501 + """list_alert_rules + + List all alert rules # noqa: E501 + + + :rtype: Union[List[GetAlertRuleResponse], Tuple[List[GetAlertRuleResponse], int], Tuple[List[GetAlertRuleResponse], int, Dict[str, str]] + """ + return 'do some magic!' + + +def update_alert_message_in_batch(update_alert_message_status_request=None): # noqa: E501 + """update_alert_message_in_batch + + Update the message status in batch # noqa: E501 + + :param update_alert_message_status_request: + :type update_alert_message_status_request: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + update_alert_message_status_request = UpdateAlertMessageStatusRequest.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def update_alert_receiver_by_id(receiver_id, create_alert_receiver_request=None): # noqa: E501 + """update_alert_receiver_by_id + + Update alert receiver by ID # noqa: E501 + + :param receiver_id: + :type receiver_id: str + :param create_alert_receiver_request: + :type create_alert_receiver_request: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + create_alert_receiver_request = CreateAlertReceiverRequest.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def update_alert_rule_by_id(rule_id, create_alert_rule_request=None): # noqa: E501 + """update_alert_rule_by_id + + # noqa: E501 + + :param rule_id: + :type rule_id: str + :param create_alert_rule_request: + :type create_alert_rule_request: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + create_alert_rule_request = CreateAlertRuleRequest.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' diff --git a/coordinator/gscoordinator/flex/controllers/data_source_controller.py b/coordinator/gscoordinator/flex/controllers/data_source_controller.py new file mode 100644 index 000000000000..792d6e5a11df --- /dev/null +++ b/coordinator/gscoordinator/flex/controllers/data_source_controller.py @@ -0,0 +1,79 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from gscoordinator.flex.models.error import Error # noqa: E501 +from gscoordinator.flex.models.schema_mapping import SchemaMapping # noqa: E501 +from gscoordinator.flex import util + +from gscoordinator.flex.core import client_wrapper +from gscoordinator.flex.core import handle_api_exception + + +@handle_api_exception() +def bind_datasource_in_batch(graph_id, schema_mapping): # noqa: E501 + """bind_datasource_in_batch + + Bind data sources in batches # noqa: E501 + + :param graph_id: + :type graph_id: str + :param schema_mapping: + :type schema_mapping: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + schema_mapping = SchemaMapping.from_dict(connexion.request.get_json()) # noqa: E501 + return client_wrapper.bind_datasource_in_batch(graph_id, schema_mapping) + + +@handle_api_exception() +def get_datasource_by_id(graph_id): # noqa: E501 + """get_datasource_by_id + + List all data sources # noqa: E501 + + :param graph_id: + :type graph_id: str + + :rtype: Union[SchemaMapping, Tuple[SchemaMapping, int], Tuple[SchemaMapping, int, Dict[str, str]] + """ + return client_wrapper.get_datasource_by_id(graph_id) + + +@handle_api_exception() +def unbind_edge_datasource(graph_id, type_name, source_vertex_type, destination_vertex_type): # noqa: E501 + """unbind_edge_datasource + + Unbind datas ource on an edge type # noqa: E501 + + :param graph_id: + :type graph_id: str + :param type_name: + :type type_name: str + :param source_vertex_type: + :type source_vertex_type: str + :param destination_vertex_type: + :type destination_vertex_type: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return client_wrapper.unbind_edge_datasource(graph_id, type_name, source_vertex_type, destination_vertex_type) + + +@handle_api_exception() +def unbind_vertex_datasource(graph_id, type_name): # noqa: E501 + """unbind_vertex_datasource + + Unbind data source on a vertex type # noqa: E501 + + :param graph_id: + :type graph_id: str + :param type_name: + :type type_name: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return client_wrapper.unbind_vertex_datasource(graph_id, type_name) diff --git a/coordinator/gscoordinator/flex/controllers/deployment_controller.py b/coordinator/gscoordinator/flex/controllers/deployment_controller.py new file mode 100644 index 000000000000..74ffb8108830 --- /dev/null +++ b/coordinator/gscoordinator/flex/controllers/deployment_controller.py @@ -0,0 +1,35 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from gscoordinator.flex.models.error import Error # noqa: E501 +from gscoordinator.flex.models.running_deployment_info import RunningDeploymentInfo # noqa: E501 +from gscoordinator.flex.models.running_deployment_status import RunningDeploymentStatus # noqa: E501 +from gscoordinator.flex import util + +from gscoordinator.flex.core import client_wrapper +from gscoordinator.flex.core import handle_api_exception + + +@handle_api_exception() +def get_deployment_info(): # noqa: E501 + """get_deployment_info + + Deployment information # noqa: E501 + + + :rtype: Union[RunningDeploymentInfo, Tuple[RunningDeploymentInfo, int], Tuple[RunningDeploymentInfo, int, Dict[str, str]] + """ + return client_wrapper.get_deployment_info() + + +def get_deployment_status(): # noqa: E501 + """get_deployment_status + + Deployment status # noqa: E501 + + + :rtype: Union[RunningDeploymentStatus, Tuple[RunningDeploymentStatus, int], Tuple[RunningDeploymentStatus, int, Dict[str, str]] + """ + return client_wrapper.get_deployment_status() diff --git a/coordinator/gscoordinator/flex/controllers/graph_controller.py b/coordinator/gscoordinator/flex/controllers/graph_controller.py new file mode 100644 index 000000000000..717c5754ceb5 --- /dev/null +++ b/coordinator/gscoordinator/flex/controllers/graph_controller.py @@ -0,0 +1,172 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from gscoordinator.flex.models.create_edge_type import CreateEdgeType # noqa: E501 +from gscoordinator.flex.models.create_graph_request import CreateGraphRequest # noqa: E501 +from gscoordinator.flex.models.create_graph_response import CreateGraphResponse # noqa: E501 +from gscoordinator.flex.models.create_graph_schema_request import CreateGraphSchemaRequest # noqa: E501 +from gscoordinator.flex.models.create_vertex_type import CreateVertexType # noqa: E501 +from gscoordinator.flex.models.error import Error # noqa: E501 +from gscoordinator.flex.models.get_graph_response import GetGraphResponse # noqa: E501 +from gscoordinator.flex.models.get_graph_schema_response import GetGraphSchemaResponse # noqa: E501 +from gscoordinator.flex import util + +from gscoordinator.flex.core import client_wrapper +from gscoordinator.flex.core import handle_api_exception + + +def create_edge_type(graph_id, create_edge_type=None): # noqa: E501 + """create_edge_type + + Create a edge type # noqa: E501 + + :param graph_id: + :type graph_id: str + :param create_edge_type: + :type create_edge_type: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + create_edge_type = CreateEdgeType.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +@handle_api_exception() +def create_graph(create_graph_request): # noqa: E501 + """create_graph + + Create a new graph # noqa: E501 + + :param create_graph_request: + :type create_graph_request: dict | bytes + + :rtype: Union[CreateGraphResponse, Tuple[CreateGraphResponse, int], Tuple[CreateGraphResponse, int, Dict[str, str]] + """ + if connexion.request.is_json: + create_graph_request = CreateGraphRequest.from_dict(connexion.request.get_json()) # noqa: E501 + return client_wrapper.create_graph(create_graph_request) + + +def create_vertex_type(graph_id, create_vertex_type): # noqa: E501 + """create_vertex_type + + Create a vertex type # noqa: E501 + + :param graph_id: + :type graph_id: str + :param create_vertex_type: + :type create_vertex_type: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + create_vertex_type = CreateVertexType.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +def delete_edge_type_by_name(graph_id, type_name, source_vertex_type, destination_vertex_type): # noqa: E501 + """delete_edge_type_by_name + + Delete edge type by name # noqa: E501 + + :param graph_id: + :type graph_id: str + :param type_name: + :type type_name: str + :param source_vertex_type: + :type source_vertex_type: str + :param destination_vertex_type: + :type destination_vertex_type: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return 'do some magic!' + + +@handle_api_exception() +def delete_graph_by_id(graph_id): # noqa: E501 + """delete_graph_by_id + + Delete graph by ID # noqa: E501 + + :param graph_id: + :type graph_id: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return client_wrapper.delete_graph_by_id(graph_id) + + +def delete_vertex_type_by_name(graph_id, type_name): # noqa: E501 + """delete_vertex_type_by_name + + Delete vertex type by name # noqa: E501 + + :param graph_id: + :type graph_id: str + :param type_name: + :type type_name: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return 'do some magic!' + + +@handle_api_exception() +def get_graph_by_id(graph_id): # noqa: E501 + """get_graph_by_id + + Get graph by ID # noqa: E501 + + :param graph_id: + :type graph_id: str + + :rtype: Union[GetGraphResponse, Tuple[GetGraphResponse, int], Tuple[GetGraphResponse, int, Dict[str, str]] + """ + return client_wrapper.get_graph_by_id(graph_id) + + +@handle_api_exception() +def get_schema_by_id(graph_id): # noqa: E501 + """get_schema_by_id + + Get graph schema by ID # noqa: E501 + + :param graph_id: + :type graph_id: str + + :rtype: Union[GetGraphSchemaResponse, Tuple[GetGraphSchemaResponse, int], Tuple[GetGraphSchemaResponse, int, Dict[str, str]] + """ + return client_wrapper.get_schema_by_id(graph_id) + + +def import_schema_by_id(graph_id, create_graph_schema_request): # noqa: E501 + """import_schema_by_id + + Import graph schema # noqa: E501 + + :param graph_id: + :type graph_id: str + :param create_graph_schema_request: + :type create_graph_schema_request: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + create_graph_schema_request = CreateGraphSchemaRequest.from_dict(connexion.request.get_json()) # noqa: E501 + return 'do some magic!' + + +@handle_api_exception() +def list_graphs(): # noqa: E501 + """list_graphs + + List all graphs # noqa: E501 + + + :rtype: Union[List[GetGraphResponse], Tuple[List[GetGraphResponse], int], Tuple[List[GetGraphResponse], int, Dict[str, str]] + """ + return client_wrapper.list_graphs() diff --git a/coordinator/gscoordinator/flex/controllers/job_controller.py b/coordinator/gscoordinator/flex/controllers/job_controller.py new file mode 100644 index 000000000000..d520b118658d --- /dev/null +++ b/coordinator/gscoordinator/flex/controllers/job_controller.py @@ -0,0 +1,85 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from gscoordinator.flex.models.create_dataloading_job_response import CreateDataloadingJobResponse # noqa: E501 +from gscoordinator.flex.models.dataloading_job_config import DataloadingJobConfig # noqa: E501 +from gscoordinator.flex.models.error import Error # noqa: E501 +from gscoordinator.flex.models.job_status import JobStatus # noqa: E501 +from gscoordinator.flex import util + +from gscoordinator.flex.core import client_wrapper +from gscoordinator.flex.core import handle_api_exception + + +@handle_api_exception() +def delete_job_by_id(job_id): # noqa: E501 + """delete_job_by_id + + Delete job by ID # noqa: E501 + + :param job_id: + :type job_id: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return client_wrapper.delete_job_by_id(job_id) + + +@handle_api_exception() +def get_dataloading_job_config(graph_id): # noqa: E501 + """get_dataloading_job_config + + Get the data loading configuration # noqa: E501 + + :param graph_id: + :type graph_id: str + + :rtype: Union[DataloadingJobConfig, Tuple[DataloadingJobConfig, int], Tuple[DataloadingJobConfig, int, Dict[str, str]] + """ + return client_wrapper.get_dataloading_job_config(graph_id) + + +@handle_api_exception() +def get_job_by_id(job_id): # noqa: E501 + """get_job_by_id + + Get job status by ID # noqa: E501 + + :param job_id: + :type job_id: str + + :rtype: Union[JobStatus, Tuple[JobStatus, int], Tuple[JobStatus, int, Dict[str, str]] + """ + return client_wrapper.get_job_by_id(job_id) + + +@handle_api_exception() +def list_jobs(): # noqa: E501 + """list_jobs + + List all jobs # noqa: E501 + + + :rtype: Union[List[JobStatus], Tuple[List[JobStatus], int], Tuple[List[JobStatus], int, Dict[str, str]] + """ + return client_wrapper.list_jobs() + + +@handle_api_exception() +def submit_dataloading_job(graph_id, dataloading_job_config): # noqa: E501 + """submit_dataloading_job + + Submit a dataloading job # noqa: E501 + + :param graph_id: + :type graph_id: str + :param dataloading_job_config: + :type dataloading_job_config: dict | bytes + + :rtype: Union[CreateDataloadingJobResponse, Tuple[CreateDataloadingJobResponse, int], Tuple[CreateDataloadingJobResponse, int, Dict[str, str]] + """ + if connexion.request.is_json: + dataloading_job_config = DataloadingJobConfig.from_dict(connexion.request.get_json()) # noqa: E501 + return client_wrapper.submit_dataloading_job(graph_id, dataloading_job_config) diff --git a/flex/coordinator/gs_flex_coordinator/controllers/security_controller.py b/coordinator/gscoordinator/flex/controllers/security_controller.py similarity index 100% rename from flex/coordinator/gs_flex_coordinator/controllers/security_controller.py rename to coordinator/gscoordinator/flex/controllers/security_controller.py diff --git a/coordinator/gscoordinator/flex/controllers/service_controller.py b/coordinator/gscoordinator/flex/controllers/service_controller.py new file mode 100644 index 000000000000..d37fae8bb9c7 --- /dev/null +++ b/coordinator/gscoordinator/flex/controllers/service_controller.py @@ -0,0 +1,77 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from gscoordinator.flex.models.error import Error # noqa: E501 +from gscoordinator.flex.models.service_status import ServiceStatus # noqa: E501 +from gscoordinator.flex.models.start_service_request import StartServiceRequest # noqa: E501 +from gscoordinator.flex import util + +from gscoordinator.flex.core import client_wrapper +from gscoordinator.flex.core import handle_api_exception + + +def get_service_status_by_id(graph_id): # noqa: E501 + """get_service_status_by_id + + Get service status by graph ID # noqa: E501 + + :param graph_id: + :type graph_id: str + + :rtype: Union[ServiceStatus, Tuple[ServiceStatus, int], Tuple[ServiceStatus, int, Dict[str, str]] + """ + return client_wrapper.get_service_status_by_id(graph_id) + + +@handle_api_exception() +def list_service_status(): # noqa: E501 + """list_service_status + + List all service status # noqa: E501 + + + :rtype: Union[List[ServiceStatus], Tuple[List[ServiceStatus], int], Tuple[List[ServiceStatus], int, Dict[str, str]] + """ + return client_wrapper.list_service_status() + + +@handle_api_exception() +def restart_service(): # noqa: E501 + """restart_service + + Restart current service # noqa: E501 + + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return client_wrapper.restart_service() + + +@handle_api_exception() +def start_service(start_service_request=None): # noqa: E501 + """start_service + + Start service # noqa: E501 + + :param start_service_request: + :type start_service_request: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + start_service_request = StartServiceRequest.from_dict(connexion.request.get_json()) # noqa: E501 + return client_wrapper.start_service(start_service_request) + + +@handle_api_exception() +def stop_service(): # noqa: E501 + """stop_service + + Stop current service # noqa: E501 + + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return client_wrapper.stop_service() diff --git a/coordinator/gscoordinator/flex/controllers/stored_procedure_controller.py b/coordinator/gscoordinator/flex/controllers/stored_procedure_controller.py new file mode 100644 index 000000000000..9410963119af --- /dev/null +++ b/coordinator/gscoordinator/flex/controllers/stored_procedure_controller.py @@ -0,0 +1,98 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from gscoordinator.flex.models.create_stored_proc_request import CreateStoredProcRequest # noqa: E501 +from gscoordinator.flex.models.create_stored_proc_response import CreateStoredProcResponse # noqa: E501 +from gscoordinator.flex.models.error import Error # noqa: E501 +from gscoordinator.flex.models.get_stored_proc_response import GetStoredProcResponse # noqa: E501 +from gscoordinator.flex.models.update_stored_proc_request import UpdateStoredProcRequest # noqa: E501 +from gscoordinator.flex import util + +from gscoordinator.flex.core import client_wrapper +from gscoordinator.flex.core import handle_api_exception + + +@handle_api_exception() +def create_stored_procedure(graph_id, create_stored_proc_request): # noqa: E501 + """create_stored_procedure + + Create a new stored procedure on a certain graph # noqa: E501 + + :param graph_id: + :type graph_id: str + :param create_stored_proc_request: + :type create_stored_proc_request: dict | bytes + + :rtype: Union[CreateStoredProcResponse, Tuple[CreateStoredProcResponse, int], Tuple[CreateStoredProcResponse, int, Dict[str, str]] + """ + if connexion.request.is_json: + create_stored_proc_request = CreateStoredProcRequest.from_dict(connexion.request.get_json()) # noqa: E501 + return client_wrapper.create_stored_procedure(graph_id, create_stored_proc_request) + + +@handle_api_exception() +def delete_stored_procedure_by_id(graph_id, stored_procedure_id): # noqa: E501 + """delete_stored_procedure_by_id + + Delete a stored procedure by ID # noqa: E501 + + :param graph_id: + :type graph_id: str + :param stored_procedure_id: + :type stored_procedure_id: str + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + return client_wrapper.delete_stored_procedure_by_id(graph_id, stored_procedure_id) + + +@handle_api_exception() +def get_stored_procedure_by_id(graph_id, stored_procedure_id): # noqa: E501 + """get_stored_procedure_by_id + + Get a stored procedure by ID # noqa: E501 + + :param graph_id: + :type graph_id: str + :param stored_procedure_id: + :type stored_procedure_id: str + + :rtype: Union[GetStoredProcResponse, Tuple[GetStoredProcResponse, int], Tuple[GetStoredProcResponse, int, Dict[str, str]] + """ + return client_wrapper.get_stored_procedure_by_id(graph_id, stored_procedure_id) + + +@handle_api_exception() +def list_stored_procedures(graph_id): # noqa: E501 + """list_stored_procedures + + List all stored procedures on a certain graph # noqa: E501 + + :param graph_id: + :type graph_id: str + + :rtype: Union[List[GetStoredProcResponse], Tuple[List[GetStoredProcResponse], int], Tuple[List[GetStoredProcResponse], int, Dict[str, str]] + """ + return client_wrapper.list_stored_procedures(graph_id) + + +@handle_api_exception() +def update_stored_procedure_by_id(graph_id, stored_procedure_id, update_stored_proc_request=None): # noqa: E501 + """update_stored_procedure_by_id + + Update a stored procedure by ID # noqa: E501 + + :param graph_id: + :type graph_id: str + :param stored_procedure_id: + :type stored_procedure_id: str + :param update_stored_proc_request: + :type update_stored_proc_request: dict | bytes + + :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] + """ + if connexion.request.is_json: + update_stored_proc_request = UpdateStoredProcRequest.from_dict(connexion.request.get_json()) # noqa: E501 + return client_wrapper.update_stored_procedure_by_id(graph_id, stored_procedure_id, update_stored_proc_request) diff --git a/coordinator/gscoordinator/flex/controllers/utils_controller.py b/coordinator/gscoordinator/flex/controllers/utils_controller.py new file mode 100644 index 000000000000..731bdb5f8645 --- /dev/null +++ b/coordinator/gscoordinator/flex/controllers/utils_controller.py @@ -0,0 +1,25 @@ +import connexion +from typing import Dict +from typing import Tuple +from typing import Union + +from gscoordinator.flex.models.error import Error # noqa: E501 +from gscoordinator.flex.models.upload_file_response import UploadFileResponse # noqa: E501 +from gscoordinator.flex import util + +from gscoordinator.flex.core import client_wrapper +from gscoordinator.flex.core import handle_api_exception + + +@handle_api_exception() +def upload_file(filestorage=None): # noqa: E501 + """upload_file + + # noqa: E501 + + :param filestorage: + :type filestorage: str + + :rtype: Union[UploadFileResponse, Tuple[UploadFileResponse, int], Tuple[UploadFileResponse, int, Dict[str, str]] + """ + return client_wrapper.upload_file(filestorage) diff --git a/flex/coordinator/gs_flex_coordinator/core/__init__.py b/coordinator/gscoordinator/flex/core/__init__.py similarity index 75% rename from flex/coordinator/gs_flex_coordinator/core/__init__.py rename to coordinator/gscoordinator/flex/core/__init__.py index b86cee8549e1..571f62592452 100644 --- a/flex/coordinator/gs_flex_coordinator/core/__init__.py +++ b/coordinator/gscoordinator/flex/core/__init__.py @@ -17,11 +17,15 @@ # import logging +import warnings + +# Disable warnings +warnings.filterwarnings("ignore", category=Warning) logging.basicConfig( format="%(asctime)s [%(levelname)s][%(module)s:%(lineno)d]: %(message)s", level=logging.INFO, ) -from gs_flex_coordinator.core.client_wrapper import client_wrapper -from gs_flex_coordinator.core.utils import handle_api_exception +from gscoordinator.flex.core.client_wrapper import client_wrapper # noqa: F401, E402 +from gscoordinator.flex.core.utils import handle_api_exception # noqa: F401, E402 diff --git a/flex/coordinator/gs_flex_coordinator/core/alert/__init__.py b/coordinator/gscoordinator/flex/core/alert/__init__.py similarity index 90% rename from flex/coordinator/gs_flex_coordinator/core/alert/__init__.py rename to coordinator/gscoordinator/flex/core/alert/__init__.py index 47d9375d1932..411f56079e38 100644 --- a/flex/coordinator/gs_flex_coordinator/core/alert/__init__.py +++ b/coordinator/gscoordinator/flex/core/alert/__init__.py @@ -16,4 +16,4 @@ # limitations under the License. # -from gs_flex_coordinator.core.alert.alert_manager import alert_manager +from gscoordinator.flex.core.alert.alert_manager import alert_manager diff --git a/flex/coordinator/gs_flex_coordinator/core/alert/alert_manager.py b/coordinator/gscoordinator/flex/core/alert/alert_manager.py similarity index 90% rename from flex/coordinator/gs_flex_coordinator/core/alert/alert_manager.py rename to coordinator/gscoordinator/flex/core/alert/alert_manager.py index 510f8a899f3d..f527d4d104de 100644 --- a/flex/coordinator/gs_flex_coordinator/core/alert/alert_manager.py +++ b/coordinator/gscoordinator/flex/core/alert/alert_manager.py @@ -20,17 +20,19 @@ import logging import os import pickle -from typing import List, Union +from typing import List +from typing import Union -from gs_flex_coordinator.core.alert.alert_receiver import DingTalkReceiver -from gs_flex_coordinator.core.alert.builtin_rules import \ - init_builtin_alert_rules -from gs_flex_coordinator.core.alert.message_collector import \ - AlertMessageCollector -from gs_flex_coordinator.core.config import ALERT_WORKSPACE -from gs_flex_coordinator.core.scheduler import schedule -from gs_flex_coordinator.core.utils import decode_datetimestr, encode_datetime -from gs_flex_coordinator.models import AlertMessage, AlertReceiver, AlertRule +from gscoordinator.flex.core.alert.alert_receiver import DingTalkReceiver +from gscoordinator.flex.core.alert.builtin_rules import init_builtin_alert_rules +from gscoordinator.flex.core.alert.message_collector import AlertMessageCollector +from gscoordinator.flex.core.config import ALERT_WORKSPACE +from gscoordinator.flex.core.scheduler import schedule +from gscoordinator.flex.core.utils import decode_datetimestr +from gscoordinator.flex.core.utils import encode_datetime +from gscoordinator.flex.models import AlertMessage +from gscoordinator.flex.models import AlertReceiver +from gscoordinator.flex.models import AlertRule class AlertManager(object): @@ -146,7 +148,10 @@ def list_alert_messages( return rlt def update_alert_messages( - self, messages: List[AlertMessage], batch_status: str, batch_delete: bool + self, + messages: List[AlertMessage], + batch_status: str, + batch_delete: bool, ): for message in messages: date = decode_datetimestr(message.trigger_time) diff --git a/flex/coordinator/gs_flex_coordinator/core/alert/alert_message.py b/coordinator/gscoordinator/flex/core/alert/alert_message.py similarity index 97% rename from flex/coordinator/gs_flex_coordinator/core/alert/alert_message.py rename to coordinator/gscoordinator/flex/core/alert/alert_message.py index 95da5e91de35..2022ebd3d31c 100644 --- a/flex/coordinator/gs_flex_coordinator/core/alert/alert_message.py +++ b/coordinator/gscoordinator/flex/core/alert/alert_message.py @@ -18,7 +18,7 @@ import datetime -from gs_flex_coordinator.core.utils import encode_datetime +from gscoordinator.flex.core.utils import encode_datetime class AlertMessage(object): diff --git a/flex/coordinator/gs_flex_coordinator/core/alert/alert_receiver.py b/coordinator/gscoordinator/flex/core/alert/alert_receiver.py similarity index 95% rename from flex/coordinator/gs_flex_coordinator/core/alert/alert_receiver.py rename to coordinator/gscoordinator/flex/core/alert/alert_receiver.py index 1e066495e84f..b4430b8385c3 100644 --- a/flex/coordinator/gs_flex_coordinator/core/alert/alert_receiver.py +++ b/coordinator/gscoordinator/flex/core/alert/alert_receiver.py @@ -21,9 +21,9 @@ import requests -from gs_flex_coordinator.core.alert.alert_message import AlertMessage -from gs_flex_coordinator.core.config import INSTANCE_NAME -from gs_flex_coordinator.core.utils import random_string +from gscoordinator.flex.core.alert.alert_message import AlertMessage +from gscoordinator.flex.core.config import INSTANCE_NAME +from gscoordinator.flex.core.utils import random_string class DingTalkReceiver(object): diff --git a/flex/coordinator/gs_flex_coordinator/core/alert/alert_rule.py b/coordinator/gscoordinator/flex/core/alert/alert_rule.py similarity index 95% rename from flex/coordinator/gs_flex_coordinator/core/alert/alert_rule.py rename to coordinator/gscoordinator/flex/core/alert/alert_rule.py index b71fc94a87b7..fcdd0c2ea7fa 100644 --- a/flex/coordinator/gs_flex_coordinator/core/alert/alert_rule.py +++ b/coordinator/gscoordinator/flex/core/alert/alert_rule.py @@ -18,10 +18,12 @@ import datetime import logging -from abc import ABCMeta, abstractmethod +from abc import ABCMeta +from abc import abstractmethod -from gs_flex_coordinator.core.alert.alert_message import AlertMessage -from gs_flex_coordinator.core.scheduler import cancel_job, schedule +from gscoordinator.flex.core.alert.alert_message import AlertMessage +from gscoordinator.flex.core.scheduler import cancel_job +from gscoordinator.flex.core.scheduler import schedule class AlertRule(metaclass=ABCMeta): diff --git a/flex/coordinator/gs_flex_coordinator/core/alert/builtin_rules.py b/coordinator/gscoordinator/flex/core/alert/builtin_rules.py similarity index 93% rename from flex/coordinator/gs_flex_coordinator/core/alert/builtin_rules.py rename to coordinator/gscoordinator/flex/core/alert/builtin_rules.py index 6a981aeaf666..b45ada8fc329 100644 --- a/flex/coordinator/gs_flex_coordinator/core/alert/builtin_rules.py +++ b/coordinator/gscoordinator/flex/core/alert/builtin_rules.py @@ -23,11 +23,11 @@ import psutil from gremlin_python.driver.client import Client -from gs_flex_coordinator.core import client_wrapper -from gs_flex_coordinator.core.alert.alert_rule import AlertRule -from gs_flex_coordinator.core.alert.message_collector import \ - AlertMessageCollector -from gs_flex_coordinator.core.config import CLUSTER_TYPE, SOLUTION +from gscoordinator.flex.core import client_wrapper +from gscoordinator.flex.core.alert.alert_rule import AlertRule +from gscoordinator.flex.core.alert.message_collector import AlertMessageCollector +from gscoordinator.flex.core.config import CLUSTER_TYPE +from gscoordinator.flex.core.config import SOLUTION class HighDiskUtilizationAlert(AlertRule): diff --git a/flex/coordinator/gs_flex_coordinator/core/alert/message_collector.py b/coordinator/gscoordinator/flex/core/alert/message_collector.py similarity index 93% rename from flex/coordinator/gs_flex_coordinator/core/alert/message_collector.py rename to coordinator/gscoordinator/flex/core/alert/message_collector.py index 14547bd65631..a6a990db4f10 100644 --- a/flex/coordinator/gs_flex_coordinator/core/alert/message_collector.py +++ b/coordinator/gscoordinator/flex/core/alert/message_collector.py @@ -21,10 +21,11 @@ import os import pickle -from gs_flex_coordinator.core.alert.alert_message import AlertMessage -from gs_flex_coordinator.core.config import ALERT_WORKSPACE -from gs_flex_coordinator.core.scheduler import cancel_job, schedule -from gs_flex_coordinator.core.utils import decode_datetimestr +from gscoordinator.flex.core.alert.alert_message import AlertMessage +from gscoordinator.flex.core.config import ALERT_WORKSPACE +from gscoordinator.flex.core.scheduler import cancel_job +from gscoordinator.flex.core.scheduler import schedule +from gscoordinator.flex.core.utils import decode_datetimestr class OneDayAlertMessageCollector(object): @@ -59,7 +60,9 @@ def _pickle_messages_impl(self): self.dump_to_disk() except Exception as e: logging.warn( - "Failed to dump alert message on date %s: %s", str(self._date), str(e) + "Failed to dump alert message on date %s: %s", + str(self._date), + str(e), ) def _try_to_recover_from_disk(self): @@ -109,7 +112,8 @@ def clean(self): cancel_job(self._pickle_messages_job, delete_scheduler=True) self._pickle_messages_job = None logging.info( - "%s: current alert message collector cleaned", str(self._date) + "%s: current alert message collector cleaned", + str(self._date), ) except: # noqa: E722, B110 pass diff --git a/coordinator/gscoordinator/flex/core/client_wrapper.py b/coordinator/gscoordinator/flex/core/client_wrapper.py new file mode 100644 index 000000000000..424af453cfde --- /dev/null +++ b/coordinator/gscoordinator/flex/core/client_wrapper.py @@ -0,0 +1,342 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2024 Alibaba Group Holding Limited. +# +# 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. +# + +import itertools +import logging +import os +import socket +import threading +from typing import List + +import psutil + +from gscoordinator.flex.core.config import CLUSTER_TYPE +from gscoordinator.flex.core.config import CREATION_TIME +from gscoordinator.flex.core.config import DATASET_WORKSPACE +from gscoordinator.flex.core.config import ENGINE_TYPE +from gscoordinator.flex.core.config import FRONTEND_TYPE +from gscoordinator.flex.core.config import INSTANCE_NAME +from gscoordinator.flex.core.config import SOLUTION +from gscoordinator.flex.core.config import STORAGE_TYPE +from gscoordinator.flex.core.datasource import DataSourceManager +from gscoordinator.flex.core.insight import init_groot_client +from gscoordinator.flex.core.interactive import init_hqps_client +from gscoordinator.flex.core.utils import encode_datetime +from gscoordinator.flex.models import CreateDataloadingJobResponse +from gscoordinator.flex.models import CreateEdgeType +from gscoordinator.flex.models import CreateGraphRequest +from gscoordinator.flex.models import CreateGraphResponse +from gscoordinator.flex.models import CreateStoredProcRequest +from gscoordinator.flex.models import CreateStoredProcResponse +from gscoordinator.flex.models import CreateVertexType +from gscoordinator.flex.models import DataloadingJobConfig +from gscoordinator.flex.models import GetGraphResponse +from gscoordinator.flex.models import GetGraphSchemaResponse +from gscoordinator.flex.models import GetStoredProcResponse +from gscoordinator.flex.models import JobStatus +from gscoordinator.flex.models import RunningDeploymentInfo +from gscoordinator.flex.models import RunningDeploymentStatus +from gscoordinator.flex.models import SchemaMapping +from gscoordinator.flex.models import ServiceStatus +from gscoordinator.flex.models import StartServiceRequest +from gscoordinator.flex.models import UpdateStoredProcRequest +from gscoordinator.flex.models import UploadFileResponse +from gscoordinator.version import __version__ + + +class ClientWrapper(object): + """Wrapper of client that interacts with engine""" + + def __init__(self): + # lock to protect the service + self._lock = threading.RLock() + # initialize specific client + self._client = self._initialize_client() + # data source management + self._datasource_manager = DataSourceManager() + + def _initialize_client(self): + service_initializer = { + "INTERACTIVE": init_hqps_client, + "GRAPHSCOPE_INSIGHT": init_groot_client, + } + initializer = service_initializer.get(SOLUTION) + if initializer is None: + logging.warn(f"Client initializer of {SOLUTION} not found.") + return None + return initializer() + + def list_graphs(self) -> List[GetGraphResponse]: + graphs = self._client.list_graphs() + # fix ValueError: Invalid value for `long_text`, must not be `None` + for g in graphs: + for item in itertools.chain( + g["schema"]["vertex_types"], g["schema"]["edge_types"] + ): + if "properties" in item: + for p in item["properties"]: + if ( + "string" in p["property_type"] + and "long_text" in p["property_type"]["string"] + ): + p["property_type"]["string"]["long_text"] = "" + # transfer + rlts = [GetGraphResponse.from_dict(g) for g in graphs] + return rlts + + def get_schema_by_id(self, graph_id: str) -> GetGraphSchemaResponse: + schema = self._client.get_schema_by_id(graph_id) + # fix ValueError: Invalid value for `long_text`, must not be `None` + for item in itertools.chain(schema["vertex_types"], schema["edge_types"]): + if "properties" in item: + for p in item["properties"]: + if ( + "string" in p["property_type"] + and "long_text" in p["property_type"]["string"] + ): + p["property_type"]["string"]["long_text"] = "" + return GetGraphSchemaResponse.from_dict(schema) + + def create_graph(self, graph: CreateGraphRequest) -> CreateGraphResponse: + # there are some tricks here, since schema is a keyword of openapi + # specification, so it will be converted into the _schema field. + graph_dict = graph.to_dict() + if "_schema" in graph_dict: + graph_dict["schema"] = graph_dict.pop("_schema") + response = self._client.create_graph(graph_dict) + return CreateGraphResponse.from_dict(response) + + def create_vertex_type(self, graph_id: str, vtype: CreateVertexType) -> str: + self._client.create_vertex_type(graph_id, vtype.to_dict()) + return "Create vertex type successfully" + # if SOLUTION == "GRAPHSCOPE_INSIGHT": + # graph_name = INSTANCE_NAME + # vtype_dict = vtype.to_dict() + # rlt = self._client.create_vertex_type(graph_name, vtype_dict) + # # self._graphs_info[graph_name].update_time = get_current_time() + # return rlt + + def create_edge_type(self, graph_id: str, etype: CreateEdgeType) -> str: + self._client.create_edge_type(graph_id, etype.to_dict()) + return "Create edge type successfully" + + def delete_vertex_type_by_name(self, graph_id: str, type_name: str) -> str: + self._client.delete_vertex_type_by_name(graph_id, type_name) + # remove data source mapping + self.unbind_vertex_datasource(graph_id, type_name) + return f"Delete vertex type {type_name} successfully" + + def delete_edge_type_by_name( + self, + graph_id: str, + type_name: str, + source_vertex_type: str, + destination_vertex_type: str, + ) -> str: + self._client.delete_edge_type_by_name( + graph_id, type_name, source_vertex_type, destination_vertex_type + ) + # remove data source mapping + self.unbind_edge_datasource( + graph_id, type_name, source_vertex_type, destination_vertex_type + ) + elabel = f"({source_vertex_type})->[{type_name}]->({destination_vertex_type})" + return f"Delete edge type {elabel} successfully" + + def delete_graph_by_id(self, graph_id: str) -> str: + rlt = self._client.delete_graph_by_id(graph_id) + # remove data source mapping + self._datasource_manager.delete_datasource_by_id(graph_id) + return rlt + + def get_graph_by_id(self, graph_id: str) -> GetGraphResponse: + g = self._client.get_graph_by_id(graph_id) + for item in itertools.chain( + g["schema"]["vertex_types"], g["schema"]["edge_types"] + ): + if "properties" in item: + for p in item["properties"]: + if ( + "string" in p["property_type"] + and "long_text" in p["property_type"]["string"] + ): + p["property_type"]["string"]["long_text"] = "" + return GetGraphResponse.from_dict(g) + + def create_stored_procedure( + self, graph_id: str, stored_procedure: CreateStoredProcRequest + ) -> CreateStoredProcResponse: + stored_procedure_dict = stored_procedure.to_dict() + response = self._client.create_stored_procedure(graph_id, stored_procedure_dict) + return CreateStoredProcResponse.from_dict(response) + + def list_stored_procedures(self, graph_id: str) -> List[GetStoredProcResponse]: + stored_procedures = self._client.list_stored_procedures(graph_id) + # transfer + rlt = [GetStoredProcResponse.from_dict(p) for p in stored_procedures] + return rlt + + def update_stored_procedure_by_id( + self, + graph_id: str, + stored_procedure_id: str, + stored_procedure: UpdateStoredProcRequest, + ) -> str: + stored_procedure_dict = stored_procedure.to_dict() + return self._client.update_stored_procedure_by_id( + graph_id, stored_procedure_id, stored_procedure_dict + ) + + def delete_stored_procedure_by_id( + self, graph_id: str, stored_procedure_id: str + ) -> str: + return self._client.delete_stored_procedure_by_id(graph_id, stored_procedure_id) + + def get_stored_procedure_by_id( + self, graph_id: str, stored_procedure_id: str + ) -> GetStoredProcResponse: + return GetStoredProcResponse.from_dict( + self._client.get_stored_procedure_by_id(graph_id, stored_procedure_id) + ) + + def get_deployment_info(self) -> RunningDeploymentInfo: + info = { + "instance_name": INSTANCE_NAME, + "cluster_type": CLUSTER_TYPE, + "version": __version__, + "frontend": FRONTEND_TYPE, + "engine": ENGINE_TYPE, + "storage": STORAGE_TYPE, + "creation_time": encode_datetime(CREATION_TIME), + } + return RunningDeploymentInfo.from_dict(info) + + def get_deployment_status(self) -> RunningDeploymentStatus: + status = {"cluster_type": CLUSTER_TYPE, "nodes": []} + if CLUSTER_TYPE == "HOSTS": + disk_info = psutil.disk_usage("/") + status["nodes"].append( + { + "name": socket.gethostname(), + "cpu_usage": psutil.cpu_percent(), + "memory_usage": psutil.virtual_memory().percent, + "disk_usage": float( + f"{disk_info.used / disk_info.total * 100:.2f}" + ), + } + ) + return RunningDeploymentStatus.from_dict(status) + + def get_service_status_by_id(self, graph_id: str) -> ServiceStatus: + status = self._client.list_service_status() + for s in status: + if graph_id == s["graph_id"]: + return ServiceStatus.from_dict(s) + raise RuntimeError(f"Failed to get service: graph {graph_id} not exists.") + + def list_service_status(self) -> List[ServiceStatus]: + status = self._client.list_service_status() + return [ServiceStatus.from_dict(s) for s in status] + + def stop_service(self) -> str: + return self._client.stop_service() + + def restart_service(self) -> str: + return self._client.restart_service() + + def start_service(self, request: StartServiceRequest) -> str: + return self._client.start_service(request.graph_id) + + def list_jobs(self) -> List[JobStatus]: + return [JobStatus.from_dict(s) for s in self._client.list_jobs()] + + def get_job_by_id(self, job_id: str) -> JobStatus: + return JobStatus.from_dict(self._client.get_job_by_id(job_id)) + + def delete_job_by_id(self, job_id: str) -> str: + return self._client.delete_job_by_id(job_id) + + def submit_dataloading_job( + self, graph_id: str, dataloading_job_config: DataloadingJobConfig + ) -> str: + config = dataloading_job_config.to_dict() + job_id = self._client.submit_dataloading_job( + graph_id, config, self._datasource_manager + ) + return CreateDataloadingJobResponse.from_dict({"job_id": job_id}) + + def get_dataloading_job_config(self, graph_id: str) -> DataloadingJobConfig: + return DataloadingJobConfig.from_dict( + self._client.get_dataloading_job_config(graph_id) + ) + + def upload_file(self, filestorage) -> str: + if CLUSTER_TYPE == "HOSTS": + filepath = os.path.join(DATASET_WORKSPACE, filestorage.filename) + filestorage.save(filepath) + return UploadFileResponse.from_dict({"file_path": filepath}) + + def bind_datasource_in_batch( + self, graph_id: str, schema_mapping: SchemaMapping + ) -> str: + # there are some tricks here, since property is a keyword of openapi + # specification, so it will be converted into the _property field. + schema_mapping_dict = schema_mapping.to_dict() + for mapping in itertools.chain( + schema_mapping_dict["vertex_mappings"], + schema_mapping_dict["edge_mappings"], + ): + for column_mapping in mapping["column_mappings"]: + if "_property" in column_mapping: + column_mapping["property"] = column_mapping.pop("_property") + if ( + "source_vertex_mappings" in mapping + and "destination_vertex_mappings" in mapping + ): + for column_mapping in itertools.chain( + mapping["source_vertex_mappings"], + mapping["destination_vertex_mappings"], + ): + if "_property" in column_mapping: + column_mapping["property"] = column_mapping.pop("_property") + self._datasource_manager.bind_datasource_in_batch(graph_id, schema_mapping_dict) + return "Bind data source mapping successfully" + + def get_datasource_by_id(self, graph_id: str) -> SchemaMapping: + return SchemaMapping.from_dict( + self._datasource_manager.get_datasource_mapping(graph_id) + ) + + def unbind_vertex_datasource(self, graph_id: str, vertex_type: str) -> str: + self._datasource_manager.unbind_vertex_datasource(graph_id, vertex_type) + return "Unbind vertex data source successfully" + + def unbind_edge_datasource( + self, + graph_id: str, + edge_type: str, + source_vertex_type: str, + destination_vertex_type: str, + ) -> str: + self._datasource_manager.unbind_edge_datasource( + graph_id, edge_type, source_vertex_type, destination_vertex_type + ) + return "Unbind edge data source successfully" + + +client_wrapper = ClientWrapper() diff --git a/flex/coordinator/gs_flex_coordinator/core/config.py b/coordinator/gscoordinator/flex/core/config.py similarity index 86% rename from flex/coordinator/gs_flex_coordinator/core/config.py rename to coordinator/gscoordinator/flex/core/config.py index d4a4e2e71339..d7d48e031087 100644 --- a/flex/coordinator/gs_flex_coordinator/core/config.py +++ b/coordinator/gscoordinator/flex/core/config.py @@ -17,7 +17,6 @@ # import datetime -import logging import os import tempfile @@ -32,7 +31,7 @@ def str_to_bool(s): try: WORKSPACE = os.environ["GRAPHSCOPE_RUNTIME"] except KeyError: - WORKSPACE = os.path.expanduser("~/.graphscope/gs") + WORKSPACE = os.path.expanduser("~/.graphscope/runtime/coordinator") # make sure we have permission to create instance workspace try: os.makedirs(os.path.join(WORKSPACE, ".ignore"), exist_ok=True) @@ -51,11 +50,14 @@ def str_to_bool(s): os.makedirs(DATASET_WORKSPACE, exist_ok=True) -# we use the solution encompasses the various applications and use cases of the -# product across different industries and business scenarios, e.g. "INTERACTIVE", +# we use the solution encompasses the various applications +# and use cases of the product across different industries +# and business scenarios, e.g. "INTERACTIVE", # "GRAPHSCOPE INSIGHT". -SOLUTION = os.environ["SOLUTION"] - +SOLUTION = os.environ.get("SOLUTION", "GRAPHSCOPE_ONE") +FRONTEND_TYPE = "Cypher/Gremlin" +STORAGE_TYPE = "MutableCSR" +ENGINE_TYPE = "Hiactor" # cluster type, optional from "K8S", "HOSTS" CLUSTER_TYPE = os.environ.get("CLUSTER_TYPE", "HOSTS") @@ -79,7 +81,7 @@ def str_to_bool(s): # kubernetes NAMESPACE = os.environ.get("NAMESPACE", "kubetask") -INSTANCE_NAME = os.environ.get("INSTANCE_NAME", "default-graph") +INSTANCE_NAME = os.environ.get("INSTANCE_NAME", "demo") # groot diff --git a/coordinator/gscoordinator/flex/core/datasource.py b/coordinator/gscoordinator/flex/core/datasource.py new file mode 100644 index 000000000000..b328720f29cb --- /dev/null +++ b/coordinator/gscoordinator/flex/core/datasource.py @@ -0,0 +1,149 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2024 Alibaba Group Holding Limited. +# +# 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. +# + +import logging +import os +import pickle + +from gscoordinator.flex.core.config import WORKSPACE + + +class DataSourceManager(object): + """Management class for data source mapping""" + + def __init__(self): + # graph id -> mapping + self._datasource_mapping = {} + self._pickle_path = os.path.join(WORKSPACE, "datasource_mapping.pickle") + # recover + self.try_to_recover_from_disk() + + def try_to_recover_from_disk(self): + try: + if os.path.exists(self._pickle_path): + logging.info( + "Recover data source mapping from file %s", + self._pickle_path, + ) + with open(self._pickle_path, "rb") as f: + self._datasource_mapping = pickle.load(f) + except Exception as e: + logging.warn("Failed to recover data source mapping: %s", str(e)) + + def dump_to_disk(self): + try: + with open(self._pickle_path, "wb") as f: + pickle.dump(self._datasource_mapping, f) + except Exception as e: + logging.warn("Failed to dump data source mapping: %s", str(e)) + + def get_edge_full_label( + self, + type_name: str, + source_vertex_type: str, + destination_vertex_type: str, + ) -> str: + return f"{source_vertex_type}_{type_name}_{destination_vertex_type}" + + def get_vertex_datasource(self, graph_id: str, vertex_type: str) -> dict: + rlt = {} + if ( + graph_id in self._datasource_mapping + and vertex_type in self._datasource_mapping[graph_id]["vertices"] + ): + rlt = self._datasource_mapping[graph_id]["vertices"][vertex_type] + return rlt + + def get_edge_datasource( + self, + graph_id: str, + edge_type: str, + source_vertex_type: str, + destination_vertex_type: str, + ) -> dict: + rlt = {} + elabel = self.get_edge_full_label( + edge_type, source_vertex_type, destination_vertex_type + ) + if ( + graph_id in self._datasource_mapping + and elabel in self._datasource_mapping[graph_id]["edges"] + ): + rlt = self._datasource_mapping[graph_id]["edges"][elabel] + return rlt + + def bind_datasource_in_batch(self, graph_id: str, schema_mapping: dict): + datasource_mapping = {"vertices": {}, "edges": {}} + # vertices + for vdsm in schema_mapping["vertex_mappings"]: + datasource_mapping["vertices"][vdsm["type_name"]] = vdsm + # edge + for edsm in schema_mapping["edge_mappings"]: + elabel = self.get_edge_full_label( + edsm["type_triplet"]["edge"], + edsm["type_triplet"]["source_vertex"], + edsm["type_triplet"]["destination_vertex"], + ) + datasource_mapping["edges"][elabel] = edsm + # update + if graph_id not in self._datasource_mapping: + self._datasource_mapping[graph_id] = datasource_mapping + else: + self._datasource_mapping[graph_id]["vertices"].update( + datasource_mapping["vertices"] + ) + self._datasource_mapping[graph_id]["edges"].update( + datasource_mapping["edges"] + ) + # dump + self.dump_to_disk() + + def get_datasource_mapping(self, graph_id: str) -> dict: + datasource_mapping = {"vertex_mappings": [], "edge_mappings": []} + if graph_id in self._datasource_mapping: + for _, v_mapping in self._datasource_mapping[graph_id]["vertices"].items(): + datasource_mapping["vertex_mappings"].append(v_mapping) + for _, e_mapping in self._datasource_mapping[graph_id]["edges"].items(): + datasource_mapping["edge_mappings"].append(e_mapping) + return datasource_mapping + + def unbind_vertex_datasource(self, graph_id: str, vertex_type: str): + if graph_id in self._datasource_mapping: + if vertex_type in self._datasource_mapping[graph_id]["vertices"]: + del self._datasource_mapping[graph_id]["vertices"][vertex_type] + self.dump_to_disk() + + def unbind_edge_datasource( + self, + graph_id: str, + edge_type: str, + source_vertex_type: str, + destination_vertex_type: str, + ): + elabel = self.get_edge_full_label( + edge_type, source_vertex_type, destination_vertex_type + ) + if graph_id in self._datasource_mapping: + if elabel in self._datasource_mapping[graph_id]["edges"]: + del self._datasource_mapping[graph_id]["edges"][elabel] + self.dump_to_disk() + + def delete_datasource_by_id(self, graph_id: str): + if graph_id in self._datasource_mapping: + del self._datasource_mapping[graph_id] + self.dump_to_disk() diff --git a/flex/coordinator/gs_flex_coordinator/core/insight/__init__.py b/coordinator/gscoordinator/flex/core/insight/__init__.py similarity index 90% rename from flex/coordinator/gs_flex_coordinator/core/insight/__init__.py rename to coordinator/gscoordinator/flex/core/insight/__init__.py index 099804e30dcb..96936ce0ef5a 100644 --- a/flex/coordinator/gs_flex_coordinator/core/insight/__init__.py +++ b/coordinator/gscoordinator/flex/core/insight/__init__.py @@ -16,4 +16,4 @@ # limitations under the License. # -from gs_flex_coordinator.core.insight.groot import init_groot_client +from gscoordinator.flex.core.insight.groot import init_groot_client diff --git a/flex/coordinator/gs_flex_coordinator/core/insight/graph.py b/coordinator/gscoordinator/flex/core/insight/graph.py similarity index 90% rename from flex/coordinator/gs_flex_coordinator/core/insight/graph.py rename to coordinator/gscoordinator/flex/core/insight/graph.py index 54f2b087afa7..6d3c1d34a017 100644 --- a/flex/coordinator/gs_flex_coordinator/core/insight/graph.py +++ b/coordinator/gscoordinator/flex/core/insight/graph.py @@ -20,25 +20,32 @@ import logging import os import time -from abc import ABCMeta, abstractmethod +from abc import ABCMeta +from abc import abstractmethod import graphscope from dateutil import tz -from graphscope.deploy.kubernetes.utils import (get_service_endpoints, - resolve_api_client) +from graphscope.deploy.kubernetes.utils import get_service_endpoints +from graphscope.deploy.kubernetes.utils import resolve_api_client from gremlin_python.driver.client import Client from kubernetes import client as kube_client from kubernetes import config as kube_config -from gs_flex_coordinator.core.config import (CLUSTER_TYPE, CREATION_TIME, - ENABLE_DNS, GROOT_GREMLIN_PORT, - GROOT_GRPC_PORT, GROOT_PASSWORD, - GROOT_USERNAME, INSTANCE_NAME, - NAMESPACE, WORKSPACE) -from gs_flex_coordinator.core.scheduler import schedule -from gs_flex_coordinator.core.utils import (data_type_to_groot, - encode_datetime, get_internal_ip) -from gs_flex_coordinator.version import __version__ +from gscoordinator.flex.core.config import CLUSTER_TYPE +from gscoordinator.flex.core.config import CREATION_TIME +from gscoordinator.flex.core.config import ENABLE_DNS +from gscoordinator.flex.core.config import GROOT_GREMLIN_PORT +from gscoordinator.flex.core.config import GROOT_GRPC_PORT +from gscoordinator.flex.core.config import GROOT_PASSWORD +from gscoordinator.flex.core.config import GROOT_USERNAME +from gscoordinator.flex.core.config import INSTANCE_NAME +from gscoordinator.flex.core.config import NAMESPACE +from gscoordinator.flex.core.config import WORKSPACE +from gscoordinator.flex.core.scheduler import schedule +from gscoordinator.flex.core.utils import data_type_to_groot +from gscoordinator.flex.core.utils import encode_datetime +from gscoordinator.flex.core.utils import get_internal_ip +from gscoordinator.version import __version__ class Graph(metaclass=ABCMeta): @@ -260,7 +267,7 @@ def delete_vertex_type(self, graph_name: str, vertex_type: str): or vertex_type == relation["dst_label"] ): raise RuntimeError( - "Can not delete '{0}' type, cause exists in edge type '{1}'".format( + "Can not delete '{0}' type, cause exists in edge '{1}'".format( vertex_type, edge_schema["label"] ), ) @@ -295,7 +302,7 @@ def get_groot_graph_from_local(): client.submit( "g.with('evaluationTimeout', 5000).V().limit(1)" ).all().result() - except Exception as e: # noqa: B110 + except Exception: # noqa: B110 pass else: break @@ -316,8 +323,8 @@ def get_groot_graph_from_k8s(): app_api = kube_client.AppsV1Api(api_client) # frontend statefulset and service name name = "{0}-graphscope-store-frontend".format(INSTANCE_NAME) - respoonse = app_api.read_namespaced_stateful_set(name, NAMESPACE) - labels = response.metadata.labels + response = app_api.read_namespaced_stateful_set(name, NAMESPACE) + app_api.read_namespaced_stateful_set(name, NAMESPACE) # creation time creation_time = response.metadata.creation_timestamp.astimezone( tz.tzlocal() diff --git a/coordinator/gscoordinator/flex/core/insight/groot.py b/coordinator/gscoordinator/flex/core/insight/groot.py new file mode 100644 index 000000000000..07e36be36c75 --- /dev/null +++ b/coordinator/gscoordinator/flex/core/insight/groot.py @@ -0,0 +1,28 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2024 Alibaba Group Holding Limited. +# +# 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. +# + + +class GrootClient(object): + """Class used to interact with Groot""" + + def __init__(self): + pass + + +def init_groot_client(): + return GrootClient() diff --git a/flex/coordinator/gs_flex_coordinator/core/insight/job.py b/coordinator/gscoordinator/flex/core/insight/job.py similarity index 89% rename from flex/coordinator/gs_flex_coordinator/core/insight/job.py rename to coordinator/gscoordinator/flex/core/insight/job.py index de4ced454095..ed07dcf0e019 100644 --- a/flex/coordinator/gs_flex_coordinator/core/insight/job.py +++ b/coordinator/gscoordinator/flex/core/insight/job.py @@ -17,11 +17,13 @@ # import pandas as pd -from graphscope.framework.record import EdgeRecordKey, VertexRecordKey +from graphscope.framework.record import EdgeRecordKey +from graphscope.framework.record import VertexRecordKey -from gs_flex_coordinator.core.scheduler import Scheduler -from gs_flex_coordinator.core.utils import encode_datetime, get_current_time -from gs_flex_coordinator.models import JobStatus +from gscoordinator.flex.core.scheduler import Scheduler +from gscoordinator.flex.core.utils import encode_datetime +from gscoordinator.flex.core.utils import get_current_time +from gscoordinator.flex.models import JobStatus class DataloadingJobScheduler(Scheduler): @@ -56,7 +58,10 @@ def _construct_detailed_info(self): return detail def get_edge_full_label( - self, type_name: str, source_vertex_type: str, destination_vertex_type: str + self, + type_name: str, + source_vertex_type: str, + destination_vertex_type: str, ) -> str: return f"{source_vertex_type}_{type_name}_{destination_vertex_type}" @@ -66,7 +71,9 @@ def _import_data_from_local_file(self): for vlabel in self._job_config["vertices"]: primary_key = self._graph.get_vertex_primary_key(vlabel) datasource = self._data_source["vertices_datasource"][vlabel] - data = pd.read_csv(datasource["location"], sep=",|\|", engine="python") + data = pd.read_csv( + datasource["location"], sep=",|\|", engine="python" + ) # noqa: W605 for record in data.itertuples(index=False): primary_key_dict = {} property_mapping = {} @@ -76,7 +83,10 @@ def _import_data_from_local_file(self): else: property_mapping[v] = record[int(k)] vertices.append( - [VertexRecordKey(vlabel, primary_key_dict), property_mapping] + [ + VertexRecordKey(vlabel, primary_key_dict), + property_mapping, + ] ) edges = [] for e in self._job_config["edges"]: @@ -101,7 +111,8 @@ def _import_data_from_local_file(self): e["type_name"], VertexRecordKey(e["source_vertex"], source_pk_column_map), VertexRecordKey( - e["destination_vertex"], destination_pk_column_map + e["destination_vertex"], + destination_pk_column_map, ), ), property_mapping, diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/__init__.py b/coordinator/gscoordinator/flex/core/interactive/__init__.py similarity index 78% rename from flex/coordinator/gs_flex_coordinator/core/interactive/__init__.py rename to coordinator/gscoordinator/flex/core/interactive/__init__.py index b75561641056..3bc4ddde0cb6 100644 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/__init__.py +++ b/coordinator/gscoordinator/flex/core/interactive/__init__.py @@ -19,10 +19,4 @@ import os import sys -try: - sys.path.insert(0, os.path.dirname(__file__)) - import hqps_client -except ImportError: - raise - -from gs_flex_coordinator.core.interactive.hqps import init_hqps_client +from gscoordinator.flex.core.interactive.hqps import init_hqps_client diff --git a/coordinator/gscoordinator/flex/core/interactive/hqps.py b/coordinator/gscoordinator/flex/core/interactive/hqps.py new file mode 100644 index 000000000000..bdecb16953c6 --- /dev/null +++ b/coordinator/gscoordinator/flex/core/interactive/hqps.py @@ -0,0 +1,424 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2024 Alibaba Group Holding Limited. +# +# 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. +# + +import datetime +import logging +import os +import pickle +import time +from typing import List +from typing import Union + +import interactive_sdk.openapi +import requests +from interactive_sdk.openapi import CreateGraphRequest +from interactive_sdk.openapi import CreateProcedureRequest +from interactive_sdk.openapi import SchemaMapping +from interactive_sdk.openapi import StartServiceRequest +from interactive_sdk.openapi import UpdateProcedureRequest + +from gscoordinator.flex.core.config import CLUSTER_TYPE +from gscoordinator.flex.core.config import HQPS_ADMIN_SERVICE_PORT +from gscoordinator.flex.core.config import WORKSPACE +from gscoordinator.flex.core.datasource import DataSourceManager +from gscoordinator.flex.core.utils import encode_datetime +from gscoordinator.flex.core.utils import get_internal_ip +from gscoordinator.flex.core.utils import get_public_ip + + +class HQPSClient(object): + """Class used to interact with hqps engine""" + + def __init__(self): + # hqps admin service endpoint + self._hqps_endpoint = self._get_hqps_service_endpoints() + # job configuration + self._job_config = {} + # job Configuration path + self._job_config_pickle_path = os.path.join(WORKSPACE, "job_config.pickle") + # recover + self.try_to_recover_from_disk() + + def dump_to_disk(self): + try: + with open(self._job_config_pickle_path, "wb") as f: + pickle.dump(self._job_config, f) + except Exception as e: + logging.warn("Failed to dump job config file: %s", str(e)) + + def try_to_recover_from_disk(self): + try: + if os.path.exists(self._job_config_pickle_path): + logging.info( + "Recover job config from file %s", + self._job_config_pickle_path, + ) + with open(self._job_config_pickle_path, "rb") as f: + self._job_config = pickle.load(f) + except Exception as e: + logging.warn("Failed to recover job config: %s", str(e)) + + def _get_hqps_service_endpoints(self): + if CLUSTER_TYPE == "HOSTS": + logging.info("Connecting to HQPS service ...") + while True: + try: + requests.get(f"http://127.0.0.1:{HQPS_ADMIN_SERVICE_PORT}") + except requests.ConnectionError: + time.sleep(3) + else: + return f"http://127.0.0.1:{HQPS_ADMIN_SERVICE_PORT}" + + def list_graphs(self) -> List[dict]: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceGraphManagementApi( + api_client + ) + graphs = [g.to_dict() for g in api_instance.list_graphs()] + for g in graphs: + g["creation_time"] = encode_datetime( + datetime.datetime.fromtimestamp(g["creation_time"] / 1000) + ) + if g["data_update_time"] == 0: + g["data_update_time"] = "null" + else: + g["data_update_time"] = encode_datetime( + datetime.datetime.fromtimestamp(g["data_update_time"] / 1000) + ) + # `schema_update_time` is same to `creation_time` in Interactive + g["schema_update_time"] = g["creation_time"] + if "edge_types" not in g["schema"]: + g["schema"]["edge_types"] = [] + if "vertex_types" not in g["schema"]: + g["schema"]["vertex_types"] = [] + # we do not have edge's primary key in Interactive + for edge in g["schema"]["edge_types"]: + if "primary_keys" not in edge: + edge["primary_keys"] = [] + return graphs + + def get_schema_by_id(self, graph_id: str) -> dict: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceGraphManagementApi( + api_client + ) + schema = api_instance.get_schema(graph_id).to_dict() + if "vertex_types" not in schema: + schema["vertex_types"] = [] + if "edge_types" not in schema: + schema["edge_types"] = [] + return schema + + def create_graph(self, graph: dict) -> dict: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceGraphManagementApi( + api_client + ) + response = api_instance.create_graph(CreateGraphRequest.from_dict(graph)) + return response.to_dict() + + def delete_graph_by_id(self, graph_id: str) -> str: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceGraphManagementApi( + api_client + ) + rlt = api_instance.delete_graph(graph_id) + return rlt + + def get_graph_by_id(self, graph_id: str) -> dict: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceGraphManagementApi( + api_client + ) + g = api_instance.get_graph(graph_id).to_dict() + g["creation_time"] = encode_datetime( + datetime.datetime.fromtimestamp(g["creation_time"] / 1000) + ) + if g["data_update_time"] == 0: + g["data_update_time"] = "null" + else: + g["data_update_time"] = encode_datetime( + datetime.datetime.fromtimestamp(g["data_update_time"] / 1000) + ) + # `schema_update_time` is same to `creation_time` in Interactive + g["schema_update_time"] = g["creation_time"] + if "edge_types" not in g["schema"]: + g["schema"]["edge_types"] = [] + if "vertex_types" not in g["schema"]: + g["schema"]["vertex_types"] = [] + # we do not have edge's primary key in Interactive + for edge in g["schema"]["edge_types"]: + if "primary_keys" not in edge: + edge["primary_keys"] = [] + return g + + def create_vertex_type(self, graph_id: str, vtype: dict): + raise RuntimeError("Create vertex type is not supported yet!") + + def create_edge_type(self, graph_id: str, etype: dict): + raise RuntimeError("Create vertex type is not supported yet!") + + def delete_vertex_type_by_name(self, graph_id: str, type_name: str): + raise RuntimeError("Create vertex type is not supported yet!") + + def delete_edge_type_by_name( + self, + graph_id: str, + edge_type: str, + source_vertex_type: str, + destination_vertex_type: str, + ): + raise RuntimeError("Create vertex type is not supported yet!") + + def create_stored_procedure(self, graph_id: str, stored_procedure: dict) -> dict: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceProcedureManagementApi( + api_client + ) + response = api_instance.create_procedure( + graph_id, CreateProcedureRequest.from_dict(stored_procedure) + ).to_dict() + if "procedure_id" in response: + response["stored_procedure_id"] = response.pop("procedure_id") + return response + + def list_stored_procedures(self, graph_id: str) -> List[dict]: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + stored_procedures = [] + api_instance = interactive_sdk.openapi.AdminServiceProcedureManagementApi( + api_client + ) + stored_procedures = [ + p.to_dict() for p in api_instance.list_procedures(graph_id) + ] + return stored_procedures + + def update_stored_procedure_by_id( + self, graph_id: str, stored_procedure_id: str, stored_procedure: dict + ) -> str: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceProcedureManagementApi( + api_client + ) + return api_instance.update_procedure( + graph_id, + stored_procedure_id, + UpdateProcedureRequest.from_dict(stored_procedure), + ) + + def delete_stored_procedure_by_id( + self, graph_id: str, stored_procedure_id: str + ) -> str: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceProcedureManagementApi( + api_client + ) + return api_instance.delete_procedure(graph_id, stored_procedure_id) + + def get_stored_procedure_by_id( + self, graph_id: str, stored_procedure_id: str + ) -> dict: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceProcedureManagementApi( + api_client + ) + return api_instance.get_procedure(graph_id, stored_procedure_id).to_dict() + + def list_service_status(self) -> List[dict]: + # get service status from serving graph + serving_graph_id = None + rlts = [] + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceServiceManagementApi( + api_client + ) + response = api_instance.get_service_status() + if CLUSTER_TYPE == "HOSTS": + host = get_public_ip() + if host is None: + host = get_internal_ip() + if response.status == "Running" and response.graph is not None: + g = response.graph.to_dict() + serving_graph_id = g["id"] + service_start_time = encode_datetime( + datetime.datetime.fromtimestamp(response.start_time / 1000) + ) + status = { + "status": response.status, + "sdk_endpoints": { + "cypher": f"neo4j://{host}:{response.bolt_port}", + "hqps": f"http://{host}:{response.hqps_port}", + "gremlin": f"ws://{host}:{response.gremlin_port}/gremlin", + }, + "start_time": service_start_time, + "graph_id": g["id"], + } + rlts.append(status) + # only one graph is serving at a certain time + graphs = self.list_graphs() + for g in graphs: + if serving_graph_id is None or serving_graph_id != g["id"]: + status = { + "status": "Stopped", + "graph_id": g["id"], + "start_time": "null", + } + rlts.append(status) + return rlts + + def stop_service(self) -> str: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceServiceManagementApi( + api_client + ) + return api_instance.stop_service() + + def restart_service(self) -> str: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceServiceManagementApi( + api_client + ) + return api_instance.restart_service() + + def start_service(self, graph_id: str) -> str: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceServiceManagementApi( + api_client + ) + return api_instance.start_service(StartServiceRequest(graph_id=graph_id)) + + def list_jobs(self) -> List[dict]: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceJobManagementApi( + api_client + ) + rlt = [] + for s in api_instance.list_jobs(): + job_status = s.to_dict() + job_status["start_time"] = encode_datetime( + datetime.datetime.fromtimestamp(job_status["start_time"] / 1000) + ) + if "end_time" in job_status: + job_status["end_time"] = encode_datetime( + datetime.datetime.fromtimestamp(job_status["end_time"] / 1000) + ) + rlt.append(job_status) + return rlt + + def get_job_by_id(self, job_id: str) -> dict: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceJobManagementApi( + api_client + ) + job_status = api_instance.get_job_by_id(job_id).to_dict() + job_status["start_time"] = encode_datetime( + datetime.datetime.fromtimestamp(job_status["start_time"] / 1000) + ) + if "end_time" in job_status: + job_status["end_time"] = encode_datetime( + datetime.datetime.fromtimestamp(job_status["end_time"] / 1000) + ) + return job_status + + def delete_job_by_id(self, job_id: str) -> str: + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceJobManagementApi( + api_client + ) + return api_instance.delete_job_by_id(job_id) + + def submit_dataloading_job( + self, graph_id: str, config: dict, ds_manager: DataSourceManager + ) -> str: + # schema mapping + schema_mapping = { + "loading_config": config["loading_config"], + "vertex_mappings": [], + "edge_mappings": [], + } + for v in config["vertices"]: + vds = ds_manager.get_vertex_datasource(graph_id, v["type_name"]) + if vds: + schema_mapping["vertex_mappings"].append(vds) + for e in config["edges"]: + eds = ds_manager.get_edge_datasource( + graph_id, + e["type_name"], + e["source_vertex"], + e["destination_vertex"], + ) + if eds: + schema_mapping["edge_mappings"].append(eds) + # set job configuration before submission + self._job_config[graph_id] = config + self.dump_to_disk() + # submit + with interactive_sdk.openapi.ApiClient( + interactive_sdk.openapi.Configuration(self._hqps_endpoint) + ) as api_client: + api_instance = interactive_sdk.openapi.AdminServiceGraphManagementApi( + api_client + ) + response = api_instance.create_dataloading_job( + graph_id, SchemaMapping.from_dict(schema_mapping) + ) + return response.job_id + + def get_dataloading_job_config(self, graph_id: str) -> dict: + config = {} + if graph_id in self._job_config: + config = self._job_config[graph_id] + return config + + +def init_hqps_client(): + return HQPSClient() diff --git a/flex/coordinator/gs_flex_coordinator/core/scheduler.py b/coordinator/gscoordinator/flex/core/scheduler.py similarity index 89% rename from flex/coordinator/gs_flex_coordinator/core/scheduler.py rename to coordinator/gscoordinator/flex/core/scheduler.py index b254fe305ce2..69dbfea6bc2f 100644 --- a/flex/coordinator/gs_flex_coordinator/core/scheduler.py +++ b/coordinator/gscoordinator/flex/core/scheduler.py @@ -17,17 +17,17 @@ # import datetime -import json import random import time -from abc import ABCMeta, abstractmethod +from abc import ABCMeta +from abc import abstractmethod from string import ascii_uppercase import schedule from schedule import CancelJob -from gs_flex_coordinator.core.stoppable_thread import StoppableThread -from gs_flex_coordinator.core.utils import decode_datetimestr +from gscoordinator.flex.core.stoppable_thread import StoppableThread +from gscoordinator.flex.core.utils import decode_datetimestr class Schedule(object): @@ -38,9 +38,10 @@ class Schedule(object): def __init__(self): self._schedule = schedule.Scheduler() - self._run_pending_thread = StoppableThread(target=self.run_pending, args=()) - self._run_pending_thread.daemon = True - self._run_pending_thread.start() + # thread + self._run_pending_trd = StoppableThread(target=self.run_pending, args=()) + self._run_pending_trd.daemon = True + self._run_pending_trd.start() @property def schedule(self): @@ -80,13 +81,14 @@ def __init__(self, at_time, repeat): # repeat every day or week, or run job once(no repeat) # optional value "day", "week", "once" self._repeat = repeat - # job running thread, note that: - # the last job should be end of execution at the beginning of the next job + # job running thread, note that the last job should be + # end of execution at the beginning of the next job self._running_thread = None # tags self._tags = [] - # when the job actually scheduled, the following variables will be generated and overridden. + # the following variables will be generated and overridden + # when the job actually scheduled self._jobid = None self._last_run = None @@ -129,9 +131,7 @@ def sunday(self): @property def timestr(self): - """return str of the time object. - time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object - """ + """return str of the time object.""" return str(self._at_time.time()) @property @@ -185,9 +185,14 @@ def do_run(self): self._running_thread.start() def submit(self): - if not self._run_now and self._repeat not in ["week", "day", "once", None]: + if not self._run_now and self._repeat not in [ + "week", + "day", + "once", + None, + ]: raise RuntimeError( - "Submit schedule job failed: at_time is '{0}', repeat is '{1}'".format( + "Submit schedule job failed: at_time: '{0}', repeat: '{1}'".format( self._at_time, self._repeat ) ) diff --git a/flex/coordinator/gs_flex_coordinator/core/stoppable_thread.py b/coordinator/gscoordinator/flex/core/stoppable_thread.py similarity index 93% rename from flex/coordinator/gs_flex_coordinator/core/stoppable_thread.py rename to coordinator/gscoordinator/flex/core/stoppable_thread.py index 34b332a2d208..be4fdee0313b 100644 --- a/flex/coordinator/gs_flex_coordinator/core/stoppable_thread.py +++ b/coordinator/gscoordinator/flex/core/stoppable_thread.py @@ -34,5 +34,5 @@ def stop(self): self._stop_event.set() def stopped(self): - """The thread itself should check regularly for the stopped() condition.""" + """Thread itself should check regularly for the stopped() condition.""" return self._stop_event.is_set() diff --git a/flex/coordinator/gs_flex_coordinator/core/utils.py b/coordinator/gscoordinator/flex/core/utils.py similarity index 100% rename from flex/coordinator/gs_flex_coordinator/core/utils.py rename to coordinator/gscoordinator/flex/core/utils.py diff --git a/flex/coordinator/gs_flex_coordinator/encoder.py b/coordinator/gscoordinator/flex/encoder.py similarity index 90% rename from flex/coordinator/gs_flex_coordinator/encoder.py rename to coordinator/gscoordinator/flex/encoder.py index 4cd8c4ad8fc0..e14d32c94bf9 100644 --- a/flex/coordinator/gs_flex_coordinator/encoder.py +++ b/coordinator/gscoordinator/flex/encoder.py @@ -1,6 +1,6 @@ from connexion.apps.flask_app import FlaskJSONEncoder -from gs_flex_coordinator.models.base_model import Model +from gscoordinator.flex.models.base_model import Model class JSONEncoder(FlaskJSONEncoder): diff --git a/coordinator/gscoordinator/flex/models/__init__.py b/coordinator/gscoordinator/flex/models/__init__.py new file mode 100644 index 000000000000..e44e6caadc4d --- /dev/null +++ b/coordinator/gscoordinator/flex/models/__init__.py @@ -0,0 +1,58 @@ +# flake8: noqa +# import models into model package +from gscoordinator.flex.models.base_edge_type import BaseEdgeType +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner_x_csr_params import BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams +from gscoordinator.flex.models.base_property_meta import BasePropertyMeta +from gscoordinator.flex.models.base_vertex_type import BaseVertexType +from gscoordinator.flex.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams +from gscoordinator.flex.models.column_mapping import ColumnMapping +from gscoordinator.flex.models.column_mapping_column import ColumnMappingColumn +from gscoordinator.flex.models.create_alert_receiver_request import CreateAlertReceiverRequest +from gscoordinator.flex.models.create_alert_rule_request import CreateAlertRuleRequest +from gscoordinator.flex.models.create_dataloading_job_response import CreateDataloadingJobResponse +from gscoordinator.flex.models.create_edge_type import CreateEdgeType +from gscoordinator.flex.models.create_graph_request import CreateGraphRequest +from gscoordinator.flex.models.create_graph_response import CreateGraphResponse +from gscoordinator.flex.models.create_graph_schema_request import CreateGraphSchemaRequest +from gscoordinator.flex.models.create_property_meta import CreatePropertyMeta +from gscoordinator.flex.models.create_stored_proc_request import CreateStoredProcRequest +from gscoordinator.flex.models.create_stored_proc_response import CreateStoredProcResponse +from gscoordinator.flex.models.create_vertex_type import CreateVertexType +from gscoordinator.flex.models.dataloading_job_config import DataloadingJobConfig +from gscoordinator.flex.models.dataloading_job_config_edges_inner import DataloadingJobConfigEdgesInner +from gscoordinator.flex.models.dataloading_job_config_loading_config import DataloadingJobConfigLoadingConfig +from gscoordinator.flex.models.dataloading_job_config_loading_config_format import DataloadingJobConfigLoadingConfigFormat +from gscoordinator.flex.models.dataloading_job_config_vertices_inner import DataloadingJobConfigVerticesInner +from gscoordinator.flex.models.edge_mapping import EdgeMapping +from gscoordinator.flex.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet +from gscoordinator.flex.models.error import Error +from gscoordinator.flex.models.gs_data_type import GSDataType +from gscoordinator.flex.models.get_alert_message_response import GetAlertMessageResponse +from gscoordinator.flex.models.get_alert_receiver_response import GetAlertReceiverResponse +from gscoordinator.flex.models.get_alert_rule_response import GetAlertRuleResponse +from gscoordinator.flex.models.get_edge_type import GetEdgeType +from gscoordinator.flex.models.get_graph_response import GetGraphResponse +from gscoordinator.flex.models.get_graph_schema_response import GetGraphSchemaResponse +from gscoordinator.flex.models.get_property_meta import GetPropertyMeta +from gscoordinator.flex.models.get_stored_proc_response import GetStoredProcResponse +from gscoordinator.flex.models.get_vertex_type import GetVertexType +from gscoordinator.flex.models.job_status import JobStatus +from gscoordinator.flex.models.long_text import LongText +from gscoordinator.flex.models.node_status import NodeStatus +from gscoordinator.flex.models.parameter import Parameter +from gscoordinator.flex.models.primitive_type import PrimitiveType +from gscoordinator.flex.models.running_deployment_info import RunningDeploymentInfo +from gscoordinator.flex.models.running_deployment_status import RunningDeploymentStatus +from gscoordinator.flex.models.running_deployment_status_nodes_inner import RunningDeploymentStatusNodesInner +from gscoordinator.flex.models.schema_mapping import SchemaMapping +from gscoordinator.flex.models.service_status import ServiceStatus +from gscoordinator.flex.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints +from gscoordinator.flex.models.start_service_request import StartServiceRequest +from gscoordinator.flex.models.stored_procedure_meta import StoredProcedureMeta +from gscoordinator.flex.models.string_type import StringType +from gscoordinator.flex.models.string_type_string import StringTypeString +from gscoordinator.flex.models.update_alert_message_status_request import UpdateAlertMessageStatusRequest +from gscoordinator.flex.models.update_stored_proc_request import UpdateStoredProcRequest +from gscoordinator.flex.models.upload_file_response import UploadFileResponse +from gscoordinator.flex.models.vertex_mapping import VertexMapping diff --git a/coordinator/gscoordinator/flex/models/base_edge_type.py b/coordinator/gscoordinator/flex/models/base_edge_type.py new file mode 100644 index 000000000000..60c4eb377885 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/base_edge_type.py @@ -0,0 +1,145 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner +from gscoordinator.flex import util + +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner # noqa: E501 + +class BaseEdgeType(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, type_name=None, vertex_type_pair_relations=None, directed=None, primary_keys=None): # noqa: E501 + """BaseEdgeType - a model defined in OpenAPI + + :param type_name: The type_name of this BaseEdgeType. # noqa: E501 + :type type_name: str + :param vertex_type_pair_relations: The vertex_type_pair_relations of this BaseEdgeType. # noqa: E501 + :type vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner] + :param directed: The directed of this BaseEdgeType. # noqa: E501 + :type directed: bool + :param primary_keys: The primary_keys of this BaseEdgeType. # noqa: E501 + :type primary_keys: List[str] + """ + self.openapi_types = { + 'type_name': str, + 'vertex_type_pair_relations': List[BaseEdgeTypeVertexTypePairRelationsInner], + 'directed': bool, + 'primary_keys': List[str] + } + + self.attribute_map = { + 'type_name': 'type_name', + 'vertex_type_pair_relations': 'vertex_type_pair_relations', + 'directed': 'directed', + 'primary_keys': 'primary_keys' + } + + self._type_name = type_name + self._vertex_type_pair_relations = vertex_type_pair_relations + self._directed = directed + self._primary_keys = primary_keys + + @classmethod + def from_dict(cls, dikt) -> 'BaseEdgeType': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The BaseEdgeType of this BaseEdgeType. # noqa: E501 + :rtype: BaseEdgeType + """ + return util.deserialize_model(dikt, cls) + + @property + def type_name(self) -> str: + """Gets the type_name of this BaseEdgeType. + + + :return: The type_name of this BaseEdgeType. + :rtype: str + """ + return self._type_name + + @type_name.setter + def type_name(self, type_name: str): + """Sets the type_name of this BaseEdgeType. + + + :param type_name: The type_name of this BaseEdgeType. + :type type_name: str + """ + if type_name is None: + raise ValueError("Invalid value for `type_name`, must not be `None`") # noqa: E501 + + self._type_name = type_name + + @property + def vertex_type_pair_relations(self) -> List[BaseEdgeTypeVertexTypePairRelationsInner]: + """Gets the vertex_type_pair_relations of this BaseEdgeType. + + + :return: The vertex_type_pair_relations of this BaseEdgeType. + :rtype: List[BaseEdgeTypeVertexTypePairRelationsInner] + """ + return self._vertex_type_pair_relations + + @vertex_type_pair_relations.setter + def vertex_type_pair_relations(self, vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner]): + """Sets the vertex_type_pair_relations of this BaseEdgeType. + + + :param vertex_type_pair_relations: The vertex_type_pair_relations of this BaseEdgeType. + :type vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner] + """ + if vertex_type_pair_relations is None: + raise ValueError("Invalid value for `vertex_type_pair_relations`, must not be `None`") # noqa: E501 + + self._vertex_type_pair_relations = vertex_type_pair_relations + + @property + def directed(self) -> bool: + """Gets the directed of this BaseEdgeType. + + + :return: The directed of this BaseEdgeType. + :rtype: bool + """ + return self._directed + + @directed.setter + def directed(self, directed: bool): + """Sets the directed of this BaseEdgeType. + + + :param directed: The directed of this BaseEdgeType. + :type directed: bool + """ + + self._directed = directed + + @property + def primary_keys(self) -> List[str]: + """Gets the primary_keys of this BaseEdgeType. + + + :return: The primary_keys of this BaseEdgeType. + :rtype: List[str] + """ + return self._primary_keys + + @primary_keys.setter + def primary_keys(self, primary_keys: List[str]): + """Sets the primary_keys of this BaseEdgeType. + + + :param primary_keys: The primary_keys of this BaseEdgeType. + :type primary_keys: List[str] + """ + + self._primary_keys = primary_keys diff --git a/coordinator/gscoordinator/flex/models/base_edge_type_vertex_type_pair_relations_inner.py b/coordinator/gscoordinator/flex/models/base_edge_type_vertex_type_pair_relations_inner.py new file mode 100644 index 000000000000..c052479e8f08 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/base_edge_type_vertex_type_pair_relations_inner.py @@ -0,0 +1,151 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner_x_csr_params import BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams +from gscoordinator.flex import util + +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner_x_csr_params import BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams # noqa: E501 + +class BaseEdgeTypeVertexTypePairRelationsInner(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, source_vertex=None, destination_vertex=None, relation=None, x_csr_params=None): # noqa: E501 + """BaseEdgeTypeVertexTypePairRelationsInner - a model defined in OpenAPI + + :param source_vertex: The source_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. # noqa: E501 + :type source_vertex: str + :param destination_vertex: The destination_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. # noqa: E501 + :type destination_vertex: str + :param relation: The relation of this BaseEdgeTypeVertexTypePairRelationsInner. # noqa: E501 + :type relation: str + :param x_csr_params: The x_csr_params of this BaseEdgeTypeVertexTypePairRelationsInner. # noqa: E501 + :type x_csr_params: BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams + """ + self.openapi_types = { + 'source_vertex': str, + 'destination_vertex': str, + 'relation': str, + 'x_csr_params': BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams + } + + self.attribute_map = { + 'source_vertex': 'source_vertex', + 'destination_vertex': 'destination_vertex', + 'relation': 'relation', + 'x_csr_params': 'x_csr_params' + } + + self._source_vertex = source_vertex + self._destination_vertex = destination_vertex + self._relation = relation + self._x_csr_params = x_csr_params + + @classmethod + def from_dict(cls, dikt) -> 'BaseEdgeTypeVertexTypePairRelationsInner': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The BaseEdgeType_vertex_type_pair_relations_inner of this BaseEdgeTypeVertexTypePairRelationsInner. # noqa: E501 + :rtype: BaseEdgeTypeVertexTypePairRelationsInner + """ + return util.deserialize_model(dikt, cls) + + @property + def source_vertex(self) -> str: + """Gets the source_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. + + + :return: The source_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. + :rtype: str + """ + return self._source_vertex + + @source_vertex.setter + def source_vertex(self, source_vertex: str): + """Sets the source_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. + + + :param source_vertex: The source_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. + :type source_vertex: str + """ + if source_vertex is None: + raise ValueError("Invalid value for `source_vertex`, must not be `None`") # noqa: E501 + + self._source_vertex = source_vertex + + @property + def destination_vertex(self) -> str: + """Gets the destination_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. + + + :return: The destination_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. + :rtype: str + """ + return self._destination_vertex + + @destination_vertex.setter + def destination_vertex(self, destination_vertex: str): + """Sets the destination_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. + + + :param destination_vertex: The destination_vertex of this BaseEdgeTypeVertexTypePairRelationsInner. + :type destination_vertex: str + """ + if destination_vertex is None: + raise ValueError("Invalid value for `destination_vertex`, must not be `None`") # noqa: E501 + + self._destination_vertex = destination_vertex + + @property + def relation(self) -> str: + """Gets the relation of this BaseEdgeTypeVertexTypePairRelationsInner. + + + :return: The relation of this BaseEdgeTypeVertexTypePairRelationsInner. + :rtype: str + """ + return self._relation + + @relation.setter + def relation(self, relation: str): + """Sets the relation of this BaseEdgeTypeVertexTypePairRelationsInner. + + + :param relation: The relation of this BaseEdgeTypeVertexTypePairRelationsInner. + :type relation: str + """ + allowed_values = ["MANY_TO_MANY", "ONE_TO_MANY", "MANY_TO_ONE", "ONE_TO_ONE"] # noqa: E501 + if relation not in allowed_values: + raise ValueError( + "Invalid value for `relation` ({0}), must be one of {1}" + .format(relation, allowed_values) + ) + + self._relation = relation + + @property + def x_csr_params(self) -> BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams: + """Gets the x_csr_params of this BaseEdgeTypeVertexTypePairRelationsInner. + + + :return: The x_csr_params of this BaseEdgeTypeVertexTypePairRelationsInner. + :rtype: BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams + """ + return self._x_csr_params + + @x_csr_params.setter + def x_csr_params(self, x_csr_params: BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams): + """Sets the x_csr_params of this BaseEdgeTypeVertexTypePairRelationsInner. + + + :param x_csr_params: The x_csr_params of this BaseEdgeTypeVertexTypePairRelationsInner. + :type x_csr_params: BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams + """ + + self._x_csr_params = x_csr_params diff --git a/flex/coordinator/gs_flex_coordinator/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py b/coordinator/gscoordinator/flex/models/base_edge_type_vertex_type_pair_relations_inner_x_csr_params.py similarity index 61% rename from flex/coordinator/gs_flex_coordinator/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py rename to coordinator/gscoordinator/flex/models/base_edge_type_vertex_type_pair_relations_inner_x_csr_params.py index 2b890b98287e..365593b4d7dc 100644 --- a/flex/coordinator/gs_flex_coordinator/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py +++ b/coordinator/gscoordinator/flex/models/base_edge_type_vertex_type_pair_relations_inner_x_csr_params.py @@ -2,20 +2,20 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util -class EdgeTypeVertexTypePairRelationsInnerXCsrParams(Model): +class BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, edge_storage_strategy=None): # noqa: E501 - """EdgeTypeVertexTypePairRelationsInnerXCsrParams - a model defined in OpenAPI + """BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams - a model defined in OpenAPI - :param edge_storage_strategy: The edge_storage_strategy of this EdgeTypeVertexTypePairRelationsInnerXCsrParams. # noqa: E501 + :param edge_storage_strategy: The edge_storage_strategy of this BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams. # noqa: E501 :type edge_storage_strategy: str """ self.openapi_types = { @@ -29,32 +29,32 @@ def __init__(self, edge_storage_strategy=None): # noqa: E501 self._edge_storage_strategy = edge_storage_strategy @classmethod - def from_dict(cls, dikt) -> 'EdgeTypeVertexTypePairRelationsInnerXCsrParams': + def from_dict(cls, dikt) -> 'BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The EdgeType_vertex_type_pair_relations_inner_x_csr_params of this EdgeTypeVertexTypePairRelationsInnerXCsrParams. # noqa: E501 - :rtype: EdgeTypeVertexTypePairRelationsInnerXCsrParams + :return: The BaseEdgeType_vertex_type_pair_relations_inner_x_csr_params of this BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams. # noqa: E501 + :rtype: BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams """ return util.deserialize_model(dikt, cls) @property def edge_storage_strategy(self) -> str: - """Gets the edge_storage_strategy of this EdgeTypeVertexTypePairRelationsInnerXCsrParams. + """Gets the edge_storage_strategy of this BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams. - :return: The edge_storage_strategy of this EdgeTypeVertexTypePairRelationsInnerXCsrParams. + :return: The edge_storage_strategy of this BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams. :rtype: str """ return self._edge_storage_strategy @edge_storage_strategy.setter def edge_storage_strategy(self, edge_storage_strategy: str): - """Sets the edge_storage_strategy of this EdgeTypeVertexTypePairRelationsInnerXCsrParams. + """Sets the edge_storage_strategy of this BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams. - :param edge_storage_strategy: The edge_storage_strategy of this EdgeTypeVertexTypePairRelationsInnerXCsrParams. + :param edge_storage_strategy: The edge_storage_strategy of this BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams. :type edge_storage_strategy: str """ allowed_values = ["ONLY_IN", "ONLY_OUT", "BOTH_OUT_IN"] # noqa: E501 diff --git a/flex/coordinator/gs_flex_coordinator/models/base_model.py b/coordinator/gscoordinator/flex/models/base_model.py similarity index 98% rename from flex/coordinator/gs_flex_coordinator/models/base_model.py rename to coordinator/gscoordinator/flex/models/base_model.py index e773084cbd37..746c513ed006 100644 --- a/flex/coordinator/gs_flex_coordinator/models/base_model.py +++ b/coordinator/gscoordinator/flex/models/base_model.py @@ -2,7 +2,7 @@ import typing -from gs_flex_coordinator import util +from gscoordinator.flex import util T = typing.TypeVar('T') diff --git a/coordinator/gscoordinator/flex/models/base_property_meta.py b/coordinator/gscoordinator/flex/models/base_property_meta.py new file mode 100644 index 000000000000..02bbd02ef945 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/base_property_meta.py @@ -0,0 +1,171 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.gs_data_type import GSDataType +from gscoordinator.flex import util + +from gscoordinator.flex.models.gs_data_type import GSDataType # noqa: E501 + +class BasePropertyMeta(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, property_name=None, property_type=None, nullable=None, default_value=None, description=None): # noqa: E501 + """BasePropertyMeta - a model defined in OpenAPI + + :param property_name: The property_name of this BasePropertyMeta. # noqa: E501 + :type property_name: str + :param property_type: The property_type of this BasePropertyMeta. # noqa: E501 + :type property_type: GSDataType + :param nullable: The nullable of this BasePropertyMeta. # noqa: E501 + :type nullable: bool + :param default_value: The default_value of this BasePropertyMeta. # noqa: E501 + :type default_value: object + :param description: The description of this BasePropertyMeta. # noqa: E501 + :type description: str + """ + self.openapi_types = { + 'property_name': str, + 'property_type': GSDataType, + 'nullable': bool, + 'default_value': object, + 'description': str + } + + self.attribute_map = { + 'property_name': 'property_name', + 'property_type': 'property_type', + 'nullable': 'nullable', + 'default_value': 'default_value', + 'description': 'description' + } + + self._property_name = property_name + self._property_type = property_type + self._nullable = nullable + self._default_value = default_value + self._description = description + + @classmethod + def from_dict(cls, dikt) -> 'BasePropertyMeta': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The BasePropertyMeta of this BasePropertyMeta. # noqa: E501 + :rtype: BasePropertyMeta + """ + return util.deserialize_model(dikt, cls) + + @property + def property_name(self) -> str: + """Gets the property_name of this BasePropertyMeta. + + + :return: The property_name of this BasePropertyMeta. + :rtype: str + """ + return self._property_name + + @property_name.setter + def property_name(self, property_name: str): + """Sets the property_name of this BasePropertyMeta. + + + :param property_name: The property_name of this BasePropertyMeta. + :type property_name: str + """ + if property_name is None: + raise ValueError("Invalid value for `property_name`, must not be `None`") # noqa: E501 + + self._property_name = property_name + + @property + def property_type(self) -> GSDataType: + """Gets the property_type of this BasePropertyMeta. + + + :return: The property_type of this BasePropertyMeta. + :rtype: GSDataType + """ + return self._property_type + + @property_type.setter + def property_type(self, property_type: GSDataType): + """Sets the property_type of this BasePropertyMeta. + + + :param property_type: The property_type of this BasePropertyMeta. + :type property_type: GSDataType + """ + if property_type is None: + raise ValueError("Invalid value for `property_type`, must not be `None`") # noqa: E501 + + self._property_type = property_type + + @property + def nullable(self) -> bool: + """Gets the nullable of this BasePropertyMeta. + + + :return: The nullable of this BasePropertyMeta. + :rtype: bool + """ + return self._nullable + + @nullable.setter + def nullable(self, nullable: bool): + """Sets the nullable of this BasePropertyMeta. + + + :param nullable: The nullable of this BasePropertyMeta. + :type nullable: bool + """ + + self._nullable = nullable + + @property + def default_value(self) -> object: + """Gets the default_value of this BasePropertyMeta. + + + :return: The default_value of this BasePropertyMeta. + :rtype: object + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value: object): + """Sets the default_value of this BasePropertyMeta. + + + :param default_value: The default_value of this BasePropertyMeta. + :type default_value: object + """ + + self._default_value = default_value + + @property + def description(self) -> str: + """Gets the description of this BasePropertyMeta. + + + :return: The description of this BasePropertyMeta. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this BasePropertyMeta. + + + :param description: The description of this BasePropertyMeta. + :type description: str + """ + + self._description = description diff --git a/coordinator/gscoordinator/flex/models/base_vertex_type.py b/coordinator/gscoordinator/flex/models/base_vertex_type.py new file mode 100644 index 000000000000..aded4bc7a77e --- /dev/null +++ b/coordinator/gscoordinator/flex/models/base_vertex_type.py @@ -0,0 +1,119 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams +from gscoordinator.flex import util + +from gscoordinator.flex.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams # noqa: E501 + +class BaseVertexType(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, type_name=None, primary_keys=None, x_csr_params=None): # noqa: E501 + """BaseVertexType - a model defined in OpenAPI + + :param type_name: The type_name of this BaseVertexType. # noqa: E501 + :type type_name: str + :param primary_keys: The primary_keys of this BaseVertexType. # noqa: E501 + :type primary_keys: List[str] + :param x_csr_params: The x_csr_params of this BaseVertexType. # noqa: E501 + :type x_csr_params: BaseVertexTypeXCsrParams + """ + self.openapi_types = { + 'type_name': str, + 'primary_keys': List[str], + 'x_csr_params': BaseVertexTypeXCsrParams + } + + self.attribute_map = { + 'type_name': 'type_name', + 'primary_keys': 'primary_keys', + 'x_csr_params': 'x_csr_params' + } + + self._type_name = type_name + self._primary_keys = primary_keys + self._x_csr_params = x_csr_params + + @classmethod + def from_dict(cls, dikt) -> 'BaseVertexType': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The BaseVertexType of this BaseVertexType. # noqa: E501 + :rtype: BaseVertexType + """ + return util.deserialize_model(dikt, cls) + + @property + def type_name(self) -> str: + """Gets the type_name of this BaseVertexType. + + + :return: The type_name of this BaseVertexType. + :rtype: str + """ + return self._type_name + + @type_name.setter + def type_name(self, type_name: str): + """Sets the type_name of this BaseVertexType. + + + :param type_name: The type_name of this BaseVertexType. + :type type_name: str + """ + if type_name is None: + raise ValueError("Invalid value for `type_name`, must not be `None`") # noqa: E501 + + self._type_name = type_name + + @property + def primary_keys(self) -> List[str]: + """Gets the primary_keys of this BaseVertexType. + + + :return: The primary_keys of this BaseVertexType. + :rtype: List[str] + """ + return self._primary_keys + + @primary_keys.setter + def primary_keys(self, primary_keys: List[str]): + """Sets the primary_keys of this BaseVertexType. + + + :param primary_keys: The primary_keys of this BaseVertexType. + :type primary_keys: List[str] + """ + if primary_keys is None: + raise ValueError("Invalid value for `primary_keys`, must not be `None`") # noqa: E501 + + self._primary_keys = primary_keys + + @property + def x_csr_params(self) -> BaseVertexTypeXCsrParams: + """Gets the x_csr_params of this BaseVertexType. + + + :return: The x_csr_params of this BaseVertexType. + :rtype: BaseVertexTypeXCsrParams + """ + return self._x_csr_params + + @x_csr_params.setter + def x_csr_params(self, x_csr_params: BaseVertexTypeXCsrParams): + """Sets the x_csr_params of this BaseVertexType. + + + :param x_csr_params: The x_csr_params of this BaseVertexType. + :type x_csr_params: BaseVertexTypeXCsrParams + """ + + self._x_csr_params = x_csr_params diff --git a/coordinator/gscoordinator/flex/models/base_vertex_type_x_csr_params.py b/coordinator/gscoordinator/flex/models/base_vertex_type_x_csr_params.py new file mode 100644 index 000000000000..e006583f623d --- /dev/null +++ b/coordinator/gscoordinator/flex/models/base_vertex_type_x_csr_params.py @@ -0,0 +1,61 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class BaseVertexTypeXCsrParams(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, max_vertex_num=None): # noqa: E501 + """BaseVertexTypeXCsrParams - a model defined in OpenAPI + + :param max_vertex_num: The max_vertex_num of this BaseVertexTypeXCsrParams. # noqa: E501 + :type max_vertex_num: int + """ + self.openapi_types = { + 'max_vertex_num': int + } + + self.attribute_map = { + 'max_vertex_num': 'max_vertex_num' + } + + self._max_vertex_num = max_vertex_num + + @classmethod + def from_dict(cls, dikt) -> 'BaseVertexTypeXCsrParams': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The BaseVertexType_x_csr_params of this BaseVertexTypeXCsrParams. # noqa: E501 + :rtype: BaseVertexTypeXCsrParams + """ + return util.deserialize_model(dikt, cls) + + @property + def max_vertex_num(self) -> int: + """Gets the max_vertex_num of this BaseVertexTypeXCsrParams. + + + :return: The max_vertex_num of this BaseVertexTypeXCsrParams. + :rtype: int + """ + return self._max_vertex_num + + @max_vertex_num.setter + def max_vertex_num(self, max_vertex_num: int): + """Sets the max_vertex_num of this BaseVertexTypeXCsrParams. + + + :param max_vertex_num: The max_vertex_num of this BaseVertexTypeXCsrParams. + :type max_vertex_num: int + """ + + self._max_vertex_num = max_vertex_num diff --git a/flex/coordinator/gs_flex_coordinator/models/column_mapping.py b/coordinator/gscoordinator/flex/models/column_mapping.py similarity index 72% rename from flex/coordinator/gs_flex_coordinator/models/column_mapping.py rename to coordinator/gscoordinator/flex/models/column_mapping.py index 545f3f126ab7..a3705c7a1f56 100644 --- a/flex/coordinator/gs_flex_coordinator/models/column_mapping.py +++ b/coordinator/gscoordinator/flex/models/column_mapping.py @@ -2,11 +2,11 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.column_mapping_column import ColumnMappingColumn +from gscoordinator.flex import util -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn # noqa: E501 +from gscoordinator.flex.models.column_mapping_column import ColumnMappingColumn # noqa: E501 class ColumnMapping(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -18,12 +18,12 @@ def __init__(self, column=None, _property=None): # noqa: E501 """ColumnMapping - a model defined in OpenAPI :param column: The column of this ColumnMapping. # noqa: E501 - :type column: EdgeMappingSourceVertexMappingsInnerColumn + :type column: ColumnMappingColumn :param _property: The _property of this ColumnMapping. # noqa: E501 :type _property: str """ self.openapi_types = { - 'column': EdgeMappingSourceVertexMappingsInnerColumn, + 'column': ColumnMappingColumn, '_property': str } @@ -47,23 +47,25 @@ def from_dict(cls, dikt) -> 'ColumnMapping': return util.deserialize_model(dikt, cls) @property - def column(self) -> EdgeMappingSourceVertexMappingsInnerColumn: + def column(self) -> ColumnMappingColumn: """Gets the column of this ColumnMapping. :return: The column of this ColumnMapping. - :rtype: EdgeMappingSourceVertexMappingsInnerColumn + :rtype: ColumnMappingColumn """ return self._column @column.setter - def column(self, column: EdgeMappingSourceVertexMappingsInnerColumn): + def column(self, column: ColumnMappingColumn): """Sets the column of this ColumnMapping. :param column: The column of this ColumnMapping. - :type column: EdgeMappingSourceVertexMappingsInnerColumn + :type column: ColumnMappingColumn """ + if column is None: + raise ValueError("Invalid value for `column`, must not be `None`") # noqa: E501 self._column = column @@ -87,5 +89,7 @@ def _property(self, _property: str): :param _property: The _property of this ColumnMapping. :type _property: str """ + if _property is None: + raise ValueError("Invalid value for `_property`, must not be `None`") # noqa: E501 self.__property = _property diff --git a/coordinator/gscoordinator/flex/models/column_mapping_column.py b/coordinator/gscoordinator/flex/models/column_mapping_column.py new file mode 100644 index 000000000000..b1ac33549f0a --- /dev/null +++ b/coordinator/gscoordinator/flex/models/column_mapping_column.py @@ -0,0 +1,87 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class ColumnMappingColumn(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, index=None, name=None): # noqa: E501 + """ColumnMappingColumn - a model defined in OpenAPI + + :param index: The index of this ColumnMappingColumn. # noqa: E501 + :type index: int + :param name: The name of this ColumnMappingColumn. # noqa: E501 + :type name: str + """ + self.openapi_types = { + 'index': int, + 'name': str + } + + self.attribute_map = { + 'index': 'index', + 'name': 'name' + } + + self._index = index + self._name = name + + @classmethod + def from_dict(cls, dikt) -> 'ColumnMappingColumn': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The ColumnMapping_column of this ColumnMappingColumn. # noqa: E501 + :rtype: ColumnMappingColumn + """ + return util.deserialize_model(dikt, cls) + + @property + def index(self) -> int: + """Gets the index of this ColumnMappingColumn. + + + :return: The index of this ColumnMappingColumn. + :rtype: int + """ + return self._index + + @index.setter + def index(self, index: int): + """Sets the index of this ColumnMappingColumn. + + + :param index: The index of this ColumnMappingColumn. + :type index: int + """ + + self._index = index + + @property + def name(self) -> str: + """Gets the name of this ColumnMappingColumn. + + + :return: The name of this ColumnMappingColumn. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name: str): + """Sets the name of this ColumnMappingColumn. + + + :param name: The name of this ColumnMappingColumn. + :type name: str + """ + + self._name = name diff --git a/coordinator/gscoordinator/flex/models/create_alert_receiver_request.py b/coordinator/gscoordinator/flex/models/create_alert_receiver_request.py new file mode 100644 index 000000000000..cbac38227afd --- /dev/null +++ b/coordinator/gscoordinator/flex/models/create_alert_receiver_request.py @@ -0,0 +1,179 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class CreateAlertReceiverRequest(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, type=None, webhook_url=None, at_user_ids=None, is_at_all=None, enable=None): # noqa: E501 + """CreateAlertReceiverRequest - a model defined in OpenAPI + + :param type: The type of this CreateAlertReceiverRequest. # noqa: E501 + :type type: str + :param webhook_url: The webhook_url of this CreateAlertReceiverRequest. # noqa: E501 + :type webhook_url: str + :param at_user_ids: The at_user_ids of this CreateAlertReceiverRequest. # noqa: E501 + :type at_user_ids: List[str] + :param is_at_all: The is_at_all of this CreateAlertReceiverRequest. # noqa: E501 + :type is_at_all: bool + :param enable: The enable of this CreateAlertReceiverRequest. # noqa: E501 + :type enable: bool + """ + self.openapi_types = { + 'type': str, + 'webhook_url': str, + 'at_user_ids': List[str], + 'is_at_all': bool, + 'enable': bool + } + + self.attribute_map = { + 'type': 'type', + 'webhook_url': 'webhook_url', + 'at_user_ids': 'at_user_ids', + 'is_at_all': 'is_at_all', + 'enable': 'enable' + } + + self._type = type + self._webhook_url = webhook_url + self._at_user_ids = at_user_ids + self._is_at_all = is_at_all + self._enable = enable + + @classmethod + def from_dict(cls, dikt) -> 'CreateAlertReceiverRequest': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The CreateAlertReceiverRequest of this CreateAlertReceiverRequest. # noqa: E501 + :rtype: CreateAlertReceiverRequest + """ + return util.deserialize_model(dikt, cls) + + @property + def type(self) -> str: + """Gets the type of this CreateAlertReceiverRequest. + + + :return: The type of this CreateAlertReceiverRequest. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type: str): + """Sets the type of this CreateAlertReceiverRequest. + + + :param type: The type of this CreateAlertReceiverRequest. + :type type: str + """ + allowed_values = ["webhook"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" + .format(type, allowed_values) + ) + + self._type = type + + @property + def webhook_url(self) -> str: + """Gets the webhook_url of this CreateAlertReceiverRequest. + + + :return: The webhook_url of this CreateAlertReceiverRequest. + :rtype: str + """ + return self._webhook_url + + @webhook_url.setter + def webhook_url(self, webhook_url: str): + """Sets the webhook_url of this CreateAlertReceiverRequest. + + + :param webhook_url: The webhook_url of this CreateAlertReceiverRequest. + :type webhook_url: str + """ + if webhook_url is None: + raise ValueError("Invalid value for `webhook_url`, must not be `None`") # noqa: E501 + + self._webhook_url = webhook_url + + @property + def at_user_ids(self) -> List[str]: + """Gets the at_user_ids of this CreateAlertReceiverRequest. + + + :return: The at_user_ids of this CreateAlertReceiverRequest. + :rtype: List[str] + """ + return self._at_user_ids + + @at_user_ids.setter + def at_user_ids(self, at_user_ids: List[str]): + """Sets the at_user_ids of this CreateAlertReceiverRequest. + + + :param at_user_ids: The at_user_ids of this CreateAlertReceiverRequest. + :type at_user_ids: List[str] + """ + if at_user_ids is None: + raise ValueError("Invalid value for `at_user_ids`, must not be `None`") # noqa: E501 + + self._at_user_ids = at_user_ids + + @property + def is_at_all(self) -> bool: + """Gets the is_at_all of this CreateAlertReceiverRequest. + + + :return: The is_at_all of this CreateAlertReceiverRequest. + :rtype: bool + """ + return self._is_at_all + + @is_at_all.setter + def is_at_all(self, is_at_all: bool): + """Sets the is_at_all of this CreateAlertReceiverRequest. + + + :param is_at_all: The is_at_all of this CreateAlertReceiverRequest. + :type is_at_all: bool + """ + if is_at_all is None: + raise ValueError("Invalid value for `is_at_all`, must not be `None`") # noqa: E501 + + self._is_at_all = is_at_all + + @property + def enable(self) -> bool: + """Gets the enable of this CreateAlertReceiverRequest. + + + :return: The enable of this CreateAlertReceiverRequest. + :rtype: bool + """ + return self._enable + + @enable.setter + def enable(self, enable: bool): + """Sets the enable of this CreateAlertReceiverRequest. + + + :param enable: The enable of this CreateAlertReceiverRequest. + :type enable: bool + """ + if enable is None: + raise ValueError("Invalid value for `enable`, must not be `None`") # noqa: E501 + + self._enable = enable diff --git a/flex/coordinator/gs_flex_coordinator/models/alert_rule.py b/coordinator/gscoordinator/flex/models/create_alert_rule_request.py similarity index 56% rename from flex/coordinator/gs_flex_coordinator/models/alert_rule.py rename to coordinator/gscoordinator/flex/models/create_alert_rule_request.py index fe1dcef4526c..2533ea550944 100644 --- a/flex/coordinator/gs_flex_coordinator/models/alert_rule.py +++ b/coordinator/gscoordinator/flex/models/create_alert_rule_request.py @@ -2,30 +2,30 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util -class AlertRule(Model): +class CreateAlertRuleRequest(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, name=None, severity=None, metric_type=None, conditions_description=None, frequency=None, enable=None): # noqa: E501 - """AlertRule - a model defined in OpenAPI + """CreateAlertRuleRequest - a model defined in OpenAPI - :param name: The name of this AlertRule. # noqa: E501 + :param name: The name of this CreateAlertRuleRequest. # noqa: E501 :type name: str - :param severity: The severity of this AlertRule. # noqa: E501 + :param severity: The severity of this CreateAlertRuleRequest. # noqa: E501 :type severity: str - :param metric_type: The metric_type of this AlertRule. # noqa: E501 + :param metric_type: The metric_type of this CreateAlertRuleRequest. # noqa: E501 :type metric_type: str - :param conditions_description: The conditions_description of this AlertRule. # noqa: E501 + :param conditions_description: The conditions_description of this CreateAlertRuleRequest. # noqa: E501 :type conditions_description: str - :param frequency: The frequency of this AlertRule. # noqa: E501 + :param frequency: The frequency of this CreateAlertRuleRequest. # noqa: E501 :type frequency: int - :param enable: The enable of this AlertRule. # noqa: E501 + :param enable: The enable of this CreateAlertRuleRequest. # noqa: E501 :type enable: bool """ self.openapi_types = { @@ -54,53 +54,55 @@ def __init__(self, name=None, severity=None, metric_type=None, conditions_descri self._enable = enable @classmethod - def from_dict(cls, dikt) -> 'AlertRule': + def from_dict(cls, dikt) -> 'CreateAlertRuleRequest': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The AlertRule of this AlertRule. # noqa: E501 - :rtype: AlertRule + :return: The CreateAlertRuleRequest of this CreateAlertRuleRequest. # noqa: E501 + :rtype: CreateAlertRuleRequest """ return util.deserialize_model(dikt, cls) @property def name(self) -> str: - """Gets the name of this AlertRule. + """Gets the name of this CreateAlertRuleRequest. - :return: The name of this AlertRule. + :return: The name of this CreateAlertRuleRequest. :rtype: str """ return self._name @name.setter def name(self, name: str): - """Sets the name of this AlertRule. + """Sets the name of this CreateAlertRuleRequest. - :param name: The name of this AlertRule. + :param name: The name of this CreateAlertRuleRequest. :type name: str """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @property def severity(self) -> str: - """Gets the severity of this AlertRule. + """Gets the severity of this CreateAlertRuleRequest. - :return: The severity of this AlertRule. + :return: The severity of this CreateAlertRuleRequest. :rtype: str """ return self._severity @severity.setter def severity(self, severity: str): - """Sets the severity of this AlertRule. + """Sets the severity of this CreateAlertRuleRequest. - :param severity: The severity of this AlertRule. + :param severity: The severity of this CreateAlertRuleRequest. :type severity: str """ allowed_values = ["warning", "emergency"] # noqa: E501 @@ -114,20 +116,20 @@ def severity(self, severity: str): @property def metric_type(self) -> str: - """Gets the metric_type of this AlertRule. + """Gets the metric_type of this CreateAlertRuleRequest. - :return: The metric_type of this AlertRule. + :return: The metric_type of this CreateAlertRuleRequest. :rtype: str """ return self._metric_type @metric_type.setter def metric_type(self, metric_type: str): - """Sets the metric_type of this AlertRule. + """Sets the metric_type of this CreateAlertRuleRequest. - :param metric_type: The metric_type of this AlertRule. + :param metric_type: The metric_type of this CreateAlertRuleRequest. :type metric_type: str """ allowed_values = ["node", "service"] # noqa: E501 @@ -141,65 +143,71 @@ def metric_type(self, metric_type: str): @property def conditions_description(self) -> str: - """Gets the conditions_description of this AlertRule. + """Gets the conditions_description of this CreateAlertRuleRequest. - :return: The conditions_description of this AlertRule. + :return: The conditions_description of this CreateAlertRuleRequest. :rtype: str """ return self._conditions_description @conditions_description.setter def conditions_description(self, conditions_description: str): - """Sets the conditions_description of this AlertRule. + """Sets the conditions_description of this CreateAlertRuleRequest. - :param conditions_description: The conditions_description of this AlertRule. + :param conditions_description: The conditions_description of this CreateAlertRuleRequest. :type conditions_description: str """ + if conditions_description is None: + raise ValueError("Invalid value for `conditions_description`, must not be `None`") # noqa: E501 self._conditions_description = conditions_description @property def frequency(self) -> int: - """Gets the frequency of this AlertRule. + """Gets the frequency of this CreateAlertRuleRequest. (mins) # noqa: E501 - :return: The frequency of this AlertRule. + :return: The frequency of this CreateAlertRuleRequest. :rtype: int """ return self._frequency @frequency.setter def frequency(self, frequency: int): - """Sets the frequency of this AlertRule. + """Sets the frequency of this CreateAlertRuleRequest. (mins) # noqa: E501 - :param frequency: The frequency of this AlertRule. + :param frequency: The frequency of this CreateAlertRuleRequest. :type frequency: int """ + if frequency is None: + raise ValueError("Invalid value for `frequency`, must not be `None`") # noqa: E501 self._frequency = frequency @property def enable(self) -> bool: - """Gets the enable of this AlertRule. + """Gets the enable of this CreateAlertRuleRequest. - :return: The enable of this AlertRule. + :return: The enable of this CreateAlertRuleRequest. :rtype: bool """ return self._enable @enable.setter def enable(self, enable: bool): - """Sets the enable of this AlertRule. + """Sets the enable of this CreateAlertRuleRequest. - :param enable: The enable of this AlertRule. + :param enable: The enable of this CreateAlertRuleRequest. :type enable: bool """ + if enable is None: + raise ValueError("Invalid value for `enable`, must not be `None`") # noqa: E501 self._enable = enable diff --git a/flex/coordinator/gs_flex_coordinator/models/job_response.py b/coordinator/gscoordinator/flex/models/create_dataloading_job_response.py similarity index 50% rename from flex/coordinator/gs_flex_coordinator/models/job_response.py rename to coordinator/gscoordinator/flex/models/create_dataloading_job_response.py index 0ff619af3936..cd079bc41568 100644 --- a/flex/coordinator/gs_flex_coordinator/models/job_response.py +++ b/coordinator/gscoordinator/flex/models/create_dataloading_job_response.py @@ -2,20 +2,20 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util -class JobResponse(Model): +class CreateDataloadingJobResponse(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, job_id=None): # noqa: E501 - """JobResponse - a model defined in OpenAPI + """CreateDataloadingJobResponse - a model defined in OpenAPI - :param job_id: The job_id of this JobResponse. # noqa: E501 + :param job_id: The job_id of this CreateDataloadingJobResponse. # noqa: E501 :type job_id: str """ self.openapi_types = { @@ -29,33 +29,35 @@ def __init__(self, job_id=None): # noqa: E501 self._job_id = job_id @classmethod - def from_dict(cls, dikt) -> 'JobResponse': + def from_dict(cls, dikt) -> 'CreateDataloadingJobResponse': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The JobResponse of this JobResponse. # noqa: E501 - :rtype: JobResponse + :return: The CreateDataloadingJobResponse of this CreateDataloadingJobResponse. # noqa: E501 + :rtype: CreateDataloadingJobResponse """ return util.deserialize_model(dikt, cls) @property def job_id(self) -> str: - """Gets the job_id of this JobResponse. + """Gets the job_id of this CreateDataloadingJobResponse. - :return: The job_id of this JobResponse. + :return: The job_id of this CreateDataloadingJobResponse. :rtype: str """ return self._job_id @job_id.setter def job_id(self, job_id: str): - """Sets the job_id of this JobResponse. + """Sets the job_id of this CreateDataloadingJobResponse. - :param job_id: The job_id of this JobResponse. + :param job_id: The job_id of this CreateDataloadingJobResponse. :type job_id: str """ + if job_id is None: + raise ValueError("Invalid value for `job_id`, must not be `None`") # noqa: E501 self._job_id = job_id diff --git a/coordinator/gscoordinator/flex/models/create_edge_type.py b/coordinator/gscoordinator/flex/models/create_edge_type.py new file mode 100644 index 000000000000..27b1cadacae8 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/create_edge_type.py @@ -0,0 +1,201 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner +from gscoordinator.flex.models.create_property_meta import CreatePropertyMeta +from gscoordinator.flex import util + +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner # noqa: E501 +from gscoordinator.flex.models.create_property_meta import CreatePropertyMeta # noqa: E501 + +class CreateEdgeType(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, type_name=None, vertex_type_pair_relations=None, directed=None, primary_keys=None, properties=None, description=None): # noqa: E501 + """CreateEdgeType - a model defined in OpenAPI + + :param type_name: The type_name of this CreateEdgeType. # noqa: E501 + :type type_name: str + :param vertex_type_pair_relations: The vertex_type_pair_relations of this CreateEdgeType. # noqa: E501 + :type vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner] + :param directed: The directed of this CreateEdgeType. # noqa: E501 + :type directed: bool + :param primary_keys: The primary_keys of this CreateEdgeType. # noqa: E501 + :type primary_keys: List[str] + :param properties: The properties of this CreateEdgeType. # noqa: E501 + :type properties: List[CreatePropertyMeta] + :param description: The description of this CreateEdgeType. # noqa: E501 + :type description: str + """ + self.openapi_types = { + 'type_name': str, + 'vertex_type_pair_relations': List[BaseEdgeTypeVertexTypePairRelationsInner], + 'directed': bool, + 'primary_keys': List[str], + 'properties': List[CreatePropertyMeta], + 'description': str + } + + self.attribute_map = { + 'type_name': 'type_name', + 'vertex_type_pair_relations': 'vertex_type_pair_relations', + 'directed': 'directed', + 'primary_keys': 'primary_keys', + 'properties': 'properties', + 'description': 'description' + } + + self._type_name = type_name + self._vertex_type_pair_relations = vertex_type_pair_relations + self._directed = directed + self._primary_keys = primary_keys + self._properties = properties + self._description = description + + @classmethod + def from_dict(cls, dikt) -> 'CreateEdgeType': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The CreateEdgeType of this CreateEdgeType. # noqa: E501 + :rtype: CreateEdgeType + """ + return util.deserialize_model(dikt, cls) + + @property + def type_name(self) -> str: + """Gets the type_name of this CreateEdgeType. + + + :return: The type_name of this CreateEdgeType. + :rtype: str + """ + return self._type_name + + @type_name.setter + def type_name(self, type_name: str): + """Sets the type_name of this CreateEdgeType. + + + :param type_name: The type_name of this CreateEdgeType. + :type type_name: str + """ + if type_name is None: + raise ValueError("Invalid value for `type_name`, must not be `None`") # noqa: E501 + + self._type_name = type_name + + @property + def vertex_type_pair_relations(self) -> List[BaseEdgeTypeVertexTypePairRelationsInner]: + """Gets the vertex_type_pair_relations of this CreateEdgeType. + + + :return: The vertex_type_pair_relations of this CreateEdgeType. + :rtype: List[BaseEdgeTypeVertexTypePairRelationsInner] + """ + return self._vertex_type_pair_relations + + @vertex_type_pair_relations.setter + def vertex_type_pair_relations(self, vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner]): + """Sets the vertex_type_pair_relations of this CreateEdgeType. + + + :param vertex_type_pair_relations: The vertex_type_pair_relations of this CreateEdgeType. + :type vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner] + """ + if vertex_type_pair_relations is None: + raise ValueError("Invalid value for `vertex_type_pair_relations`, must not be `None`") # noqa: E501 + + self._vertex_type_pair_relations = vertex_type_pair_relations + + @property + def directed(self) -> bool: + """Gets the directed of this CreateEdgeType. + + + :return: The directed of this CreateEdgeType. + :rtype: bool + """ + return self._directed + + @directed.setter + def directed(self, directed: bool): + """Sets the directed of this CreateEdgeType. + + + :param directed: The directed of this CreateEdgeType. + :type directed: bool + """ + + self._directed = directed + + @property + def primary_keys(self) -> List[str]: + """Gets the primary_keys of this CreateEdgeType. + + + :return: The primary_keys of this CreateEdgeType. + :rtype: List[str] + """ + return self._primary_keys + + @primary_keys.setter + def primary_keys(self, primary_keys: List[str]): + """Sets the primary_keys of this CreateEdgeType. + + + :param primary_keys: The primary_keys of this CreateEdgeType. + :type primary_keys: List[str] + """ + + self._primary_keys = primary_keys + + @property + def properties(self) -> List[CreatePropertyMeta]: + """Gets the properties of this CreateEdgeType. + + + :return: The properties of this CreateEdgeType. + :rtype: List[CreatePropertyMeta] + """ + return self._properties + + @properties.setter + def properties(self, properties: List[CreatePropertyMeta]): + """Sets the properties of this CreateEdgeType. + + + :param properties: The properties of this CreateEdgeType. + :type properties: List[CreatePropertyMeta] + """ + if properties is None: + raise ValueError("Invalid value for `properties`, must not be `None`") # noqa: E501 + + self._properties = properties + + @property + def description(self) -> str: + """Gets the description of this CreateEdgeType. + + + :return: The description of this CreateEdgeType. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this CreateEdgeType. + + + :param description: The description of this CreateEdgeType. + :type description: str + """ + + self._description = description diff --git a/coordinator/gscoordinator/flex/models/create_graph_request.py b/coordinator/gscoordinator/flex/models/create_graph_request.py new file mode 100644 index 000000000000..3f91bd35fcc5 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/create_graph_request.py @@ -0,0 +1,143 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.create_graph_schema_request import CreateGraphSchemaRequest +from gscoordinator.flex.models.create_stored_proc_request import CreateStoredProcRequest +from gscoordinator.flex import util + +from gscoordinator.flex.models.create_graph_schema_request import CreateGraphSchemaRequest # noqa: E501 +from gscoordinator.flex.models.create_stored_proc_request import CreateStoredProcRequest # noqa: E501 + +class CreateGraphRequest(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, name=None, description=None, stored_procedures=None, _schema=None): # noqa: E501 + """CreateGraphRequest - a model defined in OpenAPI + + :param name: The name of this CreateGraphRequest. # noqa: E501 + :type name: str + :param description: The description of this CreateGraphRequest. # noqa: E501 + :type description: str + :param stored_procedures: The stored_procedures of this CreateGraphRequest. # noqa: E501 + :type stored_procedures: List[CreateStoredProcRequest] + :param _schema: The _schema of this CreateGraphRequest. # noqa: E501 + :type _schema: CreateGraphSchemaRequest + """ + self.openapi_types = { + 'name': str, + 'description': str, + 'stored_procedures': List[CreateStoredProcRequest], + '_schema': CreateGraphSchemaRequest + } + + self.attribute_map = { + 'name': 'name', + 'description': 'description', + 'stored_procedures': 'stored_procedures', + '_schema': 'schema' + } + + self._name = name + self._description = description + self._stored_procedures = stored_procedures + self.__schema = _schema + + @classmethod + def from_dict(cls, dikt) -> 'CreateGraphRequest': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The CreateGraphRequest of this CreateGraphRequest. # noqa: E501 + :rtype: CreateGraphRequest + """ + return util.deserialize_model(dikt, cls) + + @property + def name(self) -> str: + """Gets the name of this CreateGraphRequest. + + + :return: The name of this CreateGraphRequest. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name: str): + """Sets the name of this CreateGraphRequest. + + + :param name: The name of this CreateGraphRequest. + :type name: str + """ + + self._name = name + + @property + def description(self) -> str: + """Gets the description of this CreateGraphRequest. + + + :return: The description of this CreateGraphRequest. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this CreateGraphRequest. + + + :param description: The description of this CreateGraphRequest. + :type description: str + """ + + self._description = description + + @property + def stored_procedures(self) -> List[CreateStoredProcRequest]: + """Gets the stored_procedures of this CreateGraphRequest. + + + :return: The stored_procedures of this CreateGraphRequest. + :rtype: List[CreateStoredProcRequest] + """ + return self._stored_procedures + + @stored_procedures.setter + def stored_procedures(self, stored_procedures: List[CreateStoredProcRequest]): + """Sets the stored_procedures of this CreateGraphRequest. + + + :param stored_procedures: The stored_procedures of this CreateGraphRequest. + :type stored_procedures: List[CreateStoredProcRequest] + """ + + self._stored_procedures = stored_procedures + + @property + def _schema(self) -> CreateGraphSchemaRequest: + """Gets the _schema of this CreateGraphRequest. + + + :return: The _schema of this CreateGraphRequest. + :rtype: CreateGraphSchemaRequest + """ + return self.__schema + + @_schema.setter + def _schema(self, _schema: CreateGraphSchemaRequest): + """Sets the _schema of this CreateGraphRequest. + + + :param _schema: The _schema of this CreateGraphRequest. + :type _schema: CreateGraphSchemaRequest + """ + + self.__schema = _schema diff --git a/coordinator/gscoordinator/flex/models/create_graph_response.py b/coordinator/gscoordinator/flex/models/create_graph_response.py new file mode 100644 index 000000000000..16e9c32a6cc0 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/create_graph_response.py @@ -0,0 +1,63 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class CreateGraphResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, graph_id=None): # noqa: E501 + """CreateGraphResponse - a model defined in OpenAPI + + :param graph_id: The graph_id of this CreateGraphResponse. # noqa: E501 + :type graph_id: str + """ + self.openapi_types = { + 'graph_id': str + } + + self.attribute_map = { + 'graph_id': 'graph_id' + } + + self._graph_id = graph_id + + @classmethod + def from_dict(cls, dikt) -> 'CreateGraphResponse': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The CreateGraphResponse of this CreateGraphResponse. # noqa: E501 + :rtype: CreateGraphResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def graph_id(self) -> str: + """Gets the graph_id of this CreateGraphResponse. + + + :return: The graph_id of this CreateGraphResponse. + :rtype: str + """ + return self._graph_id + + @graph_id.setter + def graph_id(self, graph_id: str): + """Sets the graph_id of this CreateGraphResponse. + + + :param graph_id: The graph_id of this CreateGraphResponse. + :type graph_id: str + """ + if graph_id is None: + raise ValueError("Invalid value for `graph_id`, must not be `None`") # noqa: E501 + + self._graph_id = graph_id diff --git a/coordinator/gscoordinator/flex/models/create_graph_schema_request.py b/coordinator/gscoordinator/flex/models/create_graph_schema_request.py new file mode 100644 index 000000000000..0d1fa282c874 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/create_graph_schema_request.py @@ -0,0 +1,95 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.create_edge_type import CreateEdgeType +from gscoordinator.flex.models.create_vertex_type import CreateVertexType +from gscoordinator.flex import util + +from gscoordinator.flex.models.create_edge_type import CreateEdgeType # noqa: E501 +from gscoordinator.flex.models.create_vertex_type import CreateVertexType # noqa: E501 + +class CreateGraphSchemaRequest(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, vertex_types=None, edge_types=None): # noqa: E501 + """CreateGraphSchemaRequest - a model defined in OpenAPI + + :param vertex_types: The vertex_types of this CreateGraphSchemaRequest. # noqa: E501 + :type vertex_types: List[CreateVertexType] + :param edge_types: The edge_types of this CreateGraphSchemaRequest. # noqa: E501 + :type edge_types: List[CreateEdgeType] + """ + self.openapi_types = { + 'vertex_types': List[CreateVertexType], + 'edge_types': List[CreateEdgeType] + } + + self.attribute_map = { + 'vertex_types': 'vertex_types', + 'edge_types': 'edge_types' + } + + self._vertex_types = vertex_types + self._edge_types = edge_types + + @classmethod + def from_dict(cls, dikt) -> 'CreateGraphSchemaRequest': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The CreateGraphSchemaRequest of this CreateGraphSchemaRequest. # noqa: E501 + :rtype: CreateGraphSchemaRequest + """ + return util.deserialize_model(dikt, cls) + + @property + def vertex_types(self) -> List[CreateVertexType]: + """Gets the vertex_types of this CreateGraphSchemaRequest. + + + :return: The vertex_types of this CreateGraphSchemaRequest. + :rtype: List[CreateVertexType] + """ + return self._vertex_types + + @vertex_types.setter + def vertex_types(self, vertex_types: List[CreateVertexType]): + """Sets the vertex_types of this CreateGraphSchemaRequest. + + + :param vertex_types: The vertex_types of this CreateGraphSchemaRequest. + :type vertex_types: List[CreateVertexType] + """ + if vertex_types is None: + raise ValueError("Invalid value for `vertex_types`, must not be `None`") # noqa: E501 + + self._vertex_types = vertex_types + + @property + def edge_types(self) -> List[CreateEdgeType]: + """Gets the edge_types of this CreateGraphSchemaRequest. + + + :return: The edge_types of this CreateGraphSchemaRequest. + :rtype: List[CreateEdgeType] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types: List[CreateEdgeType]): + """Sets the edge_types of this CreateGraphSchemaRequest. + + + :param edge_types: The edge_types of this CreateGraphSchemaRequest. + :type edge_types: List[CreateEdgeType] + """ + if edge_types is None: + raise ValueError("Invalid value for `edge_types`, must not be `None`") # noqa: E501 + + self._edge_types = edge_types diff --git a/coordinator/gscoordinator/flex/models/create_property_meta.py b/coordinator/gscoordinator/flex/models/create_property_meta.py new file mode 100644 index 000000000000..07f40491816e --- /dev/null +++ b/coordinator/gscoordinator/flex/models/create_property_meta.py @@ -0,0 +1,171 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.gs_data_type import GSDataType +from gscoordinator.flex import util + +from gscoordinator.flex.models.gs_data_type import GSDataType # noqa: E501 + +class CreatePropertyMeta(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, property_name=None, property_type=None, nullable=None, default_value=None, description=None): # noqa: E501 + """CreatePropertyMeta - a model defined in OpenAPI + + :param property_name: The property_name of this CreatePropertyMeta. # noqa: E501 + :type property_name: str + :param property_type: The property_type of this CreatePropertyMeta. # noqa: E501 + :type property_type: GSDataType + :param nullable: The nullable of this CreatePropertyMeta. # noqa: E501 + :type nullable: bool + :param default_value: The default_value of this CreatePropertyMeta. # noqa: E501 + :type default_value: object + :param description: The description of this CreatePropertyMeta. # noqa: E501 + :type description: str + """ + self.openapi_types = { + 'property_name': str, + 'property_type': GSDataType, + 'nullable': bool, + 'default_value': object, + 'description': str + } + + self.attribute_map = { + 'property_name': 'property_name', + 'property_type': 'property_type', + 'nullable': 'nullable', + 'default_value': 'default_value', + 'description': 'description' + } + + self._property_name = property_name + self._property_type = property_type + self._nullable = nullable + self._default_value = default_value + self._description = description + + @classmethod + def from_dict(cls, dikt) -> 'CreatePropertyMeta': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The CreatePropertyMeta of this CreatePropertyMeta. # noqa: E501 + :rtype: CreatePropertyMeta + """ + return util.deserialize_model(dikt, cls) + + @property + def property_name(self) -> str: + """Gets the property_name of this CreatePropertyMeta. + + + :return: The property_name of this CreatePropertyMeta. + :rtype: str + """ + return self._property_name + + @property_name.setter + def property_name(self, property_name: str): + """Sets the property_name of this CreatePropertyMeta. + + + :param property_name: The property_name of this CreatePropertyMeta. + :type property_name: str + """ + if property_name is None: + raise ValueError("Invalid value for `property_name`, must not be `None`") # noqa: E501 + + self._property_name = property_name + + @property + def property_type(self) -> GSDataType: + """Gets the property_type of this CreatePropertyMeta. + + + :return: The property_type of this CreatePropertyMeta. + :rtype: GSDataType + """ + return self._property_type + + @property_type.setter + def property_type(self, property_type: GSDataType): + """Sets the property_type of this CreatePropertyMeta. + + + :param property_type: The property_type of this CreatePropertyMeta. + :type property_type: GSDataType + """ + if property_type is None: + raise ValueError("Invalid value for `property_type`, must not be `None`") # noqa: E501 + + self._property_type = property_type + + @property + def nullable(self) -> bool: + """Gets the nullable of this CreatePropertyMeta. + + + :return: The nullable of this CreatePropertyMeta. + :rtype: bool + """ + return self._nullable + + @nullable.setter + def nullable(self, nullable: bool): + """Sets the nullable of this CreatePropertyMeta. + + + :param nullable: The nullable of this CreatePropertyMeta. + :type nullable: bool + """ + + self._nullable = nullable + + @property + def default_value(self) -> object: + """Gets the default_value of this CreatePropertyMeta. + + + :return: The default_value of this CreatePropertyMeta. + :rtype: object + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value: object): + """Sets the default_value of this CreatePropertyMeta. + + + :param default_value: The default_value of this CreatePropertyMeta. + :type default_value: object + """ + + self._default_value = default_value + + @property + def description(self) -> str: + """Gets the description of this CreatePropertyMeta. + + + :return: The description of this CreatePropertyMeta. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this CreatePropertyMeta. + + + :param description: The description of this CreatePropertyMeta. + :type description: str + """ + + self._description = description diff --git a/coordinator/gscoordinator/flex/models/create_stored_proc_request.py b/coordinator/gscoordinator/flex/models/create_stored_proc_request.py new file mode 100644 index 000000000000..f8b5833e4a2e --- /dev/null +++ b/coordinator/gscoordinator/flex/models/create_stored_proc_request.py @@ -0,0 +1,149 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class CreateStoredProcRequest(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, name=None, description=None, type=None, query=None): # noqa: E501 + """CreateStoredProcRequest - a model defined in OpenAPI + + :param name: The name of this CreateStoredProcRequest. # noqa: E501 + :type name: str + :param description: The description of this CreateStoredProcRequest. # noqa: E501 + :type description: str + :param type: The type of this CreateStoredProcRequest. # noqa: E501 + :type type: str + :param query: The query of this CreateStoredProcRequest. # noqa: E501 + :type query: str + """ + self.openapi_types = { + 'name': str, + 'description': str, + 'type': str, + 'query': str + } + + self.attribute_map = { + 'name': 'name', + 'description': 'description', + 'type': 'type', + 'query': 'query' + } + + self._name = name + self._description = description + self._type = type + self._query = query + + @classmethod + def from_dict(cls, dikt) -> 'CreateStoredProcRequest': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The CreateStoredProcRequest of this CreateStoredProcRequest. # noqa: E501 + :rtype: CreateStoredProcRequest + """ + return util.deserialize_model(dikt, cls) + + @property + def name(self) -> str: + """Gets the name of this CreateStoredProcRequest. + + + :return: The name of this CreateStoredProcRequest. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name: str): + """Sets the name of this CreateStoredProcRequest. + + + :param name: The name of this CreateStoredProcRequest. + :type name: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def description(self) -> str: + """Gets the description of this CreateStoredProcRequest. + + + :return: The description of this CreateStoredProcRequest. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this CreateStoredProcRequest. + + + :param description: The description of this CreateStoredProcRequest. + :type description: str + """ + + self._description = description + + @property + def type(self) -> str: + """Gets the type of this CreateStoredProcRequest. + + + :return: The type of this CreateStoredProcRequest. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type: str): + """Sets the type of this CreateStoredProcRequest. + + + :param type: The type of this CreateStoredProcRequest. + :type type: str + """ + allowed_values = ["cpp", "cypher"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" + .format(type, allowed_values) + ) + + self._type = type + + @property + def query(self) -> str: + """Gets the query of this CreateStoredProcRequest. + + + :return: The query of this CreateStoredProcRequest. + :rtype: str + """ + return self._query + + @query.setter + def query(self, query: str): + """Sets the query of this CreateStoredProcRequest. + + + :param query: The query of this CreateStoredProcRequest. + :type query: str + """ + if query is None: + raise ValueError("Invalid value for `query`, must not be `None`") # noqa: E501 + + self._query = query diff --git a/coordinator/gscoordinator/flex/models/create_stored_proc_response.py b/coordinator/gscoordinator/flex/models/create_stored_proc_response.py new file mode 100644 index 000000000000..d6d196c15e62 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/create_stored_proc_response.py @@ -0,0 +1,63 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class CreateStoredProcResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, stored_procedure_id=None): # noqa: E501 + """CreateStoredProcResponse - a model defined in OpenAPI + + :param stored_procedure_id: The stored_procedure_id of this CreateStoredProcResponse. # noqa: E501 + :type stored_procedure_id: str + """ + self.openapi_types = { + 'stored_procedure_id': str + } + + self.attribute_map = { + 'stored_procedure_id': 'stored_procedure_id' + } + + self._stored_procedure_id = stored_procedure_id + + @classmethod + def from_dict(cls, dikt) -> 'CreateStoredProcResponse': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The CreateStoredProcResponse of this CreateStoredProcResponse. # noqa: E501 + :rtype: CreateStoredProcResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def stored_procedure_id(self) -> str: + """Gets the stored_procedure_id of this CreateStoredProcResponse. + + + :return: The stored_procedure_id of this CreateStoredProcResponse. + :rtype: str + """ + return self._stored_procedure_id + + @stored_procedure_id.setter + def stored_procedure_id(self, stored_procedure_id: str): + """Sets the stored_procedure_id of this CreateStoredProcResponse. + + + :param stored_procedure_id: The stored_procedure_id of this CreateStoredProcResponse. + :type stored_procedure_id: str + """ + if stored_procedure_id is None: + raise ValueError("Invalid value for `stored_procedure_id`, must not be `None`") # noqa: E501 + + self._stored_procedure_id = stored_procedure_id diff --git a/coordinator/gscoordinator/flex/models/create_vertex_type.py b/coordinator/gscoordinator/flex/models/create_vertex_type.py new file mode 100644 index 000000000000..94ca61cfbe6f --- /dev/null +++ b/coordinator/gscoordinator/flex/models/create_vertex_type.py @@ -0,0 +1,175 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams +from gscoordinator.flex.models.create_property_meta import CreatePropertyMeta +from gscoordinator.flex import util + +from gscoordinator.flex.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams # noqa: E501 +from gscoordinator.flex.models.create_property_meta import CreatePropertyMeta # noqa: E501 + +class CreateVertexType(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, type_name=None, primary_keys=None, x_csr_params=None, properties=None, description=None): # noqa: E501 + """CreateVertexType - a model defined in OpenAPI + + :param type_name: The type_name of this CreateVertexType. # noqa: E501 + :type type_name: str + :param primary_keys: The primary_keys of this CreateVertexType. # noqa: E501 + :type primary_keys: List[str] + :param x_csr_params: The x_csr_params of this CreateVertexType. # noqa: E501 + :type x_csr_params: BaseVertexTypeXCsrParams + :param properties: The properties of this CreateVertexType. # noqa: E501 + :type properties: List[CreatePropertyMeta] + :param description: The description of this CreateVertexType. # noqa: E501 + :type description: str + """ + self.openapi_types = { + 'type_name': str, + 'primary_keys': List[str], + 'x_csr_params': BaseVertexTypeXCsrParams, + 'properties': List[CreatePropertyMeta], + 'description': str + } + + self.attribute_map = { + 'type_name': 'type_name', + 'primary_keys': 'primary_keys', + 'x_csr_params': 'x_csr_params', + 'properties': 'properties', + 'description': 'description' + } + + self._type_name = type_name + self._primary_keys = primary_keys + self._x_csr_params = x_csr_params + self._properties = properties + self._description = description + + @classmethod + def from_dict(cls, dikt) -> 'CreateVertexType': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The CreateVertexType of this CreateVertexType. # noqa: E501 + :rtype: CreateVertexType + """ + return util.deserialize_model(dikt, cls) + + @property + def type_name(self) -> str: + """Gets the type_name of this CreateVertexType. + + + :return: The type_name of this CreateVertexType. + :rtype: str + """ + return self._type_name + + @type_name.setter + def type_name(self, type_name: str): + """Sets the type_name of this CreateVertexType. + + + :param type_name: The type_name of this CreateVertexType. + :type type_name: str + """ + if type_name is None: + raise ValueError("Invalid value for `type_name`, must not be `None`") # noqa: E501 + + self._type_name = type_name + + @property + def primary_keys(self) -> List[str]: + """Gets the primary_keys of this CreateVertexType. + + + :return: The primary_keys of this CreateVertexType. + :rtype: List[str] + """ + return self._primary_keys + + @primary_keys.setter + def primary_keys(self, primary_keys: List[str]): + """Sets the primary_keys of this CreateVertexType. + + + :param primary_keys: The primary_keys of this CreateVertexType. + :type primary_keys: List[str] + """ + if primary_keys is None: + raise ValueError("Invalid value for `primary_keys`, must not be `None`") # noqa: E501 + + self._primary_keys = primary_keys + + @property + def x_csr_params(self) -> BaseVertexTypeXCsrParams: + """Gets the x_csr_params of this CreateVertexType. + + + :return: The x_csr_params of this CreateVertexType. + :rtype: BaseVertexTypeXCsrParams + """ + return self._x_csr_params + + @x_csr_params.setter + def x_csr_params(self, x_csr_params: BaseVertexTypeXCsrParams): + """Sets the x_csr_params of this CreateVertexType. + + + :param x_csr_params: The x_csr_params of this CreateVertexType. + :type x_csr_params: BaseVertexTypeXCsrParams + """ + + self._x_csr_params = x_csr_params + + @property + def properties(self) -> List[CreatePropertyMeta]: + """Gets the properties of this CreateVertexType. + + + :return: The properties of this CreateVertexType. + :rtype: List[CreatePropertyMeta] + """ + return self._properties + + @properties.setter + def properties(self, properties: List[CreatePropertyMeta]): + """Sets the properties of this CreateVertexType. + + + :param properties: The properties of this CreateVertexType. + :type properties: List[CreatePropertyMeta] + """ + if properties is None: + raise ValueError("Invalid value for `properties`, must not be `None`") # noqa: E501 + + self._properties = properties + + @property + def description(self) -> str: + """Gets the description of this CreateVertexType. + + + :return: The description of this CreateVertexType. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this CreateVertexType. + + + :param description: The description of this CreateVertexType. + :type description: str + """ + + self._description = description diff --git a/coordinator/gscoordinator/flex/models/dataloading_job_config.py b/coordinator/gscoordinator/flex/models/dataloading_job_config.py new file mode 100644 index 000000000000..f9d8749b26bc --- /dev/null +++ b/coordinator/gscoordinator/flex/models/dataloading_job_config.py @@ -0,0 +1,185 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.dataloading_job_config_edges_inner import DataloadingJobConfigEdgesInner +from gscoordinator.flex.models.dataloading_job_config_loading_config import DataloadingJobConfigLoadingConfig +from gscoordinator.flex.models.dataloading_job_config_vertices_inner import DataloadingJobConfigVerticesInner +from gscoordinator.flex import util + +from gscoordinator.flex.models.dataloading_job_config_edges_inner import DataloadingJobConfigEdgesInner # noqa: E501 +from gscoordinator.flex.models.dataloading_job_config_loading_config import DataloadingJobConfigLoadingConfig # noqa: E501 +from gscoordinator.flex.models.dataloading_job_config_vertices_inner import DataloadingJobConfigVerticesInner # noqa: E501 + +class DataloadingJobConfig(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, loading_config=None, vertices=None, edges=None, schedule=None, repeat=None): # noqa: E501 + """DataloadingJobConfig - a model defined in OpenAPI + + :param loading_config: The loading_config of this DataloadingJobConfig. # noqa: E501 + :type loading_config: DataloadingJobConfigLoadingConfig + :param vertices: The vertices of this DataloadingJobConfig. # noqa: E501 + :type vertices: List[DataloadingJobConfigVerticesInner] + :param edges: The edges of this DataloadingJobConfig. # noqa: E501 + :type edges: List[DataloadingJobConfigEdgesInner] + :param schedule: The schedule of this DataloadingJobConfig. # noqa: E501 + :type schedule: str + :param repeat: The repeat of this DataloadingJobConfig. # noqa: E501 + :type repeat: str + """ + self.openapi_types = { + 'loading_config': DataloadingJobConfigLoadingConfig, + 'vertices': List[DataloadingJobConfigVerticesInner], + 'edges': List[DataloadingJobConfigEdgesInner], + 'schedule': str, + 'repeat': str + } + + self.attribute_map = { + 'loading_config': 'loading_config', + 'vertices': 'vertices', + 'edges': 'edges', + 'schedule': 'schedule', + 'repeat': 'repeat' + } + + self._loading_config = loading_config + self._vertices = vertices + self._edges = edges + self._schedule = schedule + self._repeat = repeat + + @classmethod + def from_dict(cls, dikt) -> 'DataloadingJobConfig': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The DataloadingJobConfig of this DataloadingJobConfig. # noqa: E501 + :rtype: DataloadingJobConfig + """ + return util.deserialize_model(dikt, cls) + + @property + def loading_config(self) -> DataloadingJobConfigLoadingConfig: + """Gets the loading_config of this DataloadingJobConfig. + + + :return: The loading_config of this DataloadingJobConfig. + :rtype: DataloadingJobConfigLoadingConfig + """ + return self._loading_config + + @loading_config.setter + def loading_config(self, loading_config: DataloadingJobConfigLoadingConfig): + """Sets the loading_config of this DataloadingJobConfig. + + + :param loading_config: The loading_config of this DataloadingJobConfig. + :type loading_config: DataloadingJobConfigLoadingConfig + """ + if loading_config is None: + raise ValueError("Invalid value for `loading_config`, must not be `None`") # noqa: E501 + + self._loading_config = loading_config + + @property + def vertices(self) -> List[DataloadingJobConfigVerticesInner]: + """Gets the vertices of this DataloadingJobConfig. + + + :return: The vertices of this DataloadingJobConfig. + :rtype: List[DataloadingJobConfigVerticesInner] + """ + return self._vertices + + @vertices.setter + def vertices(self, vertices: List[DataloadingJobConfigVerticesInner]): + """Sets the vertices of this DataloadingJobConfig. + + + :param vertices: The vertices of this DataloadingJobConfig. + :type vertices: List[DataloadingJobConfigVerticesInner] + """ + if vertices is None: + raise ValueError("Invalid value for `vertices`, must not be `None`") # noqa: E501 + + self._vertices = vertices + + @property + def edges(self) -> List[DataloadingJobConfigEdgesInner]: + """Gets the edges of this DataloadingJobConfig. + + + :return: The edges of this DataloadingJobConfig. + :rtype: List[DataloadingJobConfigEdgesInner] + """ + return self._edges + + @edges.setter + def edges(self, edges: List[DataloadingJobConfigEdgesInner]): + """Sets the edges of this DataloadingJobConfig. + + + :param edges: The edges of this DataloadingJobConfig. + :type edges: List[DataloadingJobConfigEdgesInner] + """ + if edges is None: + raise ValueError("Invalid value for `edges`, must not be `None`") # noqa: E501 + + self._edges = edges + + @property + def schedule(self) -> str: + """Gets the schedule of this DataloadingJobConfig. + + format with '2023-02-21 11:56:30' # noqa: E501 + + :return: The schedule of this DataloadingJobConfig. + :rtype: str + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule: str): + """Sets the schedule of this DataloadingJobConfig. + + format with '2023-02-21 11:56:30' # noqa: E501 + + :param schedule: The schedule of this DataloadingJobConfig. + :type schedule: str + """ + + self._schedule = schedule + + @property + def repeat(self) -> str: + """Gets the repeat of this DataloadingJobConfig. + + + :return: The repeat of this DataloadingJobConfig. + :rtype: str + """ + return self._repeat + + @repeat.setter + def repeat(self, repeat: str): + """Sets the repeat of this DataloadingJobConfig. + + + :param repeat: The repeat of this DataloadingJobConfig. + :type repeat: str + """ + allowed_values = [None,"once", "day", "week"] # noqa: E501 + if repeat not in allowed_values: + raise ValueError( + "Invalid value for `repeat` ({0}), must be one of {1}" + .format(repeat, allowed_values) + ) + + self._repeat = repeat diff --git a/flex/coordinator/gs_flex_coordinator/models/groot_dataloading_job_config_edges_inner.py b/coordinator/gscoordinator/flex/models/dataloading_job_config_edges_inner.py similarity index 57% rename from flex/coordinator/gs_flex_coordinator/models/groot_dataloading_job_config_edges_inner.py rename to coordinator/gscoordinator/flex/models/dataloading_job_config_edges_inner.py index 82b0b57b1fba..1891ecea5ada 100644 --- a/flex/coordinator/gs_flex_coordinator/models/groot_dataloading_job_config_edges_inner.py +++ b/coordinator/gscoordinator/flex/models/dataloading_job_config_edges_inner.py @@ -2,24 +2,24 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util -class GrootDataloadingJobConfigEdgesInner(Model): +class DataloadingJobConfigEdgesInner(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, type_name=None, source_vertex=None, destination_vertex=None): # noqa: E501 - """GrootDataloadingJobConfigEdgesInner - a model defined in OpenAPI + """DataloadingJobConfigEdgesInner - a model defined in OpenAPI - :param type_name: The type_name of this GrootDataloadingJobConfigEdgesInner. # noqa: E501 + :param type_name: The type_name of this DataloadingJobConfigEdgesInner. # noqa: E501 :type type_name: str - :param source_vertex: The source_vertex of this GrootDataloadingJobConfigEdgesInner. # noqa: E501 + :param source_vertex: The source_vertex of this DataloadingJobConfigEdgesInner. # noqa: E501 :type source_vertex: str - :param destination_vertex: The destination_vertex of this GrootDataloadingJobConfigEdgesInner. # noqa: E501 + :param destination_vertex: The destination_vertex of this DataloadingJobConfigEdgesInner. # noqa: E501 :type destination_vertex: str """ self.openapi_types = { @@ -39,32 +39,32 @@ def __init__(self, type_name=None, source_vertex=None, destination_vertex=None): self._destination_vertex = destination_vertex @classmethod - def from_dict(cls, dikt) -> 'GrootDataloadingJobConfigEdgesInner': + def from_dict(cls, dikt) -> 'DataloadingJobConfigEdgesInner': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The GrootDataloadingJobConfig_edges_inner of this GrootDataloadingJobConfigEdgesInner. # noqa: E501 - :rtype: GrootDataloadingJobConfigEdgesInner + :return: The DataloadingJobConfig_edges_inner of this DataloadingJobConfigEdgesInner. # noqa: E501 + :rtype: DataloadingJobConfigEdgesInner """ return util.deserialize_model(dikt, cls) @property def type_name(self) -> str: - """Gets the type_name of this GrootDataloadingJobConfigEdgesInner. + """Gets the type_name of this DataloadingJobConfigEdgesInner. - :return: The type_name of this GrootDataloadingJobConfigEdgesInner. + :return: The type_name of this DataloadingJobConfigEdgesInner. :rtype: str """ return self._type_name @type_name.setter def type_name(self, type_name: str): - """Sets the type_name of this GrootDataloadingJobConfigEdgesInner. + """Sets the type_name of this DataloadingJobConfigEdgesInner. - :param type_name: The type_name of this GrootDataloadingJobConfigEdgesInner. + :param type_name: The type_name of this DataloadingJobConfigEdgesInner. :type type_name: str """ @@ -72,20 +72,20 @@ def type_name(self, type_name: str): @property def source_vertex(self) -> str: - """Gets the source_vertex of this GrootDataloadingJobConfigEdgesInner. + """Gets the source_vertex of this DataloadingJobConfigEdgesInner. - :return: The source_vertex of this GrootDataloadingJobConfigEdgesInner. + :return: The source_vertex of this DataloadingJobConfigEdgesInner. :rtype: str """ return self._source_vertex @source_vertex.setter def source_vertex(self, source_vertex: str): - """Sets the source_vertex of this GrootDataloadingJobConfigEdgesInner. + """Sets the source_vertex of this DataloadingJobConfigEdgesInner. - :param source_vertex: The source_vertex of this GrootDataloadingJobConfigEdgesInner. + :param source_vertex: The source_vertex of this DataloadingJobConfigEdgesInner. :type source_vertex: str """ @@ -93,20 +93,20 @@ def source_vertex(self, source_vertex: str): @property def destination_vertex(self) -> str: - """Gets the destination_vertex of this GrootDataloadingJobConfigEdgesInner. + """Gets the destination_vertex of this DataloadingJobConfigEdgesInner. - :return: The destination_vertex of this GrootDataloadingJobConfigEdgesInner. + :return: The destination_vertex of this DataloadingJobConfigEdgesInner. :rtype: str """ return self._destination_vertex @destination_vertex.setter def destination_vertex(self, destination_vertex: str): - """Sets the destination_vertex of this GrootDataloadingJobConfigEdgesInner. + """Sets the destination_vertex of this DataloadingJobConfigEdgesInner. - :param destination_vertex: The destination_vertex of this GrootDataloadingJobConfigEdgesInner. + :param destination_vertex: The destination_vertex of this DataloadingJobConfigEdgesInner. :type destination_vertex: str """ diff --git a/coordinator/gscoordinator/flex/models/dataloading_job_config_loading_config.py b/coordinator/gscoordinator/flex/models/dataloading_job_config_loading_config.py new file mode 100644 index 000000000000..47bec19f30d9 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/dataloading_job_config_loading_config.py @@ -0,0 +1,95 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.dataloading_job_config_loading_config_format import DataloadingJobConfigLoadingConfigFormat +from gscoordinator.flex import util + +from gscoordinator.flex.models.dataloading_job_config_loading_config_format import DataloadingJobConfigLoadingConfigFormat # noqa: E501 + +class DataloadingJobConfigLoadingConfig(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, import_option=None, format=None): # noqa: E501 + """DataloadingJobConfigLoadingConfig - a model defined in OpenAPI + + :param import_option: The import_option of this DataloadingJobConfigLoadingConfig. # noqa: E501 + :type import_option: str + :param format: The format of this DataloadingJobConfigLoadingConfig. # noqa: E501 + :type format: DataloadingJobConfigLoadingConfigFormat + """ + self.openapi_types = { + 'import_option': str, + 'format': DataloadingJobConfigLoadingConfigFormat + } + + self.attribute_map = { + 'import_option': 'import_option', + 'format': 'format' + } + + self._import_option = import_option + self._format = format + + @classmethod + def from_dict(cls, dikt) -> 'DataloadingJobConfigLoadingConfig': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The DataloadingJobConfig_loading_config of this DataloadingJobConfigLoadingConfig. # noqa: E501 + :rtype: DataloadingJobConfigLoadingConfig + """ + return util.deserialize_model(dikt, cls) + + @property + def import_option(self) -> str: + """Gets the import_option of this DataloadingJobConfigLoadingConfig. + + + :return: The import_option of this DataloadingJobConfigLoadingConfig. + :rtype: str + """ + return self._import_option + + @import_option.setter + def import_option(self, import_option: str): + """Sets the import_option of this DataloadingJobConfigLoadingConfig. + + + :param import_option: The import_option of this DataloadingJobConfigLoadingConfig. + :type import_option: str + """ + allowed_values = ["init", "overwrite"] # noqa: E501 + if import_option not in allowed_values: + raise ValueError( + "Invalid value for `import_option` ({0}), must be one of {1}" + .format(import_option, allowed_values) + ) + + self._import_option = import_option + + @property + def format(self) -> DataloadingJobConfigLoadingConfigFormat: + """Gets the format of this DataloadingJobConfigLoadingConfig. + + + :return: The format of this DataloadingJobConfigLoadingConfig. + :rtype: DataloadingJobConfigLoadingConfigFormat + """ + return self._format + + @format.setter + def format(self, format: DataloadingJobConfigLoadingConfigFormat): + """Sets the format of this DataloadingJobConfigLoadingConfig. + + + :param format: The format of this DataloadingJobConfigLoadingConfig. + :type format: DataloadingJobConfigLoadingConfigFormat + """ + + self._format = format diff --git a/flex/coordinator/gs_flex_coordinator/models/schema_mapping_loading_config_format.py b/coordinator/gscoordinator/flex/models/dataloading_job_config_loading_config_format.py similarity index 50% rename from flex/coordinator/gs_flex_coordinator/models/schema_mapping_loading_config_format.py rename to coordinator/gscoordinator/flex/models/dataloading_job_config_loading_config_format.py index 13a317ad7642..450666683e1c 100644 --- a/flex/coordinator/gs_flex_coordinator/models/schema_mapping_loading_config_format.py +++ b/coordinator/gscoordinator/flex/models/dataloading_job_config_loading_config_format.py @@ -2,22 +2,22 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util -class SchemaMappingLoadingConfigFormat(Model): +class DataloadingJobConfigLoadingConfigFormat(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, type=None, metadata=None): # noqa: E501 - """SchemaMappingLoadingConfigFormat - a model defined in OpenAPI + """DataloadingJobConfigLoadingConfigFormat - a model defined in OpenAPI - :param type: The type of this SchemaMappingLoadingConfigFormat. # noqa: E501 + :param type: The type of this DataloadingJobConfigLoadingConfigFormat. # noqa: E501 :type type: str - :param metadata: The metadata of this SchemaMappingLoadingConfigFormat. # noqa: E501 + :param metadata: The metadata of this DataloadingJobConfigLoadingConfigFormat. # noqa: E501 :type metadata: Dict[str, object] """ self.openapi_types = { @@ -34,32 +34,32 @@ def __init__(self, type=None, metadata=None): # noqa: E501 self._metadata = metadata @classmethod - def from_dict(cls, dikt) -> 'SchemaMappingLoadingConfigFormat': + def from_dict(cls, dikt) -> 'DataloadingJobConfigLoadingConfigFormat': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The SchemaMapping_loading_config_format of this SchemaMappingLoadingConfigFormat. # noqa: E501 - :rtype: SchemaMappingLoadingConfigFormat + :return: The DataloadingJobConfig_loading_config_format of this DataloadingJobConfigLoadingConfigFormat. # noqa: E501 + :rtype: DataloadingJobConfigLoadingConfigFormat """ return util.deserialize_model(dikt, cls) @property def type(self) -> str: - """Gets the type of this SchemaMappingLoadingConfigFormat. + """Gets the type of this DataloadingJobConfigLoadingConfigFormat. - :return: The type of this SchemaMappingLoadingConfigFormat. + :return: The type of this DataloadingJobConfigLoadingConfigFormat. :rtype: str """ return self._type @type.setter def type(self, type: str): - """Sets the type of this SchemaMappingLoadingConfigFormat. + """Sets the type of this DataloadingJobConfigLoadingConfigFormat. - :param type: The type of this SchemaMappingLoadingConfigFormat. + :param type: The type of this DataloadingJobConfigLoadingConfigFormat. :type type: str """ @@ -67,20 +67,20 @@ def type(self, type: str): @property def metadata(self) -> Dict[str, object]: - """Gets the metadata of this SchemaMappingLoadingConfigFormat. + """Gets the metadata of this DataloadingJobConfigLoadingConfigFormat. - :return: The metadata of this SchemaMappingLoadingConfigFormat. + :return: The metadata of this DataloadingJobConfigLoadingConfigFormat. :rtype: Dict[str, object] """ return self._metadata @metadata.setter def metadata(self, metadata: Dict[str, object]): - """Sets the metadata of this SchemaMappingLoadingConfigFormat. + """Sets the metadata of this DataloadingJobConfigLoadingConfigFormat. - :param metadata: The metadata of this SchemaMappingLoadingConfigFormat. + :param metadata: The metadata of this DataloadingJobConfigLoadingConfigFormat. :type metadata: Dict[str, object] """ diff --git a/coordinator/gscoordinator/flex/models/dataloading_job_config_vertices_inner.py b/coordinator/gscoordinator/flex/models/dataloading_job_config_vertices_inner.py new file mode 100644 index 000000000000..c4a2c1c457d2 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/dataloading_job_config_vertices_inner.py @@ -0,0 +1,61 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class DataloadingJobConfigVerticesInner(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, type_name=None): # noqa: E501 + """DataloadingJobConfigVerticesInner - a model defined in OpenAPI + + :param type_name: The type_name of this DataloadingJobConfigVerticesInner. # noqa: E501 + :type type_name: str + """ + self.openapi_types = { + 'type_name': str + } + + self.attribute_map = { + 'type_name': 'type_name' + } + + self._type_name = type_name + + @classmethod + def from_dict(cls, dikt) -> 'DataloadingJobConfigVerticesInner': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The DataloadingJobConfig_vertices_inner of this DataloadingJobConfigVerticesInner. # noqa: E501 + :rtype: DataloadingJobConfigVerticesInner + """ + return util.deserialize_model(dikt, cls) + + @property + def type_name(self) -> str: + """Gets the type_name of this DataloadingJobConfigVerticesInner. + + + :return: The type_name of this DataloadingJobConfigVerticesInner. + :rtype: str + """ + return self._type_name + + @type_name.setter + def type_name(self, type_name: str): + """Sets the type_name of this DataloadingJobConfigVerticesInner. + + + :param type_name: The type_name of this DataloadingJobConfigVerticesInner. + :type type_name: str + """ + + self._type_name = type_name diff --git a/flex/coordinator/gs_flex_coordinator/models/edge_mapping.py b/coordinator/gscoordinator/flex/models/edge_mapping.py similarity index 72% rename from flex/coordinator/gs_flex_coordinator/models/edge_mapping.py rename to coordinator/gscoordinator/flex/models/edge_mapping.py index fe083bbede2b..b06d180617d9 100644 --- a/flex/coordinator/gs_flex_coordinator/models/edge_mapping.py +++ b/coordinator/gscoordinator/flex/models/edge_mapping.py @@ -2,17 +2,13 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.column_mapping import ColumnMapping -from gs_flex_coordinator.models.edge_mapping_destination_vertex_mappings_inner import EdgeMappingDestinationVertexMappingsInner -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner import EdgeMappingSourceVertexMappingsInner -from gs_flex_coordinator.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.column_mapping import ColumnMapping # noqa: E501 -from gs_flex_coordinator.models.edge_mapping_destination_vertex_mappings_inner import EdgeMappingDestinationVertexMappingsInner # noqa: E501 -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner import EdgeMappingSourceVertexMappingsInner # noqa: E501 -from gs_flex_coordinator.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet # noqa: E501 +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.column_mapping import ColumnMapping +from gscoordinator.flex.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet +from gscoordinator.flex import util + +from gscoordinator.flex.models.column_mapping import ColumnMapping # noqa: E501 +from gscoordinator.flex.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet # noqa: E501 class EdgeMapping(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -28,17 +24,17 @@ def __init__(self, type_triplet=None, inputs=None, source_vertex_mappings=None, :param inputs: The inputs of this EdgeMapping. # noqa: E501 :type inputs: List[str] :param source_vertex_mappings: The source_vertex_mappings of this EdgeMapping. # noqa: E501 - :type source_vertex_mappings: List[EdgeMappingSourceVertexMappingsInner] + :type source_vertex_mappings: List[ColumnMapping] :param destination_vertex_mappings: The destination_vertex_mappings of this EdgeMapping. # noqa: E501 - :type destination_vertex_mappings: List[EdgeMappingDestinationVertexMappingsInner] + :type destination_vertex_mappings: List[ColumnMapping] :param column_mappings: The column_mappings of this EdgeMapping. # noqa: E501 :type column_mappings: List[ColumnMapping] """ self.openapi_types = { 'type_triplet': EdgeMappingTypeTriplet, 'inputs': List[str], - 'source_vertex_mappings': List[EdgeMappingSourceVertexMappingsInner], - 'destination_vertex_mappings': List[EdgeMappingDestinationVertexMappingsInner], + 'source_vertex_mappings': List[ColumnMapping], + 'destination_vertex_mappings': List[ColumnMapping], 'column_mappings': List[ColumnMapping] } @@ -85,6 +81,8 @@ def type_triplet(self, type_triplet: EdgeMappingTypeTriplet): :param type_triplet: The type_triplet of this EdgeMapping. :type type_triplet: EdgeMappingTypeTriplet """ + if type_triplet is None: + raise ValueError("Invalid value for `type_triplet`, must not be `None`") # noqa: E501 self._type_triplet = type_triplet @@ -106,48 +104,54 @@ def inputs(self, inputs: List[str]): :param inputs: The inputs of this EdgeMapping. :type inputs: List[str] """ + if inputs is None: + raise ValueError("Invalid value for `inputs`, must not be `None`") # noqa: E501 self._inputs = inputs @property - def source_vertex_mappings(self) -> List[EdgeMappingSourceVertexMappingsInner]: + def source_vertex_mappings(self) -> List[ColumnMapping]: """Gets the source_vertex_mappings of this EdgeMapping. :return: The source_vertex_mappings of this EdgeMapping. - :rtype: List[EdgeMappingSourceVertexMappingsInner] + :rtype: List[ColumnMapping] """ return self._source_vertex_mappings @source_vertex_mappings.setter - def source_vertex_mappings(self, source_vertex_mappings: List[EdgeMappingSourceVertexMappingsInner]): + def source_vertex_mappings(self, source_vertex_mappings: List[ColumnMapping]): """Sets the source_vertex_mappings of this EdgeMapping. :param source_vertex_mappings: The source_vertex_mappings of this EdgeMapping. - :type source_vertex_mappings: List[EdgeMappingSourceVertexMappingsInner] + :type source_vertex_mappings: List[ColumnMapping] """ + if source_vertex_mappings is None: + raise ValueError("Invalid value for `source_vertex_mappings`, must not be `None`") # noqa: E501 self._source_vertex_mappings = source_vertex_mappings @property - def destination_vertex_mappings(self) -> List[EdgeMappingDestinationVertexMappingsInner]: + def destination_vertex_mappings(self) -> List[ColumnMapping]: """Gets the destination_vertex_mappings of this EdgeMapping. :return: The destination_vertex_mappings of this EdgeMapping. - :rtype: List[EdgeMappingDestinationVertexMappingsInner] + :rtype: List[ColumnMapping] """ return self._destination_vertex_mappings @destination_vertex_mappings.setter - def destination_vertex_mappings(self, destination_vertex_mappings: List[EdgeMappingDestinationVertexMappingsInner]): + def destination_vertex_mappings(self, destination_vertex_mappings: List[ColumnMapping]): """Sets the destination_vertex_mappings of this EdgeMapping. :param destination_vertex_mappings: The destination_vertex_mappings of this EdgeMapping. - :type destination_vertex_mappings: List[EdgeMappingDestinationVertexMappingsInner] + :type destination_vertex_mappings: List[ColumnMapping] """ + if destination_vertex_mappings is None: + raise ValueError("Invalid value for `destination_vertex_mappings`, must not be `None`") # noqa: E501 self._destination_vertex_mappings = destination_vertex_mappings diff --git a/flex/coordinator/gs_flex_coordinator/models/edge_mapping_type_triplet.py b/coordinator/gscoordinator/flex/models/edge_mapping_type_triplet.py similarity index 87% rename from flex/coordinator/gs_flex_coordinator/models/edge_mapping_type_triplet.py rename to coordinator/gscoordinator/flex/models/edge_mapping_type_triplet.py index 7f8244436d10..b39e5700f652 100644 --- a/flex/coordinator/gs_flex_coordinator/models/edge_mapping_type_triplet.py +++ b/coordinator/gscoordinator/flex/models/edge_mapping_type_triplet.py @@ -2,8 +2,8 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util class EdgeMappingTypeTriplet(Model): @@ -67,6 +67,8 @@ def edge(self, edge: str): :param edge: The edge of this EdgeMappingTypeTriplet. :type edge: str """ + if edge is None: + raise ValueError("Invalid value for `edge`, must not be `None`") # noqa: E501 self._edge = edge @@ -88,6 +90,8 @@ def source_vertex(self, source_vertex: str): :param source_vertex: The source_vertex of this EdgeMappingTypeTriplet. :type source_vertex: str """ + if source_vertex is None: + raise ValueError("Invalid value for `source_vertex`, must not be `None`") # noqa: E501 self._source_vertex = source_vertex @@ -109,5 +113,7 @@ def destination_vertex(self, destination_vertex: str): :param destination_vertex: The destination_vertex of this EdgeMappingTypeTriplet. :type destination_vertex: str """ + if destination_vertex is None: + raise ValueError("Invalid value for `destination_vertex`, must not be `None`") # noqa: E501 self._destination_vertex = destination_vertex diff --git a/coordinator/gscoordinator/flex/models/error.py b/coordinator/gscoordinator/flex/models/error.py new file mode 100644 index 000000000000..d82f09f35ec0 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/error.py @@ -0,0 +1,95 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class Error(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, code=None, message=None): # noqa: E501 + """Error - a model defined in OpenAPI + + :param code: The code of this Error. # noqa: E501 + :type code: int + :param message: The message of this Error. # noqa: E501 + :type message: str + """ + self.openapi_types = { + 'code': int, + 'message': str + } + + self.attribute_map = { + 'code': 'code', + 'message': 'message' + } + + self._code = code + self._message = message + + @classmethod + def from_dict(cls, dikt) -> 'Error': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Error of this Error. # noqa: E501 + :rtype: Error + """ + return util.deserialize_model(dikt, cls) + + @property + def code(self) -> int: + """Gets the code of this Error. + + Error code # noqa: E501 + + :return: The code of this Error. + :rtype: int + """ + return self._code + + @code.setter + def code(self, code: int): + """Sets the code of this Error. + + Error code # noqa: E501 + + :param code: The code of this Error. + :type code: int + """ + if code is None: + raise ValueError("Invalid value for `code`, must not be `None`") # noqa: E501 + + self._code = code + + @property + def message(self) -> str: + """Gets the message of this Error. + + Error message # noqa: E501 + + :return: The message of this Error. + :rtype: str + """ + return self._message + + @message.setter + def message(self, message: str): + """Sets the message of this Error. + + Error message # noqa: E501 + + :param message: The message of this Error. + :type message: str + """ + if message is None: + raise ValueError("Invalid value for `message`, must not be `None`") # noqa: E501 + + self._message = message diff --git a/flex/coordinator/gs_flex_coordinator/models/alert_message.py b/coordinator/gscoordinator/flex/models/get_alert_message_response.py similarity index 50% rename from flex/coordinator/gs_flex_coordinator/models/alert_message.py rename to coordinator/gscoordinator/flex/models/get_alert_message_response.py index 84c4b2682af8..fb270900c1b7 100644 --- a/flex/coordinator/gs_flex_coordinator/models/alert_message.py +++ b/coordinator/gscoordinator/flex/models/get_alert_message_response.py @@ -2,38 +2,38 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util -class AlertMessage(Model): +class GetAlertMessageResponse(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ - def __init__(self, message_id=None, alert_name=None, severity=None, metric_type=None, target=None, trigger_time=None, status=None, message=None): # noqa: E501 - """AlertMessage - a model defined in OpenAPI + def __init__(self, id=None, alert_name=None, severity=None, metric_type=None, target=None, trigger_time=None, status=None, message=None): # noqa: E501 + """GetAlertMessageResponse - a model defined in OpenAPI - :param message_id: The message_id of this AlertMessage. # noqa: E501 - :type message_id: str - :param alert_name: The alert_name of this AlertMessage. # noqa: E501 + :param id: The id of this GetAlertMessageResponse. # noqa: E501 + :type id: str + :param alert_name: The alert_name of this GetAlertMessageResponse. # noqa: E501 :type alert_name: str - :param severity: The severity of this AlertMessage. # noqa: E501 + :param severity: The severity of this GetAlertMessageResponse. # noqa: E501 :type severity: str - :param metric_type: The metric_type of this AlertMessage. # noqa: E501 + :param metric_type: The metric_type of this GetAlertMessageResponse. # noqa: E501 :type metric_type: str - :param target: The target of this AlertMessage. # noqa: E501 + :param target: The target of this GetAlertMessageResponse. # noqa: E501 :type target: List[str] - :param trigger_time: The trigger_time of this AlertMessage. # noqa: E501 + :param trigger_time: The trigger_time of this GetAlertMessageResponse. # noqa: E501 :type trigger_time: str - :param status: The status of this AlertMessage. # noqa: E501 + :param status: The status of this GetAlertMessageResponse. # noqa: E501 :type status: str - :param message: The message of this AlertMessage. # noqa: E501 + :param message: The message of this GetAlertMessageResponse. # noqa: E501 :type message: str """ self.openapi_types = { - 'message_id': str, + 'id': str, 'alert_name': str, 'severity': str, 'metric_type': str, @@ -44,7 +44,7 @@ def __init__(self, message_id=None, alert_name=None, severity=None, metric_type= } self.attribute_map = { - 'message_id': 'message_id', + 'id': 'id', 'alert_name': 'alert_name', 'severity': 'severity', 'metric_type': 'metric_type', @@ -54,7 +54,7 @@ def __init__(self, message_id=None, alert_name=None, severity=None, metric_type= 'message': 'message' } - self._message_id = message_id + self._id = id self._alert_name = alert_name self._severity = severity self._metric_type = metric_type @@ -64,76 +64,80 @@ def __init__(self, message_id=None, alert_name=None, severity=None, metric_type= self._message = message @classmethod - def from_dict(cls, dikt) -> 'AlertMessage': + def from_dict(cls, dikt) -> 'GetAlertMessageResponse': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The AlertMessage of this AlertMessage. # noqa: E501 - :rtype: AlertMessage + :return: The GetAlertMessageResponse of this GetAlertMessageResponse. # noqa: E501 + :rtype: GetAlertMessageResponse """ return util.deserialize_model(dikt, cls) @property - def message_id(self) -> str: - """Gets the message_id of this AlertMessage. + def id(self) -> str: + """Gets the id of this GetAlertMessageResponse. Generated in server side # noqa: E501 - :return: The message_id of this AlertMessage. + :return: The id of this GetAlertMessageResponse. :rtype: str """ - return self._message_id + return self._id - @message_id.setter - def message_id(self, message_id: str): - """Sets the message_id of this AlertMessage. + @id.setter + def id(self, id: str): + """Sets the id of this GetAlertMessageResponse. Generated in server side # noqa: E501 - :param message_id: The message_id of this AlertMessage. - :type message_id: str + :param id: The id of this GetAlertMessageResponse. + :type id: str """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - self._message_id = message_id + self._id = id @property def alert_name(self) -> str: - """Gets the alert_name of this AlertMessage. + """Gets the alert_name of this GetAlertMessageResponse. - :return: The alert_name of this AlertMessage. + :return: The alert_name of this GetAlertMessageResponse. :rtype: str """ return self._alert_name @alert_name.setter def alert_name(self, alert_name: str): - """Sets the alert_name of this AlertMessage. + """Sets the alert_name of this GetAlertMessageResponse. - :param alert_name: The alert_name of this AlertMessage. + :param alert_name: The alert_name of this GetAlertMessageResponse. :type alert_name: str """ + if alert_name is None: + raise ValueError("Invalid value for `alert_name`, must not be `None`") # noqa: E501 self._alert_name = alert_name @property def severity(self) -> str: - """Gets the severity of this AlertMessage. + """Gets the severity of this GetAlertMessageResponse. - :return: The severity of this AlertMessage. + :return: The severity of this GetAlertMessageResponse. :rtype: str """ return self._severity @severity.setter def severity(self, severity: str): - """Sets the severity of this AlertMessage. + """Sets the severity of this GetAlertMessageResponse. - :param severity: The severity of this AlertMessage. + :param severity: The severity of this GetAlertMessageResponse. :type severity: str """ allowed_values = ["warning", "emergency"] # noqa: E501 @@ -147,20 +151,20 @@ def severity(self, severity: str): @property def metric_type(self) -> str: - """Gets the metric_type of this AlertMessage. + """Gets the metric_type of this GetAlertMessageResponse. - :return: The metric_type of this AlertMessage. + :return: The metric_type of this GetAlertMessageResponse. :rtype: str """ return self._metric_type @metric_type.setter def metric_type(self, metric_type: str): - """Sets the metric_type of this AlertMessage. + """Sets the metric_type of this GetAlertMessageResponse. - :param metric_type: The metric_type of this AlertMessage. + :param metric_type: The metric_type of this GetAlertMessageResponse. :type metric_type: str """ allowed_values = ["node", "service"] # noqa: E501 @@ -174,62 +178,66 @@ def metric_type(self, metric_type: str): @property def target(self) -> List[str]: - """Gets the target of this AlertMessage. + """Gets the target of this GetAlertMessageResponse. - :return: The target of this AlertMessage. + :return: The target of this GetAlertMessageResponse. :rtype: List[str] """ return self._target @target.setter def target(self, target: List[str]): - """Sets the target of this AlertMessage. + """Sets the target of this GetAlertMessageResponse. - :param target: The target of this AlertMessage. + :param target: The target of this GetAlertMessageResponse. :type target: List[str] """ + if target is None: + raise ValueError("Invalid value for `target`, must not be `None`") # noqa: E501 self._target = target @property def trigger_time(self) -> str: - """Gets the trigger_time of this AlertMessage. + """Gets the trigger_time of this GetAlertMessageResponse. - :return: The trigger_time of this AlertMessage. + :return: The trigger_time of this GetAlertMessageResponse. :rtype: str """ return self._trigger_time @trigger_time.setter def trigger_time(self, trigger_time: str): - """Sets the trigger_time of this AlertMessage. + """Sets the trigger_time of this GetAlertMessageResponse. - :param trigger_time: The trigger_time of this AlertMessage. + :param trigger_time: The trigger_time of this GetAlertMessageResponse. :type trigger_time: str """ + if trigger_time is None: + raise ValueError("Invalid value for `trigger_time`, must not be `None`") # noqa: E501 self._trigger_time = trigger_time @property def status(self) -> str: - """Gets the status of this AlertMessage. + """Gets the status of this GetAlertMessageResponse. - :return: The status of this AlertMessage. + :return: The status of this GetAlertMessageResponse. :rtype: str """ return self._status @status.setter def status(self, status: str): - """Sets the status of this AlertMessage. + """Sets the status of this GetAlertMessageResponse. - :param status: The status of this AlertMessage. + :param status: The status of this GetAlertMessageResponse. :type status: str """ allowed_values = ["unsolved", "solved", "dealing"] # noqa: E501 @@ -243,21 +251,23 @@ def status(self, status: str): @property def message(self) -> str: - """Gets the message of this AlertMessage. + """Gets the message of this GetAlertMessageResponse. - :return: The message of this AlertMessage. + :return: The message of this GetAlertMessageResponse. :rtype: str """ return self._message @message.setter def message(self, message: str): - """Sets the message of this AlertMessage. + """Sets the message of this GetAlertMessageResponse. - :param message: The message of this AlertMessage. + :param message: The message of this GetAlertMessageResponse. :type message: str """ + if message is None: + raise ValueError("Invalid value for `message`, must not be `None`") # noqa: E501 self._message = message diff --git a/coordinator/gscoordinator/flex/models/get_alert_receiver_response.py b/coordinator/gscoordinator/flex/models/get_alert_receiver_response.py new file mode 100644 index 000000000000..9a7cdce5a2e5 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/get_alert_receiver_response.py @@ -0,0 +1,237 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class GetAlertReceiverResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, type=None, webhook_url=None, at_user_ids=None, is_at_all=None, enable=None, id=None, message=None): # noqa: E501 + """GetAlertReceiverResponse - a model defined in OpenAPI + + :param type: The type of this GetAlertReceiverResponse. # noqa: E501 + :type type: str + :param webhook_url: The webhook_url of this GetAlertReceiverResponse. # noqa: E501 + :type webhook_url: str + :param at_user_ids: The at_user_ids of this GetAlertReceiverResponse. # noqa: E501 + :type at_user_ids: List[str] + :param is_at_all: The is_at_all of this GetAlertReceiverResponse. # noqa: E501 + :type is_at_all: bool + :param enable: The enable of this GetAlertReceiverResponse. # noqa: E501 + :type enable: bool + :param id: The id of this GetAlertReceiverResponse. # noqa: E501 + :type id: str + :param message: The message of this GetAlertReceiverResponse. # noqa: E501 + :type message: str + """ + self.openapi_types = { + 'type': str, + 'webhook_url': str, + 'at_user_ids': List[str], + 'is_at_all': bool, + 'enable': bool, + 'id': str, + 'message': str + } + + self.attribute_map = { + 'type': 'type', + 'webhook_url': 'webhook_url', + 'at_user_ids': 'at_user_ids', + 'is_at_all': 'is_at_all', + 'enable': 'enable', + 'id': 'id', + 'message': 'message' + } + + self._type = type + self._webhook_url = webhook_url + self._at_user_ids = at_user_ids + self._is_at_all = is_at_all + self._enable = enable + self._id = id + self._message = message + + @classmethod + def from_dict(cls, dikt) -> 'GetAlertReceiverResponse': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The GetAlertReceiverResponse of this GetAlertReceiverResponse. # noqa: E501 + :rtype: GetAlertReceiverResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def type(self) -> str: + """Gets the type of this GetAlertReceiverResponse. + + + :return: The type of this GetAlertReceiverResponse. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type: str): + """Sets the type of this GetAlertReceiverResponse. + + + :param type: The type of this GetAlertReceiverResponse. + :type type: str + """ + allowed_values = ["webhook"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" + .format(type, allowed_values) + ) + + self._type = type + + @property + def webhook_url(self) -> str: + """Gets the webhook_url of this GetAlertReceiverResponse. + + + :return: The webhook_url of this GetAlertReceiverResponse. + :rtype: str + """ + return self._webhook_url + + @webhook_url.setter + def webhook_url(self, webhook_url: str): + """Sets the webhook_url of this GetAlertReceiverResponse. + + + :param webhook_url: The webhook_url of this GetAlertReceiverResponse. + :type webhook_url: str + """ + if webhook_url is None: + raise ValueError("Invalid value for `webhook_url`, must not be `None`") # noqa: E501 + + self._webhook_url = webhook_url + + @property + def at_user_ids(self) -> List[str]: + """Gets the at_user_ids of this GetAlertReceiverResponse. + + + :return: The at_user_ids of this GetAlertReceiverResponse. + :rtype: List[str] + """ + return self._at_user_ids + + @at_user_ids.setter + def at_user_ids(self, at_user_ids: List[str]): + """Sets the at_user_ids of this GetAlertReceiverResponse. + + + :param at_user_ids: The at_user_ids of this GetAlertReceiverResponse. + :type at_user_ids: List[str] + """ + if at_user_ids is None: + raise ValueError("Invalid value for `at_user_ids`, must not be `None`") # noqa: E501 + + self._at_user_ids = at_user_ids + + @property + def is_at_all(self) -> bool: + """Gets the is_at_all of this GetAlertReceiverResponse. + + + :return: The is_at_all of this GetAlertReceiverResponse. + :rtype: bool + """ + return self._is_at_all + + @is_at_all.setter + def is_at_all(self, is_at_all: bool): + """Sets the is_at_all of this GetAlertReceiverResponse. + + + :param is_at_all: The is_at_all of this GetAlertReceiverResponse. + :type is_at_all: bool + """ + if is_at_all is None: + raise ValueError("Invalid value for `is_at_all`, must not be `None`") # noqa: E501 + + self._is_at_all = is_at_all + + @property + def enable(self) -> bool: + """Gets the enable of this GetAlertReceiverResponse. + + + :return: The enable of this GetAlertReceiverResponse. + :rtype: bool + """ + return self._enable + + @enable.setter + def enable(self, enable: bool): + """Sets the enable of this GetAlertReceiverResponse. + + + :param enable: The enable of this GetAlertReceiverResponse. + :type enable: bool + """ + if enable is None: + raise ValueError("Invalid value for `enable`, must not be `None`") # noqa: E501 + + self._enable = enable + + @property + def id(self) -> str: + """Gets the id of this GetAlertReceiverResponse. + + + :return: The id of this GetAlertReceiverResponse. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id: str): + """Sets the id of this GetAlertReceiverResponse. + + + :param id: The id of this GetAlertReceiverResponse. + :type id: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def message(self) -> str: + """Gets the message of this GetAlertReceiverResponse. + + Error message generated in server side # noqa: E501 + + :return: The message of this GetAlertReceiverResponse. + :rtype: str + """ + return self._message + + @message.setter + def message(self, message: str): + """Sets the message of this GetAlertReceiverResponse. + + Error message generated in server side # noqa: E501 + + :param message: The message of this GetAlertReceiverResponse. + :type message: str + """ + if message is None: + raise ValueError("Invalid value for `message`, must not be `None`") # noqa: E501 + + self._message = message diff --git a/coordinator/gscoordinator/flex/models/get_alert_rule_response.py b/coordinator/gscoordinator/flex/models/get_alert_rule_response.py new file mode 100644 index 000000000000..c31211c07e60 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/get_alert_rule_response.py @@ -0,0 +1,241 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class GetAlertRuleResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, name=None, severity=None, metric_type=None, conditions_description=None, frequency=None, enable=None, id=None): # noqa: E501 + """GetAlertRuleResponse - a model defined in OpenAPI + + :param name: The name of this GetAlertRuleResponse. # noqa: E501 + :type name: str + :param severity: The severity of this GetAlertRuleResponse. # noqa: E501 + :type severity: str + :param metric_type: The metric_type of this GetAlertRuleResponse. # noqa: E501 + :type metric_type: str + :param conditions_description: The conditions_description of this GetAlertRuleResponse. # noqa: E501 + :type conditions_description: str + :param frequency: The frequency of this GetAlertRuleResponse. # noqa: E501 + :type frequency: int + :param enable: The enable of this GetAlertRuleResponse. # noqa: E501 + :type enable: bool + :param id: The id of this GetAlertRuleResponse. # noqa: E501 + :type id: str + """ + self.openapi_types = { + 'name': str, + 'severity': str, + 'metric_type': str, + 'conditions_description': str, + 'frequency': int, + 'enable': bool, + 'id': str + } + + self.attribute_map = { + 'name': 'name', + 'severity': 'severity', + 'metric_type': 'metric_type', + 'conditions_description': 'conditions_description', + 'frequency': 'frequency', + 'enable': 'enable', + 'id': 'id' + } + + self._name = name + self._severity = severity + self._metric_type = metric_type + self._conditions_description = conditions_description + self._frequency = frequency + self._enable = enable + self._id = id + + @classmethod + def from_dict(cls, dikt) -> 'GetAlertRuleResponse': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The GetAlertRuleResponse of this GetAlertRuleResponse. # noqa: E501 + :rtype: GetAlertRuleResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def name(self) -> str: + """Gets the name of this GetAlertRuleResponse. + + + :return: The name of this GetAlertRuleResponse. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name: str): + """Sets the name of this GetAlertRuleResponse. + + + :param name: The name of this GetAlertRuleResponse. + :type name: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def severity(self) -> str: + """Gets the severity of this GetAlertRuleResponse. + + + :return: The severity of this GetAlertRuleResponse. + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity: str): + """Sets the severity of this GetAlertRuleResponse. + + + :param severity: The severity of this GetAlertRuleResponse. + :type severity: str + """ + allowed_values = ["warning", "emergency"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def metric_type(self) -> str: + """Gets the metric_type of this GetAlertRuleResponse. + + + :return: The metric_type of this GetAlertRuleResponse. + :rtype: str + """ + return self._metric_type + + @metric_type.setter + def metric_type(self, metric_type: str): + """Sets the metric_type of this GetAlertRuleResponse. + + + :param metric_type: The metric_type of this GetAlertRuleResponse. + :type metric_type: str + """ + allowed_values = ["node", "service"] # noqa: E501 + if metric_type not in allowed_values: + raise ValueError( + "Invalid value for `metric_type` ({0}), must be one of {1}" + .format(metric_type, allowed_values) + ) + + self._metric_type = metric_type + + @property + def conditions_description(self) -> str: + """Gets the conditions_description of this GetAlertRuleResponse. + + + :return: The conditions_description of this GetAlertRuleResponse. + :rtype: str + """ + return self._conditions_description + + @conditions_description.setter + def conditions_description(self, conditions_description: str): + """Sets the conditions_description of this GetAlertRuleResponse. + + + :param conditions_description: The conditions_description of this GetAlertRuleResponse. + :type conditions_description: str + """ + if conditions_description is None: + raise ValueError("Invalid value for `conditions_description`, must not be `None`") # noqa: E501 + + self._conditions_description = conditions_description + + @property + def frequency(self) -> int: + """Gets the frequency of this GetAlertRuleResponse. + + (mins) # noqa: E501 + + :return: The frequency of this GetAlertRuleResponse. + :rtype: int + """ + return self._frequency + + @frequency.setter + def frequency(self, frequency: int): + """Sets the frequency of this GetAlertRuleResponse. + + (mins) # noqa: E501 + + :param frequency: The frequency of this GetAlertRuleResponse. + :type frequency: int + """ + if frequency is None: + raise ValueError("Invalid value for `frequency`, must not be `None`") # noqa: E501 + + self._frequency = frequency + + @property + def enable(self) -> bool: + """Gets the enable of this GetAlertRuleResponse. + + + :return: The enable of this GetAlertRuleResponse. + :rtype: bool + """ + return self._enable + + @enable.setter + def enable(self, enable: bool): + """Sets the enable of this GetAlertRuleResponse. + + + :param enable: The enable of this GetAlertRuleResponse. + :type enable: bool + """ + if enable is None: + raise ValueError("Invalid value for `enable`, must not be `None`") # noqa: E501 + + self._enable = enable + + @property + def id(self) -> str: + """Gets the id of this GetAlertRuleResponse. + + + :return: The id of this GetAlertRuleResponse. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id: str): + """Sets the id of this GetAlertRuleResponse. + + + :param id: The id of this GetAlertRuleResponse. + :type id: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id diff --git a/coordinator/gscoordinator/flex/models/get_edge_type.py b/coordinator/gscoordinator/flex/models/get_edge_type.py new file mode 100644 index 000000000000..08bb8b560eb2 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/get_edge_type.py @@ -0,0 +1,227 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner +from gscoordinator.flex.models.get_property_meta import GetPropertyMeta +from gscoordinator.flex import util + +from gscoordinator.flex.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner # noqa: E501 +from gscoordinator.flex.models.get_property_meta import GetPropertyMeta # noqa: E501 + +class GetEdgeType(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, type_name=None, vertex_type_pair_relations=None, directed=None, primary_keys=None, type_id=None, properties=None, description=None): # noqa: E501 + """GetEdgeType - a model defined in OpenAPI + + :param type_name: The type_name of this GetEdgeType. # noqa: E501 + :type type_name: str + :param vertex_type_pair_relations: The vertex_type_pair_relations of this GetEdgeType. # noqa: E501 + :type vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner] + :param directed: The directed of this GetEdgeType. # noqa: E501 + :type directed: bool + :param primary_keys: The primary_keys of this GetEdgeType. # noqa: E501 + :type primary_keys: List[str] + :param type_id: The type_id of this GetEdgeType. # noqa: E501 + :type type_id: int + :param properties: The properties of this GetEdgeType. # noqa: E501 + :type properties: List[GetPropertyMeta] + :param description: The description of this GetEdgeType. # noqa: E501 + :type description: str + """ + self.openapi_types = { + 'type_name': str, + 'vertex_type_pair_relations': List[BaseEdgeTypeVertexTypePairRelationsInner], + 'directed': bool, + 'primary_keys': List[str], + 'type_id': int, + 'properties': List[GetPropertyMeta], + 'description': str + } + + self.attribute_map = { + 'type_name': 'type_name', + 'vertex_type_pair_relations': 'vertex_type_pair_relations', + 'directed': 'directed', + 'primary_keys': 'primary_keys', + 'type_id': 'type_id', + 'properties': 'properties', + 'description': 'description' + } + + self._type_name = type_name + self._vertex_type_pair_relations = vertex_type_pair_relations + self._directed = directed + self._primary_keys = primary_keys + self._type_id = type_id + self._properties = properties + self._description = description + + @classmethod + def from_dict(cls, dikt) -> 'GetEdgeType': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The GetEdgeType of this GetEdgeType. # noqa: E501 + :rtype: GetEdgeType + """ + return util.deserialize_model(dikt, cls) + + @property + def type_name(self) -> str: + """Gets the type_name of this GetEdgeType. + + + :return: The type_name of this GetEdgeType. + :rtype: str + """ + return self._type_name + + @type_name.setter + def type_name(self, type_name: str): + """Sets the type_name of this GetEdgeType. + + + :param type_name: The type_name of this GetEdgeType. + :type type_name: str + """ + if type_name is None: + raise ValueError("Invalid value for `type_name`, must not be `None`") # noqa: E501 + + self._type_name = type_name + + @property + def vertex_type_pair_relations(self) -> List[BaseEdgeTypeVertexTypePairRelationsInner]: + """Gets the vertex_type_pair_relations of this GetEdgeType. + + + :return: The vertex_type_pair_relations of this GetEdgeType. + :rtype: List[BaseEdgeTypeVertexTypePairRelationsInner] + """ + return self._vertex_type_pair_relations + + @vertex_type_pair_relations.setter + def vertex_type_pair_relations(self, vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner]): + """Sets the vertex_type_pair_relations of this GetEdgeType. + + + :param vertex_type_pair_relations: The vertex_type_pair_relations of this GetEdgeType. + :type vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner] + """ + if vertex_type_pair_relations is None: + raise ValueError("Invalid value for `vertex_type_pair_relations`, must not be `None`") # noqa: E501 + + self._vertex_type_pair_relations = vertex_type_pair_relations + + @property + def directed(self) -> bool: + """Gets the directed of this GetEdgeType. + + + :return: The directed of this GetEdgeType. + :rtype: bool + """ + return self._directed + + @directed.setter + def directed(self, directed: bool): + """Sets the directed of this GetEdgeType. + + + :param directed: The directed of this GetEdgeType. + :type directed: bool + """ + + self._directed = directed + + @property + def primary_keys(self) -> List[str]: + """Gets the primary_keys of this GetEdgeType. + + + :return: The primary_keys of this GetEdgeType. + :rtype: List[str] + """ + return self._primary_keys + + @primary_keys.setter + def primary_keys(self, primary_keys: List[str]): + """Sets the primary_keys of this GetEdgeType. + + + :param primary_keys: The primary_keys of this GetEdgeType. + :type primary_keys: List[str] + """ + + self._primary_keys = primary_keys + + @property + def type_id(self) -> int: + """Gets the type_id of this GetEdgeType. + + + :return: The type_id of this GetEdgeType. + :rtype: int + """ + return self._type_id + + @type_id.setter + def type_id(self, type_id: int): + """Sets the type_id of this GetEdgeType. + + + :param type_id: The type_id of this GetEdgeType. + :type type_id: int + """ + if type_id is None: + raise ValueError("Invalid value for `type_id`, must not be `None`") # noqa: E501 + + self._type_id = type_id + + @property + def properties(self) -> List[GetPropertyMeta]: + """Gets the properties of this GetEdgeType. + + + :return: The properties of this GetEdgeType. + :rtype: List[GetPropertyMeta] + """ + return self._properties + + @properties.setter + def properties(self, properties: List[GetPropertyMeta]): + """Sets the properties of this GetEdgeType. + + + :param properties: The properties of this GetEdgeType. + :type properties: List[GetPropertyMeta] + """ + + self._properties = properties + + @property + def description(self) -> str: + """Gets the description of this GetEdgeType. + + + :return: The description of this GetEdgeType. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this GetEdgeType. + + + :param description: The description of this GetEdgeType. + :type description: str + """ + + self._description = description diff --git a/coordinator/gscoordinator/flex/models/get_graph_response.py b/coordinator/gscoordinator/flex/models/get_graph_response.py new file mode 100644 index 000000000000..1c5aa73feb78 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/get_graph_response.py @@ -0,0 +1,291 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.get_graph_schema_response import GetGraphSchemaResponse +from gscoordinator.flex.models.get_stored_proc_response import GetStoredProcResponse +from gscoordinator.flex import util + +from gscoordinator.flex.models.get_graph_schema_response import GetGraphSchemaResponse # noqa: E501 +from gscoordinator.flex.models.get_stored_proc_response import GetStoredProcResponse # noqa: E501 + +class GetGraphResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, id=None, name=None, description=None, store_type=None, creation_time=None, data_update_time=None, schema_update_time=None, stored_procedures=None, _schema=None): # noqa: E501 + """GetGraphResponse - a model defined in OpenAPI + + :param id: The id of this GetGraphResponse. # noqa: E501 + :type id: str + :param name: The name of this GetGraphResponse. # noqa: E501 + :type name: str + :param description: The description of this GetGraphResponse. # noqa: E501 + :type description: str + :param store_type: The store_type of this GetGraphResponse. # noqa: E501 + :type store_type: str + :param creation_time: The creation_time of this GetGraphResponse. # noqa: E501 + :type creation_time: str + :param data_update_time: The data_update_time of this GetGraphResponse. # noqa: E501 + :type data_update_time: str + :param schema_update_time: The schema_update_time of this GetGraphResponse. # noqa: E501 + :type schema_update_time: str + :param stored_procedures: The stored_procedures of this GetGraphResponse. # noqa: E501 + :type stored_procedures: List[GetStoredProcResponse] + :param _schema: The _schema of this GetGraphResponse. # noqa: E501 + :type _schema: GetGraphSchemaResponse + """ + self.openapi_types = { + 'id': str, + 'name': str, + 'description': str, + 'store_type': str, + 'creation_time': str, + 'data_update_time': str, + 'schema_update_time': str, + 'stored_procedures': List[GetStoredProcResponse], + '_schema': GetGraphSchemaResponse + } + + self.attribute_map = { + 'id': 'id', + 'name': 'name', + 'description': 'description', + 'store_type': 'store_type', + 'creation_time': 'creation_time', + 'data_update_time': 'data_update_time', + 'schema_update_time': 'schema_update_time', + 'stored_procedures': 'stored_procedures', + '_schema': 'schema' + } + + self._id = id + self._name = name + self._description = description + self._store_type = store_type + self._creation_time = creation_time + self._data_update_time = data_update_time + self._schema_update_time = schema_update_time + self._stored_procedures = stored_procedures + self.__schema = _schema + + @classmethod + def from_dict(cls, dikt) -> 'GetGraphResponse': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The GetGraphResponse of this GetGraphResponse. # noqa: E501 + :rtype: GetGraphResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def id(self) -> str: + """Gets the id of this GetGraphResponse. + + + :return: The id of this GetGraphResponse. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id: str): + """Sets the id of this GetGraphResponse. + + + :param id: The id of this GetGraphResponse. + :type id: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def name(self) -> str: + """Gets the name of this GetGraphResponse. + + + :return: The name of this GetGraphResponse. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name: str): + """Sets the name of this GetGraphResponse. + + + :param name: The name of this GetGraphResponse. + :type name: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def description(self) -> str: + """Gets the description of this GetGraphResponse. + + + :return: The description of this GetGraphResponse. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this GetGraphResponse. + + + :param description: The description of this GetGraphResponse. + :type description: str + """ + + self._description = description + + @property + def store_type(self) -> str: + """Gets the store_type of this GetGraphResponse. + + + :return: The store_type of this GetGraphResponse. + :rtype: str + """ + return self._store_type + + @store_type.setter + def store_type(self, store_type: str): + """Sets the store_type of this GetGraphResponse. + + + :param store_type: The store_type of this GetGraphResponse. + :type store_type: str + """ + allowed_values = ["mutable_csr"] # noqa: E501 + if store_type not in allowed_values: + raise ValueError( + "Invalid value for `store_type` ({0}), must be one of {1}" + .format(store_type, allowed_values) + ) + + self._store_type = store_type + + @property + def creation_time(self) -> str: + """Gets the creation_time of this GetGraphResponse. + + + :return: The creation_time of this GetGraphResponse. + :rtype: str + """ + return self._creation_time + + @creation_time.setter + def creation_time(self, creation_time: str): + """Sets the creation_time of this GetGraphResponse. + + + :param creation_time: The creation_time of this GetGraphResponse. + :type creation_time: str + """ + if creation_time is None: + raise ValueError("Invalid value for `creation_time`, must not be `None`") # noqa: E501 + + self._creation_time = creation_time + + @property + def data_update_time(self) -> str: + """Gets the data_update_time of this GetGraphResponse. + + + :return: The data_update_time of this GetGraphResponse. + :rtype: str + """ + return self._data_update_time + + @data_update_time.setter + def data_update_time(self, data_update_time: str): + """Sets the data_update_time of this GetGraphResponse. + + + :param data_update_time: The data_update_time of this GetGraphResponse. + :type data_update_time: str + """ + if data_update_time is None: + raise ValueError("Invalid value for `data_update_time`, must not be `None`") # noqa: E501 + + self._data_update_time = data_update_time + + @property + def schema_update_time(self) -> str: + """Gets the schema_update_time of this GetGraphResponse. + + + :return: The schema_update_time of this GetGraphResponse. + :rtype: str + """ + return self._schema_update_time + + @schema_update_time.setter + def schema_update_time(self, schema_update_time: str): + """Sets the schema_update_time of this GetGraphResponse. + + + :param schema_update_time: The schema_update_time of this GetGraphResponse. + :type schema_update_time: str + """ + if schema_update_time is None: + raise ValueError("Invalid value for `schema_update_time`, must not be `None`") # noqa: E501 + + self._schema_update_time = schema_update_time + + @property + def stored_procedures(self) -> List[GetStoredProcResponse]: + """Gets the stored_procedures of this GetGraphResponse. + + + :return: The stored_procedures of this GetGraphResponse. + :rtype: List[GetStoredProcResponse] + """ + return self._stored_procedures + + @stored_procedures.setter + def stored_procedures(self, stored_procedures: List[GetStoredProcResponse]): + """Sets the stored_procedures of this GetGraphResponse. + + + :param stored_procedures: The stored_procedures of this GetGraphResponse. + :type stored_procedures: List[GetStoredProcResponse] + """ + + self._stored_procedures = stored_procedures + + @property + def _schema(self) -> GetGraphSchemaResponse: + """Gets the _schema of this GetGraphResponse. + + + :return: The _schema of this GetGraphResponse. + :rtype: GetGraphSchemaResponse + """ + return self.__schema + + @_schema.setter + def _schema(self, _schema: GetGraphSchemaResponse): + """Sets the _schema of this GetGraphResponse. + + + :param _schema: The _schema of this GetGraphResponse. + :type _schema: GetGraphSchemaResponse + """ + if _schema is None: + raise ValueError("Invalid value for `_schema`, must not be `None`") # noqa: E501 + + self.__schema = _schema diff --git a/coordinator/gscoordinator/flex/models/get_graph_schema_response.py b/coordinator/gscoordinator/flex/models/get_graph_schema_response.py new file mode 100644 index 000000000000..1a1d899d1227 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/get_graph_schema_response.py @@ -0,0 +1,95 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.get_edge_type import GetEdgeType +from gscoordinator.flex.models.get_vertex_type import GetVertexType +from gscoordinator.flex import util + +from gscoordinator.flex.models.get_edge_type import GetEdgeType # noqa: E501 +from gscoordinator.flex.models.get_vertex_type import GetVertexType # noqa: E501 + +class GetGraphSchemaResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, vertex_types=None, edge_types=None): # noqa: E501 + """GetGraphSchemaResponse - a model defined in OpenAPI + + :param vertex_types: The vertex_types of this GetGraphSchemaResponse. # noqa: E501 + :type vertex_types: List[GetVertexType] + :param edge_types: The edge_types of this GetGraphSchemaResponse. # noqa: E501 + :type edge_types: List[GetEdgeType] + """ + self.openapi_types = { + 'vertex_types': List[GetVertexType], + 'edge_types': List[GetEdgeType] + } + + self.attribute_map = { + 'vertex_types': 'vertex_types', + 'edge_types': 'edge_types' + } + + self._vertex_types = vertex_types + self._edge_types = edge_types + + @classmethod + def from_dict(cls, dikt) -> 'GetGraphSchemaResponse': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The GetGraphSchemaResponse of this GetGraphSchemaResponse. # noqa: E501 + :rtype: GetGraphSchemaResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def vertex_types(self) -> List[GetVertexType]: + """Gets the vertex_types of this GetGraphSchemaResponse. + + + :return: The vertex_types of this GetGraphSchemaResponse. + :rtype: List[GetVertexType] + """ + return self._vertex_types + + @vertex_types.setter + def vertex_types(self, vertex_types: List[GetVertexType]): + """Sets the vertex_types of this GetGraphSchemaResponse. + + + :param vertex_types: The vertex_types of this GetGraphSchemaResponse. + :type vertex_types: List[GetVertexType] + """ + if vertex_types is None: + raise ValueError("Invalid value for `vertex_types`, must not be `None`") # noqa: E501 + + self._vertex_types = vertex_types + + @property + def edge_types(self) -> List[GetEdgeType]: + """Gets the edge_types of this GetGraphSchemaResponse. + + + :return: The edge_types of this GetGraphSchemaResponse. + :rtype: List[GetEdgeType] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types: List[GetEdgeType]): + """Sets the edge_types of this GetGraphSchemaResponse. + + + :param edge_types: The edge_types of this GetGraphSchemaResponse. + :type edge_types: List[GetEdgeType] + """ + if edge_types is None: + raise ValueError("Invalid value for `edge_types`, must not be `None`") # noqa: E501 + + self._edge_types = edge_types diff --git a/coordinator/gscoordinator/flex/models/get_property_meta.py b/coordinator/gscoordinator/flex/models/get_property_meta.py new file mode 100644 index 000000000000..247f5a070029 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/get_property_meta.py @@ -0,0 +1,199 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.gs_data_type import GSDataType +from gscoordinator.flex import util + +from gscoordinator.flex.models.gs_data_type import GSDataType # noqa: E501 + +class GetPropertyMeta(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, property_name=None, property_type=None, nullable=None, default_value=None, description=None, property_id=None): # noqa: E501 + """GetPropertyMeta - a model defined in OpenAPI + + :param property_name: The property_name of this GetPropertyMeta. # noqa: E501 + :type property_name: str + :param property_type: The property_type of this GetPropertyMeta. # noqa: E501 + :type property_type: GSDataType + :param nullable: The nullable of this GetPropertyMeta. # noqa: E501 + :type nullable: bool + :param default_value: The default_value of this GetPropertyMeta. # noqa: E501 + :type default_value: object + :param description: The description of this GetPropertyMeta. # noqa: E501 + :type description: str + :param property_id: The property_id of this GetPropertyMeta. # noqa: E501 + :type property_id: int + """ + self.openapi_types = { + 'property_name': str, + 'property_type': GSDataType, + 'nullable': bool, + 'default_value': object, + 'description': str, + 'property_id': int + } + + self.attribute_map = { + 'property_name': 'property_name', + 'property_type': 'property_type', + 'nullable': 'nullable', + 'default_value': 'default_value', + 'description': 'description', + 'property_id': 'property_id' + } + + self._property_name = property_name + self._property_type = property_type + self._nullable = nullable + self._default_value = default_value + self._description = description + self._property_id = property_id + + @classmethod + def from_dict(cls, dikt) -> 'GetPropertyMeta': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The GetPropertyMeta of this GetPropertyMeta. # noqa: E501 + :rtype: GetPropertyMeta + """ + return util.deserialize_model(dikt, cls) + + @property + def property_name(self) -> str: + """Gets the property_name of this GetPropertyMeta. + + + :return: The property_name of this GetPropertyMeta. + :rtype: str + """ + return self._property_name + + @property_name.setter + def property_name(self, property_name: str): + """Sets the property_name of this GetPropertyMeta. + + + :param property_name: The property_name of this GetPropertyMeta. + :type property_name: str + """ + if property_name is None: + raise ValueError("Invalid value for `property_name`, must not be `None`") # noqa: E501 + + self._property_name = property_name + + @property + def property_type(self) -> GSDataType: + """Gets the property_type of this GetPropertyMeta. + + + :return: The property_type of this GetPropertyMeta. + :rtype: GSDataType + """ + return self._property_type + + @property_type.setter + def property_type(self, property_type: GSDataType): + """Sets the property_type of this GetPropertyMeta. + + + :param property_type: The property_type of this GetPropertyMeta. + :type property_type: GSDataType + """ + if property_type is None: + raise ValueError("Invalid value for `property_type`, must not be `None`") # noqa: E501 + + self._property_type = property_type + + @property + def nullable(self) -> bool: + """Gets the nullable of this GetPropertyMeta. + + + :return: The nullable of this GetPropertyMeta. + :rtype: bool + """ + return self._nullable + + @nullable.setter + def nullable(self, nullable: bool): + """Sets the nullable of this GetPropertyMeta. + + + :param nullable: The nullable of this GetPropertyMeta. + :type nullable: bool + """ + + self._nullable = nullable + + @property + def default_value(self) -> object: + """Gets the default_value of this GetPropertyMeta. + + + :return: The default_value of this GetPropertyMeta. + :rtype: object + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value: object): + """Sets the default_value of this GetPropertyMeta. + + + :param default_value: The default_value of this GetPropertyMeta. + :type default_value: object + """ + + self._default_value = default_value + + @property + def description(self) -> str: + """Gets the description of this GetPropertyMeta. + + + :return: The description of this GetPropertyMeta. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this GetPropertyMeta. + + + :param description: The description of this GetPropertyMeta. + :type description: str + """ + + self._description = description + + @property + def property_id(self) -> int: + """Gets the property_id of this GetPropertyMeta. + + + :return: The property_id of this GetPropertyMeta. + :rtype: int + """ + return self._property_id + + @property_id.setter + def property_id(self, property_id: int): + """Sets the property_id of this GetPropertyMeta. + + + :param property_id: The property_id of this GetPropertyMeta. + :type property_id: int + """ + if property_id is None: + raise ValueError("Invalid value for `property_id`, must not be `None`") # noqa: E501 + + self._property_id = property_id diff --git a/coordinator/gscoordinator/flex/models/get_stored_proc_response.py b/coordinator/gscoordinator/flex/models/get_stored_proc_response.py new file mode 100644 index 000000000000..59e7689cf01d --- /dev/null +++ b/coordinator/gscoordinator/flex/models/get_stored_proc_response.py @@ -0,0 +1,319 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.parameter import Parameter +from gscoordinator.flex import util + +from gscoordinator.flex.models.parameter import Parameter # noqa: E501 + +class GetStoredProcResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, name=None, description=None, type=None, query=None, id=None, library=None, params=None, returns=None, bound_graph=None, runnable=None): # noqa: E501 + """GetStoredProcResponse - a model defined in OpenAPI + + :param name: The name of this GetStoredProcResponse. # noqa: E501 + :type name: str + :param description: The description of this GetStoredProcResponse. # noqa: E501 + :type description: str + :param type: The type of this GetStoredProcResponse. # noqa: E501 + :type type: str + :param query: The query of this GetStoredProcResponse. # noqa: E501 + :type query: str + :param id: The id of this GetStoredProcResponse. # noqa: E501 + :type id: str + :param library: The library of this GetStoredProcResponse. # noqa: E501 + :type library: str + :param params: The params of this GetStoredProcResponse. # noqa: E501 + :type params: List[Parameter] + :param returns: The returns of this GetStoredProcResponse. # noqa: E501 + :type returns: List[Parameter] + :param bound_graph: The bound_graph of this GetStoredProcResponse. # noqa: E501 + :type bound_graph: str + :param runnable: The runnable of this GetStoredProcResponse. # noqa: E501 + :type runnable: bool + """ + self.openapi_types = { + 'name': str, + 'description': str, + 'type': str, + 'query': str, + 'id': str, + 'library': str, + 'params': List[Parameter], + 'returns': List[Parameter], + 'bound_graph': str, + 'runnable': bool + } + + self.attribute_map = { + 'name': 'name', + 'description': 'description', + 'type': 'type', + 'query': 'query', + 'id': 'id', + 'library': 'library', + 'params': 'params', + 'returns': 'returns', + 'bound_graph': 'bound_graph', + 'runnable': 'runnable' + } + + self._name = name + self._description = description + self._type = type + self._query = query + self._id = id + self._library = library + self._params = params + self._returns = returns + self._bound_graph = bound_graph + self._runnable = runnable + + @classmethod + def from_dict(cls, dikt) -> 'GetStoredProcResponse': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The GetStoredProcResponse of this GetStoredProcResponse. # noqa: E501 + :rtype: GetStoredProcResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def name(self) -> str: + """Gets the name of this GetStoredProcResponse. + + + :return: The name of this GetStoredProcResponse. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name: str): + """Sets the name of this GetStoredProcResponse. + + + :param name: The name of this GetStoredProcResponse. + :type name: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def description(self) -> str: + """Gets the description of this GetStoredProcResponse. + + + :return: The description of this GetStoredProcResponse. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this GetStoredProcResponse. + + + :param description: The description of this GetStoredProcResponse. + :type description: str + """ + + self._description = description + + @property + def type(self) -> str: + """Gets the type of this GetStoredProcResponse. + + + :return: The type of this GetStoredProcResponse. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type: str): + """Sets the type of this GetStoredProcResponse. + + + :param type: The type of this GetStoredProcResponse. + :type type: str + """ + allowed_values = ["cpp", "cypher"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" + .format(type, allowed_values) + ) + + self._type = type + + @property + def query(self) -> str: + """Gets the query of this GetStoredProcResponse. + + + :return: The query of this GetStoredProcResponse. + :rtype: str + """ + return self._query + + @query.setter + def query(self, query: str): + """Sets the query of this GetStoredProcResponse. + + + :param query: The query of this GetStoredProcResponse. + :type query: str + """ + if query is None: + raise ValueError("Invalid value for `query`, must not be `None`") # noqa: E501 + + self._query = query + + @property + def id(self) -> str: + """Gets the id of this GetStoredProcResponse. + + + :return: The id of this GetStoredProcResponse. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id: str): + """Sets the id of this GetStoredProcResponse. + + + :param id: The id of this GetStoredProcResponse. + :type id: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def library(self) -> str: + """Gets the library of this GetStoredProcResponse. + + + :return: The library of this GetStoredProcResponse. + :rtype: str + """ + return self._library + + @library.setter + def library(self, library: str): + """Sets the library of this GetStoredProcResponse. + + + :param library: The library of this GetStoredProcResponse. + :type library: str + """ + if library is None: + raise ValueError("Invalid value for `library`, must not be `None`") # noqa: E501 + + self._library = library + + @property + def params(self) -> List[Parameter]: + """Gets the params of this GetStoredProcResponse. + + + :return: The params of this GetStoredProcResponse. + :rtype: List[Parameter] + """ + return self._params + + @params.setter + def params(self, params: List[Parameter]): + """Sets the params of this GetStoredProcResponse. + + + :param params: The params of this GetStoredProcResponse. + :type params: List[Parameter] + """ + if params is None: + raise ValueError("Invalid value for `params`, must not be `None`") # noqa: E501 + + self._params = params + + @property + def returns(self) -> List[Parameter]: + """Gets the returns of this GetStoredProcResponse. + + + :return: The returns of this GetStoredProcResponse. + :rtype: List[Parameter] + """ + return self._returns + + @returns.setter + def returns(self, returns: List[Parameter]): + """Sets the returns of this GetStoredProcResponse. + + + :param returns: The returns of this GetStoredProcResponse. + :type returns: List[Parameter] + """ + if returns is None: + raise ValueError("Invalid value for `returns`, must not be `None`") # noqa: E501 + + self._returns = returns + + @property + def bound_graph(self) -> str: + """Gets the bound_graph of this GetStoredProcResponse. + + + :return: The bound_graph of this GetStoredProcResponse. + :rtype: str + """ + return self._bound_graph + + @bound_graph.setter + def bound_graph(self, bound_graph: str): + """Sets the bound_graph of this GetStoredProcResponse. + + + :param bound_graph: The bound_graph of this GetStoredProcResponse. + :type bound_graph: str + """ + if bound_graph is None: + raise ValueError("Invalid value for `bound_graph`, must not be `None`") # noqa: E501 + + self._bound_graph = bound_graph + + @property + def runnable(self) -> bool: + """Gets the runnable of this GetStoredProcResponse. + + + :return: The runnable of this GetStoredProcResponse. + :rtype: bool + """ + return self._runnable + + @runnable.setter + def runnable(self, runnable: bool): + """Sets the runnable of this GetStoredProcResponse. + + + :param runnable: The runnable of this GetStoredProcResponse. + :type runnable: bool + """ + if runnable is None: + raise ValueError("Invalid value for `runnable`, must not be `None`") # noqa: E501 + + self._runnable = runnable diff --git a/coordinator/gscoordinator/flex/models/get_vertex_type.py b/coordinator/gscoordinator/flex/models/get_vertex_type.py new file mode 100644 index 000000000000..83e84929c7ee --- /dev/null +++ b/coordinator/gscoordinator/flex/models/get_vertex_type.py @@ -0,0 +1,203 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams +from gscoordinator.flex.models.get_property_meta import GetPropertyMeta +from gscoordinator.flex import util + +from gscoordinator.flex.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams # noqa: E501 +from gscoordinator.flex.models.get_property_meta import GetPropertyMeta # noqa: E501 + +class GetVertexType(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, type_name=None, primary_keys=None, x_csr_params=None, type_id=None, properties=None, description=None): # noqa: E501 + """GetVertexType - a model defined in OpenAPI + + :param type_name: The type_name of this GetVertexType. # noqa: E501 + :type type_name: str + :param primary_keys: The primary_keys of this GetVertexType. # noqa: E501 + :type primary_keys: List[str] + :param x_csr_params: The x_csr_params of this GetVertexType. # noqa: E501 + :type x_csr_params: BaseVertexTypeXCsrParams + :param type_id: The type_id of this GetVertexType. # noqa: E501 + :type type_id: int + :param properties: The properties of this GetVertexType. # noqa: E501 + :type properties: List[GetPropertyMeta] + :param description: The description of this GetVertexType. # noqa: E501 + :type description: str + """ + self.openapi_types = { + 'type_name': str, + 'primary_keys': List[str], + 'x_csr_params': BaseVertexTypeXCsrParams, + 'type_id': int, + 'properties': List[GetPropertyMeta], + 'description': str + } + + self.attribute_map = { + 'type_name': 'type_name', + 'primary_keys': 'primary_keys', + 'x_csr_params': 'x_csr_params', + 'type_id': 'type_id', + 'properties': 'properties', + 'description': 'description' + } + + self._type_name = type_name + self._primary_keys = primary_keys + self._x_csr_params = x_csr_params + self._type_id = type_id + self._properties = properties + self._description = description + + @classmethod + def from_dict(cls, dikt) -> 'GetVertexType': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The GetVertexType of this GetVertexType. # noqa: E501 + :rtype: GetVertexType + """ + return util.deserialize_model(dikt, cls) + + @property + def type_name(self) -> str: + """Gets the type_name of this GetVertexType. + + + :return: The type_name of this GetVertexType. + :rtype: str + """ + return self._type_name + + @type_name.setter + def type_name(self, type_name: str): + """Sets the type_name of this GetVertexType. + + + :param type_name: The type_name of this GetVertexType. + :type type_name: str + """ + if type_name is None: + raise ValueError("Invalid value for `type_name`, must not be `None`") # noqa: E501 + + self._type_name = type_name + + @property + def primary_keys(self) -> List[str]: + """Gets the primary_keys of this GetVertexType. + + + :return: The primary_keys of this GetVertexType. + :rtype: List[str] + """ + return self._primary_keys + + @primary_keys.setter + def primary_keys(self, primary_keys: List[str]): + """Sets the primary_keys of this GetVertexType. + + + :param primary_keys: The primary_keys of this GetVertexType. + :type primary_keys: List[str] + """ + if primary_keys is None: + raise ValueError("Invalid value for `primary_keys`, must not be `None`") # noqa: E501 + + self._primary_keys = primary_keys + + @property + def x_csr_params(self) -> BaseVertexTypeXCsrParams: + """Gets the x_csr_params of this GetVertexType. + + + :return: The x_csr_params of this GetVertexType. + :rtype: BaseVertexTypeXCsrParams + """ + return self._x_csr_params + + @x_csr_params.setter + def x_csr_params(self, x_csr_params: BaseVertexTypeXCsrParams): + """Sets the x_csr_params of this GetVertexType. + + + :param x_csr_params: The x_csr_params of this GetVertexType. + :type x_csr_params: BaseVertexTypeXCsrParams + """ + + self._x_csr_params = x_csr_params + + @property + def type_id(self) -> int: + """Gets the type_id of this GetVertexType. + + + :return: The type_id of this GetVertexType. + :rtype: int + """ + return self._type_id + + @type_id.setter + def type_id(self, type_id: int): + """Sets the type_id of this GetVertexType. + + + :param type_id: The type_id of this GetVertexType. + :type type_id: int + """ + if type_id is None: + raise ValueError("Invalid value for `type_id`, must not be `None`") # noqa: E501 + + self._type_id = type_id + + @property + def properties(self) -> List[GetPropertyMeta]: + """Gets the properties of this GetVertexType. + + + :return: The properties of this GetVertexType. + :rtype: List[GetPropertyMeta] + """ + return self._properties + + @properties.setter + def properties(self, properties: List[GetPropertyMeta]): + """Sets the properties of this GetVertexType. + + + :param properties: The properties of this GetVertexType. + :type properties: List[GetPropertyMeta] + """ + if properties is None: + raise ValueError("Invalid value for `properties`, must not be `None`") # noqa: E501 + + self._properties = properties + + @property + def description(self) -> str: + """Gets the description of this GetVertexType. + + + :return: The description of this GetVertexType. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this GetVertexType. + + + :param description: The description of this GetVertexType. + :type description: str + """ + + self._description = description diff --git a/coordinator/gscoordinator/flex/models/gs_data_type.py b/coordinator/gscoordinator/flex/models/gs_data_type.py new file mode 100644 index 000000000000..c7e9058909bc --- /dev/null +++ b/coordinator/gscoordinator/flex/models/gs_data_type.py @@ -0,0 +1,101 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.primitive_type import PrimitiveType +from gscoordinator.flex.models.string_type import StringType +from gscoordinator.flex.models.string_type_string import StringTypeString +from gscoordinator.flex import util + +from gscoordinator.flex.models.primitive_type import PrimitiveType # noqa: E501 +from gscoordinator.flex.models.string_type import StringType # noqa: E501 +from gscoordinator.flex.models.string_type_string import StringTypeString # noqa: E501 + +class GSDataType(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, primitive_type=None, string=None): # noqa: E501 + """GSDataType - a model defined in OpenAPI + + :param primitive_type: The primitive_type of this GSDataType. # noqa: E501 + :type primitive_type: str + :param string: The string of this GSDataType. # noqa: E501 + :type string: StringTypeString + """ + self.openapi_types = { + 'primitive_type': str, + 'string': StringTypeString + } + + self.attribute_map = { + 'primitive_type': 'primitive_type', + 'string': 'string' + } + + self._primitive_type = primitive_type + self._string = string + + @classmethod + def from_dict(cls, dikt) -> 'GSDataType': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The GSDataType of this GSDataType. # noqa: E501 + :rtype: GSDataType + """ + return util.deserialize_model(dikt, cls) + + @property + def primitive_type(self) -> str: + """Gets the primitive_type of this GSDataType. + + + :return: The primitive_type of this GSDataType. + :rtype: str + """ + return self._primitive_type + + @primitive_type.setter + def primitive_type(self, primitive_type: str): + """Sets the primitive_type of this GSDataType. + + + :param primitive_type: The primitive_type of this GSDataType. + :type primitive_type: str + """ + allowed_values = ["DT_SIGNED_INT32", "DT_UNSIGNED_INT32", "DT_SIGNED_INT64", "DT_UNSIGNED_INT64", "DT_BOOL", "DT_FLOAT", "DT_DOUBLE"] # noqa: E501 + if primitive_type not in allowed_values: + raise ValueError( + "Invalid value for `primitive_type` ({0}), must be one of {1}" + .format(primitive_type, allowed_values) + ) + + self._primitive_type = primitive_type + + @property + def string(self) -> StringTypeString: + """Gets the string of this GSDataType. + + + :return: The string of this GSDataType. + :rtype: StringTypeString + """ + return self._string + + @string.setter + def string(self, string: StringTypeString): + """Sets the string of this GSDataType. + + + :param string: The string of this GSDataType. + :type string: StringTypeString + """ + if string is None: + raise ValueError("Invalid value for `string`, must not be `None`") # noqa: E501 + + self._string = string diff --git a/flex/coordinator/gs_flex_coordinator/models/job_status.py b/coordinator/gscoordinator/flex/models/job_status.py similarity index 82% rename from flex/coordinator/gs_flex_coordinator/models/job_status.py rename to coordinator/gscoordinator/flex/models/job_status.py index c4894ec41752..1659f74cd5a9 100644 --- a/flex/coordinator/gs_flex_coordinator/models/job_status.py +++ b/coordinator/gscoordinator/flex/models/job_status.py @@ -2,8 +2,8 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util class JobStatus(Model): @@ -12,11 +12,11 @@ class JobStatus(Model): Do not edit the class manually. """ - def __init__(self, job_id=None, type=None, status=None, start_time=None, end_time=None, log=None, detail=None): # noqa: E501 + def __init__(self, id=None, type=None, status=None, start_time=None, end_time=None, log=None, detail=None): # noqa: E501 """JobStatus - a model defined in OpenAPI - :param job_id: The job_id of this JobStatus. # noqa: E501 - :type job_id: str + :param id: The id of this JobStatus. # noqa: E501 + :type id: str :param type: The type of this JobStatus. # noqa: E501 :type type: str :param status: The status of this JobStatus. # noqa: E501 @@ -31,7 +31,7 @@ def __init__(self, job_id=None, type=None, status=None, start_time=None, end_tim :type detail: Dict[str, object] """ self.openapi_types = { - 'job_id': str, + 'id': str, 'type': str, 'status': str, 'start_time': str, @@ -41,7 +41,7 @@ def __init__(self, job_id=None, type=None, status=None, start_time=None, end_tim } self.attribute_map = { - 'job_id': 'job_id', + 'id': 'id', 'type': 'type', 'status': 'status', 'start_time': 'start_time', @@ -50,7 +50,7 @@ def __init__(self, job_id=None, type=None, status=None, start_time=None, end_tim 'detail': 'detail' } - self._job_id = job_id + self._id = id self._type = type self._status = status self._start_time = start_time @@ -70,25 +70,27 @@ def from_dict(cls, dikt) -> 'JobStatus': return util.deserialize_model(dikt, cls) @property - def job_id(self) -> str: - """Gets the job_id of this JobStatus. + def id(self) -> str: + """Gets the id of this JobStatus. - :return: The job_id of this JobStatus. + :return: The id of this JobStatus. :rtype: str """ - return self._job_id + return self._id - @job_id.setter - def job_id(self, job_id: str): - """Sets the job_id of this JobStatus. + @id.setter + def id(self, id: str): + """Sets the id of this JobStatus. - :param job_id: The job_id of this JobStatus. - :type job_id: str + :param id: The id of this JobStatus. + :type id: str """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - self._job_id = job_id + self._id = id @property def type(self) -> str: @@ -108,6 +110,8 @@ def type(self, type: str): :param type: The type of this JobStatus. :type type: str """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 self._type = type @@ -184,7 +188,7 @@ def end_time(self, end_time: str): def log(self) -> str: """Gets the log of this JobStatus. - URL or log string # noqa: E501 + logview URL or log string # noqa: E501 :return: The log of this JobStatus. :rtype: str @@ -195,7 +199,7 @@ def log(self) -> str: def log(self, log: str): """Sets the log of this JobStatus. - URL or log string # noqa: E501 + logview URL or log string # noqa: E501 :param log: The log of this JobStatus. :type log: str diff --git a/coordinator/gscoordinator/flex/models/long_text.py b/coordinator/gscoordinator/flex/models/long_text.py new file mode 100644 index 000000000000..5bb3a45856eb --- /dev/null +++ b/coordinator/gscoordinator/flex/models/long_text.py @@ -0,0 +1,63 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class LongText(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, long_text=None): # noqa: E501 + """LongText - a model defined in OpenAPI + + :param long_text: The long_text of this LongText. # noqa: E501 + :type long_text: str + """ + self.openapi_types = { + 'long_text': str + } + + self.attribute_map = { + 'long_text': 'long_text' + } + + self._long_text = long_text + + @classmethod + def from_dict(cls, dikt) -> 'LongText': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The LongText of this LongText. # noqa: E501 + :rtype: LongText + """ + return util.deserialize_model(dikt, cls) + + @property + def long_text(self) -> str: + """Gets the long_text of this LongText. + + + :return: The long_text of this LongText. + :rtype: str + """ + return self._long_text + + @long_text.setter + def long_text(self, long_text: str): + """Sets the long_text of this LongText. + + + :param long_text: The long_text of this LongText. + :type long_text: str + """ + if long_text is None: + raise ValueError("Invalid value for `long_text`, must not be `None`") # noqa: E501 + + self._long_text = long_text diff --git a/flex/coordinator/gs_flex_coordinator/models/node_status.py b/coordinator/gscoordinator/flex/models/node_status.py similarity index 71% rename from flex/coordinator/gs_flex_coordinator/models/node_status.py rename to coordinator/gscoordinator/flex/models/node_status.py index 584a42f7092b..f4596a54fc8c 100644 --- a/flex/coordinator/gs_flex_coordinator/models/node_status.py +++ b/coordinator/gscoordinator/flex/models/node_status.py @@ -2,8 +2,8 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util class NodeStatus(Model): @@ -12,11 +12,11 @@ class NodeStatus(Model): Do not edit the class manually. """ - def __init__(self, node=None, cpu_usage=None, memory_usage=None, disk_usage=None): # noqa: E501 + def __init__(self, name=None, cpu_usage=None, memory_usage=None, disk_usage=None): # noqa: E501 """NodeStatus - a model defined in OpenAPI - :param node: The node of this NodeStatus. # noqa: E501 - :type node: str + :param name: The name of this NodeStatus. # noqa: E501 + :type name: str :param cpu_usage: The cpu_usage of this NodeStatus. # noqa: E501 :type cpu_usage: float :param memory_usage: The memory_usage of this NodeStatus. # noqa: E501 @@ -25,20 +25,20 @@ def __init__(self, node=None, cpu_usage=None, memory_usage=None, disk_usage=None :type disk_usage: float """ self.openapi_types = { - 'node': str, + 'name': str, 'cpu_usage': float, 'memory_usage': float, 'disk_usage': float } self.attribute_map = { - 'node': 'node', + 'name': 'name', 'cpu_usage': 'cpu_usage', 'memory_usage': 'memory_usage', 'disk_usage': 'disk_usage' } - self._node = node + self._name = name self._cpu_usage = cpu_usage self._memory_usage = memory_usage self._disk_usage = disk_usage @@ -55,25 +55,27 @@ def from_dict(cls, dikt) -> 'NodeStatus': return util.deserialize_model(dikt, cls) @property - def node(self) -> str: - """Gets the node of this NodeStatus. + def name(self) -> str: + """Gets the name of this NodeStatus. - :return: The node of this NodeStatus. + :return: The name of this NodeStatus. :rtype: str """ - return self._node + return self._name - @node.setter - def node(self, node: str): - """Sets the node of this NodeStatus. + @name.setter + def name(self, name: str): + """Sets the name of this NodeStatus. - :param node: The node of this NodeStatus. - :type node: str + :param name: The name of this NodeStatus. + :type name: str """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - self._node = node + self._name = name @property def cpu_usage(self) -> float: @@ -93,6 +95,8 @@ def cpu_usage(self, cpu_usage: float): :param cpu_usage: The cpu_usage of this NodeStatus. :type cpu_usage: float """ + if cpu_usage is None: + raise ValueError("Invalid value for `cpu_usage`, must not be `None`") # noqa: E501 self._cpu_usage = cpu_usage @@ -114,6 +118,8 @@ def memory_usage(self, memory_usage: float): :param memory_usage: The memory_usage of this NodeStatus. :type memory_usage: float """ + if memory_usage is None: + raise ValueError("Invalid value for `memory_usage`, must not be `None`") # noqa: E501 self._memory_usage = memory_usage @@ -135,5 +141,7 @@ def disk_usage(self, disk_usage: float): :param disk_usage: The disk_usage of this NodeStatus. :type disk_usage: float """ + if disk_usage is None: + raise ValueError("Invalid value for `disk_usage`, must not be `None`") # noqa: E501 self._disk_usage = disk_usage diff --git a/coordinator/gscoordinator/flex/models/parameter.py b/coordinator/gscoordinator/flex/models/parameter.py new file mode 100644 index 000000000000..c500e94e93d6 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/parameter.py @@ -0,0 +1,93 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.gs_data_type import GSDataType +from gscoordinator.flex import util + +from gscoordinator.flex.models.gs_data_type import GSDataType # noqa: E501 + +class Parameter(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, name=None, type=None): # noqa: E501 + """Parameter - a model defined in OpenAPI + + :param name: The name of this Parameter. # noqa: E501 + :type name: str + :param type: The type of this Parameter. # noqa: E501 + :type type: GSDataType + """ + self.openapi_types = { + 'name': str, + 'type': GSDataType + } + + self.attribute_map = { + 'name': 'name', + 'type': 'type' + } + + self._name = name + self._type = type + + @classmethod + def from_dict(cls, dikt) -> 'Parameter': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The Parameter of this Parameter. # noqa: E501 + :rtype: Parameter + """ + return util.deserialize_model(dikt, cls) + + @property + def name(self) -> str: + """Gets the name of this Parameter. + + + :return: The name of this Parameter. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name: str): + """Sets the name of this Parameter. + + + :param name: The name of this Parameter. + :type name: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self) -> GSDataType: + """Gets the type of this Parameter. + + + :return: The type of this Parameter. + :rtype: GSDataType + """ + return self._type + + @type.setter + def type(self, type: GSDataType): + """Sets the type of this Parameter. + + + :param type: The type of this Parameter. + :type type: GSDataType + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type diff --git a/flex/coordinator/gs_flex_coordinator/models/property_property_type.py b/coordinator/gscoordinator/flex/models/primitive_type.py similarity index 59% rename from flex/coordinator/gs_flex_coordinator/models/property_property_type.py rename to coordinator/gscoordinator/flex/models/primitive_type.py index b45ae52d5ac7..68a7344ee816 100644 --- a/flex/coordinator/gs_flex_coordinator/models/property_property_type.py +++ b/coordinator/gscoordinator/flex/models/primitive_type.py @@ -2,20 +2,20 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util -class PropertyPropertyType(Model): +class PrimitiveType(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ def __init__(self, primitive_type=None): # noqa: E501 - """PropertyPropertyType - a model defined in OpenAPI + """PrimitiveType - a model defined in OpenAPI - :param primitive_type: The primitive_type of this PropertyPropertyType. # noqa: E501 + :param primitive_type: The primitive_type of this PrimitiveType. # noqa: E501 :type primitive_type: str """ self.openapi_types = { @@ -29,35 +29,35 @@ def __init__(self, primitive_type=None): # noqa: E501 self._primitive_type = primitive_type @classmethod - def from_dict(cls, dikt) -> 'PropertyPropertyType': + def from_dict(cls, dikt) -> 'PrimitiveType': """Returns the dict as a model :param dikt: A dict. :type: dict - :return: The Property_property_type of this PropertyPropertyType. # noqa: E501 - :rtype: PropertyPropertyType + :return: The PrimitiveType of this PrimitiveType. # noqa: E501 + :rtype: PrimitiveType """ return util.deserialize_model(dikt, cls) @property def primitive_type(self) -> str: - """Gets the primitive_type of this PropertyPropertyType. + """Gets the primitive_type of this PrimitiveType. - :return: The primitive_type of this PropertyPropertyType. + :return: The primitive_type of this PrimitiveType. :rtype: str """ return self._primitive_type @primitive_type.setter def primitive_type(self, primitive_type: str): - """Sets the primitive_type of this PropertyPropertyType. + """Sets the primitive_type of this PrimitiveType. - :param primitive_type: The primitive_type of this PropertyPropertyType. + :param primitive_type: The primitive_type of this PrimitiveType. :type primitive_type: str """ - allowed_values = ["DT_DOUBLE", "DT_STRING", "DT_SIGNED_INT32", "DT_SIGNED_INT64", "DT_DATE32"] # noqa: E501 + allowed_values = ["DT_SIGNED_INT32", "DT_UNSIGNED_INT32", "DT_SIGNED_INT64", "DT_UNSIGNED_INT64", "DT_BOOL", "DT_FLOAT", "DT_DOUBLE"] # noqa: E501 if primitive_type not in allowed_values: raise ValueError( "Invalid value for `primitive_type` ({0}), must be one of {1}" diff --git a/coordinator/gscoordinator/flex/models/running_deployment_info.py b/coordinator/gscoordinator/flex/models/running_deployment_info.py new file mode 100644 index 000000000000..f6770f595414 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/running_deployment_info.py @@ -0,0 +1,247 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class RunningDeploymentInfo(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, instance_name=None, cluster_type=None, version=None, creation_time=None, frontend=None, engine=None, storage=None): # noqa: E501 + """RunningDeploymentInfo - a model defined in OpenAPI + + :param instance_name: The instance_name of this RunningDeploymentInfo. # noqa: E501 + :type instance_name: str + :param cluster_type: The cluster_type of this RunningDeploymentInfo. # noqa: E501 + :type cluster_type: str + :param version: The version of this RunningDeploymentInfo. # noqa: E501 + :type version: str + :param creation_time: The creation_time of this RunningDeploymentInfo. # noqa: E501 + :type creation_time: str + :param frontend: The frontend of this RunningDeploymentInfo. # noqa: E501 + :type frontend: str + :param engine: The engine of this RunningDeploymentInfo. # noqa: E501 + :type engine: str + :param storage: The storage of this RunningDeploymentInfo. # noqa: E501 + :type storage: str + """ + self.openapi_types = { + 'instance_name': str, + 'cluster_type': str, + 'version': str, + 'creation_time': str, + 'frontend': str, + 'engine': str, + 'storage': str + } + + self.attribute_map = { + 'instance_name': 'instance_name', + 'cluster_type': 'cluster_type', + 'version': 'version', + 'creation_time': 'creation_time', + 'frontend': 'frontend', + 'engine': 'engine', + 'storage': 'storage' + } + + self._instance_name = instance_name + self._cluster_type = cluster_type + self._version = version + self._creation_time = creation_time + self._frontend = frontend + self._engine = engine + self._storage = storage + + @classmethod + def from_dict(cls, dikt) -> 'RunningDeploymentInfo': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The RunningDeploymentInfo of this RunningDeploymentInfo. # noqa: E501 + :rtype: RunningDeploymentInfo + """ + return util.deserialize_model(dikt, cls) + + @property + def instance_name(self) -> str: + """Gets the instance_name of this RunningDeploymentInfo. + + + :return: The instance_name of this RunningDeploymentInfo. + :rtype: str + """ + return self._instance_name + + @instance_name.setter + def instance_name(self, instance_name: str): + """Sets the instance_name of this RunningDeploymentInfo. + + + :param instance_name: The instance_name of this RunningDeploymentInfo. + :type instance_name: str + """ + if instance_name is None: + raise ValueError("Invalid value for `instance_name`, must not be `None`") # noqa: E501 + + self._instance_name = instance_name + + @property + def cluster_type(self) -> str: + """Gets the cluster_type of this RunningDeploymentInfo. + + + :return: The cluster_type of this RunningDeploymentInfo. + :rtype: str + """ + return self._cluster_type + + @cluster_type.setter + def cluster_type(self, cluster_type: str): + """Sets the cluster_type of this RunningDeploymentInfo. + + + :param cluster_type: The cluster_type of this RunningDeploymentInfo. + :type cluster_type: str + """ + allowed_values = ["HOSTS", "KUBERNETES"] # noqa: E501 + if cluster_type not in allowed_values: + raise ValueError( + "Invalid value for `cluster_type` ({0}), must be one of {1}" + .format(cluster_type, allowed_values) + ) + + self._cluster_type = cluster_type + + @property + def version(self) -> str: + """Gets the version of this RunningDeploymentInfo. + + + :return: The version of this RunningDeploymentInfo. + :rtype: str + """ + return self._version + + @version.setter + def version(self, version: str): + """Sets the version of this RunningDeploymentInfo. + + + :param version: The version of this RunningDeploymentInfo. + :type version: str + """ + if version is None: + raise ValueError("Invalid value for `version`, must not be `None`") # noqa: E501 + + self._version = version + + @property + def creation_time(self) -> str: + """Gets the creation_time of this RunningDeploymentInfo. + + + :return: The creation_time of this RunningDeploymentInfo. + :rtype: str + """ + return self._creation_time + + @creation_time.setter + def creation_time(self, creation_time: str): + """Sets the creation_time of this RunningDeploymentInfo. + + + :param creation_time: The creation_time of this RunningDeploymentInfo. + :type creation_time: str + """ + if creation_time is None: + raise ValueError("Invalid value for `creation_time`, must not be `None`") # noqa: E501 + + self._creation_time = creation_time + + @property + def frontend(self) -> str: + """Gets the frontend of this RunningDeploymentInfo. + + + :return: The frontend of this RunningDeploymentInfo. + :rtype: str + """ + return self._frontend + + @frontend.setter + def frontend(self, frontend: str): + """Sets the frontend of this RunningDeploymentInfo. + + + :param frontend: The frontend of this RunningDeploymentInfo. + :type frontend: str + """ + allowed_values = ["Cypher/Gremlin", "AnalyticalApps"] # noqa: E501 + if frontend not in allowed_values: + raise ValueError( + "Invalid value for `frontend` ({0}), must be one of {1}" + .format(frontend, allowed_values) + ) + + self._frontend = frontend + + @property + def engine(self) -> str: + """Gets the engine of this RunningDeploymentInfo. + + + :return: The engine of this RunningDeploymentInfo. + :rtype: str + """ + return self._engine + + @engine.setter + def engine(self, engine: str): + """Sets the engine of this RunningDeploymentInfo. + + + :param engine: The engine of this RunningDeploymentInfo. + :type engine: str + """ + allowed_values = ["Hiactor", "Gaia"] # noqa: E501 + if engine not in allowed_values: + raise ValueError( + "Invalid value for `engine` ({0}), must be one of {1}" + .format(engine, allowed_values) + ) + + self._engine = engine + + @property + def storage(self) -> str: + """Gets the storage of this RunningDeploymentInfo. + + + :return: The storage of this RunningDeploymentInfo. + :rtype: str + """ + return self._storage + + @storage.setter + def storage(self, storage: str): + """Sets the storage of this RunningDeploymentInfo. + + + :param storage: The storage of this RunningDeploymentInfo. + :type storage: str + """ + allowed_values = ["MutableCSR"] # noqa: E501 + if storage not in allowed_values: + raise ValueError( + "Invalid value for `storage` ({0}), must be one of {1}" + .format(storage, allowed_values) + ) + + self._storage = storage diff --git a/coordinator/gscoordinator/flex/models/running_deployment_status.py b/coordinator/gscoordinator/flex/models/running_deployment_status.py new file mode 100644 index 000000000000..492b8b23c2e1 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/running_deployment_status.py @@ -0,0 +1,97 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.running_deployment_status_nodes_inner import RunningDeploymentStatusNodesInner +from gscoordinator.flex import util + +from gscoordinator.flex.models.running_deployment_status_nodes_inner import RunningDeploymentStatusNodesInner # noqa: E501 + +class RunningDeploymentStatus(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, cluster_type=None, nodes=None): # noqa: E501 + """RunningDeploymentStatus - a model defined in OpenAPI + + :param cluster_type: The cluster_type of this RunningDeploymentStatus. # noqa: E501 + :type cluster_type: str + :param nodes: The nodes of this RunningDeploymentStatus. # noqa: E501 + :type nodes: List[RunningDeploymentStatusNodesInner] + """ + self.openapi_types = { + 'cluster_type': str, + 'nodes': List[RunningDeploymentStatusNodesInner] + } + + self.attribute_map = { + 'cluster_type': 'cluster_type', + 'nodes': 'nodes' + } + + self._cluster_type = cluster_type + self._nodes = nodes + + @classmethod + def from_dict(cls, dikt) -> 'RunningDeploymentStatus': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The RunningDeploymentStatus of this RunningDeploymentStatus. # noqa: E501 + :rtype: RunningDeploymentStatus + """ + return util.deserialize_model(dikt, cls) + + @property + def cluster_type(self) -> str: + """Gets the cluster_type of this RunningDeploymentStatus. + + + :return: The cluster_type of this RunningDeploymentStatus. + :rtype: str + """ + return self._cluster_type + + @cluster_type.setter + def cluster_type(self, cluster_type: str): + """Sets the cluster_type of this RunningDeploymentStatus. + + + :param cluster_type: The cluster_type of this RunningDeploymentStatus. + :type cluster_type: str + """ + allowed_values = ["HOSTS", "KUBERNETES"] # noqa: E501 + if cluster_type not in allowed_values: + raise ValueError( + "Invalid value for `cluster_type` ({0}), must be one of {1}" + .format(cluster_type, allowed_values) + ) + + self._cluster_type = cluster_type + + @property + def nodes(self) -> List[RunningDeploymentStatusNodesInner]: + """Gets the nodes of this RunningDeploymentStatus. + + + :return: The nodes of this RunningDeploymentStatus. + :rtype: List[RunningDeploymentStatusNodesInner] + """ + return self._nodes + + @nodes.setter + def nodes(self, nodes: List[RunningDeploymentStatusNodesInner]): + """Sets the nodes of this RunningDeploymentStatus. + + + :param nodes: The nodes of this RunningDeploymentStatus. + :type nodes: List[RunningDeploymentStatusNodesInner] + """ + if nodes is None: + raise ValueError("Invalid value for `nodes`, must not be `None`") # noqa: E501 + + self._nodes = nodes diff --git a/coordinator/gscoordinator/flex/models/running_deployment_status_nodes_inner.py b/coordinator/gscoordinator/flex/models/running_deployment_status_nodes_inner.py new file mode 100644 index 000000000000..6e75151e98a6 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/running_deployment_status_nodes_inner.py @@ -0,0 +1,149 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.node_status import NodeStatus +from gscoordinator.flex import util + +from gscoordinator.flex.models.node_status import NodeStatus # noqa: E501 + +class RunningDeploymentStatusNodesInner(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, name=None, cpu_usage=None, memory_usage=None, disk_usage=None): # noqa: E501 + """RunningDeploymentStatusNodesInner - a model defined in OpenAPI + + :param name: The name of this RunningDeploymentStatusNodesInner. # noqa: E501 + :type name: str + :param cpu_usage: The cpu_usage of this RunningDeploymentStatusNodesInner. # noqa: E501 + :type cpu_usage: float + :param memory_usage: The memory_usage of this RunningDeploymentStatusNodesInner. # noqa: E501 + :type memory_usage: float + :param disk_usage: The disk_usage of this RunningDeploymentStatusNodesInner. # noqa: E501 + :type disk_usage: float + """ + self.openapi_types = { + 'name': str, + 'cpu_usage': float, + 'memory_usage': float, + 'disk_usage': float + } + + self.attribute_map = { + 'name': 'name', + 'cpu_usage': 'cpu_usage', + 'memory_usage': 'memory_usage', + 'disk_usage': 'disk_usage' + } + + self._name = name + self._cpu_usage = cpu_usage + self._memory_usage = memory_usage + self._disk_usage = disk_usage + + @classmethod + def from_dict(cls, dikt) -> 'RunningDeploymentStatusNodesInner': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The RunningDeploymentStatus_nodes_inner of this RunningDeploymentStatusNodesInner. # noqa: E501 + :rtype: RunningDeploymentStatusNodesInner + """ + return util.deserialize_model(dikt, cls) + + @property + def name(self) -> str: + """Gets the name of this RunningDeploymentStatusNodesInner. + + + :return: The name of this RunningDeploymentStatusNodesInner. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name: str): + """Sets the name of this RunningDeploymentStatusNodesInner. + + + :param name: The name of this RunningDeploymentStatusNodesInner. + :type name: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def cpu_usage(self) -> float: + """Gets the cpu_usage of this RunningDeploymentStatusNodesInner. + + + :return: The cpu_usage of this RunningDeploymentStatusNodesInner. + :rtype: float + """ + return self._cpu_usage + + @cpu_usage.setter + def cpu_usage(self, cpu_usage: float): + """Sets the cpu_usage of this RunningDeploymentStatusNodesInner. + + + :param cpu_usage: The cpu_usage of this RunningDeploymentStatusNodesInner. + :type cpu_usage: float + """ + if cpu_usage is None: + raise ValueError("Invalid value for `cpu_usage`, must not be `None`") # noqa: E501 + + self._cpu_usage = cpu_usage + + @property + def memory_usage(self) -> float: + """Gets the memory_usage of this RunningDeploymentStatusNodesInner. + + + :return: The memory_usage of this RunningDeploymentStatusNodesInner. + :rtype: float + """ + return self._memory_usage + + @memory_usage.setter + def memory_usage(self, memory_usage: float): + """Sets the memory_usage of this RunningDeploymentStatusNodesInner. + + + :param memory_usage: The memory_usage of this RunningDeploymentStatusNodesInner. + :type memory_usage: float + """ + if memory_usage is None: + raise ValueError("Invalid value for `memory_usage`, must not be `None`") # noqa: E501 + + self._memory_usage = memory_usage + + @property + def disk_usage(self) -> float: + """Gets the disk_usage of this RunningDeploymentStatusNodesInner. + + + :return: The disk_usage of this RunningDeploymentStatusNodesInner. + :rtype: float + """ + return self._disk_usage + + @disk_usage.setter + def disk_usage(self, disk_usage: float): + """Sets the disk_usage of this RunningDeploymentStatusNodesInner. + + + :param disk_usage: The disk_usage of this RunningDeploymentStatusNodesInner. + :type disk_usage: float + """ + if disk_usage is None: + raise ValueError("Invalid value for `disk_usage`, must not be `None`") # noqa: E501 + + self._disk_usage = disk_usage diff --git a/flex/coordinator/gs_flex_coordinator/models/schema_mapping.py b/coordinator/gscoordinator/flex/models/schema_mapping.py similarity index 52% rename from flex/coordinator/gs_flex_coordinator/models/schema_mapping.py rename to coordinator/gscoordinator/flex/models/schema_mapping.py index 3cc9a19e1939..345371b71198 100644 --- a/flex/coordinator/gs_flex_coordinator/models/schema_mapping.py +++ b/coordinator/gscoordinator/flex/models/schema_mapping.py @@ -2,15 +2,13 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.edge_mapping import EdgeMapping -from gs_flex_coordinator.models.schema_mapping_loading_config import SchemaMappingLoadingConfig -from gs_flex_coordinator.models.vertex_mapping import VertexMapping -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.edge_mapping import EdgeMapping +from gscoordinator.flex.models.vertex_mapping import VertexMapping +from gscoordinator.flex import util -from gs_flex_coordinator.models.edge_mapping import EdgeMapping # noqa: E501 -from gs_flex_coordinator.models.schema_mapping_loading_config import SchemaMappingLoadingConfig # noqa: E501 -from gs_flex_coordinator.models.vertex_mapping import VertexMapping # noqa: E501 +from gscoordinator.flex.models.edge_mapping import EdgeMapping # noqa: E501 +from gscoordinator.flex.models.vertex_mapping import VertexMapping # noqa: E501 class SchemaMapping(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -18,34 +16,24 @@ class SchemaMapping(Model): Do not edit the class manually. """ - def __init__(self, graph=None, loading_config=None, vertex_mappings=None, edge_mappings=None): # noqa: E501 + def __init__(self, vertex_mappings=None, edge_mappings=None): # noqa: E501 """SchemaMapping - a model defined in OpenAPI - :param graph: The graph of this SchemaMapping. # noqa: E501 - :type graph: str - :param loading_config: The loading_config of this SchemaMapping. # noqa: E501 - :type loading_config: SchemaMappingLoadingConfig :param vertex_mappings: The vertex_mappings of this SchemaMapping. # noqa: E501 :type vertex_mappings: List[VertexMapping] :param edge_mappings: The edge_mappings of this SchemaMapping. # noqa: E501 :type edge_mappings: List[EdgeMapping] """ self.openapi_types = { - 'graph': str, - 'loading_config': SchemaMappingLoadingConfig, 'vertex_mappings': List[VertexMapping], 'edge_mappings': List[EdgeMapping] } self.attribute_map = { - 'graph': 'graph', - 'loading_config': 'loading_config', 'vertex_mappings': 'vertex_mappings', 'edge_mappings': 'edge_mappings' } - self._graph = graph - self._loading_config = loading_config self._vertex_mappings = vertex_mappings self._edge_mappings = edge_mappings @@ -60,48 +48,6 @@ def from_dict(cls, dikt) -> 'SchemaMapping': """ return util.deserialize_model(dikt, cls) - @property - def graph(self) -> str: - """Gets the graph of this SchemaMapping. - - - :return: The graph of this SchemaMapping. - :rtype: str - """ - return self._graph - - @graph.setter - def graph(self, graph: str): - """Sets the graph of this SchemaMapping. - - - :param graph: The graph of this SchemaMapping. - :type graph: str - """ - - self._graph = graph - - @property - def loading_config(self) -> SchemaMappingLoadingConfig: - """Gets the loading_config of this SchemaMapping. - - - :return: The loading_config of this SchemaMapping. - :rtype: SchemaMappingLoadingConfig - """ - return self._loading_config - - @loading_config.setter - def loading_config(self, loading_config: SchemaMappingLoadingConfig): - """Sets the loading_config of this SchemaMapping. - - - :param loading_config: The loading_config of this SchemaMapping. - :type loading_config: SchemaMappingLoadingConfig - """ - - self._loading_config = loading_config - @property def vertex_mappings(self) -> List[VertexMapping]: """Gets the vertex_mappings of this SchemaMapping. @@ -120,6 +66,8 @@ def vertex_mappings(self, vertex_mappings: List[VertexMapping]): :param vertex_mappings: The vertex_mappings of this SchemaMapping. :type vertex_mappings: List[VertexMapping] """ + if vertex_mappings is None: + raise ValueError("Invalid value for `vertex_mappings`, must not be `None`") # noqa: E501 self._vertex_mappings = vertex_mappings @@ -141,5 +89,7 @@ def edge_mappings(self, edge_mappings: List[EdgeMapping]): :param edge_mappings: The edge_mappings of this SchemaMapping. :type edge_mappings: List[EdgeMapping] """ + if edge_mappings is None: + raise ValueError("Invalid value for `edge_mappings`, must not be `None`") # noqa: E501 self._edge_mappings = edge_mappings diff --git a/flex/coordinator/gs_flex_coordinator/models/service_status.py b/coordinator/gscoordinator/flex/models/service_status.py similarity index 50% rename from flex/coordinator/gs_flex_coordinator/models/service_status.py rename to coordinator/gscoordinator/flex/models/service_status.py index 0bcfb46f46aa..399e5eabc0f0 100644 --- a/flex/coordinator/gs_flex_coordinator/models/service_status.py +++ b/coordinator/gscoordinator/flex/models/service_status.py @@ -2,11 +2,11 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints +from gscoordinator.flex import util -from gs_flex_coordinator.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints # noqa: E501 +from gscoordinator.flex.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints # noqa: E501 class ServiceStatus(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -14,31 +14,36 @@ class ServiceStatus(Model): Do not edit the class manually. """ - def __init__(self, status=None, graph_name=None, sdk_endpoints=None): # noqa: E501 + def __init__(self, graph_id=None, status=None, sdk_endpoints=None, start_time=None): # noqa: E501 """ServiceStatus - a model defined in OpenAPI + :param graph_id: The graph_id of this ServiceStatus. # noqa: E501 + :type graph_id: str :param status: The status of this ServiceStatus. # noqa: E501 :type status: str - :param graph_name: The graph_name of this ServiceStatus. # noqa: E501 - :type graph_name: str :param sdk_endpoints: The sdk_endpoints of this ServiceStatus. # noqa: E501 :type sdk_endpoints: ServiceStatusSdkEndpoints + :param start_time: The start_time of this ServiceStatus. # noqa: E501 + :type start_time: str """ self.openapi_types = { + 'graph_id': str, 'status': str, - 'graph_name': str, - 'sdk_endpoints': ServiceStatusSdkEndpoints + 'sdk_endpoints': ServiceStatusSdkEndpoints, + 'start_time': str } self.attribute_map = { + 'graph_id': 'graph_id', 'status': 'status', - 'graph_name': 'graph_name', - 'sdk_endpoints': 'sdk_endpoints' + 'sdk_endpoints': 'sdk_endpoints', + 'start_time': 'start_time' } + self._graph_id = graph_id self._status = status - self._graph_name = graph_name self._sdk_endpoints = sdk_endpoints + self._start_time = start_time @classmethod def from_dict(cls, dikt) -> 'ServiceStatus': @@ -52,48 +57,54 @@ def from_dict(cls, dikt) -> 'ServiceStatus': return util.deserialize_model(dikt, cls) @property - def status(self) -> str: - """Gets the status of this ServiceStatus. + def graph_id(self) -> str: + """Gets the graph_id of this ServiceStatus. - :return: The status of this ServiceStatus. + :return: The graph_id of this ServiceStatus. :rtype: str """ - return self._status + return self._graph_id - @status.setter - def status(self, status: str): - """Sets the status of this ServiceStatus. + @graph_id.setter + def graph_id(self, graph_id: str): + """Sets the graph_id of this ServiceStatus. - :param status: The status of this ServiceStatus. - :type status: str + :param graph_id: The graph_id of this ServiceStatus. + :type graph_id: str """ + if graph_id is None: + raise ValueError("Invalid value for `graph_id`, must not be `None`") # noqa: E501 - self._status = status + self._graph_id = graph_id @property - def graph_name(self) -> str: - """Gets the graph_name of this ServiceStatus. + def status(self) -> str: + """Gets the status of this ServiceStatus. - which graph is serving now # noqa: E501 - :return: The graph_name of this ServiceStatus. + :return: The status of this ServiceStatus. :rtype: str """ - return self._graph_name + return self._status - @graph_name.setter - def graph_name(self, graph_name: str): - """Sets the graph_name of this ServiceStatus. + @status.setter + def status(self, status: str): + """Sets the status of this ServiceStatus. - which graph is serving now # noqa: E501 - :param graph_name: The graph_name of this ServiceStatus. - :type graph_name: str + :param status: The status of this ServiceStatus. + :type status: str """ + allowed_values = ["Running", "Stopped"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) - self._graph_name = graph_name + self._status = status @property def sdk_endpoints(self) -> ServiceStatusSdkEndpoints: @@ -115,3 +126,24 @@ def sdk_endpoints(self, sdk_endpoints: ServiceStatusSdkEndpoints): """ self._sdk_endpoints = sdk_endpoints + + @property + def start_time(self) -> str: + """Gets the start_time of this ServiceStatus. + + + :return: The start_time of this ServiceStatus. + :rtype: str + """ + return self._start_time + + @start_time.setter + def start_time(self, start_time: str): + """Sets the start_time of this ServiceStatus. + + + :param start_time: The start_time of this ServiceStatus. + :type start_time: str + """ + + self._start_time = start_time diff --git a/flex/coordinator/gs_flex_coordinator/models/service_status_sdk_endpoints.py b/coordinator/gscoordinator/flex/models/service_status_sdk_endpoints.py similarity index 97% rename from flex/coordinator/gs_flex_coordinator/models/service_status_sdk_endpoints.py rename to coordinator/gscoordinator/flex/models/service_status_sdk_endpoints.py index d9fbc0a37050..040c74cc0dce 100644 --- a/flex/coordinator/gs_flex_coordinator/models/service_status_sdk_endpoints.py +++ b/coordinator/gscoordinator/flex/models/service_status_sdk_endpoints.py @@ -2,8 +2,8 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util class ServiceStatusSdkEndpoints(Model): diff --git a/coordinator/gscoordinator/flex/models/start_service_request.py b/coordinator/gscoordinator/flex/models/start_service_request.py new file mode 100644 index 000000000000..fbf368fea336 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/start_service_request.py @@ -0,0 +1,61 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class StartServiceRequest(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, graph_id=None): # noqa: E501 + """StartServiceRequest - a model defined in OpenAPI + + :param graph_id: The graph_id of this StartServiceRequest. # noqa: E501 + :type graph_id: str + """ + self.openapi_types = { + 'graph_id': str + } + + self.attribute_map = { + 'graph_id': 'graph_id' + } + + self._graph_id = graph_id + + @classmethod + def from_dict(cls, dikt) -> 'StartServiceRequest': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The StartServiceRequest of this StartServiceRequest. # noqa: E501 + :rtype: StartServiceRequest + """ + return util.deserialize_model(dikt, cls) + + @property + def graph_id(self) -> str: + """Gets the graph_id of this StartServiceRequest. + + + :return: The graph_id of this StartServiceRequest. + :rtype: str + """ + return self._graph_id + + @graph_id.setter + def graph_id(self, graph_id: str): + """Sets the graph_id of this StartServiceRequest. + + + :param graph_id: The graph_id of this StartServiceRequest. + :type graph_id: str + """ + + self._graph_id = graph_id diff --git a/coordinator/gscoordinator/flex/models/stored_procedure_meta.py b/coordinator/gscoordinator/flex/models/stored_procedure_meta.py new file mode 100644 index 000000000000..7528500e0cfa --- /dev/null +++ b/coordinator/gscoordinator/flex/models/stored_procedure_meta.py @@ -0,0 +1,263 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.parameter import Parameter +from gscoordinator.flex import util + +from gscoordinator.flex.models.parameter import Parameter # noqa: E501 + +class StoredProcedureMeta(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, name=None, description=None, type=None, query=None, id=None, library=None, params=None, returns=None): # noqa: E501 + """StoredProcedureMeta - a model defined in OpenAPI + + :param name: The name of this StoredProcedureMeta. # noqa: E501 + :type name: str + :param description: The description of this StoredProcedureMeta. # noqa: E501 + :type description: str + :param type: The type of this StoredProcedureMeta. # noqa: E501 + :type type: str + :param query: The query of this StoredProcedureMeta. # noqa: E501 + :type query: str + :param id: The id of this StoredProcedureMeta. # noqa: E501 + :type id: str + :param library: The library of this StoredProcedureMeta. # noqa: E501 + :type library: str + :param params: The params of this StoredProcedureMeta. # noqa: E501 + :type params: List[Parameter] + :param returns: The returns of this StoredProcedureMeta. # noqa: E501 + :type returns: List[Parameter] + """ + self.openapi_types = { + 'name': str, + 'description': str, + 'type': str, + 'query': str, + 'id': str, + 'library': str, + 'params': List[Parameter], + 'returns': List[Parameter] + } + + self.attribute_map = { + 'name': 'name', + 'description': 'description', + 'type': 'type', + 'query': 'query', + 'id': 'id', + 'library': 'library', + 'params': 'params', + 'returns': 'returns' + } + + self._name = name + self._description = description + self._type = type + self._query = query + self._id = id + self._library = library + self._params = params + self._returns = returns + + @classmethod + def from_dict(cls, dikt) -> 'StoredProcedureMeta': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The StoredProcedureMeta of this StoredProcedureMeta. # noqa: E501 + :rtype: StoredProcedureMeta + """ + return util.deserialize_model(dikt, cls) + + @property + def name(self) -> str: + """Gets the name of this StoredProcedureMeta. + + + :return: The name of this StoredProcedureMeta. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name: str): + """Sets the name of this StoredProcedureMeta. + + + :param name: The name of this StoredProcedureMeta. + :type name: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def description(self) -> str: + """Gets the description of this StoredProcedureMeta. + + + :return: The description of this StoredProcedureMeta. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this StoredProcedureMeta. + + + :param description: The description of this StoredProcedureMeta. + :type description: str + """ + + self._description = description + + @property + def type(self) -> str: + """Gets the type of this StoredProcedureMeta. + + + :return: The type of this StoredProcedureMeta. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type: str): + """Sets the type of this StoredProcedureMeta. + + + :param type: The type of this StoredProcedureMeta. + :type type: str + """ + allowed_values = ["cpp", "cypher"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" + .format(type, allowed_values) + ) + + self._type = type + + @property + def query(self) -> str: + """Gets the query of this StoredProcedureMeta. + + + :return: The query of this StoredProcedureMeta. + :rtype: str + """ + return self._query + + @query.setter + def query(self, query: str): + """Sets the query of this StoredProcedureMeta. + + + :param query: The query of this StoredProcedureMeta. + :type query: str + """ + if query is None: + raise ValueError("Invalid value for `query`, must not be `None`") # noqa: E501 + + self._query = query + + @property + def id(self) -> str: + """Gets the id of this StoredProcedureMeta. + + + :return: The id of this StoredProcedureMeta. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id: str): + """Sets the id of this StoredProcedureMeta. + + + :param id: The id of this StoredProcedureMeta. + :type id: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def library(self) -> str: + """Gets the library of this StoredProcedureMeta. + + + :return: The library of this StoredProcedureMeta. + :rtype: str + """ + return self._library + + @library.setter + def library(self, library: str): + """Sets the library of this StoredProcedureMeta. + + + :param library: The library of this StoredProcedureMeta. + :type library: str + """ + if library is None: + raise ValueError("Invalid value for `library`, must not be `None`") # noqa: E501 + + self._library = library + + @property + def params(self) -> List[Parameter]: + """Gets the params of this StoredProcedureMeta. + + + :return: The params of this StoredProcedureMeta. + :rtype: List[Parameter] + """ + return self._params + + @params.setter + def params(self, params: List[Parameter]): + """Sets the params of this StoredProcedureMeta. + + + :param params: The params of this StoredProcedureMeta. + :type params: List[Parameter] + """ + if params is None: + raise ValueError("Invalid value for `params`, must not be `None`") # noqa: E501 + + self._params = params + + @property + def returns(self) -> List[Parameter]: + """Gets the returns of this StoredProcedureMeta. + + + :return: The returns of this StoredProcedureMeta. + :rtype: List[Parameter] + """ + return self._returns + + @returns.setter + def returns(self, returns: List[Parameter]): + """Sets the returns of this StoredProcedureMeta. + + + :param returns: The returns of this StoredProcedureMeta. + :type returns: List[Parameter] + """ + if returns is None: + raise ValueError("Invalid value for `returns`, must not be `None`") # noqa: E501 + + self._returns = returns diff --git a/coordinator/gscoordinator/flex/models/string_type.py b/coordinator/gscoordinator/flex/models/string_type.py new file mode 100644 index 000000000000..7c8095ee793c --- /dev/null +++ b/coordinator/gscoordinator/flex/models/string_type.py @@ -0,0 +1,65 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.string_type_string import StringTypeString +from gscoordinator.flex import util + +from gscoordinator.flex.models.string_type_string import StringTypeString # noqa: E501 + +class StringType(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, string=None): # noqa: E501 + """StringType - a model defined in OpenAPI + + :param string: The string of this StringType. # noqa: E501 + :type string: StringTypeString + """ + self.openapi_types = { + 'string': StringTypeString + } + + self.attribute_map = { + 'string': 'string' + } + + self._string = string + + @classmethod + def from_dict(cls, dikt) -> 'StringType': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The StringType of this StringType. # noqa: E501 + :rtype: StringType + """ + return util.deserialize_model(dikt, cls) + + @property + def string(self) -> StringTypeString: + """Gets the string of this StringType. + + + :return: The string of this StringType. + :rtype: StringTypeString + """ + return self._string + + @string.setter + def string(self, string: StringTypeString): + """Sets the string of this StringType. + + + :param string: The string of this StringType. + :type string: StringTypeString + """ + if string is None: + raise ValueError("Invalid value for `string`, must not be `None`") # noqa: E501 + + self._string = string diff --git a/coordinator/gscoordinator/flex/models/string_type_string.py b/coordinator/gscoordinator/flex/models/string_type_string.py new file mode 100644 index 000000000000..2d8bb4bf3714 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/string_type_string.py @@ -0,0 +1,65 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.long_text import LongText +from gscoordinator.flex import util + +from gscoordinator.flex.models.long_text import LongText # noqa: E501 + +class StringTypeString(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, long_text=None): # noqa: E501 + """StringTypeString - a model defined in OpenAPI + + :param long_text: The long_text of this StringTypeString. # noqa: E501 + :type long_text: str + """ + self.openapi_types = { + 'long_text': str + } + + self.attribute_map = { + 'long_text': 'long_text' + } + + self._long_text = long_text + + @classmethod + def from_dict(cls, dikt) -> 'StringTypeString': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The StringType_string of this StringTypeString. # noqa: E501 + :rtype: StringTypeString + """ + return util.deserialize_model(dikt, cls) + + @property + def long_text(self) -> str: + """Gets the long_text of this StringTypeString. + + + :return: The long_text of this StringTypeString. + :rtype: str + """ + return self._long_text + + @long_text.setter + def long_text(self, long_text: str): + """Sets the long_text of this StringTypeString. + + + :param long_text: The long_text of this StringTypeString. + :type long_text: str + """ + if long_text is None: + raise ValueError("Invalid value for `long_text`, must not be `None`") # noqa: E501 + + self._long_text = long_text diff --git a/coordinator/gscoordinator/flex/models/update_alert_message_status_request.py b/coordinator/gscoordinator/flex/models/update_alert_message_status_request.py new file mode 100644 index 000000000000..a47942c318e0 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/update_alert_message_status_request.py @@ -0,0 +1,95 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class UpdateAlertMessageStatusRequest(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, message_ids=None, status=None): # noqa: E501 + """UpdateAlertMessageStatusRequest - a model defined in OpenAPI + + :param message_ids: The message_ids of this UpdateAlertMessageStatusRequest. # noqa: E501 + :type message_ids: List[str] + :param status: The status of this UpdateAlertMessageStatusRequest. # noqa: E501 + :type status: str + """ + self.openapi_types = { + 'message_ids': List[str], + 'status': str + } + + self.attribute_map = { + 'message_ids': 'message_ids', + 'status': 'status' + } + + self._message_ids = message_ids + self._status = status + + @classmethod + def from_dict(cls, dikt) -> 'UpdateAlertMessageStatusRequest': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The UpdateAlertMessageStatusRequest of this UpdateAlertMessageStatusRequest. # noqa: E501 + :rtype: UpdateAlertMessageStatusRequest + """ + return util.deserialize_model(dikt, cls) + + @property + def message_ids(self) -> List[str]: + """Gets the message_ids of this UpdateAlertMessageStatusRequest. + + + :return: The message_ids of this UpdateAlertMessageStatusRequest. + :rtype: List[str] + """ + return self._message_ids + + @message_ids.setter + def message_ids(self, message_ids: List[str]): + """Sets the message_ids of this UpdateAlertMessageStatusRequest. + + + :param message_ids: The message_ids of this UpdateAlertMessageStatusRequest. + :type message_ids: List[str] + """ + if message_ids is None: + raise ValueError("Invalid value for `message_ids`, must not be `None`") # noqa: E501 + + self._message_ids = message_ids + + @property + def status(self) -> str: + """Gets the status of this UpdateAlertMessageStatusRequest. + + + :return: The status of this UpdateAlertMessageStatusRequest. + :rtype: str + """ + return self._status + + @status.setter + def status(self, status: str): + """Sets the status of this UpdateAlertMessageStatusRequest. + + + :param status: The status of this UpdateAlertMessageStatusRequest. + :type status: str + """ + allowed_values = ["unsolved", "solved", "dealing"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" + .format(status, allowed_values) + ) + + self._status = status diff --git a/coordinator/gscoordinator/flex/models/update_stored_proc_request.py b/coordinator/gscoordinator/flex/models/update_stored_proc_request.py new file mode 100644 index 000000000000..4cf2dec4d285 --- /dev/null +++ b/coordinator/gscoordinator/flex/models/update_stored_proc_request.py @@ -0,0 +1,63 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class UpdateStoredProcRequest(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, description=None): # noqa: E501 + """UpdateStoredProcRequest - a model defined in OpenAPI + + :param description: The description of this UpdateStoredProcRequest. # noqa: E501 + :type description: str + """ + self.openapi_types = { + 'description': str + } + + self.attribute_map = { + 'description': 'description' + } + + self._description = description + + @classmethod + def from_dict(cls, dikt) -> 'UpdateStoredProcRequest': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The UpdateStoredProcRequest of this UpdateStoredProcRequest. # noqa: E501 + :rtype: UpdateStoredProcRequest + """ + return util.deserialize_model(dikt, cls) + + @property + def description(self) -> str: + """Gets the description of this UpdateStoredProcRequest. + + + :return: The description of this UpdateStoredProcRequest. + :rtype: str + """ + return self._description + + @description.setter + def description(self, description: str): + """Sets the description of this UpdateStoredProcRequest. + + + :param description: The description of this UpdateStoredProcRequest. + :type description: str + """ + if description is None: + raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 + + self._description = description diff --git a/coordinator/gscoordinator/flex/models/upload_file_response.py b/coordinator/gscoordinator/flex/models/upload_file_response.py new file mode 100644 index 000000000000..b14ecb242d1b --- /dev/null +++ b/coordinator/gscoordinator/flex/models/upload_file_response.py @@ -0,0 +1,63 @@ +from datetime import date, datetime # noqa: F401 + +from typing import List, Dict # noqa: F401 + +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex import util + + +class UploadFileResponse(Model): + """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + + Do not edit the class manually. + """ + + def __init__(self, file_path=None): # noqa: E501 + """UploadFileResponse - a model defined in OpenAPI + + :param file_path: The file_path of this UploadFileResponse. # noqa: E501 + :type file_path: str + """ + self.openapi_types = { + 'file_path': str + } + + self.attribute_map = { + 'file_path': 'file_path' + } + + self._file_path = file_path + + @classmethod + def from_dict(cls, dikt) -> 'UploadFileResponse': + """Returns the dict as a model + + :param dikt: A dict. + :type: dict + :return: The UploadFileResponse of this UploadFileResponse. # noqa: E501 + :rtype: UploadFileResponse + """ + return util.deserialize_model(dikt, cls) + + @property + def file_path(self) -> str: + """Gets the file_path of this UploadFileResponse. + + + :return: The file_path of this UploadFileResponse. + :rtype: str + """ + return self._file_path + + @file_path.setter + def file_path(self, file_path: str): + """Sets the file_path of this UploadFileResponse. + + + :param file_path: The file_path of this UploadFileResponse. + :type file_path: str + """ + if file_path is None: + raise ValueError("Invalid value for `file_path`, must not be `None`") # noqa: E501 + + self._file_path = file_path diff --git a/flex/coordinator/gs_flex_coordinator/models/vertex_mapping.py b/coordinator/gscoordinator/flex/models/vertex_mapping.py similarity index 83% rename from flex/coordinator/gs_flex_coordinator/models/vertex_mapping.py rename to coordinator/gscoordinator/flex/models/vertex_mapping.py index 7abf756fe4a5..ad18dbf65bec 100644 --- a/flex/coordinator/gs_flex_coordinator/models/vertex_mapping.py +++ b/coordinator/gscoordinator/flex/models/vertex_mapping.py @@ -2,11 +2,11 @@ from typing import List, Dict # noqa: F401 -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.column_mapping import ColumnMapping -from gs_flex_coordinator import util +from gscoordinator.flex.models.base_model import Model +from gscoordinator.flex.models.column_mapping import ColumnMapping +from gscoordinator.flex import util -from gs_flex_coordinator.models.column_mapping import ColumnMapping # noqa: E501 +from gscoordinator.flex.models.column_mapping import ColumnMapping # noqa: E501 class VertexMapping(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -69,6 +69,8 @@ def type_name(self, type_name: str): :param type_name: The type_name of this VertexMapping. :type type_name: str """ + if type_name is None: + raise ValueError("Invalid value for `type_name`, must not be `None`") # noqa: E501 self._type_name = type_name @@ -90,6 +92,8 @@ def inputs(self, inputs: List[str]): :param inputs: The inputs of this VertexMapping. :type inputs: List[str] """ + if inputs is None: + raise ValueError("Invalid value for `inputs`, must not be `None`") # noqa: E501 self._inputs = inputs @@ -111,5 +115,7 @@ def column_mappings(self, column_mappings: List[ColumnMapping]): :param column_mappings: The column_mappings of this VertexMapping. :type column_mappings: List[ColumnMapping] """ + if column_mappings is None: + raise ValueError("Invalid value for `column_mappings`, must not be `None`") # noqa: E501 self._column_mappings = column_mappings diff --git a/coordinator/gscoordinator/flex/openapi/openapi.yaml b/coordinator/gscoordinator/flex/openapi/openapi.yaml new file mode 100644 index 000000000000..9e93c04bdaa1 --- /dev/null +++ b/coordinator/gscoordinator/flex/openapi/openapi.yaml @@ -0,0 +1,3705 @@ +openapi: 3.0.3 +info: + contact: + email: graphscope@alibaba-inc.com + name: GraphScope + description: |- + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about + specification at [doc](https://swagger.io/specification/v3/). + + Some useful links: + - [GraphScope Repository](https://github.com/alibaba/GraphScope) + - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: GraphScope FLEX HTTP SERVICE API + version: 1.0.0 +externalDocs: + description: Find out More about GraphScope + url: http://graphscope.io +servers: +- url: / +tags: +- name: Deployment +- name: Graph +- name: DataSource +- name: Job +- name: Stored Procedure +- name: Service +- name: Alert +- name: Utils +paths: + /api/v1/alert/message: + get: + description: List all alert messages + operationId: list_alert_messages + parameters: + - explode: true + in: query + name: alert_type + required: false + schema: + type: string + style: form + - explode: true + in: query + name: status + required: false + schema: + enum: + - solved + - unsolved + - dealing + type: string + style: form + - explode: true + in: query + name: severity + required: false + schema: + enum: + - warning + - emergency + type: string + style: form + - description: format with "2023-02-21-11-56-30" + explode: true + in: query + name: start_time + required: false + schema: + type: string + style: form + - description: format with "2023-02-21-11-56-30" + explode: true + in: query + name: end_time + required: false + schema: + type: string + style: form + - explode: true + in: query + name: limit + required: false + schema: + format: int32 + type: integer + style: form + responses: + "200": + content: + application/json: + example: + - id: ALERT-MESSAGE-QWERTYUIOP-1 + alert_name: HighDiskUtilization + severity: warning + metric_type: node + target: + - hostname-1 + trigger_time: 2023-02-21 11:56:30 + status: unsolved + message: "Disk usage node1 85.12%, exceeds threshold" + - id: ALERT-MESSAGE-QWERTYUIOP-2 + alert_name: HighDiskUtilization + severity: emergency + metric_type: node + target: + - hostname-1 + trigger_time: 2023-02-21 11:56:30 + status: solved + message: "Disk usage node1 85.12%, exceeds threshold" + - id: ALERT-MESSAGE-QWERTYUIOP-3 + alert_name: HighDiskUtilization + severity: warning + metric_type: node + target: + - hostname-1 + trigger_time: 2023-02-21 11:56:30 + status: dealing + message: "Disk usage node1 85.12%, exceeds threshold" + schema: + items: + $ref: '#/components/schemas/GetAlertMessageResponse' + type: array + description: Successfully returned the alert messages + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + /api/v1/alert/message-collection: + delete: + description: Delete alert message in batch + operationId: delete_alert_message_in_batch + parameters: + - description: "A list of message id separated by comma, e.g. id1,id2,id3" + explode: true + in: query + name: message_ids + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully deleted the alert message + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + /api/v1/alert/message-collection/status: + put: + description: Update the message status in batch + operationId: update_alert_message_in_batch + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAlertMessageStatusRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successful operation + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + /api/v1/alert/receiver: + get: + description: List all alert receivers + operationId: list_alert_receivers + responses: + "200": + content: + application/json: + example: + - id: RECEIVER-QWERTYUIOP-1 + type: webhook + webhook_url: http://webhook.com + is_at_all: false + at_user_ids: + - 111111 + - 222222 + enable: false + - id: RECEIVER-QWERTYUIOP-2 + type: webhook + webhook_url: http://webhook.com + is_at_all: false + at_user_ids: + - 111111 + - 222222 + enable: true + message: error message + schema: + items: + $ref: '#/components/schemas/GetAlertReceiverResponse' + type: array + description: Successfully returned the alert receivers + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + post: + description: Create a new alert receiver + operationId: create_alert_receiver + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAlertReceiverRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully created the alert receiver + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + /api/v1/alert/receiver/{receiver_id}: + delete: + description: Delete the alert receiver by ID + operationId: delete_alert_receiver_by_id + parameters: + - explode: false + in: path + name: receiver_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully deleted the alert receiver + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + put: + description: Update alert receiver by ID + operationId: update_alert_receiver_by_id + parameters: + - explode: false + in: path + name: receiver_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAlertReceiverRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully updated the alert receiver + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + /api/v1/alert/rule: + get: + description: List all alert rules + operationId: list_alert_rules + responses: + "200": + content: + application/json: + example: + - id: ALERTRULE-1 + name: HighDiskUtilization + severity: warning + metric_type: node + conditions_description: disk usage >= 85 + enable: true + - id: ALERTRULE-2 + name: GremlinServiceAvailable + severity: emergency + metric_type: node + conditions_description: g.V().limit(1) failed + enable: false + schema: + items: + $ref: '#/components/schemas/GetAlertRuleResponse' + type: array + description: Successfully returned the alert rules + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + /api/v1/alert/rule/{rule_id}: + delete: + operationId: delete_alert_rule_by_id + parameters: + - explode: false + in: path + name: rule_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully deleted the alert rule + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + put: + operationId: update_alert_rule_by_id + parameters: + - explode: false + in: path + name: rule_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAlertRuleRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully updated the alert rule + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Alert + x-openapi-router-controller: gscoordinator.flex.controllers.alert_controller + /api/v1/deployment: + get: + description: Deployment information + operationId: get_deployment_info + responses: + "200": + content: + application/json: + example: + cluster_type: HOSTS + creation_time: 2024-01-01 00:00:00 + instance_name: demo + frontend: Cypher/Gremlin + engine: Hiactor + storage: MutableCSR + version: 0.27.0 + schema: + $ref: '#/components/schemas/RunningDeploymentInfo' + description: Successfully returned the deployment information + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Deployment + x-openapi-router-controller: gscoordinator.flex.controllers.deployment_controller + /api/v1/deployment/status: + get: + description: Deployment status + operationId: get_deployment_status + responses: + "200": + content: + application/json: + example: + cluster_type: HOSTS + nodes: + - name: HOSTNAME-1 + cpu_usage: 83.0 + memory_usage: 37.5 + disk_usage: 97 + schema: + $ref: '#/components/schemas/RunningDeploymentStatus' + description: Successfully returned the deployment status + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Deployment + x-openapi-router-controller: gscoordinator.flex.controllers.deployment_controller + /api/v1/file/uploading: + post: + operationId: upload_file + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/UploadFileResponse' + description: successful operation + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Utils + x-openapi-router-controller: gscoordinator.flex.controllers.utils_controller + /api/v1/graph: + get: + description: List all graphs + operationId: list_graphs + responses: + "200": + content: + application/json: + example: + - id: GRAPHID + name: demo + creation_time: 2024-01-01 00:00:00 + schema_update_time: 2024-01-02 00:00:00 + data_update_time: 2024-01-03 00:00:00 + stored_procedures: + - id: STORED-PROCEDURE-ID + name: stored_procedure_name + type: cypher + query: MATCH(a) return COUNT(a); + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: true + schema: + vertex_types: + - type_id: 0 + type_name: person + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + - type_id: 1 + type_name: software + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + edge_types: + - type_id: 0 + type_name: knows + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: person + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + - type_id: 1 + type_name: created + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: software + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + schema: + items: + $ref: '#/components/schemas/GetGraphResponse' + type: array + description: Successfully returned all graphs + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + post: + description: Create a new graph + operationId: create_graph + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateGraphRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateGraphResponse' + description: The graph was created + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + /api/v1/graph/{graph_id}: + delete: + description: Delete graph by ID + operationId: delete_graph_by_id + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully deleted the graph + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + get: + description: Get graph by ID + operationId: get_graph_by_id + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + id: GRAPHID + name: demo + creation_time: 2024-01-01 00:00:00 + schema_update_time: 2024-01-02 00:00:00 + data_update_time: 2024-01-03 00:00:00 + stored_procedures: + - id: STORED-PROCEDURE-ID + name: stored_procedure_name + type: cypher + query: MATCH(a) return COUNT(a); + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: true + schema: + vertex_types: + - type_id: 0 + type_name: person + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + - type_id: 1 + type_name: software + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + edge_types: + - type_id: 0 + type_name: knows + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: person + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + - type_id: 1 + type_name: created + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: software + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + schema: + $ref: '#/components/schemas/GetGraphResponse' + description: Successfully returned the graph + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + /api/v1/graph/{graph_id}/dataloading: + post: + description: Submit a dataloading job + operationId: submit_dataloading_job + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DataloadingJobConfig' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateDataloadingJobResponse' + description: Successfully submitted the job + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Job + x-openapi-router-controller: gscoordinator.flex.controllers.job_controller + /api/v1/graph/{graph_id}/dataloading/config: + get: + description: Get the data loading configuration + operationId: get_dataloading_job_config + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DataloadingJobConfig' + description: Successfully returned the dataloading job configuration + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Job + x-openapi-router-controller: gscoordinator.flex.controllers.job_controller + /api/v1/graph/{graph_id}/datasource: + get: + description: Get data source by ID + operationId: get_datasource_by_id + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + vertex_mappings: + - type_name: person + inputs: + - file:///path/to/person.csv + column_mappings: + - column: + index: 0 + name: id + property: id + - column: + index: 1 + name: name + property: name + - type_name: software + inputs: + - file:///path/to/software.csv + column_mappings: + - column: + index: 0 + name: id + property: id + - column: + index: 1 + name: name + property: name + edge_mappings: + - type_triplet: + edge: knows + source_vertex: person + destination_vertex: person + inputs: + - file:///path/to/knows.csv + source_vertex_mappings: + - column: + index: 0 + name: id + property: id + destination_vertex_mappings: + - column: + index: 1 + name: id + property: id + column_mappings: + - column: + index: 2 + name: weight + property: weight + - type_triplet: + edge: created + source_vertex: person + destination_vertex: software + inputs: + - file:///path/to/created.csv + source_vertex_mappings: + - column: + index: 0 + name: id + property: id + destination_vertex_mappings: + - column: + index: 1 + name: id + property: id + column_mappings: + - column: + index: 2 + name: weight + property: weight + schema: + $ref: '#/components/schemas/SchemaMapping' + description: Successful returned all data sources + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - DataSource + x-openapi-router-controller: gscoordinator.flex.controllers.data_source_controller + post: + description: Bind data sources in batches + operationId: bind_datasource_in_batch + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SchemaMapping' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successful bind the data sources + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - DataSource + x-openapi-router-controller: gscoordinator.flex.controllers.data_source_controller + /api/v1/graph/{graph_id}/datasource/edge/{type_name}: + delete: + description: Unbind datas ource on an edge type + operationId: unbind_edge_datasource + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: type_name + required: true + schema: + type: string + style: simple + - explode: true + in: query + name: source_vertex_type + required: true + schema: + type: string + style: form + - explode: true + in: query + name: destination_vertex_type + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully unbind the data source + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - DataSource + x-openapi-router-controller: gscoordinator.flex.controllers.data_source_controller + /api/v1/graph/{graph_id}/datasource/vertex/{type_name}: + delete: + description: Unbind data source on a vertex type + operationId: unbind_vertex_datasource + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: type_name + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully unbind the data source + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - DataSource + x-openapi-router-controller: gscoordinator.flex.controllers.data_source_controller + /api/v1/graph/{graph_id}/schema: + get: + description: Get graph schema by ID + operationId: get_schema_by_id + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + vertex_types: + - type_id: 0 + type_name: person + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + - type_id: 1 + type_name: software + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + edge_types: + - type_id: 0 + type_name: knows + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: person + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + - type_id: 1 + type_name: created + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: software + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + schema: + $ref: '#/components/schemas/GetGraphSchemaResponse' + description: Successfully returned the graph schema + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + post: + description: Import graph schema + operationId: import_schema_by_id + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateGraphSchemaRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successful imported the graph schema + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + /api/v1/graph/{graph_id}/schema/edge: + post: + description: Create a edge type + operationId: create_edge_type + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEdgeType' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successful created the edge type + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + /api/v1/graph/{graph_id}/schema/edge/{type_name}: + delete: + description: Delete edge type by name + operationId: delete_edge_type_by_name + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: type_name + required: true + schema: + type: string + style: simple + - explode: true + in: query + name: source_vertex_type + required: true + schema: + type: string + style: form + - explode: true + in: query + name: destination_vertex_type + required: true + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successful deleted the edge type + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + /api/v1/graph/{graph_id}/schema/vertex: + post: + description: Create a vertex type + operationId: create_vertex_type + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVertexType' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successful created a vertex type + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + /api/v1/graph/{graph_id}/schema/vertex/{type_name}: + delete: + description: Delete vertex type by name + operationId: delete_vertex_type_by_name + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: type_name + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successful deleted the vertex type + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Graph + x-openapi-router-controller: gscoordinator.flex.controllers.graph_controller + /api/v1/graph/{graph_id}/service: + get: + description: Get service status by graph ID + operationId: get_service_status_by_id + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + graph_id: GRAPHID + status: Running + sdk_endpoints: + cypher: neo4j://mock.api.cypher:7676 + gremin: ws://mock.api.gremlin/gremlin + hqps: http://mock.api.hqps:10000 + start_time: 2024-01-01 00:00:00 + schema: + $ref: '#/components/schemas/ServiceStatus' + description: Successfully returned the service status + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Service + x-openapi-router-controller: gscoordinator.flex.controllers.service_controller + /api/v1/graph/{graph_id}/storedproc: + get: + description: List all stored procedures on a certain graph + operationId: list_stored_procedures + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + - id: STORED-PROCEDUREID-1 + name: stored_procedure_name_1 + type: cypher + query: MATCH(a) return COUNT(a); + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: true + - id: STORED-PROCEDUREID-2 + name: stored_procedure_name_2 + type: cypher + query: MATCH(a) return COUNT(a); + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: false + schema: + items: + $ref: '#/components/schemas/GetStoredProcResponse' + type: array + description: Successful operation + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Stored Procedure + x-openapi-router-controller: gscoordinator.flex.controllers.stored_procedure_controller + post: + description: Create a new stored procedure on a certain graph + operationId: create_stored_procedure + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateStoredProcRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateStoredProcResponse' + description: Successfully created a stored procedure + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Stored Procedure + x-openapi-router-controller: gscoordinator.flex.controllers.stored_procedure_controller + /api/v1/graph/{graph_id}/storedproc/{stored_procedure_id}: + delete: + description: Delete a stored procedure by ID + operationId: delete_stored_procedure_by_id + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: stored_procedure_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully deleted the stored procedure + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Stored Procedure + x-openapi-router-controller: gscoordinator.flex.controllers.stored_procedure_controller + get: + description: Get a stored procedure by ID + operationId: get_stored_procedure_by_id + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: stored_procedure_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + id: STORED-PROCEDURE-ID + name: stored_procedure_name + type: cypher + query: MATCH(a) return COUNT(a); + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: true + schema: + $ref: '#/components/schemas/GetStoredProcResponse' + description: Successfully returned the stored procedure + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Stored Procedure + x-openapi-router-controller: gscoordinator.flex.controllers.stored_procedure_controller + put: + description: Update a stored procedure by ID + operationId: update_stored_procedure_by_id + parameters: + - explode: false + in: path + name: graph_id + required: true + schema: + type: string + style: simple + - explode: false + in: path + name: stored_procedure_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateStoredProcRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully updated the stored procedure + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Stored Procedure + x-openapi-router-controller: gscoordinator.flex.controllers.stored_procedure_controller + /api/v1/job: + get: + description: List all jobs + operationId: list_jobs + responses: + "200": + content: + application/json: + example: + - id: JOB-QWERTYUIOPASDFGH-1 + type: DATA IMPORT + status: RUNNING + start_time: 2024-02-24 00:00:00 + log: logging... + detail: + graph_id: GRAPHID + - id: JOB-QWERTYUIOPASDFGH-2 + type: DATA IMPORT + status: CANCELLED + start_time: 2024-02-24 00:00:00 + log: logging... + detail: + graph_id: GRAPHID + - id: JOB-QWERTYUIOPASDFGH-3 + type: DATA IMPORT + status: SUCCESS + start_time: 2024-02-24 00:00:00 + end_time: 2024-02-24 12:00:00 + detail: + graph_id: GRAPHID + - id: JOB-QWERTYUIOPASDFGH-4 + type: DATA IMPORT + status: FAILED + start_time: 2024-02-24 00:00:00 + end_time: 2024-02-24 12:00:00 + log: logging... + detail: + graph_id: GRAPHID + - id: JOB-QWERTYUIOPASDFGH-5 + type: DATA IMPORT + status: WAITING + detail: + graph_id: GRAPHID + schema: + items: + $ref: '#/components/schemas/JobStatus' + type: array + description: Successful returned all the jobs + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Job + x-openapi-router-controller: gscoordinator.flex.controllers.job_controller + /api/v1/job/{job_id}: + delete: + description: Delete job by ID + operationId: delete_job_by_id + parameters: + - explode: false + in: path + name: job_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfuly cancelled the job + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Job + x-openapi-router-controller: gscoordinator.flex.controllers.job_controller + get: + description: Get job status by ID + operationId: get_job_by_id + parameters: + - explode: false + in: path + name: job_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/JobStatus' + description: Successfully returned the job status + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Job + x-openapi-router-controller: gscoordinator.flex.controllers.job_controller + /api/v1/service: + get: + description: List all service status + operationId: list_service_status + responses: + "200": + content: + application/json: + example: + - graph_id: GRAPHID + status: Running + sdk_endpoints: + cypher: neo4j://mock.api.cypher:7676 + gremin: ws://mock.api.gremlin/gremlin + hqps: http://mock.api.hqps:10000 + start_time: 2024-01-01 00:00:00 + schema: + items: + $ref: '#/components/schemas/ServiceStatus' + type: array + description: Successfully returned all service status + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Service + x-openapi-router-controller: gscoordinator.flex.controllers.service_controller + /api/v1/service/restart: + post: + description: Restart current service + operationId: restart_service + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully restarted the service + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Service + x-openapi-router-controller: gscoordinator.flex.controllers.service_controller + /api/v1/service/start: + post: + description: Start service + operationId: start_service + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StartServiceRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully started the service + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Service + x-openapi-router-controller: gscoordinator.flex.controllers.service_controller + /api/v1/service/stop: + post: + description: Stop current service + operationId: stop_service + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + description: Successfully stopped the service + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + tags: + - Service + x-openapi-router-controller: gscoordinator.flex.controllers.service_controller +components: + responses: + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Bad request + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Not found + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Server error + schemas: + APIResponse: + type: string + Error: + example: + code: 0 + message: message + properties: + code: + description: Error code + format: int32 + title: code + type: integer + message: + description: Error message + title: message + type: string + required: + - code + - message + title: Error + AnyValue: + title: default_value + RunningDeploymentInfo: + example: + creation_time: creation_time + instance_name: instance_name + engine: Hiactor + cluster_type: HOSTS + storage: MutableCSR + version: version + frontend: Cypher/Gremlin + properties: + instance_name: + title: instance_name + type: string + cluster_type: + enum: + - HOSTS + - KUBERNETES + title: cluster_type + type: string + version: + title: version + type: string + creation_time: + title: creation_time + type: string + frontend: + enum: + - Cypher/Gremlin + - AnalyticalApps + title: frontend + type: string + engine: + enum: + - Hiactor + - Gaia + title: engine + type: string + storage: + enum: + - MutableCSR + title: storage + type: string + required: + - cluster_type + - creation_time + - engine + - frontend + - instance_name + - storage + - version + title: RunningDeploymentInfo + NodeStatus: + example: + name: name + memory_usage: 6.027456183070403 + disk_usage: 1.4658129805029452 + cpu_usage: 0.8008281904610115 + properties: + name: + title: name + type: string + cpu_usage: + format: double + title: cpu_usage + type: number + memory_usage: + format: double + title: memory_usage + type: number + disk_usage: + format: double + title: disk_usage + type: number + required: + - cpu_usage + - disk_usage + - memory_usage + - name + title: NodeStatus + RunningDeploymentStatus: + example: + nodes: + - name: name + memory_usage: 6.027456183070403 + disk_usage: 1.4658129805029452 + cpu_usage: 0.8008281904610115 + - name: name + memory_usage: 6.027456183070403 + disk_usage: 1.4658129805029452 + cpu_usage: 0.8008281904610115 + cluster_type: HOSTS + properties: + cluster_type: + enum: + - HOSTS + - KUBERNETES + title: cluster_type + type: string + nodes: + items: + $ref: '#/components/schemas/RunningDeploymentStatus_nodes_inner' + title: nodes + type: array + required: + - cluster_type + - nodes + title: RunningDeploymentStatus + StartServiceRequest: + example: + graph_id: graph_id + properties: + graph_id: + title: graph_id + type: string + title: StartServiceRequest + x-body-name: start_service_request + ServiceStatus: + example: + start_time: start_time + graph_id: graph_id + sdk_endpoints: + gremlin: gremlin + cypher: cypher + hqps: hqps + grpc: grpc + status: Running + properties: + graph_id: + title: graph_id + type: string + status: + enum: + - Running + - Stopped + title: status + type: string + sdk_endpoints: + $ref: '#/components/schemas/ServiceStatus_sdk_endpoints' + start_time: + title: start_time + type: string + required: + - creation_time + - graph_id + - status + title: ServiceStatus + UploadFileResponse: + example: + file_path: file_path + properties: + file_path: + title: file_path + type: string + required: + - file_path + title: UploadFileResponse + LongText: + properties: + long_text: + nullable: true + title: long_text + type: string + required: + - long_text + title: LongText + PrimitiveType: + example: + primitive_type: DT_SIGNED_INT32 + properties: + primitive_type: + enum: + - DT_SIGNED_INT32 + - DT_UNSIGNED_INT32 + - DT_SIGNED_INT64 + - DT_UNSIGNED_INT64 + - DT_BOOL + - DT_FLOAT + - DT_DOUBLE + title: primitive_type + type: string + required: + - primitive_type + title: PrimitiveType + StringType: + properties: + string: + $ref: '#/components/schemas/StringType_string' + required: + - string + title: StringType + GSDataType: + oneOf: + - $ref: '#/components/schemas/PrimitiveType' + - $ref: '#/components/schemas/StringType' + title: GSDataType + Parameter: + properties: + name: + title: name + type: string + type: + $ref: '#/components/schemas/GSDataType' + required: + - name + - type + title: Parameter + BasePropertyMeta: + properties: + property_name: + title: property_name + type: string + property_type: + $ref: '#/components/schemas/GSDataType' + nullable: + title: nullable + type: boolean + default_value: + title: default_value + description: + title: description + type: string + required: + - property_name + - property_type + title: BasePropertyMeta + CreatePropertyMeta: + allOf: + - $ref: '#/components/schemas/BasePropertyMeta' + example: + nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + title: CreatePropertyMeta + x-body-name: create_property_meta + GetPropertyMeta: + allOf: + - $ref: '#/components/schemas/BasePropertyMeta' + - properties: + property_id: + format: int32 + type: integer + required: + - property_id + type: object + example: + nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + title: GetPropertyMeta + x-body-name: get_property_meta + BaseVertexType: + properties: + type_name: + title: type_name + type: string + primary_keys: + items: + type: string + title: primary_keys + type: array + x_csr_params: + $ref: '#/components/schemas/BaseVertexType_x_csr_params' + required: + - primary_keys + - type_name + title: BaseVertexType + CreateVertexType: + allOf: + - $ref: '#/components/schemas/BaseVertexType' + - properties: + properties: + items: + $ref: '#/components/schemas/CreatePropertyMeta' + type: array + description: + type: string + required: + - properties + type: object + example: + type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + title: CreateVertexType + x-body-name: create_vertex_type + BaseEdgeType: + properties: + type_name: + title: type_name + type: string + vertex_type_pair_relations: + items: + $ref: '#/components/schemas/BaseEdgeType_vertex_type_pair_relations_inner' + title: vertex_type_pair_relations + type: array + directed: + title: directed + type: boolean + primary_keys: + items: + type: string + title: primary_keys + type: array + required: + - type_name + - vertex_type_pair_relations + title: BaseEdgeType + CreateEdgeType: + allOf: + - $ref: '#/components/schemas/BaseEdgeType' + - properties: + properties: + items: + $ref: '#/components/schemas/CreatePropertyMeta' + type: array + description: + type: string + required: + - properties + type: object + example: + type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + title: CreateEdgeType + x-body-name: create_edge_type + CreateStoredProcRequest: + example: + query: query + name: name + description: description + type: cpp + properties: + name: + title: name + type: string + description: + title: description + type: string + type: + enum: + - cpp + - cypher + title: type + type: string + query: + title: query + type: string + required: + - name + - query + - type + title: CreateStoredProcRequest + x-body-name: create_stored_proc_request + CreateStoredProcResponse: + example: + stored_procedure_id: stored_procedure_id + properties: + stored_procedure_id: + title: stored_procedure_id + type: string + required: + - stored_procedure_id + title: CreateStoredProcResponse + CreateGraphSchemaRequest: + example: + vertex_types: + - type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + edge_types: + - type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + properties: + vertex_types: + items: + $ref: '#/components/schemas/CreateVertexType' + title: vertex_types + type: array + edge_types: + items: + $ref: '#/components/schemas/CreateEdgeType' + title: edge_types + type: array + required: + - edge_types + - vertex_types + title: CreateGraphSchemaRequest + x-body-name: create_graph_schema_request + CreateGraphRequest: + example: + schema: + vertex_types: + - type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + edge_types: + - type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_name: property_name + stored_procedures: + - query: query + name: name + description: description + type: cpp + - query: query + name: name + description: description + type: cpp + name: name + description: description + properties: + name: + title: name + type: string + description: + title: description + type: string + stored_procedures: + items: + $ref: '#/components/schemas/CreateStoredProcRequest' + title: stored_procedures + type: array + schema: + $ref: '#/components/schemas/CreateGraphSchemaRequest' + title: CreateGraphRequest + x-body-name: create_graph_request + CreateGraphResponse: + example: + graph_id: graph_id + properties: + graph_id: + title: graph_id + type: string + required: + - graph_id + title: CreateGraphResponse + StoredProcedureMeta: + allOf: + - $ref: '#/components/schemas/CreateStoredProcRequest' + - properties: + id: + type: string + library: + type: string + params: + items: + $ref: '#/components/schemas/Parameter' + type: array + returns: + items: + $ref: '#/components/schemas/Parameter' + type: array + required: + - id + - library + - params + - returns + type: object + title: StoredProcedureMeta + GetStoredProcResponse: + allOf: + - $ref: '#/components/schemas/StoredProcedureMeta' + - properties: + bound_graph: + type: string + runnable: + type: boolean + required: + - bound_graph + - runnable + type: object + example: + runnable: true + bound_graph: bound_graph + title: GetStoredProcResponse + UpdateStoredProcRequest: + example: + description: description + properties: + description: + title: description + type: string + required: + - description + title: UpdateStoredProcRequest + x-body-name: update_stored_proc_request + GetVertexType: + allOf: + - $ref: '#/components/schemas/BaseVertexType' + - properties: + type_id: + format: int32 + type: integer + properties: + items: + $ref: '#/components/schemas/GetPropertyMeta' + type: array + description: + type: string + required: + - properties + - type_id + type: object + example: + type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + type_id: 6 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + title: GetVertexType + GetEdgeType: + allOf: + - $ref: '#/components/schemas/BaseEdgeType' + - properties: + type_id: + format: int32 + type: integer + properties: + items: + $ref: '#/components/schemas/GetPropertyMeta' + type: array + description: + type: string + required: + - type_id + type: object + example: + type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + type_id: 5 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + title: GetEdgeType + GetGraphSchemaResponse: + example: + vertex_types: + - type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + type_id: 6 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + type_id: 6 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + edge_types: + - type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + type_id: 5 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + type_id: 5 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + properties: + vertex_types: + items: + $ref: '#/components/schemas/GetVertexType' + title: vertex_types + type: array + edge_types: + items: + $ref: '#/components/schemas/GetEdgeType' + title: edge_types + type: array + required: + - edge_types + - vertex_types + title: GetGraphSchemaResponse + GetGraphResponse: + example: + creation_time: creation_time + schema: + vertex_types: + - type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + type_id: 6 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - type_name: type_name + primary_keys: + - primary_keys + - primary_keys + x_csr_params: + max_vertex_num: 0 + type_id: 6 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + edge_types: + - type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + type_id: 5 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - type_name: type_name + directed: true + primary_keys: + - primary_keys + - primary_keys + vertex_type_pair_relations: + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + - source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + type_id: 5 + description: description + properties: + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + - nullable: true + property_type: + primitive_type: DT_SIGNED_INT32 + description: description + default_value: "" + property_id: 1 + property_name: property_name + stored_procedures: + - runnable: true + bound_graph: bound_graph + - runnable: true + bound_graph: bound_graph + name: name + description: description + schema_update_time: schema_update_time + id: id + store_type: mutable_csr + data_update_time: data_update_time + properties: + id: + title: id + type: string + name: + title: name + type: string + description: + title: description + type: string + store_type: + enum: + - mutable_csr + title: store_type + type: string + creation_time: + title: creation_time + type: string + data_update_time: + title: data_update_time + type: string + schema_update_time: + title: schema_update_time + type: string + stored_procedures: + items: + $ref: '#/components/schemas/GetStoredProcResponse' + title: stored_procedures + type: array + schema: + $ref: '#/components/schemas/GetGraphSchemaResponse' + required: + - creation_time + - data_update_time + - id + - name + - schema + - schema_update_time + title: GetGraphResponse + ColumnMapping: + example: + column: + name: name + index: 0 + property: property + properties: + column: + $ref: '#/components/schemas/ColumnMapping_column' + property: + description: must align with the schema + title: property + type: string + required: + - column + - property + title: ColumnMapping + VertexMapping: + example: + type_name: type_name + inputs: + - file:///path/to/file.csv + - file:///path/to/file.csv + column_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + properties: + type_name: + title: type_name + type: string + inputs: + items: + example: file:///path/to/file.csv + type: string + title: inputs + type: array + column_mappings: + items: + $ref: '#/components/schemas/ColumnMapping' + title: column_mappings + type: array + required: + - column_mappings + - inputs + - type_name + title: VertexMapping + x-body-name: vertex_mapping + EdgeMapping: + example: + inputs: + - inputs + - inputs + source_vertex_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + destination_vertex_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + column_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + type_triplet: + edge: edge + source_vertex: source_vertex + destination_vertex: destination_vertex + properties: + type_triplet: + $ref: '#/components/schemas/EdgeMapping_type_triplet' + inputs: + items: + type: string + title: inputs + type: array + source_vertex_mappings: + items: + $ref: '#/components/schemas/ColumnMapping' + title: source_vertex_mappings + type: array + destination_vertex_mappings: + items: + $ref: '#/components/schemas/ColumnMapping' + title: destination_vertex_mappings + type: array + column_mappings: + items: + $ref: '#/components/schemas/ColumnMapping' + title: column_mappings + type: array + required: + - destination_vertex_mappings + - inputs + - source_vertex_mappings + - type_triplet + title: EdgeMapping + x-body-name: edge_mapping + SchemaMapping: + example: + edge_mappings: + - inputs: + - inputs + - inputs + source_vertex_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + destination_vertex_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + column_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + type_triplet: + edge: edge + source_vertex: source_vertex + destination_vertex: destination_vertex + - inputs: + - inputs + - inputs + source_vertex_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + destination_vertex_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + column_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + type_triplet: + edge: edge + source_vertex: source_vertex + destination_vertex: destination_vertex + vertex_mappings: + - type_name: type_name + inputs: + - file:///path/to/file.csv + - file:///path/to/file.csv + column_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + - type_name: type_name + inputs: + - file:///path/to/file.csv + - file:///path/to/file.csv + column_mappings: + - column: + name: name + index: 0 + property: property + - column: + name: name + index: 0 + property: property + properties: + vertex_mappings: + items: + $ref: '#/components/schemas/VertexMapping' + title: vertex_mappings + type: array + edge_mappings: + items: + $ref: '#/components/schemas/EdgeMapping' + title: edge_mappings + type: array + required: + - edge_mappings + - vertex_mappings + title: SchemaMapping + x-body-name: schema_mapping + DataloadingJobConfig: + example: + schedule: schedule + loading_config: + format: + metadata: + key: "" + type: type + import_option: overwrite + vertices: + - type_name: type_name + - type_name: type_name + repeat: once + edges: + - type_name: type_name + source_vertex: source_vertex + destination_vertex: destination_vertex + - type_name: type_name + source_vertex: source_vertex + destination_vertex: destination_vertex + properties: + loading_config: + $ref: '#/components/schemas/DataloadingJobConfig_loading_config' + vertices: + items: + $ref: '#/components/schemas/DataloadingJobConfig_vertices_inner' + title: vertices + type: array + edges: + items: + $ref: '#/components/schemas/DataloadingJobConfig_edges_inner' + title: edges + type: array + schedule: + description: format with '2023-02-21 11:56:30' + nullable: true + title: schedule + type: string + repeat: + enum: + - once + - day + - week + nullable: true + title: repeat + type: string + required: + - edges + - loading_config + - vertices + title: DataloadingJobConfig + x-body-name: dataloading_job_config + JobStatus: + example: + start_time: start_time + log: log + end_time: end_time + id: id + detail: + key: "" + type: type + status: RUNNING + properties: + id: + title: id + type: string + type: + title: type + type: string + status: + enum: + - RUNNING + - SUCCESS + - FAILED + - CANCELLED + - WAITING + title: status + type: string + start_time: + title: start_time + type: string + end_time: + title: end_time + type: string + log: + description: logview URL or log string + title: log + type: string + detail: + additionalProperties: true + title: detail + type: object + required: + - id + - status + - type + title: JobStatus + CreateDataloadingJobResponse: + example: + job_id: job_id + properties: + job_id: + title: job_id + type: string + required: + - job_id + title: CreateDataloadingJobResponse + CreateAlertRuleRequest: + example: + severity: warning + conditions_description: conditions_description + enable: true + name: name + metric_type: node + frequency: 0 + properties: + name: + title: name + type: string + severity: + enum: + - warning + - emergency + title: severity + type: string + metric_type: + enum: + - node + - service + title: metric_type + type: string + conditions_description: + title: conditions_description + type: string + frequency: + description: (mins) + title: frequency + type: integer + enable: + title: enable + type: boolean + required: + - conditions_description + - enable + - frequency + - metric_type + - name + - severity + title: CreateAlertRuleRequest + x-body-name: create_alert_rule_request + GetAlertRuleResponse: + allOf: + - $ref: '#/components/schemas/CreateAlertRuleRequest' + - properties: + id: + type: string + required: + - id + type: object + example: + severity: warning + conditions_description: conditions_description + enable: true + name: name + metric_type: node + id: id + frequency: 0 + title: GetAlertRuleResponse + GetAlertMessageResponse: + example: + severity: warning + trigger_time: trigger_time + metric_type: node + id: id + message: message + alert_name: alert_name + target: + - target + - target + status: unsolved + properties: + id: + description: Generated in server side + title: id + type: string + alert_name: + title: alert_name + type: string + severity: + enum: + - warning + - emergency + title: severity + type: string + metric_type: + enum: + - node + - service + title: metric_type + type: string + target: + items: + type: string + title: target + type: array + trigger_time: + title: trigger_time + type: string + status: + enum: + - unsolved + - solved + - dealing + title: status + type: string + message: + title: message + type: string + required: + - alert_name + - id + - message + - metric_type + - severity + - status + - target + - trigger_time + title: GetAlertMessageResponse + UpdateAlertMessageStatusRequest: + example: + message_ids: + - message_ids + - message_ids + status: unsolved + properties: + message_ids: + items: + type: string + title: message_ids + type: array + status: + enum: + - unsolved + - solved + - dealing + title: status + type: string + required: + - message_ids + - status + title: UpdateAlertMessageStatusRequest + x-body-name: update_alert_message_status_request + CreateAlertReceiverRequest: + example: + webhook_url: webhook_url + is_at_all: true + enable: true + at_user_ids: + - at_user_ids + - at_user_ids + type: webhook + properties: + type: + enum: + - webhook + title: type + type: string + webhook_url: + title: webhook_url + type: string + at_user_ids: + items: + type: string + title: at_user_ids + type: array + is_at_all: + title: is_at_all + type: boolean + enable: + title: enable + type: boolean + required: + - at_user_ids + - enable + - is_at_all + - type + - webhook_url + title: CreateAlertReceiverRequest + x-body-name: create_alert_receiver_request + GetAlertReceiverResponse: + allOf: + - $ref: '#/components/schemas/CreateAlertReceiverRequest' + - properties: + id: + type: string + message: + description: Error message generated in server side + type: string + required: + - id + - message + type: object + example: + webhook_url: webhook_url + is_at_all: true + enable: true + at_user_ids: + - at_user_ids + - at_user_ids + id: id + type: webhook + message: message + title: GetAlertReceiverResponse + uploadFile_request: + properties: + filestorage: + format: binary + type: string + type: object + RunningDeploymentStatus_nodes_inner: + oneOf: + - $ref: '#/components/schemas/NodeStatus' + title: RunningDeploymentStatus_nodes_inner + ServiceStatus_sdk_endpoints: + example: + gremlin: gremlin + cypher: cypher + hqps: hqps + grpc: grpc + properties: + cypher: + title: cypher + type: string + gremlin: + title: gremlin + type: string + hqps: + title: hqps + type: string + grpc: + title: grpc + type: string + title: ServiceStatus_sdk_endpoints + StringType_string: + oneOf: + - $ref: '#/components/schemas/LongText' + title: StringType_string + type: object + BaseVertexType_x_csr_params: + description: Used for storage optimization + example: + max_vertex_num: 0 + properties: + max_vertex_num: + title: max_vertex_num + type: integer + title: BaseVertexType_x_csr_params + type: object + BaseEdgeType_vertex_type_pair_relations_inner_x_csr_params: + description: Used for storage optimization + example: + edge_storage_strategy: ONLY_IN + properties: + edge_storage_strategy: + enum: + - ONLY_IN + - ONLY_OUT + - BOTH_OUT_IN + title: edge_storage_strategy + type: string + title: BaseEdgeType_vertex_type_pair_relations_inner_x_csr_params + BaseEdgeType_vertex_type_pair_relations_inner: + example: + source_vertex: source_vertex + destination_vertex: destination_vertex + x_csr_params: + edge_storage_strategy: ONLY_IN + relation: MANY_TO_MANY + properties: + source_vertex: + title: source_vertex + type: string + destination_vertex: + title: destination_vertex + type: string + relation: + enum: + - MANY_TO_MANY + - ONE_TO_MANY + - MANY_TO_ONE + - ONE_TO_ONE + title: relation + type: string + x_csr_params: + $ref: '#/components/schemas/BaseEdgeType_vertex_type_pair_relations_inner_x_csr_params' + required: + - destination_vertex + - relation + - source_vertex + title: BaseEdgeType_vertex_type_pair_relations_inner + ColumnMapping_column: + example: + name: name + index: 0 + properties: + index: + format: int32 + title: index + type: integer + name: + title: name + type: string + title: ColumnMapping_column + EdgeMapping_type_triplet: + description: "source label -> [edge label] -> destination label" + example: + edge: edge + source_vertex: source_vertex + destination_vertex: destination_vertex + properties: + edge: + title: edge + type: string + source_vertex: + title: source_vertex + type: string + destination_vertex: + title: destination_vertex + type: string + required: + - destination_vertex + - edge + - source_vertex + title: EdgeMapping_type_triplet + DataloadingJobConfig_loading_config_format: + example: + metadata: + key: "" + type: type + properties: + type: + title: type + type: string + metadata: + additionalProperties: true + title: metadata + type: object + title: DataloadingJobConfig_loading_config_format + DataloadingJobConfig_loading_config: + example: + format: + metadata: + key: "" + type: type + import_option: overwrite + properties: + import_option: + enum: + - init + - overwrite + example: overwrite + title: import_option + type: string + format: + $ref: '#/components/schemas/DataloadingJobConfig_loading_config_format' + title: DataloadingJobConfig_loading_config + DataloadingJobConfig_vertices_inner: + example: + type_name: type_name + properties: + type_name: + title: type_name + type: string + title: DataloadingJobConfig_vertices_inner + type: object + DataloadingJobConfig_edges_inner: + example: + type_name: type_name + source_vertex: source_vertex + destination_vertex: destination_vertex + properties: + type_name: + title: type_name + type: string + source_vertex: + title: source_vertex + type: string + destination_vertex: + title: destination_vertex + type: string + title: DataloadingJobConfig_edges_inner + type: object diff --git a/flex/coordinator/gs_flex_coordinator/typing_utils.py b/coordinator/gscoordinator/flex/typing_utils.py similarity index 100% rename from flex/coordinator/gs_flex_coordinator/typing_utils.py rename to coordinator/gscoordinator/flex/typing_utils.py diff --git a/flex/coordinator/gs_flex_coordinator/util.py b/coordinator/gscoordinator/flex/util.py similarity index 98% rename from flex/coordinator/gs_flex_coordinator/util.py rename to coordinator/gscoordinator/flex/util.py index fa3c9dd7693a..e75b21c86e28 100644 --- a/flex/coordinator/gs_flex_coordinator/util.py +++ b/coordinator/gscoordinator/flex/util.py @@ -1,7 +1,7 @@ import datetime import typing -from gs_flex_coordinator import typing_utils +from gscoordinator.flex import typing_utils def _deserialize(data, klass): diff --git a/coordinator/pyproject.toml b/coordinator/pyproject.toml index 69b163f11ae4..56911a8e3d3f 100644 --- a/coordinator/pyproject.toml +++ b/coordinator/pyproject.toml @@ -4,4 +4,17 @@ build-backend = "setuptools.build_meta" [tool.black] line-length = 88 -exclude = '.*\/(forward|node_modules|\.eggs|build|_pb2\.py)\/.*' +exclude = ''' +( + .*forward.* + | .*node_modules.* + | .*\.eggs.* + | .*build/.* + | ^/dist.* + | .*_pb2\.py + | .*_pb2_grpc\.py + | .*gscoordinator/flex/models/* + | .*gscoordinator/flex/controllers/* + | .*gscoordinator/flex/.*\.py +) +''' diff --git a/coordinator/requirements.txt b/coordinator/requirements.txt index 72e88e88fbe1..99b5f631f6b9 100644 --- a/coordinator/requirements.txt +++ b/coordinator/requirements.txt @@ -9,3 +9,15 @@ vineyard-io>=0.16.3;sys_platform!="win32" prometheus-client>=0.14.1 packaging tqdm +connexion == 2.14.2 +werkzeug == 2.3.8; python_version=="3.5" or python_version=="3.4" +swagger-ui-bundle >= 0.0.2 +python_dateutil >= 2.6.0 +Flask == 2.2.5 +urllib3 >= 1.25.3, < 2.1.0 +pydantic >= 2 +typing-extensions >= 4.7.1 +click >= 8.1.7 +psutil +schedule +interactive-sdk == 0.0.3 diff --git a/coordinator/setup.cfg b/coordinator/setup.cfg index 9d3876c1c224..8f2e613b7c5f 100644 --- a/coordinator/setup.cfg +++ b/coordinator/setup.cfg @@ -16,7 +16,7 @@ upload_dir = docs/_build/html ensure_newline_before_comments = True line_length = 88 force_single_line = True -skip = build/,dist/ +skip = build/,dist/,gscoordinator/flex/models/,gscoordinator/flex/controllers/,gscoordinator/flex/util.py skip_glob = *_pb2.py,*_pb2_grpc.py,*_pb2.pyi,*_pb2_grpc.pyi [flake8] @@ -25,7 +25,7 @@ max-complexity = 18 # for flake8-quotes inline-quotes = double # for flake8-comprehensions -extend-ignore = E203,E402,F401,F401,F403,C4,N802,N806 +extend-ignore = E203,E402,F401,F401,F403,C4,N802,N806,I250,W605 extend-exclude = .eggs/ *_pb2.py @@ -36,6 +36,9 @@ extend-exclude = build/ dist/ tests/** + gscoordinator/flex/models/** + gscoordinator/flex/controllers/** + gscoordinator/flex/*.py [pylint] max-line-length = 88 diff --git a/coordinator/setup.py b/coordinator/setup.py index dced1692db18..b93bc14a9162 100644 --- a/coordinator/setup.py +++ b/coordinator/setup.py @@ -369,6 +369,76 @@ def parse_version(root, **kwargs): return parse(root, **kwargs) +class GenerateFlexServer(Command): + description = "generate flex server from OpenApi specification file" + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + # tempdir + tempdir = os.path.join("/", tempfile.gettempprefix(), "gscoordinator") + if os.path.exists(tempdir): + shutil.rmtree(tempdir) + targetdir = os.path.join(repo_root, "gscoordinator", "flex") + # generate + specification = os.path.join( + repo_root, "..", "flex", "openapi", "openapi_coordinator.yaml" + ) + cmd = [ + "openapi-generator-cli", + "generate", + "-g", + "python-flask", + "-i", + str(specification), + "-o", + str(tempdir), + "--package-name", + "gscoordinator.flex", + ] + env = os.environ.copy() + env["OPENAPI_GENERATOR_VERSION"] = "7.3.0" + subprocess.check_call( + cmd, + env=env, + ) + + # remove + if os.path.exists(os.path.join(targetdir, "models")): + shutil.rmtree(os.path.join(targetdir, "models")) + # cp + subprocess.run( + [ + "cp", + "-r", + os.path.join(tempdir, "gscoordinator", "flex", "models"), + os.path.join(targetdir, "models"), + ] + ) + for filename in ["encoder.py", "typing_utils.py", "util.py"]: + subprocess.run( + [ + "cp", + os.path.join(tempdir, "gscoordinator", "flex", filename), + targetdir, + ] + ) + subprocess.run( + [ + "cp", + os.path.join( + tempdir, "gscoordinator", "flex", "openapi", "openapi.yaml" + ), + os.path.join(targetdir, "openapi"), + ] + ) + + setup( name=os.environ.get("package_name", "gs-coordinator"), description="", @@ -412,6 +482,7 @@ def parse_version(root, **kwargs): "sdist": CustomSDist, "develop": CustomDevelop, "lint": FormatAndLint, + "generate_flex_server": GenerateFlexServer, }, install_requires=parsed_reqs(), extras_require=parsed_dev_reqs(), diff --git a/docs/_static/coordinator_restful_api.html b/docs/_static/coordinator_restful_api.html new file mode 100644 index 000000000000..c851ee8b3bb4 --- /dev/null +++ b/docs/_static/coordinator_restful_api.html @@ -0,0 +1,3272 @@ + + + + GraphScope FLEX HTTP SERVICE API + + + +

GraphScope FLEX HTTP SERVICE API

+

This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about +specification at doc.

+

Some useful links:

+ +
+
More information: https://helloreverb.com
+ +
Version: 1.0.0
+
BasePath:/GRAPHSCOPE/flex-api/1.0.0
+
Apache 2.0
+
http://www.apache.org/licenses/LICENSE-2.0.html
+

Access

+ +

Methods

+ [ Jump to Models ] + +

Table of Contents

+
+

Alert

+ +

DataSource

+ +

Deployment

+ +

Graph

+ +

Job

+ +

Service

+ +

StoredProcedure

+ +

Utils

+ + +

Alert

+
+
+ Up +
post /api/v1/alert/receiver
+
(createAlertReceiver)
+
Create a new alert receiver
+ + +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+ + +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully created the alert receiver + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
delete /api/v1/alert/rule/{rule_id}
+
(delete alert rule by ID)
+
+ +

Path parameters

+
+
rule_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully deleted the alert rule + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
delete /api/v1/alert/message-collection
+
(deleteAlertMessageInBatch)
+
Delete alert message in batch
+ + + + + +

Query parameters

+
+
message_ids (required)
+ +
Query Parameter — A list of message id separated by comma, e.g. id1,id2,id3
+ + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully deleted the alert message + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
delete /api/v1/alert/receiver/{receiver_id}
+
(deleteAlertReceiverById)
+
Delete the alert receiver by ID
+ +

Path parameters

+
+
receiver_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully deleted the alert receiver + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/alert/message
+
(listAlertMessages)
+
List all alert messages
+ + + + + +

Query parameters

+
+
alert_type (optional)
+ +
Query Parameter
status (optional)
+ +
Query Parameter
severity (optional)
+ +
Query Parameter
start_time (optional)
+ +
Query Parameter — format with &quot;2023-02-21-11-56-30&quot;
end_time (optional)
+ +
Query Parameter — format with &quot;2023-02-21-11-56-30&quot;
limit (optional)
+ +
Query Parameter — format: int32
+ + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
[ {
+  "severity" : "warning",
+  "trigger_time" : "trigger_time",
+  "metric_type" : "node",
+  "id" : "id",
+  "message" : "message",
+  "alert_name" : "alert_name",
+  "target" : [ "target", "target" ],
+  "status" : "unsolved"
+}, {
+  "severity" : "warning",
+  "trigger_time" : "trigger_time",
+  "metric_type" : "node",
+  "id" : "id",
+  "message" : "message",
+  "alert_name" : "alert_name",
+  "target" : [ "target", "target" ],
+  "status" : "unsolved"
+} ]
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the alert messages + +

Example data

+
Content-Type: application/json
+
[{"id":"ALERT-MESSAGE-QWERTYUIOP-1","alert_name":"HighDiskUtilization","severity":"warning","metric_type":"node","target":["hostname-1"],"trigger_time":"2023-02-21T11:56:30.000Z","status":"unsolved","message":"Disk usage node1 85.12%, exceeds threshold"},{"id":"ALERT-MESSAGE-QWERTYUIOP-2","alert_name":"HighDiskUtilization","severity":"emergency","metric_type":"node","target":["hostname-1"],"trigger_time":"2023-02-21T11:56:30.000Z","status":"solved","message":"Disk usage node1 85.12%, exceeds threshold"},{"id":"ALERT-MESSAGE-QWERTYUIOP-3","alert_name":"HighDiskUtilization","severity":"warning","metric_type":"node","target":["hostname-1"],"trigger_time":"2023-02-21T11:56:30.000Z","status":"dealing","message":"Disk usage node1 85.12%, exceeds threshold"}]
+

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/alert/receiver
+
(listAlertReceivers)
+
List all alert receivers
+ + + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
[ "", "" ]
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the alert receivers + +

Example data

+
Content-Type: application/json
+
[{"id":"RECEIVER-QWERTYUIOP-1","type":"webhook","webhook_url":"http://webhook.com","is_at_all":false,"at_user_ids":[111111,222222],"enable":false},{"id":"RECEIVER-QWERTYUIOP-2","type":"webhook","webhook_url":"http://webhook.com","is_at_all":false,"at_user_ids":[111111,222222],"enable":true,"message":"error message"}]
+

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/alert/rule
+
(listAlertRules)
+
List all alert rules
+ + + + + + + +

Return type

+
+ array[GetAlertRuleResponse] + +
+ + + +

Example data

+
Content-Type: application/json
+
[ "", "" ]
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the alert rules + +

Example data

+
Content-Type: application/json
+
[{"id":"ALERTRULE-1","name":"HighDiskUtilization","severity":"warning","metric_type":"node","conditions_description":"disk usage >= 85","enable":true},{"id":"ALERTRULE-2","name":"GremlinServiceAvailable","severity":"emergency","metric_type":"node","conditions_description":"g.V().limit(1) failed","enable":false}]
+

500

+ Server error + Error +
+
+
+
+ Up +
put /api/v1/alert/rule/{rule_id}
+
(update alert rule by ID)
+
+ +

Path parameters

+
+
rule_id (required)
+ +
Path Parameter
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body CreateAlertRuleRequest (optional)
+ +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully updated the alert rule + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
put /api/v1/alert/message-collection/status
+
(updateAlertMessageInBatch)
+
Update the message status in batch
+ + +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+ + +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful operation + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
put /api/v1/alert/receiver/{receiver_id}
+
(updateAlertReceiverById)
+
Update alert receiver by ID
+ +

Path parameters

+
+
receiver_id (required)
+ +
Path Parameter
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+ + +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully updated the alert receiver + APIResponse +

500

+ Server error + Error +
+
+

DataSource

+
+
+ Up +
post /api/v1/graph/{graph_id}/datasource
+
(bindDatasourceInBatch)
+
Bind data sources in batches
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body SchemaMapping (required)
+ +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful bind the data sources + APIResponse +

400

+ Bad request + Error +

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/graph/{graph_id}/datasource
+
(getDatasourceById)
+
Get data source by ID
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "edge_mappings" : [ {
+    "inputs" : [ "inputs", "inputs" ],
+    "source_vertex_mappings" : [ null, null ],
+    "destination_vertex_mappings" : [ null, null ],
+    "column_mappings" : [ null, null ],
+    "type_triplet" : {
+      "edge" : "edge",
+      "source_vertex" : "source_vertex",
+      "destination_vertex" : "destination_vertex"
+    }
+  }, {
+    "inputs" : [ "inputs", "inputs" ],
+    "source_vertex_mappings" : [ null, null ],
+    "destination_vertex_mappings" : [ null, null ],
+    "column_mappings" : [ null, null ],
+    "type_triplet" : {
+      "edge" : "edge",
+      "source_vertex" : "source_vertex",
+      "destination_vertex" : "destination_vertex"
+    }
+  } ],
+  "vertex_mappings" : [ {
+    "type_name" : "type_name",
+    "inputs" : [ "file:///path/to/file.csv", "file:///path/to/file.csv" ],
+    "column_mappings" : [ {
+      "column" : {
+        "name" : "name",
+        "index" : 0
+      },
+      "property" : "property"
+    }, {
+      "column" : {
+        "name" : "name",
+        "index" : 0
+      },
+      "property" : "property"
+    } ]
+  }, {
+    "type_name" : "type_name",
+    "inputs" : [ "file:///path/to/file.csv", "file:///path/to/file.csv" ],
+    "column_mappings" : [ {
+      "column" : {
+        "name" : "name",
+        "index" : 0
+      },
+      "property" : "property"
+    }, {
+      "column" : {
+        "name" : "name",
+        "index" : 0
+      },
+      "property" : "property"
+    } ]
+  } ]
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful returned all data sources + SchemaMapping +

Example data

+
Content-Type: application/json
+
{"vertex_mappings":[{"type_name":"person","inputs":["file:///path/to/person.csv"],"column_mappings":[{"column":{"index":0,"name":"id"},"property":"id"},{"column":{"index":1,"name":"name"},"property":"name"}]},{"type_name":"software","inputs":["file:///path/to/software.csv"],"column_mappings":[{"column":{"index":0,"name":"id"},"property":"id"},{"column":{"index":1,"name":"name"},"property":"name"}]}],"edge_mappings":[{"type_triplet":{"edge":"knows","source_vertex":"person","destination_vertex":"person"},"inputs":["file:///path/to/knows.csv"],"source_vertex_mappings":[{"column":{"index":0,"name":"id"},"property":"id"}],"destination_vertex_mappings":[{"column":{"index":1,"name":"id"},"property":"id"}],"column_mappings":[{"column":{"index":2,"name":"weight"},"property":"weight"}]},{"type_triplet":{"edge":"created","source_vertex":"person","destination_vertex":"software"},"inputs":["file:///path/to/created.csv"],"source_vertex_mappings":[{"column":{"index":0,"name":"id"},"property":"id"}],"destination_vertex_mappings":[{"column":{"index":1,"name":"id"},"property":"id"}],"column_mappings":[{"column":{"index":2,"name":"weight"},"property":"weight"}]}]}
+

500

+ Server error + Error +
+
+
+
+ Up +
delete /api/v1/graph/{graph_id}/datasource/edge/{type_name}
+
(unbindEdgeDatasource)
+
Unbind datas ource on an edge type
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
type_name (required)
+ +
Path Parameter
+ + + + +

Query parameters

+
+
source_vertex_type (required)
+ +
Query Parameter
destination_vertex_type (required)
+ +
Query Parameter
+ + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully unbind the data source + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
delete /api/v1/graph/{graph_id}/datasource/vertex/{type_name}
+
(unbindVertexDatasource)
+
Unbind data source on a vertex type
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
type_name (required)
+ +
Path Parameter
+ + + + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully unbind the data source + APIResponse +

500

+ Server error + Error +
+
+

Deployment

+
+
+ Up +
get /api/v1/deployment
+
(getDeploymentInfo)
+
Deployment information
+ + + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "creation_time" : "creation_time",
+  "instance_name" : "instance_name",
+  "engine" : "Hiactor",
+  "cluster_type" : "HOSTS",
+  "storage" : "MutableCSR",
+  "version" : "version",
+  "frontend" : "Cypher/Gremlin"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the deployment information + RunningDeploymentInfo +

Example data

+
Content-Type: application/json
+
{"cluster_type":"HOSTS","creation_time":"2024-01-01T00:00:00.000Z","instance_name":"demo","frontend":"Cypher/Gremlin","engine":"Hiactor","storage":"MutableCSR","version":"0.27.0"}
+

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/deployment/status
+
(getDeploymentStatus)
+
Deployment status
+ + + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "nodes" : [ "", "" ],
+  "cluster_type" : "HOSTS"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the deployment status + RunningDeploymentStatus +

Example data

+
Content-Type: application/json
+
{"cluster_type":"HOSTS","nodes":[{"name":"HOSTNAME-1","cpu_usage":83,"memory_usage":37.5,"disk_usage":97}]}
+

500

+ Server error + Error +
+
+

Graph

+
+
+ Up +
post /api/v1/graph/{graph_id}/schema/edge
+
(createEdgeType)
+
Create a edge type
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body CreateEdgeType (optional)
+ +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful created the edge type + APIResponse +

400

+ Bad request + Error +

500

+ Server error + Error +
+
+
+
+ Up +
post /api/v1/graph
+
(createGraph)
+
Create a new graph
+ + +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body CreateGraphRequest (required)
+ +
Body Parameter
+
+ + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "graph_id" : "graph_id"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ The graph was created + CreateGraphResponse +

400

+ Bad request + Error +

500

+ Server error + Error +
+
+
+
+ Up +
post /api/v1/graph/{graph_id}/schema/vertex
+
(createVertexType)
+
Create a vertex type
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body CreateVertexType (required)
+ +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful created a vertex type + APIResponse +

400

+ Bad request + Error +

500

+ Server error + Error +
+
+
+
+ Up +
delete /api/v1/graph/{graph_id}/schema/edge/{type_name}
+
(deleteEdgeTypeByName)
+
Delete edge type by name
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
type_name (required)
+ +
Path Parameter
+ + + + +

Query parameters

+
+
source_vertex_type (required)
+ +
Query Parameter
destination_vertex_type (required)
+ +
Query Parameter
+ + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful deleted the edge type + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
delete /api/v1/graph/{graph_id}
+
(deleteGraphById)
+
Delete graph by ID
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully deleted the graph + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
delete /api/v1/graph/{graph_id}/schema/vertex/{type_name}
+
(deleteVertexTypeByName)
+
Delete vertex type by name
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
type_name (required)
+ +
Path Parameter
+ + + + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful deleted the vertex type + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/graph/{graph_id}
+
(getGraphById)
+
Get graph by ID
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "creation_time" : "creation_time",
+  "schema" : {
+    "vertex_types" : [ "", "" ],
+    "edge_types" : [ "", "" ]
+  },
+  "stored_procedures" : [ "", "" ],
+  "name" : "name",
+  "description" : "description",
+  "schema_update_time" : "schema_update_time",
+  "id" : "id",
+  "store_type" : "mutable_csr",
+  "data_update_time" : "data_update_time"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the graph + GetGraphResponse +

Example data

+
Content-Type: application/json
+
{"id":"GRAPHID","name":"demo","creation_time":"2024-01-01 00:00:00","schema_update_time":"2024-01-02 00:00:00","data_update_time":"2024-01-03 00:00:00","stored_procedures":[{"id":"STORED-PROCEDURE-ID","name":"stored_procedure_name","type":"cypher","query":"MATCH(a) return COUNT(a);","library":"/path/to/library","params":[{"name":"param1","type":{"string":{}}}],"returns":[{"name":"return1","type":{"PrimitiveType":"DT_SIGNED_INT64"}}],"bound_graph":"demo","runnable":true}],"schema":{"vertex_types":[{"type_id":0,"type_name":"person","properties":[{"property_id":0,"property_name":"id","property_type":{"string":{}}},{"property_id":1,"property_name":"name","property_type":{"string":{}}}],"primary_keys":["id"]},{"type_id":1,"type_name":"software","properties":[{"property_id":0,"property_name":"id","property_type":{"string":{}}},{"property_id":1,"property_name":"name","property_type":{"string":{}}}],"primary_keys":["id"]}],"edge_types":[{"type_id":0,"type_name":"knows","vertex_type_pair_relations":[{"source_vertex":"person","destination_vertex":"person","relation":"MANY_TO_MANY","x_csr_params":{"edge_storage_strategy":"ONLY_IN"}}],"properties":[{"property_id":0,"property_name":"weight","property_type":{"primitive_type":"DT_DOUBLE"}}]},{"type_id":1,"type_name":"created","vertex_type_pair_relations":[{"source_vertex":"person","destination_vertex":"software","relation":"MANY_TO_MANY","x_csr_params":{"edge_storage_strategy":"ONLY_IN"}}],"properties":[{"property_id":0,"property_name":"weight","property_type":{"primitive_type":"DT_DOUBLE"}}]}]}}
+

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/graph/{graph_id}/schema
+
(getSchemaById)
+
Get graph schema by ID
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "vertex_types" : [ "", "" ],
+  "edge_types" : [ "", "" ]
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the graph schema + GetGraphSchemaResponse +

Example data

+
Content-Type: application/json
+
{"vertex_types":[{"type_id":0,"type_name":"person","properties":[{"property_id":0,"property_name":"id","property_type":{"string":{}}},{"property_id":1,"property_name":"name","property_type":{"string":{}}}],"primary_keys":["id"]},{"type_id":1,"type_name":"software","properties":[{"property_id":0,"property_name":"id","property_type":{"string":{}}},{"property_id":1,"property_name":"name","property_type":{"string":{}}}],"primary_keys":["id"]}],"edge_types":[{"type_id":0,"type_name":"knows","vertex_type_pair_relations":[{"source_vertex":"person","destination_vertex":"person","relation":"MANY_TO_MANY","x_csr_params":{"edge_storage_strategy":"ONLY_IN"}}],"properties":[{"property_id":0,"property_name":"weight","property_type":{"primitive_type":"DT_DOUBLE"}}]},{"type_id":1,"type_name":"created","vertex_type_pair_relations":[{"source_vertex":"person","destination_vertex":"software","relation":"MANY_TO_MANY","x_csr_params":{"edge_storage_strategy":"ONLY_IN"}}],"properties":[{"property_id":0,"property_name":"weight","property_type":{"primitive_type":"DT_DOUBLE"}}]}]}
+

500

+ Server error + Error +
+
+
+
+ Up +
post /api/v1/graph/{graph_id}/schema
+
(importSchemaById)
+
Import graph schema
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body CreateGraphSchemaRequest (required)
+ +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful imported the graph schema + APIResponse +

400

+ Bad request + Error +

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/graph
+
(listGraphs)
+
List all graphs
+ + + + + + + +

Return type

+
+ array[GetGraphResponse] + +
+ + + +

Example data

+
Content-Type: application/json
+
[ {
+  "creation_time" : "creation_time",
+  "schema" : {
+    "vertex_types" : [ "", "" ],
+    "edge_types" : [ "", "" ]
+  },
+  "stored_procedures" : [ "", "" ],
+  "name" : "name",
+  "description" : "description",
+  "schema_update_time" : "schema_update_time",
+  "id" : "id",
+  "store_type" : "mutable_csr",
+  "data_update_time" : "data_update_time"
+}, {
+  "creation_time" : "creation_time",
+  "schema" : {
+    "vertex_types" : [ "", "" ],
+    "edge_types" : [ "", "" ]
+  },
+  "stored_procedures" : [ "", "" ],
+  "name" : "name",
+  "description" : "description",
+  "schema_update_time" : "schema_update_time",
+  "id" : "id",
+  "store_type" : "mutable_csr",
+  "data_update_time" : "data_update_time"
+} ]
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned all graphs + +

Example data

+
Content-Type: application/json
+
[{"id":"GRAPHID","name":"demo","creation_time":"2024-01-01 00:00:00","schema_update_time":"2024-01-02 00:00:00","data_update_time":"2024-01-03 00:00:00","stored_procedures":[{"id":"STORED-PROCEDURE-ID","name":"stored_procedure_name","type":"cypher","query":"MATCH(a) return COUNT(a);","library":"/path/to/library","params":[{"name":"param1","type":{"string":{}}}],"returns":[{"name":"return1","type":{"PrimitiveType":"DT_SIGNED_INT64"}}],"bound_graph":"demo","runnable":true}],"schema":{"vertex_types":[{"type_id":0,"type_name":"person","properties":[{"property_id":0,"property_name":"id","property_type":{"string":{}}},{"property_id":1,"property_name":"name","property_type":{"string":{}}}],"primary_keys":["id"]},{"type_id":1,"type_name":"software","properties":[{"property_id":0,"property_name":"id","property_type":{"string":{}}},{"property_id":1,"property_name":"name","property_type":{"string":{}}}],"primary_keys":["id"]}],"edge_types":[{"type_id":0,"type_name":"knows","vertex_type_pair_relations":[{"source_vertex":"person","destination_vertex":"person","relation":"MANY_TO_MANY","x_csr_params":{"edge_storage_strategy":"ONLY_IN"}}],"properties":[{"property_id":0,"property_name":"weight","property_type":{"primitive_type":"DT_DOUBLE"}}]},{"type_id":1,"type_name":"created","vertex_type_pair_relations":[{"source_vertex":"person","destination_vertex":"software","relation":"MANY_TO_MANY","x_csr_params":{"edge_storage_strategy":"ONLY_IN"}}],"properties":[{"property_id":0,"property_name":"weight","property_type":{"primitive_type":"DT_DOUBLE"}}]}]}}]
+

500

+ Server error + Error +
+
+

Job

+
+
+ Up +
delete /api/v1/job/{job_id}
+
(deleteJobById)
+
Delete job by ID
+ +

Path parameters

+
+
job_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfuly cancelled the job + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/graph/{graph_id}/dataloading/config
+
(getDataloadingJobConfig)
+
Get the data loading configuration
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "schedule" : "schedule",
+  "loading_config" : {
+    "format" : {
+      "metadata" : "",
+      "type" : "type"
+    },
+    "import_option" : "overwrite"
+  },
+  "vertices" : [ {
+    "type_name" : "type_name"
+  }, {
+    "type_name" : "type_name"
+  } ],
+  "repeat" : "once",
+  "edges" : [ {
+    "type_name" : "type_name",
+    "source_vertex" : "source_vertex",
+    "destination_vertex" : "destination_vertex"
+  }, {
+    "type_name" : "type_name",
+    "source_vertex" : "source_vertex",
+    "destination_vertex" : "destination_vertex"
+  } ]
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the dataloading job configuration + DataloadingJobConfig +

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/job/{job_id}
+
(getJobById)
+
Get job status by ID
+ +

Path parameters

+
+
job_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+
+ JobStatus + +
+ + + +

Example data

+
Content-Type: application/json
+
{
+  "start_time" : "start_time",
+  "log" : "log",
+  "end_time" : "end_time",
+  "id" : "id",
+  "detail" : "",
+  "type" : "type",
+  "status" : "RUNNING"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the job status + JobStatus +

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/job
+
(listJobs)
+
List all jobs
+ + + + + + + +

Return type

+
+ array[JobStatus] + +
+ + + +

Example data

+
Content-Type: application/json
+
[ {
+  "start_time" : "start_time",
+  "log" : "log",
+  "end_time" : "end_time",
+  "id" : "id",
+  "detail" : "",
+  "type" : "type",
+  "status" : "RUNNING"
+}, {
+  "start_time" : "start_time",
+  "log" : "log",
+  "end_time" : "end_time",
+  "id" : "id",
+  "detail" : "",
+  "type" : "type",
+  "status" : "RUNNING"
+} ]
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful returned all the jobs + +

Example data

+
Content-Type: application/json
+
[{"id":"JOB-QWERTYUIOPASDFGH-1","type":"DATA IMPORT","status":"RUNNING","start_time":"2024-02-24T00:00:00.000Z","log":"logging...","detail":{"graph_name":"demo"}},{"id":"JOB-QWERTYUIOPASDFGH-2","type":"DATA IMPORT","status":"CANCELLED","start_time":"2024-02-24T00:00:00.000Z","log":"logging...","detail":{"graph_name":"demo"}},{"id":"JOB-QWERTYUIOPASDFGH-3","type":"DATA IMPORT","status":"SUCCESS","start_time":"2024-02-24T00:00:00.000Z","end_time":"2024-02-24T12:00:00.000Z","detail":{"graph_name":"demo"}},{"id":"JOB-QWERTYUIOPASDFGH-4","type":"DATA IMPORT","status":"FAILED","start_time":"2024-02-24T00:00:00.000Z","end_time":"2024-02-24T12:00:00.000Z","log":"logging...","detail":{"graph_name":"demo"}},{"id":"JOB-QWERTYUIOPASDFGH-5","type":"DATA IMPORT","status":"WAITING","detail":{"graph_name":"demo"}}]
+

500

+ Server error + Error +
+
+
+
+ Up +
post /api/v1/graph/{graph_id}/dataloading
+
(submitDataloadingJob)
+
Submit a dataloading job
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body DataloadingJobConfig (required)
+ +
Body Parameter
+
+ + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "job_id" : "job_id"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully submitted the job + CreateDataloadingJobResponse +

400

+ Bad request + Error +

500

+ Server error + Error +
+
+

Service

+
+
+ Up +
get /api/v1/graph/{graph_id}/service
+
(getServiceStatusById)
+
Get service status by graph ID
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "start_time" : "start_time",
+  "graph_id" : "graph_id",
+  "sdk_endpoints" : {
+    "gremlin" : "gremlin",
+    "cypher" : "cypher",
+    "hqps" : "hqps",
+    "grpc" : "grpc"
+  },
+  "status" : "Running"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the service status + ServiceStatus +

Example data

+
Content-Type: application/json
+
{"graph_id":"GRAPHID","status":"Running","sdk_endpoints":{"cypher":"neo4j://mock.api.cypher:7676","gremin":"ws://mock.api.gremlin/gremlin","hqps":"http://mock.api.hqps:10000"},"start_time":"2024-01-01 00:00:00"}
+

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/service
+
(listServiceStatus)
+
List all service status
+ + + + + + + +

Return type

+
+ array[ServiceStatus] + +
+ + + +

Example data

+
Content-Type: application/json
+
[ {
+  "start_time" : "start_time",
+  "graph_id" : "graph_id",
+  "sdk_endpoints" : {
+    "gremlin" : "gremlin",
+    "cypher" : "cypher",
+    "hqps" : "hqps",
+    "grpc" : "grpc"
+  },
+  "status" : "Running"
+}, {
+  "start_time" : "start_time",
+  "graph_id" : "graph_id",
+  "sdk_endpoints" : {
+    "gremlin" : "gremlin",
+    "cypher" : "cypher",
+    "hqps" : "hqps",
+    "grpc" : "grpc"
+  },
+  "status" : "Running"
+} ]
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned all service status + +

Example data

+
Content-Type: application/json
+
[{"graph_id":"GRAPHID","status":"Running","sdk_endpoints":{"cypher":"neo4j://mock.api.cypher:7676","gremin":"ws://mock.api.gremlin/gremlin","hqps":"http://mock.api.hqps:10000"},"start_time":"2024-01-01 00:00:00"}]
+

500

+ Server error + Error +
+
+
+
+ Up +
post /api/v1/service/restart
+
(restartService)
+
Restart current service
+ + + + + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully restarted the service + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
post /api/v1/service/start
+
(startService)
+
Start service
+ + +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body StartServiceRequest (optional)
+ +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully started the service + APIResponse +

400

+ Bad request + Error +

500

+ Server error + Error +
+
+
+
+ Up +
post /api/v1/service/stop
+
(stopService)
+
Stop current service
+ + + + + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully stopped the service + APIResponse +

500

+ Server error + Error +
+
+

StoredProcedure

+
+
+ Up +
post /api/v1/graph/{graph_id}/storedproc
+
(createStoredProcedure)
+
Create a new stored procedure on a certain graph
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body CreateStoredProcRequest (required)
+ +
Body Parameter
+
+ + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "stored_procedure_id" : "stored_procedure_id"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully created a stored procedure + CreateStoredProcResponse +

400

+ Bad request + Error +

500

+ Server error + Error +
+
+
+
+ Up +
delete /api/v1/graph/{graph_id}/storedproc/{stored_procedure_id}
+
(deleteStoredProcedureById)
+
Delete a stored procedure by ID
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
stored_procedure_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully deleted the stored procedure + APIResponse +

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/graph/{graph_id}/storedproc/{stored_procedure_id}
+
(getStoredProcedureById)
+
Get a stored procedure by ID
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
stored_procedure_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully returned the stored procedure + GetStoredProcResponse +

Example data

+
Content-Type: application/json
+
{"id":"STORED-PROCEDURE-ID","name":"stored_procedure_name","type":"cypher","query":"MATCH(a) return COUNT(a);","library":"/path/to/library","params":[{"name":"param1","type":{"string":{}}}],"returns":[{"name":"return1","type":{"PrimitiveType":"DT_SIGNED_INT64"}}],"bound_graph":"demo","runnable":true}
+

500

+ Server error + Error +
+
+
+
+ Up +
get /api/v1/graph/{graph_id}/storedproc
+
(listStoredProcedures)
+
List all stored procedures on a certain graph
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
+ + + + + + +

Return type

+
+ array[GetStoredProcResponse] + +
+ + + +

Example data

+
Content-Type: application/json
+
[ "", "" ]
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successful operation + +

Example data

+
Content-Type: application/json
+
[{"id":"STORED-PROCEDUREID-1","name":"stored_procedure_name_1","type":"cypher","query":"MATCH(a) return COUNT(a);","library":"/path/to/library","params":[{"name":"param1","type":{"string":{}}}],"returns":[{"name":"return1","type":{"PrimitiveType":"DT_SIGNED_INT64"}}],"bound_graph":"demo","runnable":true},{"id":"STORED-PROCEDUREID-2","name":"stored_procedure_name_2","type":"cypher","query":"MATCH(a) return COUNT(a);","library":"/path/to/library","params":[{"name":"param1","type":{"string":{}}}],"returns":[{"name":"return1","type":{"PrimitiveType":"DT_SIGNED_INT64"}}],"bound_graph":"demo","runnable":false}]
+

400

+ Bad request + Error +

500

+ Server error + Error +
+
+
+
+ Up +
put /api/v1/graph/{graph_id}/storedproc/{stored_procedure_id}
+
(updateStoredProcedureById)
+
Update a stored procedure by ID
+ +

Path parameters

+
+
graph_id (required)
+ +
Path Parameter
stored_procedure_id (required)
+ +
Path Parameter
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +
+ +

Request body

+
+
body UpdateStoredProcRequest (optional)
+ +
Body Parameter
+
+ + + + +

Return type

+
+ APIResponse + +
+ + + +

Example data

+
Content-Type: application/json
+
""
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ Successfully updated the stored procedure + APIResponse +

500

+ Server error + Error +
+
+

Utils

+
+
+ Up +
post /api/v1/file/uploading
+
(uploadFile)
+
+ + +

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • multipart/form-data
  • +
+ + + + +

Form parameters

+
+
filestorage (required)
+ +
Form Parameter — format: binary
+ +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "file_path" : "file_path"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. +
    +
  • application/json
  • +
+ +

Responses

+

200

+ successful operation + UploadFileResponse +

500

+ Server error + Error +
+
+ +

Models

+ [ Jump to Methods ] + +

Table of Contents

+
    +
  1. APIResponse
  2. +
  3. AnyValue
  4. +
  5. BaseEdgeType
  6. +
  7. BaseEdgeType_vertex_type_pair_relations
  8. +
  9. BaseEdgeType_x_csr_params
  10. +
  11. BasePropertyMeta
  12. +
  13. BaseVertexType
  14. +
  15. BaseVertexType_x_csr_params
  16. +
  17. ColumnMapping
  18. +
  19. ColumnMapping_column
  20. +
  21. CreateAlertReceiverRequest
  22. +
  23. CreateAlertRuleRequest
  24. +
  25. CreateDataloadingJobResponse
  26. +
  27. CreateEdgeType
  28. +
  29. CreateGraphRequest
  30. +
  31. CreateGraphResponse
  32. +
  33. CreateGraphSchemaRequest
  34. +
  35. CreatePropertyMeta
  36. +
  37. CreateStoredProcRequest
  38. +
  39. CreateStoredProcResponse
  40. +
  41. CreateVertexType
  42. +
  43. DataloadingJobConfig
  44. +
  45. DataloadingJobConfig_edges
  46. +
  47. DataloadingJobConfig_loading_config
  48. +
  49. DataloadingJobConfig_loading_config_format
  50. +
  51. DataloadingJobConfig_vertices
  52. +
  53. EdgeMapping
  54. +
  55. EdgeMapping_type_triplet
  56. +
  57. Error
  58. +
  59. GSDataType
  60. +
  61. GetAlertMessageResponse
  62. +
  63. GetAlertReceiverResponse
  64. +
  65. GetAlertRuleResponse
  66. +
  67. GetEdgeType
  68. +
  69. GetGraphResponse
  70. +
  71. GetGraphSchemaResponse
  72. +
  73. GetPropertyMeta
  74. +
  75. GetStoredProcResponse
  76. +
  77. GetVertexType
  78. +
  79. JobStatus
  80. +
  81. LongText
  82. +
  83. NodeStatus
  84. +
  85. Parameter
  86. +
  87. PrimitiveType
  88. +
  89. RunningDeploymentInfo
  90. +
  91. RunningDeploymentStatus
  92. +
  93. SchemaMapping
  94. +
  95. ServiceStatus
  96. +
  97. ServiceStatus_sdk_endpoints
  98. +
  99. StartServiceRequest
  100. +
  101. StoredProcedureMeta
  102. +
  103. StringType
  104. +
  105. UpdateAlertMessageStatusRequest
  106. +
  107. UpdateStoredProcRequest
  108. +
  109. UploadFileResponse
  110. +
  111. VertexMapping
  112. +
  113. file_uploading_body
  114. +
+ +
+

APIResponse Up

+ +
+
+
+
+

AnyValue Up

+ +
+
+
+
+

BaseEdgeType Up

+ +
+
type_name
+
vertex_type_pair_relations
+
directed (optional)
+
primary_keys (optional)
+
+
+
+

BaseEdgeType_vertex_type_pair_relations Up

+ +
+
source_vertex
+
destination_vertex
+
relation
+
Enum:
+
MANY_TO_MANY
ONE_TO_MANY
MANY_TO_ONE
ONE_TO_ONE
+
x_csr_params (optional)
+
+
+
+

BaseEdgeType_x_csr_params Up

+
Used for storage optimization
+
+
edge_storage_strategy (optional)
+
Enum:
+
ONLY_IN
ONLY_OUT
BOTH_OUT_IN
+
+
+
+

BasePropertyMeta Up

+ +
+
property_name
+
property_type
+
nullable (optional)
+
default_value (optional)
+
description (optional)
+
+
+
+

BaseVertexType Up

+ +
+
type_name
+
primary_keys
+
x_csr_params (optional)
+
+
+
+

BaseVertexType_x_csr_params Up

+
Used for storage optimization
+
+
max_vertex_num (optional)
+
+
+
+

ColumnMapping Up

+ +
+
column
+
property
String must align with the schema
+
+
+
+

ColumnMapping_column Up

+ +
+
index (optional)
Integer format: int32
+
name (optional)
+
+
+
+

CreateAlertReceiverRequest Up

+ +
+
type
+
Enum:
+
webhook
+
webhook_url
+
at_user_ids
+
is_at_all
+
enable
+
+
+
+

CreateAlertRuleRequest Up

+ +
+
name
+
severity
+
Enum:
+
warning
emergency
+
metric_type
+
Enum:
+
node
service
+
conditions_description
+
frequency
Integer (mins)
+
enable
+
+
+ +
+

CreateEdgeType Up

+ +
+
properties
+
description (optional)
+
type_name
+
vertex_type_pair_relations
+
directed (optional)
+
primary_keys (optional)
+
+
+
+

CreateGraphRequest Up

+ +
+
name (optional)
+
description (optional)
+
stored_procedures (optional)
+
schema (optional)
+
+
+
+

CreateGraphResponse Up

+ +
+
graph_id
+
+
+ +
+

CreatePropertyMeta Up

+ +
+
property_name
+
property_type
+
nullable (optional)
+
default_value (optional)
+
description (optional)
+
+
+
+

CreateStoredProcRequest Up

+ +
+
name
+
description (optional)
+
type
+
Enum:
+
cpp
cypher
+
query
+
+
+
+

CreateStoredProcResponse Up

+ +
+
stored_procedure_id
+
+
+
+

CreateVertexType Up

+ +
+
properties
+
description (optional)
+
type_name
+
primary_keys
+
x_csr_params (optional)
+
+
+
+

DataloadingJobConfig Up

+ +
+
loading_config
+
vertices
+
edges
+
schedule (optional)
String format with '2023-02-21 11:56:30'
+
repeat (optional)
+
Enum:
+
once
day
week
+
+
+
+

DataloadingJobConfig_edges Up

+ +
+
type_name (optional)
+
source_vertex (optional)
+
destination_vertex (optional)
+
+
+
+

DataloadingJobConfig_loading_config Up

+ +
+
import_option (optional)
+
Enum:
+
init
overwrite
+
example: overwrite
+
format (optional)
+
+
+
+

DataloadingJobConfig_loading_config_format Up

+ +
+
type (optional)
+
metadata (optional)
+
+
+
+

DataloadingJobConfig_vertices Up

+ +
+
type_name (optional)
+
+
+
+

EdgeMapping Up

+ +
+
type_triplet
+
inputs
+
source_vertex_mappings
+
destination_vertex_mappings
+
column_mappings (optional)
+
+
+
+

EdgeMapping_type_triplet Up

+
source label -&gt; [edge label] -&gt; destination label
+
+
edge
+
source_vertex
+
destination_vertex
+
+
+
+

Error Up

+ +
+
code
Integer Error code format: int32
+
message
String Error message
+
+
+
+

GSDataType Up

+ +
+
+
+
+

GetAlertMessageResponse Up

+ +
+
id
String Generated in server side
+
alert_name
+
severity
+
Enum:
+
warning
emergency
+
metric_type
+
Enum:
+
node
service
+
target
+
trigger_time
+
status
+
Enum:
+
unsolved
solved
dealing
+
message
+
+
+
+

GetAlertReceiverResponse Up

+ +
+
id
+
message
String Error message generated in server side
+
type
+
Enum:
+
webhook
+
webhook_url
+
at_user_ids
+
is_at_all
+
enable
+
+
+
+

GetAlertRuleResponse Up

+ +
+
id
+
name
+
severity
+
Enum:
+
warning
emergency
+
metric_type
+
Enum:
+
node
service
+
conditions_description
+
frequency
Integer (mins)
+
enable
+
+
+
+

GetEdgeType Up

+ +
+
type_id
Integer format: int32
+
properties
+
description (optional)
+
type_name
+
vertex_type_pair_relations
+
directed (optional)
+
primary_keys (optional)
+
+
+
+

GetGraphResponse Up

+ +
+
id
+
name
+
description (optional)
+
store_type (optional)
+
Enum:
+
mutable_csr
+
creation_time
+
data_update_time
+
schema_update_time
+
stored_procedures (optional)
+
schema
+
+
+
+

GetGraphSchemaResponse Up

+ +
+
vertex_types
+
edge_types
+
+
+
+

GetPropertyMeta Up

+ +
+
property_id
Integer format: int32
+
property_name
+
property_type
+
nullable (optional)
+
default_value (optional)
+
description (optional)
+
+
+
+

GetStoredProcResponse Up

+ +
+
bound_graph
+
runnable
+
id
+
library
+
params
+
returns
+
+
+
+

GetVertexType Up

+ +
+
type_id
Integer format: int32
+
properties
+
description (optional)
+
type_name
+
primary_keys
+
x_csr_params (optional)
+
+
+
+

JobStatus Up

+ +
+
id
+
type
+
status
+
Enum:
+
RUNNING
SUCCESS
FAILED
CANCELLED
WAITING
+
start_time (optional)
+
end_time (optional)
+
log (optional)
String logview URL or log string
+
detail (optional)
+
+
+
+

LongText Up

+ +
+
long_text
+
+
+
+

NodeStatus Up

+ +
+
name
+
cpu_usage
Double format: double
+
memory_usage
Double format: double
+
disk_usage
Double format: double
+
+
+
+

Parameter Up

+ +
+
name
+
type
+
+
+
+

PrimitiveType Up

+ +
+
primitive_type
+
Enum:
+
DT_SIGNED_INT32
DT_UNSIGNED_INT32
DT_SIGNED_INT64
DT_UNSIGNED_INT64
DT_BOOL
DT_FLOAT
DT_DOUBLE
+
+
+
+

RunningDeploymentInfo Up

+ +
+
instance_name
+
cluster_type
+
Enum:
+
HOSTS
KUBERNETES
+
version
+
creation_time
+
frontend
+
Enum:
+
Cypher/Gremlin
AnalyticalApps
+
engine
+
Enum:
+
Hiactor
Gaia
+
storage
+
Enum:
+
MutableCSR
+
+
+
+

RunningDeploymentStatus Up

+ +
+
cluster_type
+
Enum:
+
HOSTS
KUBERNETES
+
nodes
+
items oneOf: + NodeStatus    +
+
+
+
+

SchemaMapping Up

+ +
+
vertex_mappings
+
edge_mappings
+
+
+
+

ServiceStatus Up

+ +
+
graph_id
+
status
+
Enum:
+
Running
Stopped
+
sdk_endpoints (optional)
+
start_time (optional)
+
+
+
+

ServiceStatus_sdk_endpoints Up

+ +
+
cypher (optional)
+
gremlin (optional)
+
hqps (optional)
+
grpc (optional)
+
+
+
+

StartServiceRequest Up

+ +
+
graph_id (optional)
+
+
+
+

StoredProcedureMeta Up

+ +
+
id
+
library
+
params
+
returns
+
name
+
description (optional)
+
type
+
Enum:
+
cpp
cypher
+
query
+
+
+
+

StringType Up

+ +
+
string
+
oneOf: + LongText    +
+
+
+
+

UpdateAlertMessageStatusRequest Up

+ +
+
message_ids
+
status
+
Enum:
+
unsolved
solved
dealing
+
+
+
+

UpdateStoredProcRequest Up

+ +
+
description
+
+
+
+

UploadFileResponse Up

+ +
+
file_path
+
+
+
+

VertexMapping Up

+ +
+
type_name
+
inputs
+
column_mappings
+
+
+
+

file_uploading_body Up

+ +
+
filestorage (optional)
byte[] format: binary
+
+
+ + diff --git a/docs/conf.py b/docs/conf.py index 0be5e15d3e66..1f57a7e1add8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -42,7 +42,6 @@ 'sphinx.ext.autosectionlabel', 'sphinx_panels', 'sphinxemoji.sphinxemoji', - "sphinxext.opengraph", "sphinx_copybutton", 'sphinx_ext', ] diff --git a/docs/flex/coordinator.md b/docs/flex/coordinator.md new file mode 100644 index 000000000000..d1290a7154c4 --- /dev/null +++ b/docs/flex/coordinator.md @@ -0,0 +1,11 @@ +# GraphScope Coordinator + +The GraphScope Coordinator serves as a centralized entry point for users, providing a RESTful API that follows the Swagger specification. It supports multiple language SDKs, including Python, and offers a unified interface. The main purpose of the Coordinator is to abstract and standardize the underlying engines and storage systems, shielding users from their complexities. This allows users to interact with the GraphScope platform through a simplified and consistent set of APIs, making it easier for users to understand and utilize the functionalities provided by GraphScope. + +```{toctree} arguments +--- +caption: +maxdepth: 2 +--- +coordinator/restful_api +``` diff --git a/docs/flex/coordinator/restful_api.rst b/docs/flex/coordinator/restful_api.rst new file mode 100644 index 000000000000..9dbc31b3b882 --- /dev/null +++ b/docs/flex/coordinator/restful_api.rst @@ -0,0 +1,6 @@ +Coordinator RESTFul API +----------------------- + +.. raw:: html + +
diff --git a/docs/flex/interactive/data_model.md b/docs/flex/interactive/data_model.md index 5da5d2e8b40d..af5c7ed3a115 100644 --- a/docs/flex/interactive/data_model.md +++ b/docs/flex/interactive/data_model.md @@ -30,7 +30,7 @@ Within the `graph.yaml` file, vertices are delineated under the `vertex_types` s Note: - In the current version, only one single primary key can be specified, but we plan to support multiple primary keys in the future. -- The data type of primary key column must be one of `DT_SIGNED_INT32`, `DT_UNSIGNED_INT32`, `DT_SIGNED_INT64` or `DT_UNSIGNED_INT64`. +- The data type of primary key column must be one of `DT_SIGNED_INT32`, `DT_UNSIGNED_INT32`, `DT_SIGNED_INT64`,`DT_UNSIGNED_INT64`, or string types `var_char`,`long_text`(`fixed_char` is currently not supported). Edges are defined within the `edge_types` section, characterized by the mandatory fields: `type_name`, `vertex_type_pair_relations`, and `properties`. The type_name and properties fields function similarly to those in vertices. However, the vertex_type_pair_relations field is exclusive to edges, specifying the permissible source and destination vertex types, as well as the relationship detailing how many source and destination vertices can be linked by this edge. Here's an illustrative example: ```yaml diff --git a/docs/flex/interactive/development/java/java_sdk.md b/docs/flex/interactive/development/java/java_sdk.md index 6afebc263fe8..8371f57c20b8 100644 --- a/docs/flex/interactive/development/java/java_sdk.md +++ b/docs/flex/interactive/development/java/java_sdk.md @@ -34,7 +34,7 @@ Add this dependency to your project's POM: ```xml com.alibaba.graphscope - interactive-java-sdk + interactive-sdk 0.0.3 compile @@ -50,7 +50,7 @@ mvn clean package Then manually install the following JARs: -* `target/interactive-java-sdk-0.0.3.jar` +* `target/interactive-sdk-0.0.3.jar` * `target/lib/*.jar` ## Getting Started diff --git a/docs/flex/interactive/development/python/python_sdk.md b/docs/flex/interactive/development/python/python_sdk.md index 9464da01d4ce..b9f9a78cf080 100644 --- a/docs/flex/interactive/development/python/python_sdk.md +++ b/docs/flex/interactive/development/python/python_sdk.md @@ -10,7 +10,7 @@ Python 3.7+ ### pip install ```bash -pip3 install graphscope-interactive +pip3 install interactive-sdk ``` Then import the package: diff --git a/docs/flex/interactive/development/restful_api.md b/docs/flex/interactive/development/restful_api.md index 7c109df6fb0c..738620819721 100644 --- a/docs/flex/interactive/development/restful_api.md +++ b/docs/flex/interactive/development/restful_api.md @@ -12,6 +12,7 @@ The table below provides an overview of the available APIs: | API name | Method and URL | Explanation | |-----------------|------------------------------------------------|--------------------------------------------------------------------| | ListGraphs | GET /v1/graph | Get all graphs in current interactive service, the schema for each graph is returned. | +| GetGraphStatistics | GET /v1/graph/{graph}/statistics | Get the statistics for the specified graph.| | GetGraphSchema | GET /v1/graph/{graph}/schema | Get the schema for the specified graph. | | CreateGraph | POST /v1/graph | Create an empty graph with the specified schema. | | DeleteGraph | DELETE /v1/graph/{graph} | Delete the specified graph. | @@ -179,6 +180,64 @@ curl -X GET -H "Content-Type: application/json" "http://{INTERACTIVE_ENDPOINT}/v - `200 OK`: Request successful. - `500 Internal Error`: Server internal Error. +### GetGraphStatistics API (GraphManagement Category) + +#### Description + +This API retrieves the statistical data(enumerating the count of vertices and edges corresponding to each label) for the actively running graph. +If at the time of the request, no graph is in service, the service will respond with a NOT FOUND status. + +#### HTTP Request +- **Method**: GET +- **Endpoint**: `/v1/graph/{graph_id}/statistics` +- **Content-type**: `application/json` + +#### Curl Command Example +```bash +curl -X GET -H "Content-Type: application/json" "http://{INTERACTIVE_ENDPOINT}/v1/graph/{graph_id}/statistics" +``` + +#### Expected Response +- **Format**: `application/json` +- **Body**: +```json +{ + "edge_type_statistics": [ + { + "type_id": 0, + "type_name": "knows", + "vertex_type_pair_statistics": [ + { + "count": 5, + "destination_vertex": "person", + "source_vertex": "person" + } + ] + } + ], + "total_edge_count": 5, + "total_vertex_count": 6, + "vertex_type_statistics": [ + { + "count": 4, + "type_id": 0, + "type_name": "person" + }, + { + "count": 2, + "type_id": 1, + "type_name": "software" + } + ] +} +``` + +#### Status Codes +- `200 OK`: Request successful. +- `500 Internal Error`: Server internal Error. +- `404 Not Found`: No graph is serving or the queried graph is not the running graph. + + ### CreateGraph (GraphManagement Category) #### Description diff --git a/docs/index.rst b/docs/index.rst index d40c52fcefd4..1c34b8e35466 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -49,6 +49,7 @@ and the vineyard store that offers efficient in-memory data transfers. :maxdepth: 1 :caption: GraphScope Flex + flex/coordinator flex/interactive_intro .. toctree:: diff --git a/flex/CMakeLists.txt b/flex/CMakeLists.txt index a4a8ded53e4c..32e811c2baed 100644 --- a/flex/CMakeLists.txt +++ b/flex/CMakeLists.txt @@ -250,6 +250,8 @@ set(CPACK_DEB_COMPONENT_INSTALL YES) #install CMakeLists.txt.template to resources/ install(FILES resources/hqps/CMakeLists.txt.template DESTINATION lib/flex/) +#install header-only nlohmann-json.hpp to include/ +install(FILES ${CMAKE_SOURCE_DIR}/third_party/nlohmann-json/single_include/nlohmann/json.hpp DESTINATION include/nlohmann) if(USE_PTHASH) install(DIRECTORY ${PROJECT_SOURCE_DIR}/third_party/murmurhash diff --git a/flex/bin/interactive_server.cc b/flex/bin/interactive_server.cc index 0fed3f23bd77..80132adb1d57 100644 --- a/flex/bin/interactive_server.cc +++ b/flex/bin/interactive_server.cc @@ -85,7 +85,7 @@ void init_codegen_proxy(const bpo::variables_map& vm, } void openDefaultGraph(const std::string workspace, int32_t thread_num, - const std::string& default_graph) { + const std::string& default_graph, uint32_t memory_level) { if (!std::filesystem::exists(workspace)) { LOG(ERROR) << "Workspace directory not exists: " << workspace; } @@ -126,7 +126,12 @@ void openDefaultGraph(const std::string workspace, int32_t thread_num, << ", for graph: " << default_graph; } db.Close(); - if (!db.Open(schema_res.value(), data_dir, thread_num).ok()) { + gs::GraphDBConfig config(schema_res.value(), data_dir, thread_num); + config.memory_level = memory_level; + if (config.memory_level >= 2) { + config.enable_auto_compaction = true; + } + if (!db.Open(config).ok()) { LOG(FATAL) << "Fail to load graph from data directory: " << data_dir; } LOG(INFO) << "Successfully init graph db for default graph: " @@ -164,7 +169,9 @@ int main(int argc, char** argv) { "enable-trace", bpo::value()->default_value(false), "whether to enable opentelemetry tracing")( "start-compiler", bpo::value()->default_value(false), - "whether or not to start compiler"); + "whether or not to start compiler")( + "memory-level,m", bpo::value()->default_value(1), + "memory allocation strategy"); setenv("TZ", "Asia/Shanghai", 1); tzset(); @@ -195,6 +202,7 @@ int main(int argc, char** argv) { service_config.engine_config_path = engine_config_file; service_config.start_admin_service = vm["enable-admin-service"].as(); service_config.start_compiler = vm["start-compiler"].as(); + service_config.memory_level = vm["memory-level"].as(); auto& db = gs::GraphDB::get(); @@ -218,7 +226,8 @@ int main(int argc, char** argv) { } gs::openDefaultGraph(workspace, service_config.shard_num, - service_config.default_graph); + service_config.default_graph, + service_config.memory_level); // Suppose the default_graph is already loaded. LOG(INFO) << "Finish init workspace"; auto schema_file = server::WorkDirManipulator::GetGraphSchemaPath( diff --git a/flex/codegen/src/hqps/hqps_project_builder.h b/flex/codegen/src/hqps/hqps_project_builder.h index e4027090925e..ca15b7b5ecab 100644 --- a/flex/codegen/src/hqps/hqps_project_builder.h +++ b/flex/codegen/src/hqps/hqps_project_builder.h @@ -254,10 +254,16 @@ std::string project_key_values_to_string( auto& key_value = mappings[i]; auto& key = key_value.key(); CHECK(key.item_case() == common::Value::kStr); - auto& value = key_value.value(); - auto key_value_str = project_key_value_to_string(ctx, key.str(), value); - if (!key_value_str.empty()) { - key_value_strs.emplace_back(key_value_str); + if (key_value.has_val()) { + auto& value = key_value.val(); + auto key_value_str = project_key_value_to_string(ctx, key.str(), value); + if (!key_value_str.empty()) { + key_value_strs.emplace_back(key_value_str); + } + } else if (key_value.has_nested()) { + LOG(FATAL) << "Nested key value not supported yet"; + } else { + LOG(FATAL) << "Unknown key value type"; } } diff --git a/flex/coordinator/.dockerignore b/flex/coordinator/.dockerignore deleted file mode 100644 index f9619601908b..000000000000 --- a/flex/coordinator/.dockerignore +++ /dev/null @@ -1,72 +0,0 @@ -.travis.yaml -.openapi-generator-ignore -README.md -tox.ini -git_push.sh -test-requirements.txt -setup.py - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ -venv/ -.python-version - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -#Ipython Notebook -.ipynb_checkpoints diff --git a/flex/coordinator/.gitignore b/flex/coordinator/.gitignore deleted file mode 100644 index 43995bd42fa2..000000000000 --- a/flex/coordinator/.gitignore +++ /dev/null @@ -1,66 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ -venv/ -.venv/ -.python-version -.pytest_cache - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -#Ipython Notebook -.ipynb_checkpoints diff --git a/flex/coordinator/.openapi-generator-ignore b/flex/coordinator/.openapi-generator-ignore deleted file mode 100644 index b215b2c874ac..000000000000 --- a/flex/coordinator/.openapi-generator-ignore +++ /dev/null @@ -1,27 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md - -gs_flex_coordinator/controllers/* -setup.py -requirements.txt diff --git a/flex/coordinator/.openapi-generator/FILES b/flex/coordinator/.openapi-generator/FILES deleted file mode 100644 index 251c46d9122a..000000000000 --- a/flex/coordinator/.openapi-generator/FILES +++ /dev/null @@ -1,65 +0,0 @@ -.dockerignore -.gitignore -.travis.yml -Dockerfile -README.md -git_push.sh -gs_flex_coordinator/__init__.py -gs_flex_coordinator/__main__.py -gs_flex_coordinator/encoder.py -gs_flex_coordinator/models/__init__.py -gs_flex_coordinator/models/alert_message.py -gs_flex_coordinator/models/alert_receiver.py -gs_flex_coordinator/models/alert_rule.py -gs_flex_coordinator/models/base_model.py -gs_flex_coordinator/models/column_mapping.py -gs_flex_coordinator/models/connection.py -gs_flex_coordinator/models/connection_status.py -gs_flex_coordinator/models/data_source.py -gs_flex_coordinator/models/deployment_info.py -gs_flex_coordinator/models/deployment_info_graphs_info_value.py -gs_flex_coordinator/models/deployment_status.py -gs_flex_coordinator/models/edge_data_source.py -gs_flex_coordinator/models/edge_mapping.py -gs_flex_coordinator/models/edge_mapping_destination_vertex_mappings_inner.py -gs_flex_coordinator/models/edge_mapping_source_vertex_mappings_inner.py -gs_flex_coordinator/models/edge_mapping_source_vertex_mappings_inner_column.py -gs_flex_coordinator/models/edge_mapping_type_triplet.py -gs_flex_coordinator/models/edge_type.py -gs_flex_coordinator/models/edge_type_vertex_type_pair_relations_inner.py -gs_flex_coordinator/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py -gs_flex_coordinator/models/graph.py -gs_flex_coordinator/models/graph_stored_procedures.py -gs_flex_coordinator/models/groot_dataloading_job_config.py -gs_flex_coordinator/models/groot_dataloading_job_config_edges_inner.py -gs_flex_coordinator/models/groot_edge_type.py -gs_flex_coordinator/models/groot_edge_type_relations_inner.py -gs_flex_coordinator/models/groot_graph.py -gs_flex_coordinator/models/groot_graph_gremlin_interface.py -gs_flex_coordinator/models/groot_property.py -gs_flex_coordinator/models/groot_schema.py -gs_flex_coordinator/models/groot_vertex_type.py -gs_flex_coordinator/models/job_status.py -gs_flex_coordinator/models/model_property.py -gs_flex_coordinator/models/model_schema.py -gs_flex_coordinator/models/node_status.py -gs_flex_coordinator/models/procedure.py -gs_flex_coordinator/models/procedure_params_inner.py -gs_flex_coordinator/models/property_property_type.py -gs_flex_coordinator/models/schema_mapping.py -gs_flex_coordinator/models/schema_mapping_loading_config.py -gs_flex_coordinator/models/schema_mapping_loading_config_data_source.py -gs_flex_coordinator/models/schema_mapping_loading_config_format.py -gs_flex_coordinator/models/service_status.py -gs_flex_coordinator/models/service_status_sdk_endpoints.py -gs_flex_coordinator/models/start_service_request.py -gs_flex_coordinator/models/update_alert_messages_request.py -gs_flex_coordinator/models/vertex_data_source.py -gs_flex_coordinator/models/vertex_mapping.py -gs_flex_coordinator/models/vertex_type.py -gs_flex_coordinator/openapi/openapi.yaml -gs_flex_coordinator/test/__init__.py -gs_flex_coordinator/typing_utils.py -gs_flex_coordinator/util.py -test-requirements.txt -tox.ini diff --git a/flex/coordinator/.openapi-generator/VERSION b/flex/coordinator/.openapi-generator/VERSION deleted file mode 100644 index 8b23b8d47ce2..000000000000 --- a/flex/coordinator/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.3.0 \ No newline at end of file diff --git a/flex/coordinator/.travis.yml b/flex/coordinator/.travis.yml deleted file mode 100644 index ad71ee5ca083..000000000000 --- a/flex/coordinator/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -# ref: https://docs.travis-ci.com/user/languages/python -language: python -python: - - "3.2" - - "3.3" - - "3.4" - - "3.5" - - "3.6" - - "3.7" - - "3.8" -# command to install dependencies -install: "pip install -r requirements.txt" -# command to run tests -script: nosetests diff --git a/flex/coordinator/Dockerfile b/flex/coordinator/Dockerfile deleted file mode 100644 index f52cc649c663..000000000000 --- a/flex/coordinator/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM python:3-alpine - -RUN mkdir -p /usr/src/app -WORKDIR /usr/src/app - -COPY requirements.txt /usr/src/app/ - -RUN pip3 install --no-cache-dir -r requirements.txt - -COPY . /usr/src/app - -EXPOSE 8080 - -ENTRYPOINT ["python3"] - -CMD ["-m", "gs_flex_coordinator"] \ No newline at end of file diff --git a/flex/coordinator/README.md b/flex/coordinator/README.md deleted file mode 100644 index 57e9714cc9c8..000000000000 --- a/flex/coordinator/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# OpenAPI generated server - -## Overview -This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the -[OpenAPI-Spec](https://openapis.org) from a remote server, you can easily generate a server stub. This -is an example of building a OpenAPI-enabled Flask server. - -This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask. - -## Requirements -Python 3.5.2+ - -## Usage -To run the server, please execute the following from the root directory: - -``` -pip3 install -r requirements.txt -python3 -m gs_flex_coordinator -``` - -and open your browser to here: - -``` -http://localhost:8080/ui/ -``` - -Your OpenAPI definition lives here: - -``` -http://localhost:8080/openapi.json -``` - -To launch the integration tests, use tox: -``` -sudo pip install tox -tox -``` - -## Running with Docker - -To run the server on a Docker container, please execute the following from the root directory: - -```bash -# building the image -docker build -t gs_flex_coordinator . - -# starting up a container -docker run -p 8080:8080 gs_flex_coordinator -``` \ No newline at end of file diff --git a/flex/coordinator/git_push.sh b/flex/coordinator/git_push.sh deleted file mode 100644 index f53a75d4fabe..000000000000 --- a/flex/coordinator/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/flex/coordinator/gs_flex_coordinator/VERSION b/flex/coordinator/gs_flex_coordinator/VERSION deleted file mode 120000 index d62dc733efdf..000000000000 --- a/flex/coordinator/gs_flex_coordinator/VERSION +++ /dev/null @@ -1 +0,0 @@ -../../../VERSION \ No newline at end of file diff --git a/flex/coordinator/gs_flex_coordinator/__init__.py b/flex/coordinator/gs_flex_coordinator/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/flex/coordinator/gs_flex_coordinator/__main__.py b/flex/coordinator/gs_flex_coordinator/__main__.py deleted file mode 100644 index faad0ce0d5d6..000000000000 --- a/flex/coordinator/gs_flex_coordinator/__main__.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python3 - -import connexion - -from gs_flex_coordinator import encoder - - -def main(): - app = connexion.App(__name__, specification_dir='./openapi/') - app.app.json_encoder = encoder.JSONEncoder - app.add_api('openapi.yaml', - arguments={'title': 'GraphScope FLEX HTTP SERVICE API'}, - pythonic_params=True) - - app.run(port=8080) - - -if __name__ == '__main__': - main() diff --git a/flex/coordinator/gs_flex_coordinator/controllers/__init__.py b/flex/coordinator/gs_flex_coordinator/controllers/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/flex/coordinator/gs_flex_coordinator/controllers/alert_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/alert_controller.py deleted file mode 100644 index e0615872bee5..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/alert_controller.py +++ /dev/null @@ -1,159 +0,0 @@ -import connexion -from typing import Dict -from typing import Tuple -from typing import Union - -from gs_flex_coordinator.core.alert import alert_manager -from gs_flex_coordinator.core import handle_api_exception -from gs_flex_coordinator.models.alert_message import AlertMessage # noqa: E501 -from gs_flex_coordinator.models.alert_receiver import AlertReceiver # noqa: E501 -from gs_flex_coordinator.models.alert_rule import AlertRule # noqa: E501 -from gs_flex_coordinator.models.update_alert_messages_request import UpdateAlertMessagesRequest # noqa: E501 -from gs_flex_coordinator import util - - -@handle_api_exception() -def delete_alert_rule_by_name(rule_name): # noqa: E501 - """delete_alert_rule - - # noqa: E501 - - :param rule_name: - :type rule_name: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return alert_manager.delete_alert_rule_by_name(rule_name) - - -@handle_api_exception() -def delete_receiver_by_id(receiver_id): # noqa: E501 - """delete_receiver_by_id - - # noqa: E501 - - :param receiver_id: - :type receiver_id: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return alert_manager.delete_receiver_by_id(receiver_id) - - -@handle_api_exception() -def list_alert_messages(alert_type=None, status=None, severity=None, start_time=None, end_time=None): # noqa: E501 - """list_alert_messages - - # noqa: E501 - - :param alert_type: - :type alert_type: str - :param status: - :type status: str - :param severity: - :type severity: str - :param start_time: format with \"2023-02-21-11-56-30\" - :type start_time: str - :param end_time: format with \"2023-02-21-11-56-30\" - :type end_time: str - - :rtype: Union[List[AlertMessage], Tuple[List[AlertMessage], int], Tuple[List[AlertMessage], int, Dict[str, str]] - """ - return alert_manager.list_alert_messages(alert_type, status, severity, start_time, end_time) - - -@handle_api_exception() -def list_alert_rules(): # noqa: E501 - """list_alert_rules - - # noqa: E501 - - - :rtype: Union[List[AlertRule], Tuple[List[AlertRule], int], Tuple[List[AlertRule], int, Dict[str, str]] - """ - return alert_manager.list_alert_rules() - - -@handle_api_exception() -def list_receivers(): # noqa: E501 - """list_receivers - - # noqa: E501 - - - :rtype: Union[List[AlertReceiver], Tuple[List[AlertReceiver], int], Tuple[List[AlertReceiver], int, Dict[str, str]] - """ - return alert_manager.list_receivers() - - -@handle_api_exception() -def register_receiver(alert_receiver): # noqa: E501 - """register_receiver - - # noqa: E501 - - :param alert_receiver: - :type alert_receiver: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - alert_receiver = AlertReceiver.from_dict(connexion.request.get_json()) # noqa: E501 - return alert_manager.register_receiver(alert_receiver) - return 'do some magic!' - - -@handle_api_exception() -def update_alert_messages(update_alert_messages_request=None): # noqa: E501 - """update_alert_messages - - Update alert messages in batch # noqa: E501 - - :param update_alert_messages_request: - :type update_alert_messages_request: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - update_alert_messages_request = UpdateAlertMessagesRequest.from_dict(connexion.request.get_json()) # noqa: E501 - return alert_manager.update_alert_messages( - update_alert_messages_request.messages, - update_alert_messages_request.batch_status, - update_alert_messages_request.batch_delete - ) - - -@handle_api_exception() -def update_alert_rule_by_name(rule_name, alert_rule=None): # noqa: E501 - """update_alert_rule_by_name - - # noqa: E501 - - :param rule_name: - :type rule_name: str - :param alert_rule: - :type alert_rule: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - alert_rule = AlertRule.from_dict(connexion.request.get_json()) # noqa: E501 - return alert_manager.update_alert_rule_by_name(rule_name, alert_rule) - - -@handle_api_exception() -def update_receiver_by_id(receiver_id, alert_receiver=None): # noqa: E501 - """update_receiver_by_id - - # noqa: E501 - - :param receiver_id: - :type receiver_id: str - :param alert_receiver: - :type alert_receiver: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - alert_receiver = AlertReceiver.from_dict(connexion.request.get_json()) # noqa: E501 - return alert_manager.update_receiver_by_id(receiver_id, alert_receiver) diff --git a/flex/coordinator/gs_flex_coordinator/controllers/connection_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/connection_controller.py deleted file mode 100644 index a97f4bcee7f6..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/connection_controller.py +++ /dev/null @@ -1,39 +0,0 @@ -import connexion -from typing import Dict -from typing import Tuple -from typing import Union - -from gs_flex_coordinator.core.config import SOLUTION -from gs_flex_coordinator.models.connection import Connection # noqa: E501 -from gs_flex_coordinator.models.connection_status import ConnectionStatus # noqa: E501 -from gs_flex_coordinator import util - - -def close(): # noqa: E501 - """close - - Close the connection with coordinator # noqa: E501 - - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return "Disconnect with coordinator successfully." - - -def connect(connection): # noqa: E501 - """connect - - Connect to coordinator service # noqa: E501 - - :param connection: - :type connection: dict | bytes - - :rtype: Union[ConnectionStatus, Tuple[ConnectionStatus, int], Tuple[ConnectionStatus, int, Dict[str, str]] - """ - if connexion.request.is_json: - connection = Connection.from_dict(connexion.request.get_json()) # noqa: E501 - connection_status = ConnectionStatus.from_dict({ - "status": "CONNECTED", - "solution": SOLUTION - }) - return connection_status diff --git a/flex/coordinator/gs_flex_coordinator/controllers/datasource_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/datasource_controller.py deleted file mode 100644 index cbf3c24dbd3b..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/datasource_controller.py +++ /dev/null @@ -1,161 +0,0 @@ -import connexion -from typing import Dict -from typing import Tuple -from typing import Union - -from gs_flex_coordinator.core import client_wrapper -from gs_flex_coordinator.core import handle_api_exception -from gs_flex_coordinator.models.data_source import DataSource # noqa: E501 -from gs_flex_coordinator.models.edge_data_source import EdgeDataSource # noqa: E501 -from gs_flex_coordinator.models.vertex_data_source import VertexDataSource # noqa: E501 -from gs_flex_coordinator import util - - -@handle_api_exception() -def bind_edge_datasource(graph_name, edge_data_source): # noqa: E501 - """bind_edge_datasource - - Bind data source on edge type # noqa: E501 - - :param graph_name: - :type graph_name: str - :param edge_data_source: - :type edge_data_source: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - edge_data_source = EdgeDataSource.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.bind_edge_datasource(graph_name, edge_data_source) - - -@handle_api_exception() -def bind_vertex_datasource(graph_name, vertex_data_source): # noqa: E501 - """bind_vertex_datasource - - Bind data source on vertex type # noqa: E501 - - :param graph_name: - :type graph_name: str - :param vertex_data_source: - :type vertex_data_source: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - vertex_data_source = VertexDataSource.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.bind_vertex_datasource(graph_name, vertex_data_source) - - -@handle_api_exception() -def get_datasource(graph_name): # noqa: E501 - """get_datasource - - List data source on graph # noqa: E501 - - :param graph_name: - :type graph_name: str - - :rtype: Union[DataSource, Tuple[DataSource, int], Tuple[DataSource, int, Dict[str, str]] - """ - return client_wrapper.get_datasource(graph_name) - - -@handle_api_exception() -def get_edge_datasource(graph_name, type_name, source_vertex_type, destination_vertex_type): # noqa: E501 - """get_edge_datasource - - Get edge data source # noqa: E501 - - :param graph_name: - :type graph_name: str - :param type_name: - :type type_name: str - :param source_vertex_type: - :type source_vertex_type: str - :param destination_vertex_type: - :type destination_vertex_type: str - - :rtype: Union[EdgeDataSource, Tuple[EdgeDataSource, int], Tuple[EdgeDataSource, int, Dict[str, str]] - """ - return client_wrapper.get_edge_datasource( - graph_name, - type_name, - source_vertex_type, - destination_vertex_type - ) - - -@handle_api_exception() -def get_vertex_datasource(graph_name, type_name): # noqa: E501 - """get_vertex_datasource - - Get vertex data source # noqa: E501 - - :param graph_name: - :type graph_name: str - :param type_name: - :type type_name: str - - :rtype: Union[VertexDataSource, Tuple[VertexDataSource, int], Tuple[VertexDataSource, int, Dict[str, str]] - """ - return client_wrapper.get_vertex_datasource(graph_name, type_name) - - -@handle_api_exception() -def import_datasource(graph_name, data_source): # noqa: E501 - """import_datasource - - Import data source in batch # noqa: E501 - - :param graph_name: - :type graph_name: str - :param data_source: - :type data_source: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - data_source = DataSource.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.import_datasource(graph_name, data_source) - - -@handle_api_exception() -def unbind_edge_datasource(graph_name, type_name, source_vertex_type, destination_vertex_type): # noqa: E501 - """unbind_edge_datasource - - Unbind datasource on an edge type # noqa: E501 - - :param graph_name: - :type graph_name: str - :param type_name: - :type type_name: str - :param source_vertex_type: - :type source_vertex_type: str - :param destination_vertex_type: - :type destination_vertex_type: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.unbind_edge_datasource( - graph_name, - type_name, - source_vertex_type, - destination_vertex_type - ) - - -@handle_api_exception() -def unbind_vertex_datasource(graph_name, type_name): # noqa: E501 - """unbind_vertex_datasource - - Unbind datasource on a vertex type # noqa: E501 - - :param graph_name: - :type graph_name: str - :param type_name: - :type type_name: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.unbind_vertex_datasource(graph_name, type_name) diff --git a/flex/coordinator/gs_flex_coordinator/controllers/deployment_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/deployment_controller.py deleted file mode 100644 index d1bd87765728..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/deployment_controller.py +++ /dev/null @@ -1,66 +0,0 @@ -import connexion -from typing import Dict -from typing import Tuple -from typing import Union - -from gs_flex_coordinator.core import client_wrapper -from gs_flex_coordinator.core import handle_api_exception -from gs_flex_coordinator.models.deployment_info import DeploymentInfo # noqa: E501 -from gs_flex_coordinator.models.node_status import NodeStatus # noqa: E501 -from gs_flex_coordinator import util - - -@handle_api_exception() -def fetch_log(component, pod_name, container_name, since_seconds): # noqa: E501 - """fetch_log - - # noqa: E501 - - :param component: - :type component: str - :param pod_name: - :type pod_name: str - :param container_name: - :type container_name: str - :param since_seconds: - :type since_seconds: int - - :rtype: Union[List[DeploymentStatus], Tuple[List[DeploymentStatus], int], Tuple[List[DeploymentStatus], int, Dict[str, str]] - """ - return 'do some magic!' - - -@handle_api_exception() -def get_deployment_info(): # noqa: E501 - """get_deployment_info - - Get deployment's meta info # noqa: E501 - - - :rtype: Union[List[DeploymentInfo], Tuple[List[DeploymentInfo], int], Tuple[List[DeploymentInfo], int, Dict[str, str]] - """ - return client_wrapper.get_deployment_info() - - -@handle_api_exception() -def get_deployment_status(): # noqa: E501 - """get_deployment_status - - Get deployment's status (k8s only) # noqa: E501 - - - :rtype: Union[List[DeploymentStatus], Tuple[List[DeploymentStatus], int], Tuple[List[DeploymentStatus], int, Dict[str, str]] - """ - return client_wrapper.get_deployment_status() - - -@handle_api_exception() -def get_node_status(): # noqa: E501 - """get_node_status - - Get node status (cpu/memory/disk) # noqa: E501 - - - :rtype: Union[List[NodeStatus], Tuple[List[NodeStatus], int], Tuple[List[NodeStatus], int, Dict[str, str]] - """ - return client_wrapper.get_node_status() diff --git a/flex/coordinator/gs_flex_coordinator/controllers/graph_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/graph_controller.py deleted file mode 100644 index c484dee2ab8c..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/graph_controller.py +++ /dev/null @@ -1,142 +0,0 @@ -import connexion -from typing import Dict -from typing import Tuple -from typing import Union - -from gs_flex_coordinator.core import client_wrapper -from gs_flex_coordinator.core import handle_api_exception -from gs_flex_coordinator.models.edge_type import EdgeType # noqa: E501 -from gs_flex_coordinator.models.graph import Graph # noqa: E501 -from gs_flex_coordinator.models.model_schema import ModelSchema # noqa: E501 -from gs_flex_coordinator.models.vertex_type import VertexType # noqa: E501 -from gs_flex_coordinator import util - - -@handle_api_exception() -def create_edge_type(graph_name, edge_type): # noqa: E501 - """create_edge_type - - Create a edge type # noqa: E501 - - :param graph_name: - :type graph_name: str - :param edge_type: - :type edge_type: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - edge_type = EdgeType.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.create_edge_type(graph_name, edge_type) - - -@handle_api_exception() -def create_graph(graph): # noqa: E501 - """create_graph - - Create a new graph # noqa: E501 - - :param graph: - :type graph: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - graph = Graph.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.create_graph(graph) - - -@handle_api_exception() -def create_vertex_type(graph_name, vertex_type): # noqa: E501 - """create_vertex_type - - Create a vertex type # noqa: E501 - - :param graph_name: - :type graph_name: str - :param vertex_type: - :type vertex_type: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - vertex_type = VertexType.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.create_vertex_type(graph_name, vertex_type) - - -@handle_api_exception() -def delete_edge_type(graph_name, type_name, source_vertex_type, destination_vertex_type): # noqa: E501 - """delete_edge_type - - Delete a edge type by name # noqa: E501 - - :param graph_name: - :type graph_name: str - :param type_name: - :type type_name: str - :param source_vertex_type: - :type source_vertex_type: str - :param destination_vertex_type: - :type destination_vertex_type: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.delete_edge_type( - graph_name, type_name, source_vertex_type, destination_vertex_type - ) - - -@handle_api_exception() -def delete_graph(graph_name): # noqa: E501 - """delete_graph - - Delete a graph by name # noqa: E501 - - :param graph_name: - :type graph_name: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.delete_graph_by_name(graph_name) - - -@handle_api_exception() -def delete_vertex_type(graph_name, type_name): # noqa: E501 - """delete_vertex_type - - Delete a vertex type by name # noqa: E501 - - :param graph_name: - :type graph_name: str - :param type_name: - :type type_name: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.delete_vertex_type(graph_name, type_name) - - -@handle_api_exception() -def get_schema(graph_name): # noqa: E501 - """get_schema - - Get graph schema by name # noqa: E501 - - :param graph_name: - :type graph_name: str - - :rtype: Union[ModelSchema, Tuple[ModelSchema, int], Tuple[ModelSchema, int, Dict[str, str]] - """ - return client_wrapper.get_schema_by_name(graph_name) - - -@handle_api_exception() -def list_graphs(): # noqa: E501 - """list_graphs - - List all graphs # noqa: E501 - - - :rtype: Union[List[Graph], Tuple[List[Graph], int], Tuple[List[Graph], int, Dict[str, str]] - """ - return client_wrapper.list_graphs() diff --git a/flex/coordinator/gs_flex_coordinator/controllers/job_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/job_controller.py deleted file mode 100644 index b557d9a865e2..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/job_controller.py +++ /dev/null @@ -1,82 +0,0 @@ -import connexion -from typing import Dict -from typing import Tuple -from typing import Union - -from gs_flex_coordinator.core import client_wrapper -from gs_flex_coordinator.core import handle_api_exception -from gs_flex_coordinator.models.job_status import JobStatus # noqa: E501 -from gs_flex_coordinator.models.schema_mapping import SchemaMapping # noqa: E501 -from gs_flex_coordinator import util - - -@handle_api_exception() -def create_dataloading_job(graph_name, schema_mapping): # noqa: E501 - """create_dataloading_job - - # noqa: E501 - - :param graph_name: - :type graph_name: str - :param schema_mapping: - :type schema_mapping: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - schema_mapping = SchemaMapping.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.create_dataloading_job(graph_name, schema_mapping) - - -@handle_api_exception() -def delete_job_by_id(job_id): # noqa: E501 - """delete_job_by_id - - # noqa: E501 - - :param job_id: - :type job_id: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.delete_job_by_id(job_id) - - -@handle_api_exception() -def get_job_by_id(job_id): # noqa: E501 - """get_job_by_id - - # noqa: E501 - - :param job_id: - :type job_id: str - - :rtype: Union[JobStatus, Tuple[JobStatus, int], Tuple[JobStatus, int, Dict[str, str]] - """ - return client_wrapper.get_job_by_id(job_id) - - -@handle_api_exception() -def list_jobs(): # noqa: E501 - """list_jobs - - # noqa: E501 - - - :rtype: Union[List[JobStatus], Tuple[List[JobStatus], int], Tuple[List[JobStatus], int, Dict[str, str]] - """ - return client_wrapper.list_jobs() - - -@handle_api_exception() -def get_dataloading_config(graph_name): # noqa: E501 - """get_dataloading_config - - get dataloading configuration # noqa: E501 - - :param graph_name: - :type graph_name: str - - :rtype: Union[List[SchemaMapping], Tuple[List[SchemaMapping], int], Tuple[List[SchemaMapping], int, Dict[str, str]] - """ - return client_wrapper.get_dataloading_config(graph_name) diff --git a/flex/coordinator/gs_flex_coordinator/controllers/legacy_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/legacy_controller.py deleted file mode 100644 index 19ae6181312c..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/legacy_controller.py +++ /dev/null @@ -1,75 +0,0 @@ -import connexion -from typing import Dict -from typing import Tuple -from typing import Union - -from gs_flex_coordinator.core import client_wrapper -from gs_flex_coordinator.core import handle_api_exception -from gs_flex_coordinator.models.groot_dataloading_job_config import GrootDataloadingJobConfig # noqa: E501 -from gs_flex_coordinator.models.groot_graph import GrootGraph # noqa: E501 -from gs_flex_coordinator.models.groot_schema import GrootSchema # noqa: E501 -from gs_flex_coordinator.models.schema_mapping import SchemaMapping # noqa: E501 -from gs_flex_coordinator import util - - -def create_groot_dataloading_job(graph_name, groot_dataloading_job_config): # noqa: E501 - """create_groot_dataloading_job - - # noqa: E501 - - :param graph_name: - :type graph_name: str - :param groot_dataloading_job_config: - :type groot_dataloading_job_config: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - groot_dataloading_job_config = GrootDataloadingJobConfig.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.create_groot_dataloading_job( - graph_name, groot_dataloading_job_config - ) - - -@handle_api_exception() -def get_groot_schema(graph_name): # noqa: E501 - """get_groot_schema - - Get graph schema by name # noqa: E501 - - :param graph_name: - :type graph_name: str - - :rtype: Union[GrootSchema, Tuple[GrootSchema, int], Tuple[GrootSchema, int, Dict[str, str]] - """ - return client_wrapper.get_groot_schema(graph_name) - - -@handle_api_exception() -def import_groot_schema(graph_name, groot_schema): # noqa: E501 - """import_schema - - Import schema to groot graph # noqa: E501 - - :param graph_name: - :type graph_name: str - :param groot_schema: - :type groot_schema: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - groot_schema = GrootSchema.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.import_groot_schema(graph_name, groot_schema) - - -@handle_api_exception() -def list_groot_graph(): # noqa: E501 - """list_groot_graph - - list groot graph # noqa: E501 - - - :rtype: Union[List[GrootGraph], Tuple[List[GrootGraph], int], Tuple[List[GrootGraph], int, Dict[str, str]] - """ - return client_wrapper.list_groot_graph() diff --git a/flex/coordinator/gs_flex_coordinator/controllers/procedure_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/procedure_controller.py deleted file mode 100644 index ce7029a06a93..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/procedure_controller.py +++ /dev/null @@ -1,104 +0,0 @@ -import connexion -from typing import Dict -from typing import Tuple -from typing import Union - -from gs_flex_coordinator.core import client_wrapper -from gs_flex_coordinator.core import handle_api_exception -from gs_flex_coordinator.models.procedure import Procedure # noqa: E501 -from gs_flex_coordinator import util - - -@handle_api_exception() -def create_procedure(graph_name, procedure): # noqa: E501 - """create_procedure - - Create a new stored procedure on a certain graph # noqa: E501 - - :param graph_name: - :type graph_name: str - :param procedure: - :type procedure: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - procedure = Procedure.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.create_procedure(graph_name, procedure) - - -@handle_api_exception() -def delete_procedure(graph_name, procedure_name): # noqa: E501 - """delete_procedure - - Delete a stored procedure on a certain graph # noqa: E501 - - :param graph_name: - :type graph_name: str - :param procedure_name: - :type procedure_name: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.delete_procedure_by_name(graph_name, procedure_name) - - -def get_procedure(graph_name, procedure_name): # noqa: E501 - """get_procedure - - Get a procedure by name # noqa: E501 - - :param graph_name: - :type graph_name: str - :param procedure_name: - :type procedure_name: str - - :rtype: Union[Procedure, Tuple[Procedure, int], Tuple[Procedure, int, Dict[str, str]] - """ - return client_wrapper.get_procedure_by_name(graph_name, procedure_name) - - -@handle_api_exception() -def list_procedures(): # noqa: E501 - """list_procedures - - List all the stored procedures # noqa: E501 - - - :rtype: Union[List[Procedure], Tuple[List[Procedure], int], Tuple[List[Procedure], int, Dict[str, str]] - """ - return client_wrapper.list_procedures(graph_name=None) - - -@handle_api_exception() -def list_procedures_by_graph(graph_name): # noqa: E501 - """list_procedures_by_graph - - List stored procedures on a certain graph # noqa: E501 - - :param graph_name: - :type graph_name: str - - :rtype: Union[List[Procedure], Tuple[List[Procedure], int], Tuple[List[Procedure], int, Dict[str, str]] - """ - return client_wrapper.list_procedures(graph_name=graph_name) - - -@handle_api_exception() -def update_procedure(graph_name, procedure_name, procedure=None): # noqa: E501 - """update_procedure - - Update stored procedure on a certain graph # noqa: E501 - - :param graph_name: - :type graph_name: str - :param procedure_name: - :type procedure_name: str - :param procedure: - :type procedure: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - procedure = Procedure.from_dict(connexion.request.get_json()) # noqa: E501 - return client_wrapper.update_procedure(graph_name, procedure_name, procedure) diff --git a/flex/coordinator/gs_flex_coordinator/controllers/service_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/service_controller.py deleted file mode 100644 index 6938682f4401..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/service_controller.py +++ /dev/null @@ -1,64 +0,0 @@ -from typing import Dict, Tuple, Union - -import connexion - -from gs_flex_coordinator import util -from gs_flex_coordinator.core import client_wrapper, handle_api_exception -from gs_flex_coordinator.models.service_status import \ - ServiceStatus # noqa: E501 -from gs_flex_coordinator.models.start_service_request import \ - StartServiceRequest # noqa: E501 - - -@handle_api_exception() -def get_service_status(): # noqa: E501 - """get_service_status - - Get service status # noqa: E501 - - - :rtype: Union[ServiceStatus, Tuple[ServiceStatus, int], Tuple[ServiceStatus, int, Dict[str, str]] - """ - return client_wrapper.get_service_status() - - -@handle_api_exception() -def restart_service(): # noqa: E501 - """restart_service - - Restart current service # noqa: E501 - - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.restart_service() - - -@handle_api_exception() -def start_service(start_service_request=None): # noqa: E501 - """start_service - - Start service # noqa: E501 - - :param start_service_request: - :type start_service_request: dict | bytes - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - if connexion.request.is_json: - start_service_request = StartServiceRequest.from_dict( - connexion.request.get_json() - ) # noqa: E501 - return client_wrapper.start_service(start_service_request) - - -@handle_api_exception() -def stop_service(): # noqa: E501 - """stop_service - - Stop current service # noqa: E501 - - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.stop_service() diff --git a/flex/coordinator/gs_flex_coordinator/controllers/utils_controller.py b/flex/coordinator/gs_flex_coordinator/controllers/utils_controller.py deleted file mode 100644 index 7e6e8585cebf..000000000000 --- a/flex/coordinator/gs_flex_coordinator/controllers/utils_controller.py +++ /dev/null @@ -1,22 +0,0 @@ -import connexion -from typing import Dict -from typing import Tuple -from typing import Union - -from gs_flex_coordinator.core import client_wrapper -from gs_flex_coordinator.core import handle_api_exception -from gs_flex_coordinator import util - - -@handle_api_exception() -def upload_file(filestorage=None): # noqa: E501 - """upload_file - - # noqa: E501 - - :param filestorage: - :type filestorage: str - - :rtype: Union[str, Tuple[str, int], Tuple[str, int, Dict[str, str]] - """ - return client_wrapper.upload_file(filestorage) diff --git a/flex/coordinator/gs_flex_coordinator/core/client_wrapper.py b/flex/coordinator/gs_flex_coordinator/core/client_wrapper.py deleted file mode 100644 index d3a5e6f75b44..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/client_wrapper.py +++ /dev/null @@ -1,396 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. -# -# 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. -# - -import datetime -import itertools -import logging -import os -import pickle -import socket -import threading -from typing import List, Union - -import psutil - -from gs_flex_coordinator.core.config import ( - CLUSTER_TYPE, - CREATION_TIME, - DATASET_WORKSPACE, - INSTANCE_NAME, - SOLUTION, - WORKSPACE, -) -from gs_flex_coordinator.core.insight import init_groot_client -from gs_flex_coordinator.core.interactive import init_hqps_client -from gs_flex_coordinator.core.scheduler import schedule -from gs_flex_coordinator.core.utils import ( - GraphInfo, - decode_datetimestr, - encode_datetime, - get_current_time, -) -from gs_flex_coordinator.models import ( - DataSource, - DeploymentInfo, - EdgeDataSource, - EdgeType, - Graph, - GrootDataloadingJobConfig, - GrootGraph, - GrootSchema, - JobStatus, - ModelSchema, - NodeStatus, - Procedure, - SchemaMapping, - ServiceStatus, - StartServiceRequest, - VertexDataSource, - VertexType, -) -from gs_flex_coordinator.version import __version__ - - -class ClientWrapper(object): - """Wrapper of client that interacts with engine""" - - def __init__(self): - # lock to protect the service - self._lock = threading.RLock() - # initialize specific client - self._client = self._initialize_client() - # graphs info - self._graphs_info = {} - # pickle path - self._pickle_path = os.path.join(WORKSPACE, "graphs_info.pickle") - # recover - self._try_to_recover_from_disk() - # sync graphs info every 60s - self._sync_graphs_info_job = ( - schedule.every(60) - .seconds.do(self._sync_graphs_info_impl) - .tag("sync", "graphs info") - ) - - def _try_to_recover_from_disk(self): - try: - if os.path.exists(self._pickle_path): - logging.info("Recover graphs info from file %s", self._pickle_path) - with open(self._pickle_path, "rb") as f: - self._graphs_info = pickle.load(f) - except Exception as e: - logging.warn("Failed to recover graphs info: %s", str(e)) - # set default graph info - self._sync_graphs_info_impl() - - def _pickle_graphs_info_impl(self): - try: - with open(self._pickle_path, "wb") as f: - pickle.dump(self._graphs_info, f) - except Exception as e: - logging.warn("Failed to dump graphs info: %s", str(e)) - - def _sync_graphs_info_impl(self): - if SOLUTION == "INTERACTIVE": - graphs = self.list_graphs() - elif SOLUTION == "GRAPHSCOPE_INSIGHT": - graphs = self.list_groot_graph() - rlts = {} - for g in graphs: - if g.name in self._graphs_info: - rlts[g.name] = self._graphs_info[g.name] - else: - rlts[g.name] = GraphInfo(name=g.name, creation_time=CREATION_TIME) - self._graphs_info = rlts - - def _initialize_client(self): - service_initializer = { - "INTERACTIVE": init_hqps_client, - "GRAPHSCOPE_INSIGHT": init_groot_client, - } - initializer = service_initializer.get(SOLUTION) - if initializer is None: - raise RuntimeError(f"Client initializer of {SOLUTION} not found.") - return initializer() - - def list_graphs(self) -> List[Graph]: - graphs = self._client.list_graphs() - # transfer - rlts = [Graph.from_dict(g.to_dict()) for g in graphs] - return rlts - - def get_schema_by_name(self, graph_name: str) -> ModelSchema: - schema = self._client.get_schema_by_name(graph_name) - # transfer - rlt = ModelSchema.from_dict(schema.to_dict()) - return rlt - - def get_groot_schema(self, graph_name: str) -> GrootSchema: - return GrootSchema.from_dict(self._client.get_groot_schema(graph_name)) - - def import_groot_schema(self, graph_name: str, schema: GrootSchema) -> str: - rlt = self._client.import_groot_schema(graph_name, schema.to_dict()) - self._graphs_info[INSTANCE_NAME].update_time = get_current_time() - return rlt - - def get_current_graph(self) -> GrootGraph: - return self._client.get_current_graph() - - def create_graph(self, graph: Graph) -> str: - # there are some tricks here, since schema is a keyword of openapi - # specification, so it will be converted into the _schema field. - graph_dict = graph.to_dict() - if "_schema" in graph_dict: - graph_dict["schema"] = graph_dict.pop("_schema") - rlt = self._client.create_graph(graph_dict) - self._graphs_info[graph.name] = GraphInfo( - name=graph.name, creation_time=get_current_time() - ) - self._pickle_graphs_info_impl() - return rlt - - def create_vertex_type(self, graph_name: str, vtype: VertexType) -> str: - if SOLUTION == "GRAPHSCOPE_INSIGHT": - graph_name = INSTANCE_NAME - vtype_dict = vtype.to_dict() - rlt = self._client.create_vertex_type(graph_name, vtype_dict) - self._graphs_info[graph_name].update_time = get_current_time() - return rlt - - def create_edge_type(self, graph_name: str, etype: EdgeType) -> str: - if SOLUTION == "GRAPHSCOPE_INSIGHT": - graph_name = INSTANCE_NAME - etype_dict = etype.to_dict() - rlt = self._client.create_edge_type(graph_name, etype_dict) - self._graphs_info[graph_name].update_time = get_current_time() - return rlt - - def delete_vertex_type(self, graph_name: str, vertex_type: str) -> str: - if SOLUTION == "GRAPHSCOPE_INSIGHT": - graph_name = INSTANCE_NAME - rlt = self._client.delete_vertex_type(graph_name, vertex_type) - self._graphs_info[graph_name].update_time = get_current_time() - return rlt - - def delete_edge_type( - self, - graph_name: str, - edge_type: str, - source_vertex_type: str, - destination_vertex_type: str, - ) -> str: - if SOLUTION == "GRAPHSCOPE_INSIGHT": - graph_name = INSTANCE_NAME - rlt = self._client.delete_edge_type( - graph_name, edge_type, source_vertex_type, destination_vertex_type - ) - self._graphs_info[graph_name].update_time = get_current_time() - return rlt - - def delete_graph_by_name(self, graph_name: str) -> str: - rlt = self._client.delete_graph_by_name(graph_name) - if graph_name in self._graphs_info: - del self._graphs_info[graph_name] - self._pickle_graphs_info_impl() - return rlt - - def create_procedure(self, graph_name: str, procedure: Procedure) -> str: - procedure_dict = procedure.to_dict() - return self._client.create_procedure(graph_name, procedure_dict) - - def list_procedures(self, graph_name: Union[None, str]) -> List[Procedure]: - procedures = self._client.list_procedures(graph_name) - # transfer - rlt = [Procedure.from_dict(p.to_dict()) for p in procedures] - return rlt - - def update_procedure( - self, graph_name: str, procedure_name: str, procedure: Procedure - ) -> str: - procedure_dict = procedure.to_dict() - return self._client.update_procedure(graph_name, procedure_name, procedure_dict) - - def delete_procedure_by_name(self, graph_name: str, procedure_name: str) -> str: - return self._client.delete_procedure_by_name(graph_name, procedure_name) - - def get_procedure_by_name(self, graph_name: str, procedure_name: str) -> Procedure: - return Procedure.from_dict( - self._client.get_procedure_by_name(graph_name, procedure_name).to_dict() - ) - - def get_node_status(self) -> List[NodeStatus]: - rlt = [] - if CLUSTER_TYPE == "HOSTS": - disk_info = psutil.disk_usage("/") - status = { - "node": socket.gethostname(), - "cpu_usage": psutil.cpu_percent(), - "memory_usage": psutil.virtual_memory().percent, - "disk_usage": float(f"{disk_info.used / disk_info.total * 100:.2f}"), - } - rlt.append(NodeStatus.from_dict(status)) - return rlt - - def get_deployment_info(self) -> DeploymentInfo: - # update graphs info - for job in self.list_jobs(): - if ( - job.detail["graph_name"] in self._graphs_info - and job.end_time is not None - ): - self._graphs_info[job.detail["graph_name"]].last_dataloading_time = ( - decode_datetimestr(job.end_time) - ) - self._pickle_graphs_info_impl() - graphs_info = {} - for name, info in self._graphs_info.items(): - graphs_info[name] = info.to_dict() - info = { - "name": INSTANCE_NAME, - "cluster_type": CLUSTER_TYPE, - "version": __version__, - "solution": SOLUTION, - "creation_time": encode_datetime(CREATION_TIME), - "graphs_info": graphs_info, - } - return DeploymentInfo.from_dict(info) - - def get_service_status(self) -> ServiceStatus: - return ServiceStatus.from_dict(self._client.get_service_status()) - - def stop_service(self) -> str: - return self._client.stop_service() - - def restart_service(self) -> str: - return self._client.restart_service() - - def start_service(self, request: StartServiceRequest) -> str: - return self._client.start_service(request) - - def list_jobs(self) -> List[JobStatus]: - # transfer - rlt = [] - for job_status_dict in self._client.list_jobs(): - rlt.append(JobStatus.from_dict(job_status_dict)) - return rlt - - def get_job_by_id(self, job_id: str) -> JobStatus: - job_status_dict = self._client.get_job_by_id(job_id) - return JobStatus.from_dict(job_status_dict) - - def delete_job_by_id(self, job_id: str) -> str: - return self._client.delete_job_by_id(job_id) - - def create_dataloading_job( - self, graph_name: str, schema_mapping: SchemaMapping - ) -> str: - # there are some tricks here, since property is a keyword of openapi - # specification, so it will be converted into the _property field. - schema_mapping_dict = schema_mapping.to_dict() - for mapping in itertools.chain( - schema_mapping_dict["vertex_mappings"], schema_mapping_dict["edge_mappings"] - ): - for column_mapping in mapping["column_mappings"]: - if "_property" in column_mapping: - column_mapping["property"] = column_mapping.pop("_property") - job_id = self._client.create_dataloading_job(graph_name, schema_mapping_dict) - return job_id - - def get_dataloading_config(self, graph_name: str) -> SchemaMapping: - config = self._client.get_dataloading_config(graph_name) - if not config: - # construct an empty config - schema_mapping = SchemaMapping() - else: - schema_mapping = SchemaMapping.from_dict(config) - return schema_mapping - - def upload_file(self, filestorage) -> str: - if CLUSTER_TYPE == "HOSTS": - filepath = os.path.join(DATASET_WORKSPACE, filestorage.filename) - filestorage.save(filepath) - return str(filepath) - - def create_groot_dataloading_job( - self, graph_name: str, job_config: GrootDataloadingJobConfig - ) -> str: - job_id = self._client.create_groot_dataloading_job( - graph_name, job_config.to_dict() - ) - return job_id - - def list_groot_graph(self) -> List[GrootGraph]: - graphs = self._client.list_groot_graph() - # transfer - rlts = [GrootGraph.from_dict(g) for g in graphs] - return rlts - - def import_datasource(self, graph_name: str, data_source: DataSource) -> str: - return self._client.import_datasource(graph_name, data_source.to_dict()) - - def get_datasource(self, graph_name: str) -> DataSource: - return DataSource.from_dict(self._client.get_datasource(graph_name)) - - def bind_vertex_datasource( - self, graph_name: str, vertex_data_source: VertexDataSource - ) -> str: - return self._client.bind_vertex_datasource( - graph_name, vertex_data_source.to_dict() - ) - - def bind_edge_datasource( - self, graph_name: str, edge_data_source: EdgeDataSource - ) -> str: - return self._client.bind_edge_datasource(graph_name, edge_data_source.to_dict()) - - def get_vertex_datasource( - self, graph_name: str, vertex_type: str - ) -> VertexDataSource: - return VertexDataSource.from_dict( - self._client.get_vertex_datasource(graph_name, vertex_type) - ) - - def get_edge_datasource( - self, - graph_name: str, - edge_type: str, - source_vertex_type: str, - destination_vertex_type: str, - ) -> EdgeDataSource: - return EdgeDataSource.from_dict( - self._client.get_edge_datasource( - graph_name, edge_type, source_vertex_type, destination_vertex_type - ) - ) - - def unbind_vertex_datasource(self, graph_name: str, vertex_type: str) -> str: - return self._client.unbind_vertex_datasource(graph_name, vertex_type) - - def unbind_edge_datasource( - self, - graph_name: str, - edge_type: str, - source_vertex_type: str, - destination_vertex_type: str, - ) -> str: - return self._client.unbind_edge_datasource( - graph_name, edge_type, source_vertex_type, destination_vertex_type - ) - - -client_wrapper = ClientWrapper() diff --git a/flex/coordinator/gs_flex_coordinator/core/insight/groot.py b/flex/coordinator/gs_flex_coordinator/core/insight/groot.py deleted file mode 100644 index a03f148d7801..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/insight/groot.py +++ /dev/null @@ -1,389 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. -# -# 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. -# - -import itertools -import logging -import os -import pickle -from typing import List - -from gs_flex_coordinator.core.config import (CLUSTER_TYPE, INSTANCE_NAME, - WORKSPACE) -from gs_flex_coordinator.core.insight.graph import get_groot_graph -from gs_flex_coordinator.core.insight.job import DataloadingJobScheduler -from gs_flex_coordinator.core.scheduler import schedule -from gs_flex_coordinator.models import JobStatus - - -class GrootClient(object): - """Class used to interact with Groot""" - - def __init__(self): - self._graph = get_groot_graph() - # workspace - self._workspace = os.path.join(WORKSPACE, "groot") - os.makedirs(self._workspace, exist_ok=True) - # data source - self._data_source = {"vertices_datasource": {}, "edges_datasource": {}} - # pickle path - self._datasource_pickle_path = os.path.join( - self._workspace, "datasource.pickle" - ) - # job - self._job_scheduler = {} - # job status - self._job_status = {} - # pickle path - self._job_status_pickle_path = os.path.join( - self._workspace, "job_status.pickle" - ) - # recover - self._try_to_recover_from_disk() - # dump job status to disk every 10s - self._pickle_job_status_job = ( - schedule.every(10) - .seconds.do(self._pickle_job_status_impl) - .tag("pickle", "job status") - ) - - def _try_to_recover_from_disk(self): - try: - if os.path.exists(self._datasource_pickle_path): - logging.info( - "Recover data source from file %s", self._datasource_pickle_path - ) - with open(self._datasource_pickle_path, "rb") as f: - self._data_source = pickle.load(f) - except Exception as e: - logging.warn("Failed to recover data source: %s", str(e)) - - try: - if os.path.exists(self._job_status_pickle_path): - logging.info( - "Recover job status from file %s", self._job_status_pickle_path - ) - with open(self._job_status_pickle_path, "rb") as f: - data = pickle.load(f) - for jobid, status in data.items(): - self._job_status[jobid] = JobStatus.from_dict(status) - except Exception as e: - logging.warn("Failed to recover job status: %s", str(e)) - - def _pickle_datasource_impl(self): - try: - with open(self._datasource_pickle_path, "wb") as f: - pickle.dump(self._data_source, f) - except Exception as e: - logging.warn("Failed to dump data source: %s", str(e)) - - def _pickle_job_status_impl(self): - try: - rlt = {} - for jobid, status in self._job_status.items(): - rlt[jobid] = status.to_dict() - with open(self._job_status_pickle_path, "wb") as f: - pickle.dump(rlt, f) - except Exception as e: - logging.warn("Failed to dump job status: %s", str(e)) - - def get_edge_full_label( - self, type_name: str, source_vertex_type: str, destination_vertex_type: str - ) -> str: - return f"{source_vertex_type}_{type_name}_{destination_vertex_type}" - - def get_current_graph(self): - return self._graph - - def list_groot_graph(self) -> list: - rlts = [self._graph.to_dict()] - return rlts - - def create_vertex_type(self, graph_name: str, vtype_dict: dict) -> str: - return self._graph.create_vertex_type(vtype_dict) - - def create_edge_type(self, graph_name: str, etype_dict: dict) -> str: - return self._graph.create_edge_type(etype_dict) - - def delete_vertex_type(self, graph_name: str, vertex_type: str) -> str: - rlt = self._graph.delete_vertex_type(graph_name, vertex_type) - # unbind data source - if vertex_type in self._data_source["vertices_datasource"]: - del self._data_source["vertices_datasource"][vertex_type] - self._pickle_datasource_impl() - return rlt - - def delete_edge_type( - self, - graph_name: str, - edge_type: str, - source_vertex_type: str, - destination_vertex_type: str, - ) -> str: - rlt = self._graph.delete_edge_type( - graph_name, edge_type, source_vertex_type, destination_vertex_type - ) - # unbind data source - edge_label = self.get_edge_full_label( - edge_type, source_vertex_type, destination_vertex_type - ) - if edge_label in self._data_source["edges_datasource"]: - del self._data_source["edges_datasource"][edge_label] - self._pickle_datasource_impl() - return rlt - - def get_groot_schema(self, graph_name: str) -> dict: - return self._graph.schema - - def import_groot_schema(self, graph_name: str, schema: dict) -> str: - def _data_type_to_groot(dt): - if dt == "DT_DOUBLE": - return "DOUBLE" - elif dt == "DT_SIGNED_INT64": - return "LONG" - elif dt == "DT_STRING": - return "STRING" - else: - return dt - - # transfer to groot data type - for item in itertools.chain(schema["vertices"], schema["edges"]): - for p in item["properties"]: - p["type"] = _data_type_to_groot(p["type"]) - return self._graph.import_schema(schema) - - def list_jobs(self) -> List[dict]: - rlt = [] - for jobid, status in self._job_status.items(): - rlt.append(status.to_dict()) - return rlt - - def import_datasource(self, graph_name: str, data_source: dict) -> str: - for vertex_data_source in data_source["vertices_datasource"]: - self._data_source["vertices_datasource"][ - vertex_data_source["type_name"] - ] = vertex_data_source - for edge_data_source in data_source["edges_datasource"]: - edge_label = self.get_edge_full_label( - edge_data_source["type_name"], - edge_data_source["source_vertex"], - edge_data_source["destination_vertex"], - ) - self._data_source["edges_datasource"][edge_label] = edge_data_source - self._pickle_datasource_impl() - - def get_service_status(self) -> dict: - return { - "status": "running", - "graph_name": self._graph.name, - "sdk_endpoints": { - "gremlin": self._graph.gremlin_interface["gremlin_endpoint"], - "grpc": self._graph.gremlin_interface["grpc_endpoint"], - }, - } - - def get_datasource(self, graph_name: str) -> dict: - rlts = {"vertices_datasource": [], "edges_datasource": []} - for _, v in self._data_source["vertices_datasource"].items(): - rlts["vertices_datasource"].append(v) - for _, e in self._data_source["edges_datasource"].items(): - rlts["edges_datasource"].append(e) - return rlts - - def bind_vertex_datasource(self, graph_name: str, vertex_data_source: dict) -> str: - self._data_source["vertices_datasource"][ - vertex_data_source["type_name"] - ] = vertex_data_source - self._pickle_datasource_impl() - return "Bind vertex data source successfully" - - def bind_edge_datasource(self, graph_name: str, edge_data_source: dict) -> str: - edge_label = self.get_edge_full_label( - edge_data_source["type_name"], - edge_data_source["source_vertex"], - edge_data_source["destination_vertex"], - ) - self._data_source["edges_datasource"][edge_label] = edge_data_source - self._pickle_datasource_impl() - return "Bind edge data source successfully" - - def get_vertex_datasource(self, graph_name: str, vertex_type: str) -> dict: - if vertex_type not in self._data_source["vertices_datasource"]: - raise RuntimeError( - f"Vertex type {vertex_type} does not bind any data source" - ) - return self._data_source["vertices_datasource"][vertex_type] - - def get_edge_datasource( - self, - graph_name: str, - edge_type: str, - source_vertex_type: str, - destination_vertex_type: str, - ) -> dict: - edge_label = self.get_edge_full_label( - edge_type, source_vertex_type, destination_vertex_type - ) - if edge_label not in self._data_source["edges_datasource"]: - raise RuntimeError(f"Edge type {edge_label} does not bind any data source") - return self._data_source["edges_datasource"][edge_label] - - def unbind_vertex_datasource(self, graph_name: str, vertex_type: str) -> str: - # check - vertex_type_exists = False - schema = self._graph.schema - for v in schema["vertices"]: - if vertex_type == v["label"]: - vertex_type_exists = True - break - if not vertex_type_exists: - raise RuntimeError(f"Vertex type {vertex_type} not exists") - if vertex_type in self._data_source["vertices_datasource"]: - del self._data_source["vertices_datasource"][vertex_type] - self._pickle_datasource_impl() - return "unbind data source successfully" - - def unbind_edge_datasource( - self, - graph_name: str, - edge_type: str, - source_vertex_type: str, - destination_vertex_type: str, - ) -> str: - # check - edge_type_exists = False - schema = self._graph.schema - for e in schema["edges"]: - for relation in e["relations"]: - if ( - edge_type == e["label"] - and source_vertex_type == relation["src_label"] - and destination_vertex_type == relation["dst_label"] - ): - edge_type_exists = True - break - if not edge_type_exists: - raise RuntimeError( - f"Edge type ({source_vertex_type})-[{edge_type}]->({destination_vertex_type}) not exists" - ) - edge_label = self.get_edge_full_label( - edge_type, source_vertex_type, destination_vertex_type - ) - if edge_label in self._data_source["edges_datasource"]: - del self._data_source["edges_datasource"][edge_label] - self._pickle_datasource_impl() - return "unbind data source successfully" - - def create_groot_dataloading_job(self, graph_name: str, job_config: dict) -> str: - dataloading_job_scheduler = DataloadingJobScheduler( - job_config=job_config, - data_source=self._data_source, - job_scheduler=self._job_scheduler, - job_status=self._job_status, - graph=self._graph, - ) - return dataloading_job_scheduler.schedulerid - - def get_job_by_id(self, job_id: str) -> dict: - if job_id not in self._job_status: - raise RuntimeError(f"Job {job_id} not found") - return self._job_status[job_id].to_dict() - - def delete_job_by_id(self, job_id: str) -> str: - if job_id not in self._job_status: - raise RuntimeError(f"Job {job_id} not found") - if job_id in self._job_scheduler: - # we don't have some processes in case of restart the coordinator - # some processes will not exist if the coordinator is restart - self._job_scheduler[job_id].cancel() - return f"Submit cancellation job successfully" - - def get_dataloading_config(self, graph_name: str) -> dict: - config = { - "graph": INSTANCE_NAME, - "loading_config": {}, - "vertex_mappings": [], - "edge_mappings": [], - } - # transfer - for vtype, ds in self._data_source["vertices_datasource"].items(): - column_mappings = [] - if ds["property_mapping"] is not None: - for index, property_name in ds["property_mapping"].items(): - column_mappings.append( - { - "column": { - "index": int(index), - }, - "property": property_name, - } - ) - config["vertex_mappings"].append( - { - "type_name": vtype, - "inputs": [ds["location"]], - "column_mappings": column_mappings, - } - ) - for etype, ds in self._data_source["edges_datasource"].items(): - source_vertex_mappings = [] - for index, _ in ds["source_pk_column_map"].items(): - source_vertex_mappings.append( - { - "column": { - "index": int(index), - } - } - ) - destination_vertex_mappings = [] - for index, _ in ds["destination_pk_column_map"].items(): - destination_vertex_mappings.append( - { - "column": { - "index": int(index), - } - } - ) - column_mappings = [] - if ds["property_mapping"] is not None: - for index, property_name in ds["property_mapping"].items(): - column_mappings.append( - { - "column": { - "index": int(index), - }, - "property": property_name, - } - ) - config["edge_mappings"].append( - { - "type_triplet": { - "edge": ds["type_name"], - "source_vertex": ds["source_vertex"], - "destination_vertex": ds["destination_vertex"], - }, - "inputs": [ds["location"]], - "source_vertex_mappings": source_vertex_mappings, - "destination_vertex_mappings": destination_vertex_mappings, - "column_mappings": column_mappings, - } - ) - return config - - -def init_groot_client(): - return GrootClient() diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps.py deleted file mode 100644 index a2059c31ff05..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps.py +++ /dev/null @@ -1,285 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. -# -# 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. -# - -import datetime -import logging -import os -import pickle -import time -from typing import List, Union - -import hqps_client -import requests -from hqps_client import ( - Graph, - JobResponse, - JobStatus, - ModelSchema, - Procedure, - SchemaMapping, - Service, -) - -from gs_flex_coordinator.core.config import ( - CLUSTER_TYPE, - HQPS_ADMIN_SERVICE_PORT, - WORKSPACE, -) -from gs_flex_coordinator.core.utils import ( - encode_datetime, - get_internal_ip, - get_public_ip, -) -from gs_flex_coordinator.models import StartServiceRequest - - -class HQPSClient(object): - """Class used to interact with hqps engine""" - - def __init__(self): - # hqps admin service endpoint - self._hqps_endpoint = self._get_hqps_service_endpoints() - # workspace - self._workspace = os.path.join(WORKSPACE, "interactive") - os.makedirs(self._workspace, exist_ok=True) - # dataloading config - self._dataloading_config = {} - # pickle path - self._pickle_path = os.path.join(self._workspace, "dataloading_config") - # recover - self._try_to_recover_from_disk() - - def _try_to_recover_from_disk(self): - try: - if os.path.exists(self._pickle_path): - logging.info( - "Recover dataloading configs from file %s", self._pickle_path - ) - with open(self._pickle_path, "rb") as f: - self._dataloading_config = pickle.load(f) - except Exception as e: - logging.warn("Failed to recover dataloading configs: %s", str(e)) - - def _pickle_dataloading_config_impl(self): - try: - with open(self._pickle_path, "wb") as f: - pickle.dump(self._dataloading_config, f) - except Exception as e: - logging.warn("Failed to dump dataloading configs: %s", str(e)) - - def _get_hqps_service_endpoints(self): - if CLUSTER_TYPE == "HOSTS": - logging.info("Connecting to HQPS service ...") - while True: - try: - requests.get(f"http://192.168.0.9:{HQPS_ADMIN_SERVICE_PORT}") - except requests.ConnectionError: - time.sleep(3) - else: - return f"http://192.168.0.9:{HQPS_ADMIN_SERVICE_PORT}" - - def list_graphs(self) -> List[Graph]: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.GraphApi(api_client) - return api_instance.list_graphs() - - def get_schema_by_name(self, graph_name: str) -> ModelSchema: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.GraphApi(api_client) - return api_instance.get_schema(graph_name) - - def create_graph(self, graph: dict) -> str: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.GraphApi(api_client) - return api_instance.create_graph(Graph.from_dict(graph)) - - def delete_graph_by_name(self, graph_name: str) -> str: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.GraphApi(api_client) - rlt = api_instance.delete_graph(graph_name) - # unbind datasource - if graph_name in self._dataloading_config: - del self._dataloading_config[graph_name] - self._pickle_dataloading_config_impl() - return rlt - - def create_procedure(self, graph_name: str, procedure: dict) -> str: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.ProcedureApi(api_client) - return api_instance.create_procedure( - graph_name, Procedure.from_dict(procedure) - ) - - def list_procedures(self, graph_name: Union[None, str]) -> List[Procedure]: - if graph_name is not None: - graph_name_list = [graph_name] - else: - # list all procedures - graphs = self.list_graphs() - graph_name_list = [g.name for g in graphs] - - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - procedures = [] - api_instance = hqps_client.ProcedureApi(api_client) - for graph_name in graph_name_list: - response = api_instance.list_procedures(graph_name) - if response is not None: - procedures.extend(response) - return procedures - - def update_procedure( - self, graph_name: str, procedure_name: str, procedure: dict - ) -> str: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.ProcedureApi(api_client) - return api_instance.update_procedure( - graph_name, procedure_name, Procedure.from_dict(procedure) - ) - - def delete_procedure_by_name(self, graph_name: str, procedure_name: str) -> str: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.ProcedureApi(api_client) - return api_instance.delete_procedure(graph_name, procedure_name) - - def get_procedure_by_name(self, graph_name: str, procedure_name: str) -> Procedure: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.ProcedureApi(api_client) - return api_instance.get_procedure(graph_name, procedure_name) - - def get_service_status(self) -> dict: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.ServiceApi(api_client) - response = api_instance.get_service_status() - # transfer - if CLUSTER_TYPE == "HOSTS": - host = get_public_ip() - if host is None: - host = get_internal_ip() - return { - "status": response.status, - "graph_name": response.graph_name, - "sdk_endpoints": { - "cypher": f"neo4j://{host}:{response.bolt_port}", - "hqps": f"http://{host}:{response.hqps_port}", - }, - } - - def stop_service(self) -> str: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.ServiceApi(api_client) - return api_instance.stop_service() - - def restart_service(self) -> str: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.ServiceApi(api_client) - return api_instance.restart_service() - - def start_service(self, request: StartServiceRequest) -> str: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.ServiceApi(api_client) - return api_instance.start_service( - Service.from_dict({"graph_name": request.graph_name}) - ) - - def list_jobs(self) -> List[dict]: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.JobApi(api_client) - rlt = [] - for s in api_instance.list_jobs(): - job_status = s.to_dict() - job_status["start_time"] = encode_datetime( - datetime.datetime.fromtimestamp(job_status["start_time"] / 1000) - ) - if "end_time" in job_status: - job_status["end_time"] = encode_datetime( - datetime.datetime.fromtimestamp(job_status["end_time"] / 1000) - ) - rlt.append(job_status) - return rlt - - def get_job_by_id(self, job_id: str) -> dict: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.JobApi(api_client) - job_status = api_instance.get_job_by_id(job_id).to_dict() - job_status["start_time"] = encode_datetime( - datetime.datetime.fromtimestamp(job_status["start_time"] / 1000) - ) - if "end_time" in job_status: - job_status["end_time"] = encode_datetime( - datetime.datetime.fromtimestamp(job_status["end_time"] / 1000) - ) - return job_status - - def delete_job_by_id(self, job_id: str) -> str: - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.JobApi(api_client) - return api_instance.delete_job_by_id(job_id) - - def create_dataloading_job( - self, graph_name: str, schema_mapping: dict - ) -> JobResponse: - # dataloading - self._dataloading_config[graph_name] = schema_mapping - self._pickle_dataloading_config_impl() - with hqps_client.ApiClient( - hqps_client.Configuration(self._hqps_endpoint) - ) as api_client: - api_instance = hqps_client.JobApi(api_client) - response = api_instance.create_dataloading_job( - graph_name, SchemaMapping.from_dict(schema_mapping) - ) - return response.job_id - - def get_dataloading_config(self, graph_name: str) -> dict: - return self._dataloading_config.get(graph_name, {}) - - -def init_hqps_client(): - return HQPSClient() diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/__init__.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/__init__.py deleted file mode 100644 index 1ca63d2e1849..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -__version__ = "1.0.0" - -# import apis into sdk package -from hqps_client.api.graph_api import GraphApi -from hqps_client.api.job_api import JobApi -from hqps_client.api.procedure_api import ProcedureApi -from hqps_client.api.service_api import ServiceApi - -# import ApiClient -from hqps_client.api_response import ApiResponse -from hqps_client.api_client import ApiClient -from hqps_client.configuration import Configuration -from hqps_client.exceptions import OpenApiException -from hqps_client.exceptions import ApiTypeError -from hqps_client.exceptions import ApiValueError -from hqps_client.exceptions import ApiKeyError -from hqps_client.exceptions import ApiAttributeError -from hqps_client.exceptions import ApiException - -# import models into sdk package -from hqps_client.models.column_mapping import ColumnMapping -from hqps_client.models.edge_mapping import EdgeMapping -from hqps_client.models.edge_mapping_destination_vertex_mappings_inner import EdgeMappingDestinationVertexMappingsInner -from hqps_client.models.edge_mapping_source_vertex_mappings_inner import EdgeMappingSourceVertexMappingsInner -from hqps_client.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn -from hqps_client.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet -from hqps_client.models.edge_type import EdgeType -from hqps_client.models.edge_type_vertex_type_pair_relations_inner import EdgeTypeVertexTypePairRelationsInner -from hqps_client.models.edge_type_vertex_type_pair_relations_inner_x_csr_params import EdgeTypeVertexTypePairRelationsInnerXCsrParams -from hqps_client.models.graph import Graph -from hqps_client.models.graph_stored_procedures import GraphStoredProcedures -from hqps_client.models.job_response import JobResponse -from hqps_client.models.job_status import JobStatus -from hqps_client.models.model_property import ModelProperty -from hqps_client.models.model_schema import ModelSchema -from hqps_client.models.procedure import Procedure -from hqps_client.models.procedure_params_inner import ProcedureParamsInner -from hqps_client.models.property_property_type import PropertyPropertyType -from hqps_client.models.schema_mapping import SchemaMapping -from hqps_client.models.schema_mapping_loading_config import SchemaMappingLoadingConfig -from hqps_client.models.schema_mapping_loading_config_data_source import SchemaMappingLoadingConfigDataSource -from hqps_client.models.schema_mapping_loading_config_format import SchemaMappingLoadingConfigFormat -from hqps_client.models.service import Service -from hqps_client.models.service_status import ServiceStatus -from hqps_client.models.vertex_mapping import VertexMapping -from hqps_client.models.vertex_type import VertexType diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/__init__.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/__init__.py deleted file mode 100644 index 5fbd916816d1..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# flake8: noqa - -# import apis into api package -from hqps_client.api.graph_api import GraphApi -from hqps_client.api.job_api import JobApi -from hqps_client.api.procedure_api import ProcedureApi -from hqps_client.api.service_api import ServiceApi - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/graph_api.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/graph_api.py deleted file mode 100644 index 6d323a0a238b..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/graph_api.py +++ /dev/null @@ -1,1075 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import io -import warnings - -from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated - -from pydantic import StrictStr - -from typing import List - -from hqps_client.models.graph import Graph -from hqps_client.models.model_schema import ModelSchema - -from hqps_client.api_client import ApiClient -from hqps_client.api_response import ApiResponse -from hqps_client.rest import RESTResponseType - - -class GraphApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - - @validate_call - def create_graph( - self, - graph: Graph, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """create_graph - - Create a new graph - - :param graph: (required) - :type graph: Graph - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._create_graph_serialize( - graph=graph, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def create_graph_with_http_info( - self, - graph: Graph, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """create_graph - - Create a new graph - - :param graph: (required) - :type graph: Graph - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._create_graph_serialize( - graph=graph, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def create_graph_without_preload_content( - self, - graph: Graph, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """create_graph - - Create a new graph - - :param graph: (required) - :type graph: Graph - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._create_graph_serialize( - graph=graph, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _create_graph_serialize( - self, - graph, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if graph is not None: - _body_params = graph - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/graph', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def delete_graph( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """delete_graph - - Delete a graph by name - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._delete_graph_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def delete_graph_with_http_info( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """delete_graph - - Delete a graph by name - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._delete_graph_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def delete_graph_without_preload_content( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """delete_graph - - Delete a graph by name - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._delete_graph_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _delete_graph_serialize( - self, - graph_name, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='DELETE', - resource_path='/v1/graph/{graph_name}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def get_schema( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ModelSchema: - """get_schema - - Get schema by graph name - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_schema_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ModelSchema", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def get_schema_with_http_info( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ModelSchema]: - """get_schema - - Get schema by graph name - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_schema_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ModelSchema", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def get_schema_without_preload_content( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """get_schema - - Get schema by graph name - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_schema_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ModelSchema", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_schema_serialize( - self, - graph_name, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/graph/{graph_name}/schema', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def list_graphs( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[Graph]: - """list_graphs - - List all graphs - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_graphs_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Graph]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def list_graphs_with_http_info( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[Graph]]: - """list_graphs - - List all graphs - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_graphs_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Graph]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def list_graphs_without_preload_content( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """list_graphs - - List all graphs - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_graphs_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Graph]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _list_graphs_serialize( - self, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/graph', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/job_api.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/job_api.py deleted file mode 100644 index 4b035cb84aee..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/job_api.py +++ /dev/null @@ -1,1082 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import io -import warnings - -from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated - -from pydantic import StrictStr - -from typing import List - -from hqps_client.models.job_response import JobResponse -from hqps_client.models.job_status import JobStatus -from hqps_client.models.schema_mapping import SchemaMapping - -from hqps_client.api_client import ApiClient -from hqps_client.api_response import ApiResponse -from hqps_client.rest import RESTResponseType - - -class JobApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - - @validate_call - def create_dataloading_job( - self, - graph_name: StrictStr, - schema_mapping: SchemaMapping, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> JobResponse: - """create_dataloading_job - - Create a dataloading job - - :param graph_name: (required) - :type graph_name: str - :param schema_mapping: (required) - :type schema_mapping: SchemaMapping - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._create_dataloading_job_serialize( - graph_name=graph_name, - schema_mapping=schema_mapping, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "JobResponse", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def create_dataloading_job_with_http_info( - self, - graph_name: StrictStr, - schema_mapping: SchemaMapping, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[JobResponse]: - """create_dataloading_job - - Create a dataloading job - - :param graph_name: (required) - :type graph_name: str - :param schema_mapping: (required) - :type schema_mapping: SchemaMapping - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._create_dataloading_job_serialize( - graph_name=graph_name, - schema_mapping=schema_mapping, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "JobResponse", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def create_dataloading_job_without_preload_content( - self, - graph_name: StrictStr, - schema_mapping: SchemaMapping, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """create_dataloading_job - - Create a dataloading job - - :param graph_name: (required) - :type graph_name: str - :param schema_mapping: (required) - :type schema_mapping: SchemaMapping - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._create_dataloading_job_serialize( - graph_name=graph_name, - schema_mapping=schema_mapping, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "JobResponse", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _create_dataloading_job_serialize( - self, - graph_name, - schema_mapping, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if schema_mapping is not None: - _body_params = schema_mapping - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/graph/{graph_name}/dataloading', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def delete_job_by_id( - self, - job_id: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """delete_job_by_id - - - :param job_id: (required) - :type job_id: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._delete_job_by_id_serialize( - job_id=job_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def delete_job_by_id_with_http_info( - self, - job_id: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """delete_job_by_id - - - :param job_id: (required) - :type job_id: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._delete_job_by_id_serialize( - job_id=job_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def delete_job_by_id_without_preload_content( - self, - job_id: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """delete_job_by_id - - - :param job_id: (required) - :type job_id: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._delete_job_by_id_serialize( - job_id=job_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _delete_job_by_id_serialize( - self, - job_id, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if job_id is not None: - _path_params['job_id'] = job_id - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='DELETE', - resource_path='/v1/job/{job_id}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def get_job_by_id( - self, - job_id: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> JobStatus: - """get_job_by_id - - - :param job_id: (required) - :type job_id: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_job_by_id_serialize( - job_id=job_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "JobStatus", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def get_job_by_id_with_http_info( - self, - job_id: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[JobStatus]: - """get_job_by_id - - - :param job_id: (required) - :type job_id: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_job_by_id_serialize( - job_id=job_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "JobStatus", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def get_job_by_id_without_preload_content( - self, - job_id: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """get_job_by_id - - - :param job_id: (required) - :type job_id: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_job_by_id_serialize( - job_id=job_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "JobStatus", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_job_by_id_serialize( - self, - job_id, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if job_id is not None: - _path_params['job_id'] = job_id - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/job/{job_id}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def list_jobs( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[JobStatus]: - """list_jobs - - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_jobs_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[JobStatus]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def list_jobs_with_http_info( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[JobStatus]]: - """list_jobs - - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_jobs_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[JobStatus]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def list_jobs_without_preload_content( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """list_jobs - - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_jobs_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[JobStatus]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _list_jobs_serialize( - self, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/job', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/service_api.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/service_api.py deleted file mode 100644 index fd46dc43e180..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/service_api.py +++ /dev/null @@ -1,1045 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import io -import warnings - -from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated - -from pydantic import Field -from typing_extensions import Annotated -from typing import Optional - -from hqps_client.models.service import Service -from hqps_client.models.service_status import ServiceStatus - -from hqps_client.api_client import ApiClient -from hqps_client.api_response import ApiResponse -from hqps_client.rest import RESTResponseType - - -class ServiceApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - - @validate_call - def get_service_status( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ServiceStatus: - """get_service_status - - Get service status - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_service_status_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ServiceStatus", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def get_service_status_with_http_info( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ServiceStatus]: - """get_service_status - - Get service status - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_service_status_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ServiceStatus", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def get_service_status_without_preload_content( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """get_service_status - - Get service status - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_service_status_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ServiceStatus", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_service_status_serialize( - self, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/v1/service/status', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def restart_service( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """restart_service - - Start current service - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._restart_service_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def restart_service_with_http_info( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """restart_service - - Start current service - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._restart_service_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def restart_service_without_preload_content( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """restart_service - - Start current service - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._restart_service_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _restart_service_serialize( - self, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/service/restart', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def start_service( - self, - service: Annotated[Optional[Service], Field(description="Start service on a specified graph")] = None, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """start_service - - Start service on a specified graph - - :param service: Start service on a specified graph - :type service: Service - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._start_service_serialize( - service=service, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def start_service_with_http_info( - self, - service: Annotated[Optional[Service], Field(description="Start service on a specified graph")] = None, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """start_service - - Start service on a specified graph - - :param service: Start service on a specified graph - :type service: Service - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._start_service_serialize( - service=service, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def start_service_without_preload_content( - self, - service: Annotated[Optional[Service], Field(description="Start service on a specified graph")] = None, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """start_service - - Start service on a specified graph - - :param service: Start service on a specified graph - :type service: Service - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._start_service_serialize( - service=service, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _start_service_serialize( - self, - service, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if service is not None: - _body_params = service - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/service/start', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def stop_service( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """stop_service - - Stop current service - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._stop_service_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def stop_service_with_http_info( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """stop_service - - Stop current service - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._stop_service_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def stop_service_without_preload_content( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """stop_service - - Stop current service - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._stop_service_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _stop_service_serialize( - self, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> Tuple: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/v1/service/stop', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api_client.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api_client.py deleted file mode 100644 index 2faed8f1b12a..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api_client.py +++ /dev/null @@ -1,732 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import atexit -import datetime -from dateutil.parser import parse -import json -import mimetypes -import os -import re -import tempfile - -from urllib.parse import quote -from typing import Tuple, Optional, List - -from hqps_client.configuration import Configuration -from hqps_client.api_response import ApiResponse -import hqps_client.models -from hqps_client import rest -from hqps_client.exceptions import ( - ApiValueError, - ApiException, - BadRequestException, - UnauthorizedException, - ForbiddenException, - NotFoundException, - ServiceException -) - - -class ApiClient: - """Generic API client for OpenAPI client library builds. - - OpenAPI generic API client. This client handles the client- - server communication, and is invariant across implementations. Specifics of - the methods and models for each application are generated from the OpenAPI - templates. - - :param configuration: .Configuration object for this client - :param header_name: a header to pass when making calls to the API. - :param header_value: a header value to pass when making calls to - the API. - :param cookie: a cookie to include in the header when making calls - to the API - """ - - PRIMITIVE_TYPES = (float, bool, bytes, str, int) - NATIVE_TYPES_MAPPING = { - 'int': int, - 'long': int, # TODO remove as only py3 is supported? - 'float': float, - 'str': str, - 'bool': bool, - 'date': datetime.date, - 'datetime': datetime.datetime, - 'object': object, - } - _pool = None - - def __init__( - self, - configuration=None, - header_name=None, - header_value=None, - cookie=None - ) -> None: - # use default configuration if none is provided - if configuration is None: - configuration = Configuration.get_default() - self.configuration = configuration - - self.rest_client = rest.RESTClientObject(configuration) - self.default_headers = {} - if header_name is not None: - self.default_headers[header_name] = header_value - self.cookie = cookie - # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/1.0.0/python' - self.client_side_validation = configuration.client_side_validation - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, traceback): - pass - - @property - def user_agent(self): - """User agent for this API client""" - return self.default_headers['User-Agent'] - - @user_agent.setter - def user_agent(self, value): - self.default_headers['User-Agent'] = value - - def set_default_header(self, header_name, header_value): - self.default_headers[header_name] = header_value - - - _default = None - - @classmethod - def get_default(cls): - """Return new instance of ApiClient. - - This method returns newly created, based on default constructor, - object of ApiClient class or returns a copy of default - ApiClient. - - :return: The ApiClient object. - """ - if cls._default is None: - cls._default = ApiClient() - return cls._default - - @classmethod - def set_default(cls, default): - """Set default instance of ApiClient. - - It stores default ApiClient. - - :param default: object of ApiClient. - """ - cls._default = default - - def param_serialize( - self, - method, - resource_path, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, auth_settings=None, - collection_formats=None, - _host=None, - _request_auth=None - ) -> Tuple: - - """Builds the HTTP request params needed by the request. - :param method: Method to call. - :param resource_path: Path to method endpoint. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :return: tuple of form (path, http_method, query_params, header_params, - body, post_params, files) - """ - - config = self.configuration - - # header parameters - header_params = header_params or {} - header_params.update(self.default_headers) - if self.cookie: - header_params['Cookie'] = self.cookie - if header_params: - header_params = self.sanitize_for_serialization(header_params) - header_params = dict( - self.parameters_to_tuples(header_params,collection_formats) - ) - - # path parameters - if path_params: - path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples( - path_params, - collection_formats - ) - for k, v in path_params: - # specified safe chars, encode everything - resource_path = resource_path.replace( - '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param) - ) - - # post parameters - if post_params or files: - post_params = post_params if post_params else [] - post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples( - post_params, - collection_formats - ) - post_params.extend(self.files_parameters(files)) - - # auth setting - self.update_params_for_auth( - header_params, - query_params, - auth_settings, - resource_path, - method, - body, - request_auth=_request_auth - ) - - # body - if body: - body = self.sanitize_for_serialization(body) - - # request url - if _host is None: - url = self.configuration.host + resource_path - else: - # use server/host defined in path or operation instead - url = _host + resource_path - - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - url_query = self.parameters_to_url_query( - query_params, - collection_formats - ) - url += "?" + url_query - - return method, url, header_params, body, post_params - - - def call_api( - self, - method, - url, - header_params=None, - body=None, - post_params=None, - _request_timeout=None - ) -> rest.RESTResponse: - """Makes the HTTP request (synchronous) - :param method: Method to call. - :param url: Path to method endpoint. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param _request_timeout: timeout setting for this request. - :return: RESTResponse - """ - - try: - # perform request and return response - response_data = self.rest_client.request( - method, url, - headers=header_params, - body=body, post_params=post_params, - _request_timeout=_request_timeout - ) - - except ApiException as e: - if e.body: - e.body = e.body.decode('utf-8') - raise e - - return response_data - - def response_deserialize( - self, - response_data: rest.RESTResponse = None, - response_types_map=None - ) -> ApiResponse: - """Deserializes response into an object. - :param response_data: RESTResponse object to be deserialized. - :param response_types_map: dict of response types. - :return: ApiResponse - """ - - - response_type = response_types_map.get(str(response_data.status), None) - if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: - # if not found, look for '1XX', '2XX', etc. - response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) - - # deserialize response data - response_text = None - return_data = None - try: - if response_type == "bytearray": - return_data = response_data.data - elif response_type == "file": - return_data = self.__deserialize_file(response_data) - elif response_type is not None: - match = None - content_type = response_data.getheader('content-type') - if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) - encoding = match.group(1) if match else "utf-8" - response_text = response_data.data.decode(encoding) - return_data = self.deserialize(response_text, response_type) - finally: - if not 200 <= response_data.status <= 299: - raise ApiException.from_response( - http_resp=response_data, - body=response_text, - data=return_data, - ) - - return ApiResponse( - status_code = response_data.status, - data = return_data, - headers = response_data.getheaders(), - raw_data = response_data.data - ) - - def sanitize_for_serialization(self, obj): - """Builds a JSON POST object. - - If obj is None, return None. - If obj is str, int, long, float, bool, return directly. - If obj is datetime.datetime, datetime.date - convert to string in iso8601 format. - If obj is list, sanitize each element in the list. - If obj is dict, return the dict. - If obj is OpenAPI model, return the properties dict. - - :param obj: The data to serialize. - :return: The serialized form of data. - """ - if obj is None: - return None - elif isinstance(obj, self.PRIMITIVE_TYPES): - return obj - elif isinstance(obj, list): - return [ - self.sanitize_for_serialization(sub_obj) for sub_obj in obj - ] - elif isinstance(obj, tuple): - return tuple( - self.sanitize_for_serialization(sub_obj) for sub_obj in obj - ) - elif isinstance(obj, (datetime.datetime, datetime.date)): - return obj.isoformat() - - elif isinstance(obj, dict): - obj_dict = obj - else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - obj_dict = obj.to_dict() - - return { - key: self.sanitize_for_serialization(val) - for key, val in obj_dict.items() - } - - def deserialize(self, response_text, response_type): - """Deserializes response into an object. - - :param response: RESTResponse object to be deserialized. - :param response_type: class literal for - deserialized object, or string of class name. - - :return: deserialized object. - """ - - # fetch data from response object - try: - data = json.loads(response_text) - except ValueError: - data = response_text - - return self.__deserialize(data, response_type) - - def __deserialize(self, data, klass): - """Deserializes dict, list, str into an object. - - :param data: dict, list or str. - :param klass: class literal, or string of class name. - - :return: object. - """ - if data is None: - return None - - if isinstance(klass, str): - if klass.startswith('List['): - sub_kls = re.match(r'List\[(.*)]', klass).group(1) - return [self.__deserialize(sub_data, sub_kls) - for sub_data in data] - - if klass.startswith('Dict['): - sub_kls = re.match(r'Dict\[([^,]*), (.*)]', klass).group(2) - return {k: self.__deserialize(v, sub_kls) - for k, v in data.items()} - - # convert str to class - if klass in self.NATIVE_TYPES_MAPPING: - klass = self.NATIVE_TYPES_MAPPING[klass] - else: - klass = getattr(hqps_client.models, klass) - - if klass in self.PRIMITIVE_TYPES: - return self.__deserialize_primitive(data, klass) - elif klass == object: - return self.__deserialize_object(data) - elif klass == datetime.date: - return self.__deserialize_date(data) - elif klass == datetime.datetime: - return self.__deserialize_datetime(data) - else: - return self.__deserialize_model(data, klass) - - def parameters_to_tuples(self, params, collection_formats): - """Get parameters as list of tuples, formatting collections. - - :param params: Parameters as dict or list of two-tuples - :param dict collection_formats: Parameter collection formats - :return: Parameters as list of tuples, collections formatted - """ - new_params = [] - if collection_formats is None: - collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: - if k in collection_formats: - collection_format = collection_formats[k] - if collection_format == 'multi': - new_params.extend((k, value) for value in v) - else: - if collection_format == 'ssv': - delimiter = ' ' - elif collection_format == 'tsv': - delimiter = '\t' - elif collection_format == 'pipes': - delimiter = '|' - else: # csv is the default - delimiter = ',' - new_params.append( - (k, delimiter.join(str(value) for value in v))) - else: - new_params.append((k, v)) - return new_params - - def parameters_to_url_query(self, params, collection_formats): - """Get parameters as list of tuples, formatting collections. - - :param params: Parameters as dict or list of two-tuples - :param dict collection_formats: Parameter collection formats - :return: URL query string (e.g. a=Hello%20World&b=123) - """ - new_params = [] - if collection_formats is None: - collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: - if isinstance(v, bool): - v = str(v).lower() - if isinstance(v, (int, float)): - v = str(v) - if isinstance(v, dict): - v = json.dumps(v) - - if k in collection_formats: - collection_format = collection_formats[k] - if collection_format == 'multi': - new_params.extend((k, value) for value in v) - else: - if collection_format == 'ssv': - delimiter = ' ' - elif collection_format == 'tsv': - delimiter = '\t' - elif collection_format == 'pipes': - delimiter = '|' - else: # csv is the default - delimiter = ',' - new_params.append( - (k, delimiter.join(quote(str(value)) for value in v)) - ) - else: - new_params.append((k, quote(str(v)))) - - return "&".join(["=".join(item) for item in new_params]) - - def files_parameters(self, files=None): - """Builds form parameters. - - :param files: File parameters. - :return: Form parameters with files. - """ - params = [] - - if files: - for k, v in files.items(): - if not v: - continue - file_names = v if type(v) is list else [v] - for n in file_names: - with open(n, 'rb') as f: - filename = os.path.basename(f.name) - filedata = f.read() - mimetype = ( - mimetypes.guess_type(filename)[0] - or 'application/octet-stream' - ) - params.append( - tuple([k, tuple([filename, filedata, mimetype])]) - ) - - return params - - def select_header_accept(self, accepts: List[str]) -> Optional[str]: - """Returns `Accept` based on an array of accepts provided. - - :param accepts: List of headers. - :return: Accept (e.g. application/json). - """ - if not accepts: - return None - - for accept in accepts: - if re.search('json', accept, re.IGNORECASE): - return accept - - return accepts[0] - - def select_header_content_type(self, content_types): - """Returns `Content-Type` based on an array of content_types provided. - - :param content_types: List of content-types. - :return: Content-Type (e.g. application/json). - """ - if not content_types: - return None - - for content_type in content_types: - if re.search('json', content_type, re.IGNORECASE): - return content_type - - return content_types[0] - - def update_params_for_auth( - self, - headers, - queries, - auth_settings, - resource_path, - method, - body, - request_auth=None - ) -> None: - """Updates header and query params based on authentication setting. - - :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. - :param auth_settings: Authentication setting identifiers list. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param request_auth: if set, the provided settings will - override the token in the configuration. - """ - if not auth_settings: - return - - if request_auth: - self._apply_auth_params( - headers, - queries, - resource_path, - method, - body, - request_auth - ) - else: - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - self._apply_auth_params( - headers, - queries, - resource_path, - method, - body, - auth_setting - ) - - def _apply_auth_params( - self, - headers, - queries, - resource_path, - method, - body, - auth_setting - ) -> None: - """Updates the request parameters based on a single auth_setting - - :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param auth_setting: auth settings for the endpoint - """ - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) - - def __deserialize_file(self, response): - """Deserializes body to file - - Saves response body into a file in a temporary folder, - using the filename from the `Content-Disposition` header if provided. - - handle file downloading - save response body into a tmp file and return the instance - - :param response: RESTResponse. - :return: file path. - """ - fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) - os.close(fd) - os.remove(path) - - content_disposition = response.getheader("Content-Disposition") - if content_disposition: - filename = re.search( - r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition - ).group(1) - path = os.path.join(os.path.dirname(path), filename) - - with open(path, "wb") as f: - f.write(response.data) - - return path - - def __deserialize_primitive(self, data, klass): - """Deserializes string to primitive type. - - :param data: str. - :param klass: class literal. - - :return: int, long, float, str, bool. - """ - try: - return klass(data) - except UnicodeEncodeError: - return str(data) - except TypeError: - return data - - def __deserialize_object(self, value): - """Return an original value. - - :return: object. - """ - return value - - def __deserialize_date(self, string): - """Deserializes string to date. - - :param string: str. - :return: date. - """ - try: - return parse(string).date() - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason="Failed to parse `{0}` as date object".format(string) - ) - - def __deserialize_datetime(self, string): - """Deserializes string to datetime. - - The string should be in iso8601 datetime format. - - :param string: str. - :return: datetime. - """ - try: - return parse(string) - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason=( - "Failed to parse `{0}` as datetime object" - .format(string) - ) - ) - - def __deserialize_model(self, data, klass): - """Deserializes list or dict to model. - - :param data: dict, list. - :param klass: class literal. - :return: model object. - """ - - return klass.from_dict(data) diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api_response.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api_response.py deleted file mode 100644 index 2ac1ada6e9b3..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api_response.py +++ /dev/null @@ -1,21 +0,0 @@ -"""API response object.""" - -from __future__ import annotations -from typing import Any, Dict, Optional, Generic, TypeVar -from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel - -T = TypeVar("T") - -class ApiResponse(BaseModel, Generic[T]): - """ - API response object - """ - - status_code: StrictInt = Field(description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") - data: T = Field(description="Deserialized data given the data type") - raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") - - model_config = { - "arbitrary_types_allowed": True - } diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/configuration.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/configuration.py deleted file mode 100644 index 4f3de71e8330..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/configuration.py +++ /dev/null @@ -1,435 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import copy -import logging -import multiprocessing -import sys -import urllib3 - -import http.client as httplib - -JSON_SCHEMA_VALIDATION_KEYWORDS = { - 'multipleOf', 'maximum', 'exclusiveMaximum', - 'minimum', 'exclusiveMinimum', 'maxLength', - 'minLength', 'pattern', 'maxItems', 'minItems' -} - -class Configuration: - """This class contains various settings of the API client. - - :param host: Base url. - :param api_key: Dict to store API key(s). - Each entry in the dict specifies an API key. - The dict key is the name of the security scheme in the OAS specification. - The dict value is the API key secret. - :param api_key_prefix: Dict to store API prefix (e.g. Bearer). - The dict key is the name of the security scheme in the OAS specification. - The dict value is an API key prefix when generating the auth data. - :param username: Username for HTTP basic authentication. - :param password: Password for HTTP basic authentication. - :param access_token: Access token. - :param server_index: Index to servers configuration. - :param server_variables: Mapping with string values to replace variables in - templated server configuration. The validation of enums is performed for - variables with defined enum values before. - :param server_operation_index: Mapping from operation ID to an index to server - configuration. - :param server_operation_variables: Mapping from operation ID to a mapping with - string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum - values before. - :param ssl_ca_cert: str - the path to a file of concatenated CA certificates - in PEM format. - - """ - - _default = None - - def __init__(self, host=None, - api_key=None, api_key_prefix=None, - username=None, password=None, - access_token=None, - server_index=None, server_variables=None, - server_operation_index=None, server_operation_variables=None, - ssl_ca_cert=None, - ) -> None: - """Constructor - """ - self._base_path = "http://localhost" if host is None else host - """Default Base url - """ - self.server_index = 0 if server_index is None and host is None else server_index - self.server_operation_index = server_operation_index or {} - """Default server index - """ - self.server_variables = server_variables or {} - self.server_operation_variables = server_operation_variables or {} - """Default server variables - """ - self.temp_folder_path = None - """Temp file folder for downloading files - """ - # Authentication Settings - self.api_key = {} - if api_key: - self.api_key = api_key - """dict to store API key(s) - """ - self.api_key_prefix = {} - if api_key_prefix: - self.api_key_prefix = api_key_prefix - """dict to store API prefix (e.g. Bearer) - """ - self.refresh_api_key_hook = None - """function hook to refresh API key if expired - """ - self.username = username - """Username for HTTP basic authentication - """ - self.password = password - """Password for HTTP basic authentication - """ - self.access_token = access_token - """Access token - """ - self.logger = {} - """Logging Settings - """ - self.logger["package_logger"] = logging.getLogger("hqps_client") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = '%(asctime)s %(levelname)s %(message)s' - """Log format - """ - self.logger_stream_handler = None - """Log stream handler - """ - self.logger_file_handler = None - """Log file handler - """ - self.logger_file = None - """Debug file location - """ - self.debug = False - """Debug switch - """ - - self.verify_ssl = True - """SSL/TLS verification - Set this to false to skip verifying SSL certificate when calling API - from https server. - """ - self.ssl_ca_cert = ssl_ca_cert - """Set this to customize the certificate file to verify the peer. - """ - self.cert_file = None - """client certificate file - """ - self.key_file = None - """client key file - """ - self.assert_hostname = None - """Set this to True/False to enable/disable SSL hostname verification. - """ - self.tls_server_name = None - """SSL/TLS Server Name Indication (SNI) - Set this to the SNI value expected by the server. - """ - - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - """urllib3 connection pool's maximum number of connections saved - per pool. urllib3 uses 1 connection as default value, but this is - not the best value when you are making a lot of possibly parallel - requests to the same host, which is often the case here. - cpu_count * 5 is used as default value to increase performance. - """ - - self.proxy = None - """Proxy URL - """ - self.proxy_headers = None - """Proxy headers - """ - self.safe_chars_for_path_param = '' - """Safe chars for path_param - """ - self.retries = None - """Adding retries to override urllib3 default value 3 - """ - # Enable client side validation - self.client_side_validation = True - - self.socket_options = None - """Options to pass down to the underlying urllib3 socket - """ - - self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" - """datetime format - """ - - self.date_format = "%Y-%m-%d" - """date format - """ - - def __deepcopy__(self, memo): - cls = self.__class__ - result = cls.__new__(cls) - memo[id(self)] = result - for k, v in self.__dict__.items(): - if k not in ('logger', 'logger_file_handler'): - setattr(result, k, copy.deepcopy(v, memo)) - # shallow copy of loggers - result.logger = copy.copy(self.logger) - # use setters to configure loggers - result.logger_file = self.logger_file - result.debug = self.debug - return result - - def __setattr__(self, name, value): - object.__setattr__(self, name, value) - - @classmethod - def set_default(cls, default): - """Set default instance of configuration. - - It stores default configuration, which can be - returned by get_default_copy method. - - :param default: object of Configuration - """ - cls._default = default - - @classmethod - def get_default_copy(cls): - """Deprecated. Please use `get_default` instead. - - Deprecated. Please use `get_default` instead. - - :return: The configuration object. - """ - return cls.get_default() - - @classmethod - def get_default(cls): - """Return the default configuration. - - This method returns newly created, based on default constructor, - object of Configuration class or returns a copy of default - configuration. - - :return: The configuration object. - """ - if cls._default is None: - cls._default = Configuration() - return cls._default - - @property - def logger_file(self): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - return self.__logger_file - - @logger_file.setter - def logger_file(self, value): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - self.__logger_file = value - if self.__logger_file: - # If set logging file, - # then add file handler and remove stream handler. - self.logger_file_handler = logging.FileHandler(self.__logger_file) - self.logger_file_handler.setFormatter(self.logger_formatter) - for _, logger in self.logger.items(): - logger.addHandler(self.logger_file_handler) - - @property - def debug(self): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - return self.__debug - - @debug.setter - def debug(self, value): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - self.__debug = value - if self.__debug: - # if debug status is True, turn on debug logging - for _, logger in self.logger.items(): - logger.setLevel(logging.DEBUG) - # turn on httplib debug - httplib.HTTPConnection.debuglevel = 1 - else: - # if debug status is False, turn off debug logging, - # setting log level to default `logging.WARNING` - for _, logger in self.logger.items(): - logger.setLevel(logging.WARNING) - # turn off httplib debug - httplib.HTTPConnection.debuglevel = 0 - - @property - def logger_format(self): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - return self.__logger_format - - @logger_format.setter - def logger_format(self, value): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - self.__logger_format = value - self.logger_formatter = logging.Formatter(self.__logger_format) - - def get_api_key_with_prefix(self, identifier, alias=None): - """Gets API key (with prefix if set). - - :param identifier: The identifier of apiKey. - :param alias: The alternative identifier of apiKey. - :return: The token for api key authentication. - """ - if self.refresh_api_key_hook is not None: - self.refresh_api_key_hook(self) - key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) - if key: - prefix = self.api_key_prefix.get(identifier) - if prefix: - return "%s %s" % (prefix, key) - else: - return key - - def get_basic_auth_token(self): - """Gets HTTP basic authentication header (string). - - :return: The token for basic HTTP authentication. - """ - username = "" - if self.username is not None: - username = self.username - password = "" - if self.password is not None: - password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') - - def auth_settings(self): - """Gets Auth Settings dict for api client. - - :return: The Auth Settings information dict. - """ - auth = {} - return auth - - def to_debug_report(self): - """Gets the essential information for debugging. - - :return: The report for debugging. - """ - return "Python SDK Debug Report:\n"\ - "OS: {env}\n"\ - "Python Version: {pyversion}\n"\ - "Version of the API: 0.9.1\n"\ - "SDK Package Version: 1.0.0".\ - format(env=sys.platform, pyversion=sys.version) - - def get_host_settings(self): - """Gets an array of host settings - - :return: An array of host settings - """ - return [ - { - 'url': "", - 'description': "No description provided", - } - ] - - def get_host_from_settings(self, index, variables=None, servers=None): - """Gets host URL based on the index and variables - :param index: array index of the host settings - :param variables: hash of variable and the corresponding value - :param servers: an array of host settings or None - :return: URL based on host settings - """ - if index is None: - return self._base_path - - variables = {} if variables is None else variables - servers = self.get_host_settings() if servers is None else servers - - try: - server = servers[index] - except IndexError: - raise ValueError( - "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers))) - - url = server['url'] - - # go through variables and replace placeholders - for variable_name, variable in server.get('variables', {}).items(): - used_value = variables.get( - variable_name, variable['default_value']) - - if 'enum_values' in variable \ - and used_value not in variable['enum_values']: - raise ValueError( - "The variable `{0}` in the host URL has invalid value " - "{1}. Must be {2}.".format( - variable_name, variables[variable_name], - variable['enum_values'])) - - url = url.replace("{" + variable_name + "}", used_value) - - return url - - @property - def host(self): - """Return generated host.""" - return self.get_host_from_settings(self.server_index, variables=self.server_variables) - - @host.setter - def host(self, value): - """Fix base path.""" - self._base_path = value - self.server_index = None diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/exceptions.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/exceptions.py deleted file mode 100644 index 6832c50bf463..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/exceptions.py +++ /dev/null @@ -1,201 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - -from typing import Any, Optional - -from typing_extensions import Self - -class OpenApiException(Exception): - """The base exception class for all OpenAPIExceptions""" - - -class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None) -> None: - """ Raises an exception for TypeErrors - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list): a list of keys an indices to get to the - current_item - None if unset - valid_classes (tuple): the primitive classes that current item - should be an instance of - None if unset - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a list - None if unset - """ - self.path_to_item = path_to_item - self.valid_classes = valid_classes - self.key_type = key_type - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiTypeError, self).__init__(full_msg) - - -class ApiValueError(OpenApiException, ValueError): - def __init__(self, msg, path_to_item=None) -> None: - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list) the path to the exception in the - received_data dict. None if unset - """ - - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiValueError, self).__init__(full_msg) - - -class ApiAttributeError(OpenApiException, AttributeError): - def __init__(self, msg, path_to_item=None) -> None: - """ - Raised when an attribute reference or assignment fails. - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiAttributeError, self).__init__(full_msg) - - -class ApiKeyError(OpenApiException, KeyError): - def __init__(self, msg, path_to_item=None) -> None: - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiKeyError, self).__init__(full_msg) - - -class ApiException(OpenApiException): - - def __init__( - self, - status=None, - reason=None, - http_resp=None, - *, - body: Optional[str] = None, - data: Optional[Any] = None, - ) -> None: - self.status = status - self.reason = reason - self.body = body - self.data = data - self.headers = None - - if http_resp: - if self.status is None: - self.status = http_resp.status - if self.reason is None: - self.reason = http_resp.reason - if self.body is None: - try: - self.body = http_resp.data.decode('utf-8') - except Exception: - pass - self.headers = http_resp.getheaders() - - @classmethod - def from_response( - cls, - *, - http_resp, - body: Optional[str], - data: Optional[Any], - ) -> Self: - if http_resp.status == 400: - raise BadRequestException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 401: - raise UnauthorizedException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 403: - raise ForbiddenException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 404: - raise NotFoundException(http_resp=http_resp, body=body, data=data) - - if 500 <= http_resp.status <= 599: - raise ServiceException(http_resp=http_resp, body=body, data=data) - raise ApiException(http_resp=http_resp, body=body, data=data) - - def __str__(self): - """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) - if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) - - if self.data or self.body: - error_message += "HTTP response body: {0}\n".format(self.data or self.body) - - return error_message - - -class BadRequestException(ApiException): - pass - - -class NotFoundException(ApiException): - pass - - -class UnauthorizedException(ApiException): - pass - - -class ForbiddenException(ApiException): - pass - - -class ServiceException(ApiException): - pass - - -def render_path(path_to_item): - """Returns a string representation of a path""" - result = "" - for pth in path_to_item: - if isinstance(pth, int): - result += "[{0}]".format(pth) - else: - result += "['{0}']".format(pth) - return result diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/__init__.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/__init__.py deleted file mode 100644 index 6eeaab32b362..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding: utf-8 - -# flake8: noqa -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -# import models into model package -from hqps_client.models.column_mapping import ColumnMapping -from hqps_client.models.edge_mapping import EdgeMapping -from hqps_client.models.edge_mapping_destination_vertex_mappings_inner import EdgeMappingDestinationVertexMappingsInner -from hqps_client.models.edge_mapping_source_vertex_mappings_inner import EdgeMappingSourceVertexMappingsInner -from hqps_client.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn -from hqps_client.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet -from hqps_client.models.edge_type import EdgeType -from hqps_client.models.edge_type_vertex_type_pair_relations_inner import EdgeTypeVertexTypePairRelationsInner -from hqps_client.models.edge_type_vertex_type_pair_relations_inner_x_csr_params import EdgeTypeVertexTypePairRelationsInnerXCsrParams -from hqps_client.models.graph import Graph -from hqps_client.models.graph_stored_procedures import GraphStoredProcedures -from hqps_client.models.job_response import JobResponse -from hqps_client.models.job_status import JobStatus -from hqps_client.models.model_property import ModelProperty -from hqps_client.models.model_schema import ModelSchema -from hqps_client.models.procedure import Procedure -from hqps_client.models.procedure_params_inner import ProcedureParamsInner -from hqps_client.models.property_property_type import PropertyPropertyType -from hqps_client.models.schema_mapping import SchemaMapping -from hqps_client.models.schema_mapping_loading_config import SchemaMappingLoadingConfig -from hqps_client.models.schema_mapping_loading_config_data_source import SchemaMappingLoadingConfigDataSource -from hqps_client.models.schema_mapping_loading_config_format import SchemaMappingLoadingConfigFormat -from hqps_client.models.service import Service -from hqps_client.models.service_status import ServiceStatus -from hqps_client.models.vertex_mapping import VertexMapping -from hqps_client.models.vertex_type import VertexType diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/column_mapping.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/column_mapping.py deleted file mode 100644 index 79a6d32f29e7..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/column_mapping.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr -from pydantic import Field -from hqps_client.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class ColumnMapping(BaseModel): - """ - ColumnMapping - """ # noqa: E501 - column: Optional[EdgeMappingSourceVertexMappingsInnerColumn] = None - var_property: Optional[StrictStr] = Field(default=None, description="must align with the schema", alias="property") - __properties: ClassVar[List[str]] = ["column", "property"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of ColumnMapping from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of column - if self.column: - _dict['column'] = self.column.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of ColumnMapping from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "column": EdgeMappingSourceVertexMappingsInnerColumn.from_dict(obj.get("column")) if obj.get("column") is not None else None, - "property": obj.get("property") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping.py deleted file mode 100644 index 1befeb93358d..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping.py +++ /dev/null @@ -1,125 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr -from hqps_client.models.column_mapping import ColumnMapping -from hqps_client.models.edge_mapping_destination_vertex_mappings_inner import EdgeMappingDestinationVertexMappingsInner -from hqps_client.models.edge_mapping_source_vertex_mappings_inner import EdgeMappingSourceVertexMappingsInner -from hqps_client.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class EdgeMapping(BaseModel): - """ - EdgeMapping - """ # noqa: E501 - type_triplet: Optional[EdgeMappingTypeTriplet] = None - inputs: Optional[List[StrictStr]] = None - source_vertex_mappings: Optional[List[EdgeMappingSourceVertexMappingsInner]] = None - destination_vertex_mappings: Optional[List[EdgeMappingDestinationVertexMappingsInner]] = None - column_mappings: Optional[List[ColumnMapping]] = None - __properties: ClassVar[List[str]] = ["type_triplet", "inputs", "source_vertex_mappings", "destination_vertex_mappings", "column_mappings"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of EdgeMapping from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of type_triplet - if self.type_triplet: - _dict['type_triplet'] = self.type_triplet.to_dict() - # override the default output from pydantic by calling `to_dict()` of each item in source_vertex_mappings (list) - _items = [] - if self.source_vertex_mappings: - for _item in self.source_vertex_mappings: - if _item: - _items.append(_item.to_dict()) - _dict['source_vertex_mappings'] = _items - # override the default output from pydantic by calling `to_dict()` of each item in destination_vertex_mappings (list) - _items = [] - if self.destination_vertex_mappings: - for _item in self.destination_vertex_mappings: - if _item: - _items.append(_item.to_dict()) - _dict['destination_vertex_mappings'] = _items - # override the default output from pydantic by calling `to_dict()` of each item in column_mappings (list) - _items = [] - if self.column_mappings: - for _item in self.column_mappings: - if _item: - _items.append(_item.to_dict()) - _dict['column_mappings'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of EdgeMapping from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "type_triplet": EdgeMappingTypeTriplet.from_dict(obj.get("type_triplet")) if obj.get("type_triplet") is not None else None, - "inputs": obj.get("inputs"), - "source_vertex_mappings": [EdgeMappingSourceVertexMappingsInner.from_dict(_item) for _item in obj.get("source_vertex_mappings")] if obj.get("source_vertex_mappings") is not None else None, - "destination_vertex_mappings": [EdgeMappingDestinationVertexMappingsInner.from_dict(_item) for _item in obj.get("destination_vertex_mappings")] if obj.get("destination_vertex_mappings") is not None else None, - "column_mappings": [ColumnMapping.from_dict(_item) for _item in obj.get("column_mappings")] if obj.get("column_mappings") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_destination_vertex_mappings_inner.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_destination_vertex_mappings_inner.py deleted file mode 100644 index 29a9fa32fd1a..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_destination_vertex_mappings_inner.py +++ /dev/null @@ -1,93 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel -from hqps_client.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class EdgeMappingDestinationVertexMappingsInner(BaseModel): - """ - Mapping column to the primary key of destination vertex - """ # noqa: E501 - column: Optional[EdgeMappingSourceVertexMappingsInnerColumn] = None - __properties: ClassVar[List[str]] = ["column"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of EdgeMappingDestinationVertexMappingsInner from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of column - if self.column: - _dict['column'] = self.column.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of EdgeMappingDestinationVertexMappingsInner from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "column": EdgeMappingSourceVertexMappingsInnerColumn.from_dict(obj.get("column")) if obj.get("column") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_source_vertex_mappings_inner.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_source_vertex_mappings_inner.py deleted file mode 100644 index 6c426c0a6b87..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_source_vertex_mappings_inner.py +++ /dev/null @@ -1,93 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel -from hqps_client.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class EdgeMappingSourceVertexMappingsInner(BaseModel): - """ - Mapping column to the primary key of source vertex - """ # noqa: E501 - column: Optional[EdgeMappingSourceVertexMappingsInnerColumn] = None - __properties: ClassVar[List[str]] = ["column"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of EdgeMappingSourceVertexMappingsInner from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of column - if self.column: - _dict['column'] = self.column.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of EdgeMappingSourceVertexMappingsInner from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "column": EdgeMappingSourceVertexMappingsInnerColumn.from_dict(obj.get("column")) if obj.get("column") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_source_vertex_mappings_inner_column.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_source_vertex_mappings_inner_column.py deleted file mode 100644 index 00bb6cda40a7..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_source_vertex_mappings_inner_column.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class EdgeMappingSourceVertexMappingsInnerColumn(BaseModel): - """ - EdgeMappingSourceVertexMappingsInnerColumn - """ # noqa: E501 - index: Optional[StrictInt] = None - name: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["index", "name"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of EdgeMappingSourceVertexMappingsInnerColumn from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of EdgeMappingSourceVertexMappingsInnerColumn from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "index": obj.get("index"), - "name": obj.get("name") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_type_triplet.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_type_triplet.py deleted file mode 100644 index 0a00c4171760..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_mapping_type_triplet.py +++ /dev/null @@ -1,93 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class EdgeMappingTypeTriplet(BaseModel): - """ - source label -> [edge label] -> destination label - """ # noqa: E501 - edge: Optional[StrictStr] = None - source_vertex: Optional[StrictStr] = None - destination_vertex: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["edge", "source_vertex", "destination_vertex"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of EdgeMappingTypeTriplet from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of EdgeMappingTypeTriplet from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "edge": obj.get("edge"), - "source_vertex": obj.get("source_vertex"), - "destination_vertex": obj.get("destination_vertex") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_type.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_type.py deleted file mode 100644 index bc010e123db6..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_type.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictInt, StrictStr -from hqps_client.models.edge_type_vertex_type_pair_relations_inner import EdgeTypeVertexTypePairRelationsInner -from hqps_client.models.model_property import ModelProperty -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class EdgeType(BaseModel): - """ - EdgeType - """ # noqa: E501 - type_id: Optional[StrictInt] = None - type_name: Optional[StrictStr] = None - vertex_type_pair_relations: Optional[List[EdgeTypeVertexTypePairRelationsInner]] = None - properties: Optional[List[ModelProperty]] = None - __properties: ClassVar[List[str]] = ["type_id", "type_name", "vertex_type_pair_relations", "properties"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of EdgeType from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each item in vertex_type_pair_relations (list) - _items = [] - if self.vertex_type_pair_relations: - for _item in self.vertex_type_pair_relations: - if _item: - _items.append(_item.to_dict()) - _dict['vertex_type_pair_relations'] = _items - # override the default output from pydantic by calling `to_dict()` of each item in properties (list) - _items = [] - if self.properties: - for _item in self.properties: - if _item: - _items.append(_item.to_dict()) - _dict['properties'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of EdgeType from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "type_id": obj.get("type_id"), - "type_name": obj.get("type_name"), - "vertex_type_pair_relations": [EdgeTypeVertexTypePairRelationsInner.from_dict(_item) for _item in obj.get("vertex_type_pair_relations")] if obj.get("vertex_type_pair_relations") is not None else None, - "properties": [ModelProperty.from_dict(_item) for _item in obj.get("properties")] if obj.get("properties") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_type_vertex_type_pair_relations_inner.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_type_vertex_type_pair_relations_inner.py deleted file mode 100644 index 6c141304a522..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_type_vertex_type_pair_relations_inner.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr, field_validator -from hqps_client.models.edge_type_vertex_type_pair_relations_inner_x_csr_params import EdgeTypeVertexTypePairRelationsInnerXCsrParams -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class EdgeTypeVertexTypePairRelationsInner(BaseModel): - """ - EdgeTypeVertexTypePairRelationsInner - """ # noqa: E501 - source_vertex: Optional[StrictStr] = None - destination_vertex: Optional[StrictStr] = None - relation: Optional[StrictStr] = None - x_csr_params: Optional[EdgeTypeVertexTypePairRelationsInnerXCsrParams] = None - __properties: ClassVar[List[str]] = ["source_vertex", "destination_vertex", "relation", "x_csr_params"] - - @field_validator('relation') - def relation_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('MANY_TO_MANY', 'ONE_TO_MANY', 'MANY_TO_ONE', 'ONE_TO_ONE'): - raise ValueError("must be one of enum values ('MANY_TO_MANY', 'ONE_TO_MANY', 'MANY_TO_ONE', 'ONE_TO_ONE')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of EdgeTypeVertexTypePairRelationsInner from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of x_csr_params - if self.x_csr_params: - _dict['x_csr_params'] = self.x_csr_params.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of EdgeTypeVertexTypePairRelationsInner from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "source_vertex": obj.get("source_vertex"), - "destination_vertex": obj.get("destination_vertex"), - "relation": obj.get("relation"), - "x_csr_params": EdgeTypeVertexTypePairRelationsInnerXCsrParams.from_dict(obj.get("x_csr_params")) if obj.get("x_csr_params") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py deleted file mode 100644 index c1bcdff67b4c..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr, field_validator -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class EdgeTypeVertexTypePairRelationsInnerXCsrParams(BaseModel): - """ - Used for storage optimization - """ # noqa: E501 - edge_storage_strategy: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["edge_storage_strategy"] - - @field_validator('edge_storage_strategy') - def edge_storage_strategy_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('ONLY_IN', 'ONLY_OUT', 'BOTH_OUT_IN'): - raise ValueError("must be one of enum values ('ONLY_IN', 'ONLY_OUT', 'BOTH_OUT_IN')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of EdgeTypeVertexTypePairRelationsInnerXCsrParams from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of EdgeTypeVertexTypePairRelationsInnerXCsrParams from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "edge_storage_strategy": obj.get("edge_storage_strategy") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/graph.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/graph.py deleted file mode 100644 index 496dd20e514a..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/graph.py +++ /dev/null @@ -1,114 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr, field_validator -from pydantic import Field -from hqps_client.models.graph_stored_procedures import GraphStoredProcedures -from hqps_client.models.model_schema import ModelSchema -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class Graph(BaseModel): - """ - Graph - """ # noqa: E501 - name: Optional[StrictStr] = None - store_type: Optional[StrictStr] = None - stored_procedures: Optional[GraphStoredProcedures] = None - var_schema: Optional[ModelSchema] = Field(default=None, alias="schema") - __properties: ClassVar[List[str]] = ["name", "store_type", "stored_procedures", "schema"] - - @field_validator('store_type') - def store_type_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('mutable_csr'): - raise ValueError("must be one of enum values ('mutable_csr')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of Graph from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of stored_procedures - if self.stored_procedures: - _dict['stored_procedures'] = self.stored_procedures.to_dict() - # override the default output from pydantic by calling `to_dict()` of var_schema - if self.var_schema: - _dict['schema'] = self.var_schema.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of Graph from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "name": obj.get("name"), - "store_type": obj.get("store_type"), - "stored_procedures": GraphStoredProcedures.from_dict(obj.get("stored_procedures")) if obj.get("stored_procedures") is not None else None, - "schema": ModelSchema.from_dict(obj.get("schema")) if obj.get("schema") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/graph_stored_procedures.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/graph_stored_procedures.py deleted file mode 100644 index 94f37ebebc1e..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/graph_stored_procedures.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr, field_validator -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class GraphStoredProcedures(BaseModel): - """ - GraphStoredProcedures - """ # noqa: E501 - directory: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["directory"] - - @field_validator('directory') - def directory_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('plugins'): - raise ValueError("must be one of enum values ('plugins')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of GraphStoredProcedures from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of GraphStoredProcedures from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "directory": obj.get("directory") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/job_response.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/job_response.py deleted file mode 100644 index 78292eeb21c5..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/job_response.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class JobResponse(BaseModel): - """ - JobResponse - """ # noqa: E501 - job_id: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["job_id"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of JobResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of JobResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "job_id": obj.get("job_id") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/job_status.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/job_status.py deleted file mode 100644 index 36a93a011e56..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/job_status.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictInt, StrictStr, field_validator -from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class JobStatus(BaseModel): - """ - JobStatus - """ # noqa: E501 - job_id: Optional[StrictStr] = None - type: Optional[StrictStr] = None - status: Optional[StrictStr] = None - start_time: Optional[StrictInt] = None - end_time: Optional[StrictInt] = None - log: Optional[StrictStr] = Field(default=None, description="URL or log string") - detail: Optional[Dict[str, Any]] = None - __properties: ClassVar[List[str]] = ["job_id", "type", "status", "start_time", "end_time", "log", "detail"] - - @field_validator('status') - def status_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('RUNNING', 'SUCCESS', 'FAILED', 'CANCELLED', 'WAITING'): - raise ValueError("must be one of enum values ('RUNNING', 'SUCCESS', 'FAILED', 'CANCELLED', 'WAITING')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of JobStatus from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of JobStatus from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "job_id": obj.get("job_id"), - "type": obj.get("type"), - "status": obj.get("status"), - "start_time": obj.get("start_time"), - "end_time": obj.get("end_time"), - "log": obj.get("log"), - "detail": obj.get("detail") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/model_property.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/model_property.py deleted file mode 100644 index 710d007f1527..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/model_property.py +++ /dev/null @@ -1,97 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictInt, StrictStr -from hqps_client.models.property_property_type import PropertyPropertyType -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class ModelProperty(BaseModel): - """ - ModelProperty - """ # noqa: E501 - property_id: Optional[StrictInt] = None - property_name: Optional[StrictStr] = None - property_type: Optional[PropertyPropertyType] = None - __properties: ClassVar[List[str]] = ["property_id", "property_name", "property_type"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of ModelProperty from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of property_type - if self.property_type: - _dict['property_type'] = self.property_type.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of ModelProperty from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "property_id": obj.get("property_id"), - "property_name": obj.get("property_name"), - "property_type": PropertyPropertyType.from_dict(obj.get("property_type")) if obj.get("property_type") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/model_schema.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/model_schema.py deleted file mode 100644 index ef00bffdca0d..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/model_schema.py +++ /dev/null @@ -1,107 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel -from hqps_client.models.edge_type import EdgeType -from hqps_client.models.vertex_type import VertexType -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class ModelSchema(BaseModel): - """ - ModelSchema - """ # noqa: E501 - vertex_types: Optional[List[VertexType]] = None - edge_types: Optional[List[EdgeType]] = None - __properties: ClassVar[List[str]] = ["vertex_types", "edge_types"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of ModelSchema from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each item in vertex_types (list) - _items = [] - if self.vertex_types: - for _item in self.vertex_types: - if _item: - _items.append(_item.to_dict()) - _dict['vertex_types'] = _items - # override the default output from pydantic by calling `to_dict()` of each item in edge_types (list) - _items = [] - if self.edge_types: - for _item in self.edge_types: - if _item: - _items.append(_item.to_dict()) - _dict['edge_types'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of ModelSchema from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "vertex_types": [VertexType.from_dict(_item) for _item in obj.get("vertex_types")] if obj.get("vertex_types") is not None else None, - "edge_types": [EdgeType.from_dict(_item) for _item in obj.get("edge_types")] if obj.get("edge_types") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/procedure.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/procedure.py deleted file mode 100644 index 9fee360e02a1..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/procedure.py +++ /dev/null @@ -1,130 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictBool, StrictStr, field_validator -from hqps_client.models.procedure_params_inner import ProcedureParamsInner -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class Procedure(BaseModel): - """ - Procedure - """ # noqa: E501 - name: Optional[StrictStr] = None - bound_graph: Optional[StrictStr] = None - description: Optional[StrictStr] = None - type: Optional[StrictStr] = None - query: Optional[StrictStr] = None - enable: Optional[StrictBool] = None - runnable: Optional[StrictBool] = None - params: Optional[List[ProcedureParamsInner]] = None - returns: Optional[List[ProcedureParamsInner]] = None - __properties: ClassVar[List[str]] = ["name", "bound_graph", "description", "type", "query", "enable", "runnable", "params", "returns"] - - @field_validator('type') - def type_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('cpp', 'cypher'): - raise ValueError("must be one of enum values ('cpp', 'cypher')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of Procedure from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each item in params (list) - _items = [] - if self.params: - for _item in self.params: - if _item: - _items.append(_item.to_dict()) - _dict['params'] = _items - # override the default output from pydantic by calling `to_dict()` of each item in returns (list) - _items = [] - if self.returns: - for _item in self.returns: - if _item: - _items.append(_item.to_dict()) - _dict['returns'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of Procedure from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "name": obj.get("name"), - "bound_graph": obj.get("bound_graph"), - "description": obj.get("description"), - "type": obj.get("type"), - "query": obj.get("query"), - "enable": obj.get("enable"), - "runnable": obj.get("runnable"), - "params": [ProcedureParamsInner.from_dict(_item) for _item in obj.get("params")] if obj.get("params") is not None else None, - "returns": [ProcedureParamsInner.from_dict(_item) for _item in obj.get("returns")] if obj.get("returns") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/procedure_params_inner.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/procedure_params_inner.py deleted file mode 100644 index 28d015335995..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/procedure_params_inner.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class ProcedureParamsInner(BaseModel): - """ - ProcedureParamsInner - """ # noqa: E501 - name: Optional[StrictStr] = None - type: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["name", "type"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of ProcedureParamsInner from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of ProcedureParamsInner from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "name": obj.get("name"), - "type": obj.get("type") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/property_property_type.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/property_property_type.py deleted file mode 100644 index 6cd10092f5dd..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/property_property_type.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr, field_validator -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class PropertyPropertyType(BaseModel): - """ - Property type - """ # noqa: E501 - primitive_type: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["primitive_type"] - - @field_validator('primitive_type') - def primitive_type_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('DT_DOUBLE', 'DT_STRING', 'DT_SIGNED_INT32', 'DT_SIGNED_INT64', 'DT_DATE32'): - raise ValueError("must be one of enum values ('DT_DOUBLE', 'DT_STRING', 'DT_SIGNED_INT32', 'DT_SIGNED_INT64', 'DT_DATE32')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of PropertyPropertyType from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of PropertyPropertyType from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "primitive_type": obj.get("primitive_type") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping.py deleted file mode 100644 index d533f83fc13d..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr -from hqps_client.models.edge_mapping import EdgeMapping -from hqps_client.models.schema_mapping_loading_config import SchemaMappingLoadingConfig -from hqps_client.models.vertex_mapping import VertexMapping -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class SchemaMapping(BaseModel): - """ - SchemaMapping - """ # noqa: E501 - graph: Optional[StrictStr] = None - loading_config: Optional[SchemaMappingLoadingConfig] = None - vertex_mappings: Optional[List[VertexMapping]] = None - edge_mappings: Optional[List[EdgeMapping]] = None - __properties: ClassVar[List[str]] = ["graph", "loading_config", "vertex_mappings", "edge_mappings"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of SchemaMapping from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of loading_config - if self.loading_config: - _dict['loading_config'] = self.loading_config.to_dict() - # override the default output from pydantic by calling `to_dict()` of each item in vertex_mappings (list) - _items = [] - if self.vertex_mappings: - for _item in self.vertex_mappings: - if _item: - _items.append(_item.to_dict()) - _dict['vertex_mappings'] = _items - # override the default output from pydantic by calling `to_dict()` of each item in edge_mappings (list) - _items = [] - if self.edge_mappings: - for _item in self.edge_mappings: - if _item: - _items.append(_item.to_dict()) - _dict['edge_mappings'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of SchemaMapping from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "graph": obj.get("graph"), - "loading_config": SchemaMappingLoadingConfig.from_dict(obj.get("loading_config")) if obj.get("loading_config") is not None else None, - "vertex_mappings": [VertexMapping.from_dict(_item) for _item in obj.get("vertex_mappings")] if obj.get("vertex_mappings") is not None else None, - "edge_mappings": [EdgeMapping.from_dict(_item) for _item in obj.get("edge_mappings")] if obj.get("edge_mappings") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping_loading_config.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping_loading_config.py deleted file mode 100644 index b3576ccfc82d..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping_loading_config.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr, field_validator -from hqps_client.models.schema_mapping_loading_config_data_source import SchemaMappingLoadingConfigDataSource -from hqps_client.models.schema_mapping_loading_config_format import SchemaMappingLoadingConfigFormat -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class SchemaMappingLoadingConfig(BaseModel): - """ - SchemaMappingLoadingConfig - """ # noqa: E501 - data_source: Optional[SchemaMappingLoadingConfigDataSource] = None - import_option: Optional[StrictStr] = None - format: Optional[SchemaMappingLoadingConfigFormat] = None - __properties: ClassVar[List[str]] = ["data_source", "import_option", "format"] - - @field_validator('import_option') - def import_option_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('init', 'overwrite'): - raise ValueError("must be one of enum values ('init', 'overwrite')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of SchemaMappingLoadingConfig from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of data_source - if self.data_source: - _dict['data_source'] = self.data_source.to_dict() - # override the default output from pydantic by calling `to_dict()` of format - if self.format: - _dict['format'] = self.format.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of SchemaMappingLoadingConfig from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "data_source": SchemaMappingLoadingConfigDataSource.from_dict(obj.get("data_source")) if obj.get("data_source") is not None else None, - "import_option": obj.get("import_option"), - "format": SchemaMappingLoadingConfigFormat.from_dict(obj.get("format")) if obj.get("format") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping_loading_config_data_source.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping_loading_config_data_source.py deleted file mode 100644 index c29059f34d0d..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping_loading_config_data_source.py +++ /dev/null @@ -1,99 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr, field_validator -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class SchemaMappingLoadingConfigDataSource(BaseModel): - """ - SchemaMappingLoadingConfigDataSource - """ # noqa: E501 - scheme: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["scheme"] - - @field_validator('scheme') - def scheme_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('file', 'oss', 's3', 'hdfs'): - raise ValueError("must be one of enum values ('file', 'oss', 's3', 'hdfs')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of SchemaMappingLoadingConfigDataSource from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of SchemaMappingLoadingConfigDataSource from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "scheme": obj.get("scheme") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping_loading_config_format.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping_loading_config_format.py deleted file mode 100644 index 5c5ad40d0f3f..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/schema_mapping_loading_config_format.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class SchemaMappingLoadingConfigFormat(BaseModel): - """ - SchemaMappingLoadingConfigFormat - """ # noqa: E501 - type: Optional[StrictStr] = None - metadata: Optional[Dict[str, Any]] = None - __properties: ClassVar[List[str]] = ["type", "metadata"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of SchemaMappingLoadingConfigFormat from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of SchemaMappingLoadingConfigFormat from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "type": obj.get("type"), - "metadata": obj.get("metadata") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/service.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/service.py deleted file mode 100644 index 3770bf7c8c0d..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/service.py +++ /dev/null @@ -1,89 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class Service(BaseModel): - """ - Service - """ # noqa: E501 - graph_name: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["graph_name"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of Service from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of Service from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "graph_name": obj.get("graph_name") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/service_status.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/service_status.py deleted file mode 100644 index 5493c3d0c419..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/service_status.py +++ /dev/null @@ -1,95 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class ServiceStatus(BaseModel): - """ - ServiceStatus - """ # noqa: E501 - status: Optional[StrictStr] = None - graph_name: Optional[StrictStr] = None - bolt_port: Optional[StrictInt] = None - hqps_port: Optional[StrictInt] = None - __properties: ClassVar[List[str]] = ["status", "graph_name", "bolt_port", "hqps_port"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of ServiceStatus from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of ServiceStatus from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "status": obj.get("status"), - "graph_name": obj.get("graph_name"), - "bolt_port": obj.get("bolt_port"), - "hqps_port": obj.get("hqps_port") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/vertex_mapping.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/vertex_mapping.py deleted file mode 100644 index 83de7b5976e3..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/vertex_mapping.py +++ /dev/null @@ -1,101 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictStr -from hqps_client.models.column_mapping import ColumnMapping -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class VertexMapping(BaseModel): - """ - VertexMapping - """ # noqa: E501 - type_name: Optional[StrictStr] = None - inputs: Optional[List[StrictStr]] = None - column_mappings: Optional[List[ColumnMapping]] = None - __properties: ClassVar[List[str]] = ["type_name", "inputs", "column_mappings"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of VertexMapping from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each item in column_mappings (list) - _items = [] - if self.column_mappings: - for _item in self.column_mappings: - if _item: - _items.append(_item.to_dict()) - _dict['column_mappings'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of VertexMapping from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "type_name": obj.get("type_name"), - "inputs": obj.get("inputs"), - "column_mappings": [ColumnMapping.from_dict(_item) for _item in obj.get("column_mappings")] if obj.get("column_mappings") is not None else None - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/vertex_type.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/vertex_type.py deleted file mode 100644 index bb796972ea79..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/models/vertex_type.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictInt, StrictStr -from hqps_client.models.model_property import ModelProperty -try: - from typing import Self -except ImportError: - from typing_extensions import Self - -class VertexType(BaseModel): - """ - VertexType - """ # noqa: E501 - type_id: Optional[StrictInt] = None - type_name: Optional[StrictStr] = None - properties: Optional[List[ModelProperty]] = None - primary_keys: Optional[List[StrictStr]] = None - __properties: ClassVar[List[str]] = ["type_id", "type_name", "properties", "primary_keys"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of VertexType from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - }, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each item in properties (list) - _items = [] - if self.properties: - for _item in self.properties: - if _item: - _items.append(_item.to_dict()) - _dict['properties'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of VertexType from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "type_id": obj.get("type_id"), - "type_name": obj.get("type_name"), - "properties": [ModelProperty.from_dict(_item) for _item in obj.get("properties")] if obj.get("properties") is not None else None, - "primary_keys": obj.get("primary_keys") - }) - return _obj - - diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/py.typed b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/py.typed deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/rest.py b/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/rest.py deleted file mode 100644 index ccdfd8fd6c01..000000000000 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/rest.py +++ /dev/null @@ -1,268 +0,0 @@ -# coding: utf-8 - -""" - GraphScope Interactive API - - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import io -import json -import re -import ssl - -import urllib3 - -from hqps_client.exceptions import ApiException, ApiValueError - -SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} -RESTResponseType = urllib3.HTTPResponse - - -def is_socks_proxy_url(url): - if url is None: - return False - split_section = url.split("://") - if len(split_section) < 2: - return False - else: - return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES - - -class RESTResponse(io.IOBase): - - def __init__(self, resp) -> None: - self.response = resp - self.status = resp.status - self.reason = resp.reason - self.data = None - - def read(self): - if self.data is None: - self.data = self.response.data - return self.data - - def getheaders(self): - """Returns a dictionary of the response headers.""" - return self.response.headers - - def getheader(self, name, default=None): - """Returns a given response header.""" - return self.response.headers.get(name, default) - - -class RESTClientObject: - - def __init__(self, configuration) -> None: - # urllib3.PoolManager will pass all kw parameters to connectionpool - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 - # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 - # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 - - # cert_reqs - if configuration.verify_ssl: - cert_reqs = ssl.CERT_REQUIRED - else: - cert_reqs = ssl.CERT_NONE - - addition_pool_args = {} - if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = ( - configuration.assert_hostname - ) - - if configuration.retries is not None: - addition_pool_args['retries'] = configuration.retries - - if configuration.tls_server_name: - addition_pool_args['server_hostname'] = configuration.tls_server_name - - - if configuration.socket_options is not None: - addition_pool_args['socket_options'] = configuration.socket_options - - if configuration.connection_pool_maxsize is not None: - addition_pool_args['maxsize'] = configuration.connection_pool_maxsize - - # https pool manager - if configuration.proxy: - if is_socks_proxy_url(configuration.proxy): - from urllib3.contrib.socks import SOCKSProxyManager - self.pool_manager = SOCKSProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - headers=configuration.proxy_headers, - **addition_pool_args - ) - else: - self.pool_manager = urllib3.ProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - proxy_headers=configuration.proxy_headers, - **addition_pool_args - ) - else: - self.pool_manager = urllib3.PoolManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) - - def request( - self, - method, - url, - headers=None, - body=None, - post_params=None, - _request_timeout=None - ): - """Perform requests. - - :param method: http request method - :param url: http request url - :param headers: http request headers - :param body: request json body, for `application/json` - :param post_params: request post parameters, - `application/x-www-form-urlencoded` - and `multipart/form-data` - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - """ - method = method.upper() - assert method in [ - 'GET', - 'HEAD', - 'DELETE', - 'POST', - 'PUT', - 'PATCH', - 'OPTIONS' - ] - - if post_params and body: - raise ApiValueError( - "body parameter cannot be used with post_params parameter." - ) - - post_params = post_params or {} - headers = headers or {} - - timeout = None - if _request_timeout: - if isinstance(_request_timeout, (int, float)): - timeout = urllib3.Timeout(total=_request_timeout) - elif ( - isinstance(_request_timeout, tuple) - and len(_request_timeout) == 2 - ): - timeout = urllib3.Timeout( - connect=_request_timeout[0], - read=_request_timeout[1] - ) - - try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - - # no content type provided or payload is json - content_type = headers.get('Content-Type') - if ( - not content_type - or re.search('json', content_type, re.IGNORECASE) - ): - request_body = None - if body is not None: - request_body = json.dumps(body) - r = self.pool_manager.request( - method, - url, - body=request_body, - timeout=timeout, - headers=headers, - preload_content=False - ) - elif content_type == 'application/x-www-form-urlencoded': - r = self.pool_manager.request( - method, - url, - fields=post_params, - encode_multipart=False, - timeout=timeout, - headers=headers, - preload_content=False - ) - elif content_type == 'multipart/form-data': - # must del headers['Content-Type'], or the correct - # Content-Type which generated by urllib3 will be - # overwritten. - del headers['Content-Type'] - r = self.pool_manager.request( - method, - url, - fields=post_params, - encode_multipart=True, - timeout=timeout, - headers=headers, - preload_content=False - ) - # Pass a `string` parameter directly in the body to support - # other content types than Json when `body` argument is - # provided in serialized form - elif isinstance(body, str) or isinstance(body, bytes): - request_body = body - r = self.pool_manager.request( - method, - url, - body=request_body, - timeout=timeout, - headers=headers, - preload_content=False - ) - elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): - request_body = "true" if body else "false" - r = self.pool_manager.request( - method, - url, - body=request_body, - preload_content=False, - timeout=timeout, - headers=headers) - else: - # Cannot generate the request from given parameters - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - raise ApiException(status=0, reason=msg) - # For `GET`, `HEAD` - else: - r = self.pool_manager.request( - method, - url, - fields={}, - timeout=timeout, - headers=headers, - preload_content=False - ) - except urllib3.exceptions.SSLError as e: - msg = "\n".join([type(e).__name__, str(e)]) - raise ApiException(status=0, reason=msg) - - return RESTResponse(r) diff --git a/flex/coordinator/gs_flex_coordinator/models/__init__.py b/flex/coordinator/gs_flex_coordinator/models/__init__.py deleted file mode 100644 index 9bb175ee9366..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/__init__.py +++ /dev/null @@ -1,50 +0,0 @@ -# flake8: noqa -# import models into model package -from gs_flex_coordinator.models.alert_message import AlertMessage -from gs_flex_coordinator.models.alert_receiver import AlertReceiver -from gs_flex_coordinator.models.alert_rule import AlertRule -from gs_flex_coordinator.models.column_mapping import ColumnMapping -from gs_flex_coordinator.models.connection import Connection -from gs_flex_coordinator.models.connection_status import ConnectionStatus -from gs_flex_coordinator.models.data_source import DataSource -from gs_flex_coordinator.models.deployment_info import DeploymentInfo -from gs_flex_coordinator.models.deployment_info_graphs_info_value import DeploymentInfoGraphsInfoValue -from gs_flex_coordinator.models.deployment_status import DeploymentStatus -from gs_flex_coordinator.models.edge_data_source import EdgeDataSource -from gs_flex_coordinator.models.edge_mapping import EdgeMapping -from gs_flex_coordinator.models.edge_mapping_destination_vertex_mappings_inner import EdgeMappingDestinationVertexMappingsInner -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner import EdgeMappingSourceVertexMappingsInner -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn -from gs_flex_coordinator.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet -from gs_flex_coordinator.models.edge_type import EdgeType -from gs_flex_coordinator.models.edge_type_vertex_type_pair_relations_inner import EdgeTypeVertexTypePairRelationsInner -from gs_flex_coordinator.models.edge_type_vertex_type_pair_relations_inner_x_csr_params import EdgeTypeVertexTypePairRelationsInnerXCsrParams -from gs_flex_coordinator.models.graph import Graph -from gs_flex_coordinator.models.graph_stored_procedures import GraphStoredProcedures -from gs_flex_coordinator.models.groot_dataloading_job_config import GrootDataloadingJobConfig -from gs_flex_coordinator.models.groot_dataloading_job_config_edges_inner import GrootDataloadingJobConfigEdgesInner -from gs_flex_coordinator.models.groot_edge_type import GrootEdgeType -from gs_flex_coordinator.models.groot_edge_type_relations_inner import GrootEdgeTypeRelationsInner -from gs_flex_coordinator.models.groot_graph import GrootGraph -from gs_flex_coordinator.models.groot_graph_gremlin_interface import GrootGraphGremlinInterface -from gs_flex_coordinator.models.groot_property import GrootProperty -from gs_flex_coordinator.models.groot_schema import GrootSchema -from gs_flex_coordinator.models.groot_vertex_type import GrootVertexType -from gs_flex_coordinator.models.job_status import JobStatus -from gs_flex_coordinator.models.model_property import ModelProperty -from gs_flex_coordinator.models.model_schema import ModelSchema -from gs_flex_coordinator.models.node_status import NodeStatus -from gs_flex_coordinator.models.procedure import Procedure -from gs_flex_coordinator.models.procedure_params_inner import ProcedureParamsInner -from gs_flex_coordinator.models.property_property_type import PropertyPropertyType -from gs_flex_coordinator.models.schema_mapping import SchemaMapping -from gs_flex_coordinator.models.schema_mapping_loading_config import SchemaMappingLoadingConfig -from gs_flex_coordinator.models.schema_mapping_loading_config_data_source import SchemaMappingLoadingConfigDataSource -from gs_flex_coordinator.models.schema_mapping_loading_config_format import SchemaMappingLoadingConfigFormat -from gs_flex_coordinator.models.service_status import ServiceStatus -from gs_flex_coordinator.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints -from gs_flex_coordinator.models.start_service_request import StartServiceRequest -from gs_flex_coordinator.models.update_alert_messages_request import UpdateAlertMessagesRequest -from gs_flex_coordinator.models.vertex_data_source import VertexDataSource -from gs_flex_coordinator.models.vertex_mapping import VertexMapping -from gs_flex_coordinator.models.vertex_type import VertexType diff --git a/flex/coordinator/gs_flex_coordinator/models/alert_receiver.py b/flex/coordinator/gs_flex_coordinator/models/alert_receiver.py deleted file mode 100644 index e566c5cc8853..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/alert_receiver.py +++ /dev/null @@ -1,227 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class AlertReceiver(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, type=None, receiver_id=None, webhook_url=None, at_user_ids=None, is_at_all=None, enable=None, message=None): # noqa: E501 - """AlertReceiver - a model defined in OpenAPI - - :param type: The type of this AlertReceiver. # noqa: E501 - :type type: str - :param receiver_id: The receiver_id of this AlertReceiver. # noqa: E501 - :type receiver_id: str - :param webhook_url: The webhook_url of this AlertReceiver. # noqa: E501 - :type webhook_url: str - :param at_user_ids: The at_user_ids of this AlertReceiver. # noqa: E501 - :type at_user_ids: List[str] - :param is_at_all: The is_at_all of this AlertReceiver. # noqa: E501 - :type is_at_all: bool - :param enable: The enable of this AlertReceiver. # noqa: E501 - :type enable: bool - :param message: The message of this AlertReceiver. # noqa: E501 - :type message: str - """ - self.openapi_types = { - 'type': str, - 'receiver_id': str, - 'webhook_url': str, - 'at_user_ids': List[str], - 'is_at_all': bool, - 'enable': bool, - 'message': str - } - - self.attribute_map = { - 'type': 'type', - 'receiver_id': 'receiver_id', - 'webhook_url': 'webhook_url', - 'at_user_ids': 'at_user_ids', - 'is_at_all': 'is_at_all', - 'enable': 'enable', - 'message': 'message' - } - - self._type = type - self._receiver_id = receiver_id - self._webhook_url = webhook_url - self._at_user_ids = at_user_ids - self._is_at_all = is_at_all - self._enable = enable - self._message = message - - @classmethod - def from_dict(cls, dikt) -> 'AlertReceiver': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The AlertReceiver of this AlertReceiver. # noqa: E501 - :rtype: AlertReceiver - """ - return util.deserialize_model(dikt, cls) - - @property - def type(self) -> str: - """Gets the type of this AlertReceiver. - - - :return: The type of this AlertReceiver. - :rtype: str - """ - return self._type - - @type.setter - def type(self, type: str): - """Sets the type of this AlertReceiver. - - - :param type: The type of this AlertReceiver. - :type type: str - """ - allowed_values = ["webhook"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" - .format(type, allowed_values) - ) - - self._type = type - - @property - def receiver_id(self) -> str: - """Gets the receiver_id of this AlertReceiver. - - Generated in server side # noqa: E501 - - :return: The receiver_id of this AlertReceiver. - :rtype: str - """ - return self._receiver_id - - @receiver_id.setter - def receiver_id(self, receiver_id: str): - """Sets the receiver_id of this AlertReceiver. - - Generated in server side # noqa: E501 - - :param receiver_id: The receiver_id of this AlertReceiver. - :type receiver_id: str - """ - - self._receiver_id = receiver_id - - @property - def webhook_url(self) -> str: - """Gets the webhook_url of this AlertReceiver. - - - :return: The webhook_url of this AlertReceiver. - :rtype: str - """ - return self._webhook_url - - @webhook_url.setter - def webhook_url(self, webhook_url: str): - """Sets the webhook_url of this AlertReceiver. - - - :param webhook_url: The webhook_url of this AlertReceiver. - :type webhook_url: str - """ - - self._webhook_url = webhook_url - - @property - def at_user_ids(self) -> List[str]: - """Gets the at_user_ids of this AlertReceiver. - - - :return: The at_user_ids of this AlertReceiver. - :rtype: List[str] - """ - return self._at_user_ids - - @at_user_ids.setter - def at_user_ids(self, at_user_ids: List[str]): - """Sets the at_user_ids of this AlertReceiver. - - - :param at_user_ids: The at_user_ids of this AlertReceiver. - :type at_user_ids: List[str] - """ - - self._at_user_ids = at_user_ids - - @property - def is_at_all(self) -> bool: - """Gets the is_at_all of this AlertReceiver. - - - :return: The is_at_all of this AlertReceiver. - :rtype: bool - """ - return self._is_at_all - - @is_at_all.setter - def is_at_all(self, is_at_all: bool): - """Sets the is_at_all of this AlertReceiver. - - - :param is_at_all: The is_at_all of this AlertReceiver. - :type is_at_all: bool - """ - - self._is_at_all = is_at_all - - @property - def enable(self) -> bool: - """Gets the enable of this AlertReceiver. - - - :return: The enable of this AlertReceiver. - :rtype: bool - """ - return self._enable - - @enable.setter - def enable(self, enable: bool): - """Sets the enable of this AlertReceiver. - - - :param enable: The enable of this AlertReceiver. - :type enable: bool - """ - - self._enable = enable - - @property - def message(self) -> str: - """Gets the message of this AlertReceiver. - - error message generated in server side # noqa: E501 - - :return: The message of this AlertReceiver. - :rtype: str - """ - return self._message - - @message.setter - def message(self, message: str): - """Sets the message of this AlertReceiver. - - error message generated in server side # noqa: E501 - - :param message: The message of this AlertReceiver. - :type message: str - """ - - self._message = message diff --git a/flex/coordinator/gs_flex_coordinator/models/connection.py b/flex/coordinator/gs_flex_coordinator/models/connection.py deleted file mode 100644 index 778489af33ae..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/connection.py +++ /dev/null @@ -1,61 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class Connection(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, coordinator_endpoint=None): # noqa: E501 - """Connection - a model defined in OpenAPI - - :param coordinator_endpoint: The coordinator_endpoint of this Connection. # noqa: E501 - :type coordinator_endpoint: str - """ - self.openapi_types = { - 'coordinator_endpoint': str - } - - self.attribute_map = { - 'coordinator_endpoint': 'coordinator_endpoint' - } - - self._coordinator_endpoint = coordinator_endpoint - - @classmethod - def from_dict(cls, dikt) -> 'Connection': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Connection of this Connection. # noqa: E501 - :rtype: Connection - """ - return util.deserialize_model(dikt, cls) - - @property - def coordinator_endpoint(self) -> str: - """Gets the coordinator_endpoint of this Connection. - - - :return: The coordinator_endpoint of this Connection. - :rtype: str - """ - return self._coordinator_endpoint - - @coordinator_endpoint.setter - def coordinator_endpoint(self, coordinator_endpoint: str): - """Sets the coordinator_endpoint of this Connection. - - - :param coordinator_endpoint: The coordinator_endpoint of this Connection. - :type coordinator_endpoint: str - """ - - self._coordinator_endpoint = coordinator_endpoint diff --git a/flex/coordinator/gs_flex_coordinator/models/connection_status.py b/flex/coordinator/gs_flex_coordinator/models/connection_status.py deleted file mode 100644 index d7aefe26b09d..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/connection_status.py +++ /dev/null @@ -1,99 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class ConnectionStatus(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, status=None, solution=None): # noqa: E501 - """ConnectionStatus - a model defined in OpenAPI - - :param status: The status of this ConnectionStatus. # noqa: E501 - :type status: str - :param solution: The solution of this ConnectionStatus. # noqa: E501 - :type solution: str - """ - self.openapi_types = { - 'status': str, - 'solution': str - } - - self.attribute_map = { - 'status': 'status', - 'solution': 'solution' - } - - self._status = status - self._solution = solution - - @classmethod - def from_dict(cls, dikt) -> 'ConnectionStatus': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The ConnectionStatus of this ConnectionStatus. # noqa: E501 - :rtype: ConnectionStatus - """ - return util.deserialize_model(dikt, cls) - - @property - def status(self) -> str: - """Gets the status of this ConnectionStatus. - - - :return: The status of this ConnectionStatus. - :rtype: str - """ - return self._status - - @status.setter - def status(self, status: str): - """Sets the status of this ConnectionStatus. - - - :param status: The status of this ConnectionStatus. - :type status: str - """ - allowed_values = ["CONNECTED"] # noqa: E501 - if status not in allowed_values: - raise ValueError( - "Invalid value for `status` ({0}), must be one of {1}" - .format(status, allowed_values) - ) - - self._status = status - - @property - def solution(self) -> str: - """Gets the solution of this ConnectionStatus. - - - :return: The solution of this ConnectionStatus. - :rtype: str - """ - return self._solution - - @solution.setter - def solution(self, solution: str): - """Sets the solution of this ConnectionStatus. - - - :param solution: The solution of this ConnectionStatus. - :type solution: str - """ - allowed_values = ["INTERACTIVE", "GRAPHSCOPE_INSIGHT"] # noqa: E501 - if solution not in allowed_values: - raise ValueError( - "Invalid value for `solution` ({0}), must be one of {1}" - .format(solution, allowed_values) - ) - - self._solution = solution diff --git a/flex/coordinator/gs_flex_coordinator/models/data_source.py b/flex/coordinator/gs_flex_coordinator/models/data_source.py deleted file mode 100644 index ddf377f2a8cb..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/data_source.py +++ /dev/null @@ -1,91 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.edge_data_source import EdgeDataSource -from gs_flex_coordinator.models.vertex_data_source import VertexDataSource -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.edge_data_source import EdgeDataSource # noqa: E501 -from gs_flex_coordinator.models.vertex_data_source import VertexDataSource # noqa: E501 - -class DataSource(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, vertices_datasource=None, edges_datasource=None): # noqa: E501 - """DataSource - a model defined in OpenAPI - - :param vertices_datasource: The vertices_datasource of this DataSource. # noqa: E501 - :type vertices_datasource: List[VertexDataSource] - :param edges_datasource: The edges_datasource of this DataSource. # noqa: E501 - :type edges_datasource: List[EdgeDataSource] - """ - self.openapi_types = { - 'vertices_datasource': List[VertexDataSource], - 'edges_datasource': List[EdgeDataSource] - } - - self.attribute_map = { - 'vertices_datasource': 'vertices_datasource', - 'edges_datasource': 'edges_datasource' - } - - self._vertices_datasource = vertices_datasource - self._edges_datasource = edges_datasource - - @classmethod - def from_dict(cls, dikt) -> 'DataSource': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The DataSource of this DataSource. # noqa: E501 - :rtype: DataSource - """ - return util.deserialize_model(dikt, cls) - - @property - def vertices_datasource(self) -> List[VertexDataSource]: - """Gets the vertices_datasource of this DataSource. - - - :return: The vertices_datasource of this DataSource. - :rtype: List[VertexDataSource] - """ - return self._vertices_datasource - - @vertices_datasource.setter - def vertices_datasource(self, vertices_datasource: List[VertexDataSource]): - """Sets the vertices_datasource of this DataSource. - - - :param vertices_datasource: The vertices_datasource of this DataSource. - :type vertices_datasource: List[VertexDataSource] - """ - - self._vertices_datasource = vertices_datasource - - @property - def edges_datasource(self) -> List[EdgeDataSource]: - """Gets the edges_datasource of this DataSource. - - - :return: The edges_datasource of this DataSource. - :rtype: List[EdgeDataSource] - """ - return self._edges_datasource - - @edges_datasource.setter - def edges_datasource(self, edges_datasource: List[EdgeDataSource]): - """Sets the edges_datasource of this DataSource. - - - :param edges_datasource: The edges_datasource of this DataSource. - :type edges_datasource: List[EdgeDataSource] - """ - - self._edges_datasource = edges_datasource diff --git a/flex/coordinator/gs_flex_coordinator/models/deployment_info.py b/flex/coordinator/gs_flex_coordinator/models/deployment_info.py deleted file mode 100644 index be3e14174773..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/deployment_info.py +++ /dev/null @@ -1,205 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.deployment_info_graphs_info_value import DeploymentInfoGraphsInfoValue -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.deployment_info_graphs_info_value import DeploymentInfoGraphsInfoValue # noqa: E501 - -class DeploymentInfo(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, name=None, cluster_type=None, version=None, solution=None, creation_time=None, graphs_info=None): # noqa: E501 - """DeploymentInfo - a model defined in OpenAPI - - :param name: The name of this DeploymentInfo. # noqa: E501 - :type name: str - :param cluster_type: The cluster_type of this DeploymentInfo. # noqa: E501 - :type cluster_type: str - :param version: The version of this DeploymentInfo. # noqa: E501 - :type version: str - :param solution: The solution of this DeploymentInfo. # noqa: E501 - :type solution: str - :param creation_time: The creation_time of this DeploymentInfo. # noqa: E501 - :type creation_time: str - :param graphs_info: The graphs_info of this DeploymentInfo. # noqa: E501 - :type graphs_info: Dict[str, DeploymentInfoGraphsInfoValue] - """ - self.openapi_types = { - 'name': str, - 'cluster_type': str, - 'version': str, - 'solution': str, - 'creation_time': str, - 'graphs_info': Dict[str, DeploymentInfoGraphsInfoValue] - } - - self.attribute_map = { - 'name': 'name', - 'cluster_type': 'cluster_type', - 'version': 'version', - 'solution': 'solution', - 'creation_time': 'creation_time', - 'graphs_info': 'graphs_info' - } - - self._name = name - self._cluster_type = cluster_type - self._version = version - self._solution = solution - self._creation_time = creation_time - self._graphs_info = graphs_info - - @classmethod - def from_dict(cls, dikt) -> 'DeploymentInfo': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The DeploymentInfo of this DeploymentInfo. # noqa: E501 - :rtype: DeploymentInfo - """ - return util.deserialize_model(dikt, cls) - - @property - def name(self) -> str: - """Gets the name of this DeploymentInfo. - - - :return: The name of this DeploymentInfo. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this DeploymentInfo. - - - :param name: The name of this DeploymentInfo. - :type name: str - """ - - self._name = name - - @property - def cluster_type(self) -> str: - """Gets the cluster_type of this DeploymentInfo. - - - :return: The cluster_type of this DeploymentInfo. - :rtype: str - """ - return self._cluster_type - - @cluster_type.setter - def cluster_type(self, cluster_type: str): - """Sets the cluster_type of this DeploymentInfo. - - - :param cluster_type: The cluster_type of this DeploymentInfo. - :type cluster_type: str - """ - allowed_values = ["HOSTS", "KUBERNETES"] # noqa: E501 - if cluster_type not in allowed_values: - raise ValueError( - "Invalid value for `cluster_type` ({0}), must be one of {1}" - .format(cluster_type, allowed_values) - ) - - self._cluster_type = cluster_type - - @property - def version(self) -> str: - """Gets the version of this DeploymentInfo. - - - :return: The version of this DeploymentInfo. - :rtype: str - """ - return self._version - - @version.setter - def version(self, version: str): - """Sets the version of this DeploymentInfo. - - - :param version: The version of this DeploymentInfo. - :type version: str - """ - - self._version = version - - @property - def solution(self) -> str: - """Gets the solution of this DeploymentInfo. - - - :return: The solution of this DeploymentInfo. - :rtype: str - """ - return self._solution - - @solution.setter - def solution(self, solution: str): - """Sets the solution of this DeploymentInfo. - - - :param solution: The solution of this DeploymentInfo. - :type solution: str - """ - allowed_values = ["INTERACTIVE", "GRAPHSCOPE_INSIGHT"] # noqa: E501 - if solution not in allowed_values: - raise ValueError( - "Invalid value for `solution` ({0}), must be one of {1}" - .format(solution, allowed_values) - ) - - self._solution = solution - - @property - def creation_time(self) -> str: - """Gets the creation_time of this DeploymentInfo. - - - :return: The creation_time of this DeploymentInfo. - :rtype: str - """ - return self._creation_time - - @creation_time.setter - def creation_time(self, creation_time: str): - """Sets the creation_time of this DeploymentInfo. - - - :param creation_time: The creation_time of this DeploymentInfo. - :type creation_time: str - """ - - self._creation_time = creation_time - - @property - def graphs_info(self) -> Dict[str, DeploymentInfoGraphsInfoValue]: - """Gets the graphs_info of this DeploymentInfo. - - - :return: The graphs_info of this DeploymentInfo. - :rtype: Dict[str, DeploymentInfoGraphsInfoValue] - """ - return self._graphs_info - - @graphs_info.setter - def graphs_info(self, graphs_info: Dict[str, DeploymentInfoGraphsInfoValue]): - """Sets the graphs_info of this DeploymentInfo. - - - :param graphs_info: The graphs_info of this DeploymentInfo. - :type graphs_info: Dict[str, DeploymentInfoGraphsInfoValue] - """ - - self._graphs_info = graphs_info diff --git a/flex/coordinator/gs_flex_coordinator/models/deployment_info_graphs_info_value.py b/flex/coordinator/gs_flex_coordinator/models/deployment_info_graphs_info_value.py deleted file mode 100644 index 639d1c5d593e..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/deployment_info_graphs_info_value.py +++ /dev/null @@ -1,139 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class DeploymentInfoGraphsInfoValue(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, name=None, creation_time=None, update_time=None, last_dataloading_time=None): # noqa: E501 - """DeploymentInfoGraphsInfoValue - a model defined in OpenAPI - - :param name: The name of this DeploymentInfoGraphsInfoValue. # noqa: E501 - :type name: str - :param creation_time: The creation_time of this DeploymentInfoGraphsInfoValue. # noqa: E501 - :type creation_time: str - :param update_time: The update_time of this DeploymentInfoGraphsInfoValue. # noqa: E501 - :type update_time: str - :param last_dataloading_time: The last_dataloading_time of this DeploymentInfoGraphsInfoValue. # noqa: E501 - :type last_dataloading_time: str - """ - self.openapi_types = { - 'name': str, - 'creation_time': str, - 'update_time': str, - 'last_dataloading_time': str - } - - self.attribute_map = { - 'name': 'name', - 'creation_time': 'creation_time', - 'update_time': 'update_time', - 'last_dataloading_time': 'last_dataloading_time' - } - - self._name = name - self._creation_time = creation_time - self._update_time = update_time - self._last_dataloading_time = last_dataloading_time - - @classmethod - def from_dict(cls, dikt) -> 'DeploymentInfoGraphsInfoValue': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The DeploymentInfo_graphs_info_value of this DeploymentInfoGraphsInfoValue. # noqa: E501 - :rtype: DeploymentInfoGraphsInfoValue - """ - return util.deserialize_model(dikt, cls) - - @property - def name(self) -> str: - """Gets the name of this DeploymentInfoGraphsInfoValue. - - - :return: The name of this DeploymentInfoGraphsInfoValue. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this DeploymentInfoGraphsInfoValue. - - - :param name: The name of this DeploymentInfoGraphsInfoValue. - :type name: str - """ - - self._name = name - - @property - def creation_time(self) -> str: - """Gets the creation_time of this DeploymentInfoGraphsInfoValue. - - - :return: The creation_time of this DeploymentInfoGraphsInfoValue. - :rtype: str - """ - return self._creation_time - - @creation_time.setter - def creation_time(self, creation_time: str): - """Sets the creation_time of this DeploymentInfoGraphsInfoValue. - - - :param creation_time: The creation_time of this DeploymentInfoGraphsInfoValue. - :type creation_time: str - """ - - self._creation_time = creation_time - - @property - def update_time(self) -> str: - """Gets the update_time of this DeploymentInfoGraphsInfoValue. - - - :return: The update_time of this DeploymentInfoGraphsInfoValue. - :rtype: str - """ - return self._update_time - - @update_time.setter - def update_time(self, update_time: str): - """Sets the update_time of this DeploymentInfoGraphsInfoValue. - - - :param update_time: The update_time of this DeploymentInfoGraphsInfoValue. - :type update_time: str - """ - - self._update_time = update_time - - @property - def last_dataloading_time(self) -> str: - """Gets the last_dataloading_time of this DeploymentInfoGraphsInfoValue. - - - :return: The last_dataloading_time of this DeploymentInfoGraphsInfoValue. - :rtype: str - """ - return self._last_dataloading_time - - @last_dataloading_time.setter - def last_dataloading_time(self, last_dataloading_time: str): - """Sets the last_dataloading_time of this DeploymentInfoGraphsInfoValue. - - - :param last_dataloading_time: The last_dataloading_time of this DeploymentInfoGraphsInfoValue. - :type last_dataloading_time: str - """ - - self._last_dataloading_time = last_dataloading_time diff --git a/flex/coordinator/gs_flex_coordinator/models/deployment_status.py b/flex/coordinator/gs_flex_coordinator/models/deployment_status.py deleted file mode 100644 index 19b0b9136599..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/deployment_status.py +++ /dev/null @@ -1,325 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class DeploymentStatus(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, name=None, container=None, image=None, labels=None, node=None, status=None, restart_count=None, cpu_value=None, memory_value=None, timestamp=None, creation_time=None): # noqa: E501 - """DeploymentStatus - a model defined in OpenAPI - - :param name: The name of this DeploymentStatus. # noqa: E501 - :type name: str - :param container: The container of this DeploymentStatus. # noqa: E501 - :type container: List[str] - :param image: The image of this DeploymentStatus. # noqa: E501 - :type image: List[str] - :param labels: The labels of this DeploymentStatus. # noqa: E501 - :type labels: List[str] - :param node: The node of this DeploymentStatus. # noqa: E501 - :type node: str - :param status: The status of this DeploymentStatus. # noqa: E501 - :type status: str - :param restart_count: The restart_count of this DeploymentStatus. # noqa: E501 - :type restart_count: int - :param cpu_value: The cpu_value of this DeploymentStatus. # noqa: E501 - :type cpu_value: int - :param memory_value: The memory_value of this DeploymentStatus. # noqa: E501 - :type memory_value: int - :param timestamp: The timestamp of this DeploymentStatus. # noqa: E501 - :type timestamp: str - :param creation_time: The creation_time of this DeploymentStatus. # noqa: E501 - :type creation_time: str - """ - self.openapi_types = { - 'name': str, - 'container': List[str], - 'image': List[str], - 'labels': List[str], - 'node': str, - 'status': str, - 'restart_count': int, - 'cpu_value': int, - 'memory_value': int, - 'timestamp': str, - 'creation_time': str - } - - self.attribute_map = { - 'name': 'name', - 'container': 'container', - 'image': 'image', - 'labels': 'labels', - 'node': 'node', - 'status': 'status', - 'restart_count': 'restart_count', - 'cpu_value': 'cpu_value', - 'memory_value': 'memory_value', - 'timestamp': 'timestamp', - 'creation_time': 'creation_time' - } - - self._name = name - self._container = container - self._image = image - self._labels = labels - self._node = node - self._status = status - self._restart_count = restart_count - self._cpu_value = cpu_value - self._memory_value = memory_value - self._timestamp = timestamp - self._creation_time = creation_time - - @classmethod - def from_dict(cls, dikt) -> 'DeploymentStatus': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The DeploymentStatus of this DeploymentStatus. # noqa: E501 - :rtype: DeploymentStatus - """ - return util.deserialize_model(dikt, cls) - - @property - def name(self) -> str: - """Gets the name of this DeploymentStatus. - - - :return: The name of this DeploymentStatus. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this DeploymentStatus. - - - :param name: The name of this DeploymentStatus. - :type name: str - """ - - self._name = name - - @property - def container(self) -> List[str]: - """Gets the container of this DeploymentStatus. - - - :return: The container of this DeploymentStatus. - :rtype: List[str] - """ - return self._container - - @container.setter - def container(self, container: List[str]): - """Sets the container of this DeploymentStatus. - - - :param container: The container of this DeploymentStatus. - :type container: List[str] - """ - - self._container = container - - @property - def image(self) -> List[str]: - """Gets the image of this DeploymentStatus. - - - :return: The image of this DeploymentStatus. - :rtype: List[str] - """ - return self._image - - @image.setter - def image(self, image: List[str]): - """Sets the image of this DeploymentStatus. - - - :param image: The image of this DeploymentStatus. - :type image: List[str] - """ - - self._image = image - - @property - def labels(self) -> List[str]: - """Gets the labels of this DeploymentStatus. - - - :return: The labels of this DeploymentStatus. - :rtype: List[str] - """ - return self._labels - - @labels.setter - def labels(self, labels: List[str]): - """Sets the labels of this DeploymentStatus. - - - :param labels: The labels of this DeploymentStatus. - :type labels: List[str] - """ - - self._labels = labels - - @property - def node(self) -> str: - """Gets the node of this DeploymentStatus. - - - :return: The node of this DeploymentStatus. - :rtype: str - """ - return self._node - - @node.setter - def node(self, node: str): - """Sets the node of this DeploymentStatus. - - - :param node: The node of this DeploymentStatus. - :type node: str - """ - - self._node = node - - @property - def status(self) -> str: - """Gets the status of this DeploymentStatus. - - - :return: The status of this DeploymentStatus. - :rtype: str - """ - return self._status - - @status.setter - def status(self, status: str): - """Sets the status of this DeploymentStatus. - - - :param status: The status of this DeploymentStatus. - :type status: str - """ - - self._status = status - - @property - def restart_count(self) -> int: - """Gets the restart_count of this DeploymentStatus. - - - :return: The restart_count of this DeploymentStatus. - :rtype: int - """ - return self._restart_count - - @restart_count.setter - def restart_count(self, restart_count: int): - """Sets the restart_count of this DeploymentStatus. - - - :param restart_count: The restart_count of this DeploymentStatus. - :type restart_count: int - """ - - self._restart_count = restart_count - - @property - def cpu_value(self) -> int: - """Gets the cpu_value of this DeploymentStatus. - - cpu value in millicore # noqa: E501 - - :return: The cpu_value of this DeploymentStatus. - :rtype: int - """ - return self._cpu_value - - @cpu_value.setter - def cpu_value(self, cpu_value: int): - """Sets the cpu_value of this DeploymentStatus. - - cpu value in millicore # noqa: E501 - - :param cpu_value: The cpu_value of this DeploymentStatus. - :type cpu_value: int - """ - - self._cpu_value = cpu_value - - @property - def memory_value(self) -> int: - """Gets the memory_value of this DeploymentStatus. - - memory value in megabytes # noqa: E501 - - :return: The memory_value of this DeploymentStatus. - :rtype: int - """ - return self._memory_value - - @memory_value.setter - def memory_value(self, memory_value: int): - """Sets the memory_value of this DeploymentStatus. - - memory value in megabytes # noqa: E501 - - :param memory_value: The memory_value of this DeploymentStatus. - :type memory_value: int - """ - - self._memory_value = memory_value - - @property - def timestamp(self) -> str: - """Gets the timestamp of this DeploymentStatus. - - - :return: The timestamp of this DeploymentStatus. - :rtype: str - """ - return self._timestamp - - @timestamp.setter - def timestamp(self, timestamp: str): - """Sets the timestamp of this DeploymentStatus. - - - :param timestamp: The timestamp of this DeploymentStatus. - :type timestamp: str - """ - - self._timestamp = timestamp - - @property - def creation_time(self) -> str: - """Gets the creation_time of this DeploymentStatus. - - - :return: The creation_time of this DeploymentStatus. - :rtype: str - """ - return self._creation_time - - @creation_time.setter - def creation_time(self, creation_time: str): - """Sets the creation_time of this DeploymentStatus. - - - :param creation_time: The creation_time of this DeploymentStatus. - :type creation_time: str - """ - - self._creation_time = creation_time diff --git a/flex/coordinator/gs_flex_coordinator/models/edge_data_source.py b/flex/coordinator/gs_flex_coordinator/models/edge_data_source.py deleted file mode 100644 index 4fca6c37a4a7..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/edge_data_source.py +++ /dev/null @@ -1,249 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class EdgeDataSource(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, data_source=None, type_name=None, source_vertex=None, destination_vertex=None, location=None, source_pk_column_map=None, destination_pk_column_map=None, property_mapping=None): # noqa: E501 - """EdgeDataSource - a model defined in OpenAPI - - :param data_source: The data_source of this EdgeDataSource. # noqa: E501 - :type data_source: str - :param type_name: The type_name of this EdgeDataSource. # noqa: E501 - :type type_name: str - :param source_vertex: The source_vertex of this EdgeDataSource. # noqa: E501 - :type source_vertex: str - :param destination_vertex: The destination_vertex of this EdgeDataSource. # noqa: E501 - :type destination_vertex: str - :param location: The location of this EdgeDataSource. # noqa: E501 - :type location: str - :param source_pk_column_map: The source_pk_column_map of this EdgeDataSource. # noqa: E501 - :type source_pk_column_map: Dict[str, object] - :param destination_pk_column_map: The destination_pk_column_map of this EdgeDataSource. # noqa: E501 - :type destination_pk_column_map: Dict[str, object] - :param property_mapping: The property_mapping of this EdgeDataSource. # noqa: E501 - :type property_mapping: Dict[str, object] - """ - self.openapi_types = { - 'data_source': str, - 'type_name': str, - 'source_vertex': str, - 'destination_vertex': str, - 'location': str, - 'source_pk_column_map': Dict[str, object], - 'destination_pk_column_map': Dict[str, object], - 'property_mapping': Dict[str, object] - } - - self.attribute_map = { - 'data_source': 'data_source', - 'type_name': 'type_name', - 'source_vertex': 'source_vertex', - 'destination_vertex': 'destination_vertex', - 'location': 'location', - 'source_pk_column_map': 'source_pk_column_map', - 'destination_pk_column_map': 'destination_pk_column_map', - 'property_mapping': 'property_mapping' - } - - self._data_source = data_source - self._type_name = type_name - self._source_vertex = source_vertex - self._destination_vertex = destination_vertex - self._location = location - self._source_pk_column_map = source_pk_column_map - self._destination_pk_column_map = destination_pk_column_map - self._property_mapping = property_mapping - - @classmethod - def from_dict(cls, dikt) -> 'EdgeDataSource': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The EdgeDataSource of this EdgeDataSource. # noqa: E501 - :rtype: EdgeDataSource - """ - return util.deserialize_model(dikt, cls) - - @property - def data_source(self) -> str: - """Gets the data_source of this EdgeDataSource. - - - :return: The data_source of this EdgeDataSource. - :rtype: str - """ - return self._data_source - - @data_source.setter - def data_source(self, data_source: str): - """Sets the data_source of this EdgeDataSource. - - - :param data_source: The data_source of this EdgeDataSource. - :type data_source: str - """ - allowed_values = ["ODPS", "FILE"] # noqa: E501 - if data_source not in allowed_values: - raise ValueError( - "Invalid value for `data_source` ({0}), must be one of {1}" - .format(data_source, allowed_values) - ) - - self._data_source = data_source - - @property - def type_name(self) -> str: - """Gets the type_name of this EdgeDataSource. - - - :return: The type_name of this EdgeDataSource. - :rtype: str - """ - return self._type_name - - @type_name.setter - def type_name(self, type_name: str): - """Sets the type_name of this EdgeDataSource. - - - :param type_name: The type_name of this EdgeDataSource. - :type type_name: str - """ - - self._type_name = type_name - - @property - def source_vertex(self) -> str: - """Gets the source_vertex of this EdgeDataSource. - - - :return: The source_vertex of this EdgeDataSource. - :rtype: str - """ - return self._source_vertex - - @source_vertex.setter - def source_vertex(self, source_vertex: str): - """Sets the source_vertex of this EdgeDataSource. - - - :param source_vertex: The source_vertex of this EdgeDataSource. - :type source_vertex: str - """ - - self._source_vertex = source_vertex - - @property - def destination_vertex(self) -> str: - """Gets the destination_vertex of this EdgeDataSource. - - - :return: The destination_vertex of this EdgeDataSource. - :rtype: str - """ - return self._destination_vertex - - @destination_vertex.setter - def destination_vertex(self, destination_vertex: str): - """Sets the destination_vertex of this EdgeDataSource. - - - :param destination_vertex: The destination_vertex of this EdgeDataSource. - :type destination_vertex: str - """ - - self._destination_vertex = destination_vertex - - @property - def location(self) -> str: - """Gets the location of this EdgeDataSource. - - - :return: The location of this EdgeDataSource. - :rtype: str - """ - return self._location - - @location.setter - def location(self, location: str): - """Sets the location of this EdgeDataSource. - - - :param location: The location of this EdgeDataSource. - :type location: str - """ - - self._location = location - - @property - def source_pk_column_map(self) -> Dict[str, object]: - """Gets the source_pk_column_map of this EdgeDataSource. - - - :return: The source_pk_column_map of this EdgeDataSource. - :rtype: Dict[str, object] - """ - return self._source_pk_column_map - - @source_pk_column_map.setter - def source_pk_column_map(self, source_pk_column_map: Dict[str, object]): - """Sets the source_pk_column_map of this EdgeDataSource. - - - :param source_pk_column_map: The source_pk_column_map of this EdgeDataSource. - :type source_pk_column_map: Dict[str, object] - """ - - self._source_pk_column_map = source_pk_column_map - - @property - def destination_pk_column_map(self) -> Dict[str, object]: - """Gets the destination_pk_column_map of this EdgeDataSource. - - - :return: The destination_pk_column_map of this EdgeDataSource. - :rtype: Dict[str, object] - """ - return self._destination_pk_column_map - - @destination_pk_column_map.setter - def destination_pk_column_map(self, destination_pk_column_map: Dict[str, object]): - """Sets the destination_pk_column_map of this EdgeDataSource. - - - :param destination_pk_column_map: The destination_pk_column_map of this EdgeDataSource. - :type destination_pk_column_map: Dict[str, object] - """ - - self._destination_pk_column_map = destination_pk_column_map - - @property - def property_mapping(self) -> Dict[str, object]: - """Gets the property_mapping of this EdgeDataSource. - - - :return: The property_mapping of this EdgeDataSource. - :rtype: Dict[str, object] - """ - return self._property_mapping - - @property_mapping.setter - def property_mapping(self, property_mapping: Dict[str, object]): - """Sets the property_mapping of this EdgeDataSource. - - - :param property_mapping: The property_mapping of this EdgeDataSource. - :type property_mapping: Dict[str, object] - """ - - self._property_mapping = property_mapping diff --git a/flex/coordinator/gs_flex_coordinator/models/edge_mapping_destination_vertex_mappings_inner.py b/flex/coordinator/gs_flex_coordinator/models/edge_mapping_destination_vertex_mappings_inner.py deleted file mode 100644 index 0caa3d499d91..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/edge_mapping_destination_vertex_mappings_inner.py +++ /dev/null @@ -1,63 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn # noqa: E501 - -class EdgeMappingDestinationVertexMappingsInner(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, column=None): # noqa: E501 - """EdgeMappingDestinationVertexMappingsInner - a model defined in OpenAPI - - :param column: The column of this EdgeMappingDestinationVertexMappingsInner. # noqa: E501 - :type column: EdgeMappingSourceVertexMappingsInnerColumn - """ - self.openapi_types = { - 'column': EdgeMappingSourceVertexMappingsInnerColumn - } - - self.attribute_map = { - 'column': 'column' - } - - self._column = column - - @classmethod - def from_dict(cls, dikt) -> 'EdgeMappingDestinationVertexMappingsInner': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The EdgeMapping_destination_vertex_mappings_inner of this EdgeMappingDestinationVertexMappingsInner. # noqa: E501 - :rtype: EdgeMappingDestinationVertexMappingsInner - """ - return util.deserialize_model(dikt, cls) - - @property - def column(self) -> EdgeMappingSourceVertexMappingsInnerColumn: - """Gets the column of this EdgeMappingDestinationVertexMappingsInner. - - - :return: The column of this EdgeMappingDestinationVertexMappingsInner. - :rtype: EdgeMappingSourceVertexMappingsInnerColumn - """ - return self._column - - @column.setter - def column(self, column: EdgeMappingSourceVertexMappingsInnerColumn): - """Sets the column of this EdgeMappingDestinationVertexMappingsInner. - - - :param column: The column of this EdgeMappingDestinationVertexMappingsInner. - :type column: EdgeMappingSourceVertexMappingsInnerColumn - """ - - self._column = column diff --git a/flex/coordinator/gs_flex_coordinator/models/edge_mapping_source_vertex_mappings_inner.py b/flex/coordinator/gs_flex_coordinator/models/edge_mapping_source_vertex_mappings_inner.py deleted file mode 100644 index 4650c8f66a73..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/edge_mapping_source_vertex_mappings_inner.py +++ /dev/null @@ -1,63 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn # noqa: E501 - -class EdgeMappingSourceVertexMappingsInner(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, column=None): # noqa: E501 - """EdgeMappingSourceVertexMappingsInner - a model defined in OpenAPI - - :param column: The column of this EdgeMappingSourceVertexMappingsInner. # noqa: E501 - :type column: EdgeMappingSourceVertexMappingsInnerColumn - """ - self.openapi_types = { - 'column': EdgeMappingSourceVertexMappingsInnerColumn - } - - self.attribute_map = { - 'column': 'column' - } - - self._column = column - - @classmethod - def from_dict(cls, dikt) -> 'EdgeMappingSourceVertexMappingsInner': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The EdgeMapping_source_vertex_mappings_inner of this EdgeMappingSourceVertexMappingsInner. # noqa: E501 - :rtype: EdgeMappingSourceVertexMappingsInner - """ - return util.deserialize_model(dikt, cls) - - @property - def column(self) -> EdgeMappingSourceVertexMappingsInnerColumn: - """Gets the column of this EdgeMappingSourceVertexMappingsInner. - - - :return: The column of this EdgeMappingSourceVertexMappingsInner. - :rtype: EdgeMappingSourceVertexMappingsInnerColumn - """ - return self._column - - @column.setter - def column(self, column: EdgeMappingSourceVertexMappingsInnerColumn): - """Sets the column of this EdgeMappingSourceVertexMappingsInner. - - - :param column: The column of this EdgeMappingSourceVertexMappingsInner. - :type column: EdgeMappingSourceVertexMappingsInnerColumn - """ - - self._column = column diff --git a/flex/coordinator/gs_flex_coordinator/models/edge_mapping_source_vertex_mappings_inner_column.py b/flex/coordinator/gs_flex_coordinator/models/edge_mapping_source_vertex_mappings_inner_column.py deleted file mode 100644 index bb3d0093e3d6..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/edge_mapping_source_vertex_mappings_inner_column.py +++ /dev/null @@ -1,87 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class EdgeMappingSourceVertexMappingsInnerColumn(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, index=None, name=None): # noqa: E501 - """EdgeMappingSourceVertexMappingsInnerColumn - a model defined in OpenAPI - - :param index: The index of this EdgeMappingSourceVertexMappingsInnerColumn. # noqa: E501 - :type index: int - :param name: The name of this EdgeMappingSourceVertexMappingsInnerColumn. # noqa: E501 - :type name: str - """ - self.openapi_types = { - 'index': int, - 'name': str - } - - self.attribute_map = { - 'index': 'index', - 'name': 'name' - } - - self._index = index - self._name = name - - @classmethod - def from_dict(cls, dikt) -> 'EdgeMappingSourceVertexMappingsInnerColumn': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The EdgeMapping_source_vertex_mappings_inner_column of this EdgeMappingSourceVertexMappingsInnerColumn. # noqa: E501 - :rtype: EdgeMappingSourceVertexMappingsInnerColumn - """ - return util.deserialize_model(dikt, cls) - - @property - def index(self) -> int: - """Gets the index of this EdgeMappingSourceVertexMappingsInnerColumn. - - - :return: The index of this EdgeMappingSourceVertexMappingsInnerColumn. - :rtype: int - """ - return self._index - - @index.setter - def index(self, index: int): - """Sets the index of this EdgeMappingSourceVertexMappingsInnerColumn. - - - :param index: The index of this EdgeMappingSourceVertexMappingsInnerColumn. - :type index: int - """ - - self._index = index - - @property - def name(self) -> str: - """Gets the name of this EdgeMappingSourceVertexMappingsInnerColumn. - - - :return: The name of this EdgeMappingSourceVertexMappingsInnerColumn. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this EdgeMappingSourceVertexMappingsInnerColumn. - - - :param name: The name of this EdgeMappingSourceVertexMappingsInnerColumn. - :type name: str - """ - - self._name = name diff --git a/flex/coordinator/gs_flex_coordinator/models/edge_type.py b/flex/coordinator/gs_flex_coordinator/models/edge_type.py deleted file mode 100644 index d0ed8f513746..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/edge_type.py +++ /dev/null @@ -1,143 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.edge_type_vertex_type_pair_relations_inner import EdgeTypeVertexTypePairRelationsInner -from gs_flex_coordinator.models.model_property import ModelProperty -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.edge_type_vertex_type_pair_relations_inner import EdgeTypeVertexTypePairRelationsInner # noqa: E501 -from gs_flex_coordinator.models.model_property import ModelProperty # noqa: E501 - -class EdgeType(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, type_id=None, type_name=None, vertex_type_pair_relations=None, properties=None): # noqa: E501 - """EdgeType - a model defined in OpenAPI - - :param type_id: The type_id of this EdgeType. # noqa: E501 - :type type_id: int - :param type_name: The type_name of this EdgeType. # noqa: E501 - :type type_name: str - :param vertex_type_pair_relations: The vertex_type_pair_relations of this EdgeType. # noqa: E501 - :type vertex_type_pair_relations: List[EdgeTypeVertexTypePairRelationsInner] - :param properties: The properties of this EdgeType. # noqa: E501 - :type properties: List[ModelProperty] - """ - self.openapi_types = { - 'type_id': int, - 'type_name': str, - 'vertex_type_pair_relations': List[EdgeTypeVertexTypePairRelationsInner], - 'properties': List[ModelProperty] - } - - self.attribute_map = { - 'type_id': 'type_id', - 'type_name': 'type_name', - 'vertex_type_pair_relations': 'vertex_type_pair_relations', - 'properties': 'properties' - } - - self._type_id = type_id - self._type_name = type_name - self._vertex_type_pair_relations = vertex_type_pair_relations - self._properties = properties - - @classmethod - def from_dict(cls, dikt) -> 'EdgeType': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The EdgeType of this EdgeType. # noqa: E501 - :rtype: EdgeType - """ - return util.deserialize_model(dikt, cls) - - @property - def type_id(self) -> int: - """Gets the type_id of this EdgeType. - - - :return: The type_id of this EdgeType. - :rtype: int - """ - return self._type_id - - @type_id.setter - def type_id(self, type_id: int): - """Sets the type_id of this EdgeType. - - - :param type_id: The type_id of this EdgeType. - :type type_id: int - """ - - self._type_id = type_id - - @property - def type_name(self) -> str: - """Gets the type_name of this EdgeType. - - - :return: The type_name of this EdgeType. - :rtype: str - """ - return self._type_name - - @type_name.setter - def type_name(self, type_name: str): - """Sets the type_name of this EdgeType. - - - :param type_name: The type_name of this EdgeType. - :type type_name: str - """ - - self._type_name = type_name - - @property - def vertex_type_pair_relations(self) -> List[EdgeTypeVertexTypePairRelationsInner]: - """Gets the vertex_type_pair_relations of this EdgeType. - - - :return: The vertex_type_pair_relations of this EdgeType. - :rtype: List[EdgeTypeVertexTypePairRelationsInner] - """ - return self._vertex_type_pair_relations - - @vertex_type_pair_relations.setter - def vertex_type_pair_relations(self, vertex_type_pair_relations: List[EdgeTypeVertexTypePairRelationsInner]): - """Sets the vertex_type_pair_relations of this EdgeType. - - - :param vertex_type_pair_relations: The vertex_type_pair_relations of this EdgeType. - :type vertex_type_pair_relations: List[EdgeTypeVertexTypePairRelationsInner] - """ - - self._vertex_type_pair_relations = vertex_type_pair_relations - - @property - def properties(self) -> List[ModelProperty]: - """Gets the properties of this EdgeType. - - - :return: The properties of this EdgeType. - :rtype: List[ModelProperty] - """ - return self._properties - - @properties.setter - def properties(self, properties: List[ModelProperty]): - """Sets the properties of this EdgeType. - - - :param properties: The properties of this EdgeType. - :type properties: List[ModelProperty] - """ - - self._properties = properties diff --git a/flex/coordinator/gs_flex_coordinator/models/edge_type_vertex_type_pair_relations_inner.py b/flex/coordinator/gs_flex_coordinator/models/edge_type_vertex_type_pair_relations_inner.py deleted file mode 100644 index 9bf34c9c37fb..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/edge_type_vertex_type_pair_relations_inner.py +++ /dev/null @@ -1,147 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.edge_type_vertex_type_pair_relations_inner_x_csr_params import EdgeTypeVertexTypePairRelationsInnerXCsrParams -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.edge_type_vertex_type_pair_relations_inner_x_csr_params import EdgeTypeVertexTypePairRelationsInnerXCsrParams # noqa: E501 - -class EdgeTypeVertexTypePairRelationsInner(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, source_vertex=None, destination_vertex=None, relation=None, x_csr_params=None): # noqa: E501 - """EdgeTypeVertexTypePairRelationsInner - a model defined in OpenAPI - - :param source_vertex: The source_vertex of this EdgeTypeVertexTypePairRelationsInner. # noqa: E501 - :type source_vertex: str - :param destination_vertex: The destination_vertex of this EdgeTypeVertexTypePairRelationsInner. # noqa: E501 - :type destination_vertex: str - :param relation: The relation of this EdgeTypeVertexTypePairRelationsInner. # noqa: E501 - :type relation: str - :param x_csr_params: The x_csr_params of this EdgeTypeVertexTypePairRelationsInner. # noqa: E501 - :type x_csr_params: EdgeTypeVertexTypePairRelationsInnerXCsrParams - """ - self.openapi_types = { - 'source_vertex': str, - 'destination_vertex': str, - 'relation': str, - 'x_csr_params': EdgeTypeVertexTypePairRelationsInnerXCsrParams - } - - self.attribute_map = { - 'source_vertex': 'source_vertex', - 'destination_vertex': 'destination_vertex', - 'relation': 'relation', - 'x_csr_params': 'x_csr_params' - } - - self._source_vertex = source_vertex - self._destination_vertex = destination_vertex - self._relation = relation - self._x_csr_params = x_csr_params - - @classmethod - def from_dict(cls, dikt) -> 'EdgeTypeVertexTypePairRelationsInner': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The EdgeType_vertex_type_pair_relations_inner of this EdgeTypeVertexTypePairRelationsInner. # noqa: E501 - :rtype: EdgeTypeVertexTypePairRelationsInner - """ - return util.deserialize_model(dikt, cls) - - @property - def source_vertex(self) -> str: - """Gets the source_vertex of this EdgeTypeVertexTypePairRelationsInner. - - - :return: The source_vertex of this EdgeTypeVertexTypePairRelationsInner. - :rtype: str - """ - return self._source_vertex - - @source_vertex.setter - def source_vertex(self, source_vertex: str): - """Sets the source_vertex of this EdgeTypeVertexTypePairRelationsInner. - - - :param source_vertex: The source_vertex of this EdgeTypeVertexTypePairRelationsInner. - :type source_vertex: str - """ - - self._source_vertex = source_vertex - - @property - def destination_vertex(self) -> str: - """Gets the destination_vertex of this EdgeTypeVertexTypePairRelationsInner. - - - :return: The destination_vertex of this EdgeTypeVertexTypePairRelationsInner. - :rtype: str - """ - return self._destination_vertex - - @destination_vertex.setter - def destination_vertex(self, destination_vertex: str): - """Sets the destination_vertex of this EdgeTypeVertexTypePairRelationsInner. - - - :param destination_vertex: The destination_vertex of this EdgeTypeVertexTypePairRelationsInner. - :type destination_vertex: str - """ - - self._destination_vertex = destination_vertex - - @property - def relation(self) -> str: - """Gets the relation of this EdgeTypeVertexTypePairRelationsInner. - - - :return: The relation of this EdgeTypeVertexTypePairRelationsInner. - :rtype: str - """ - return self._relation - - @relation.setter - def relation(self, relation: str): - """Sets the relation of this EdgeTypeVertexTypePairRelationsInner. - - - :param relation: The relation of this EdgeTypeVertexTypePairRelationsInner. - :type relation: str - """ - allowed_values = ["MANY_TO_MANY", "ONE_TO_MANY", "MANY_TO_ONE", "ONE_TO_ONE"] # noqa: E501 - if relation not in allowed_values: - raise ValueError( - "Invalid value for `relation` ({0}), must be one of {1}" - .format(relation, allowed_values) - ) - - self._relation = relation - - @property - def x_csr_params(self) -> EdgeTypeVertexTypePairRelationsInnerXCsrParams: - """Gets the x_csr_params of this EdgeTypeVertexTypePairRelationsInner. - - - :return: The x_csr_params of this EdgeTypeVertexTypePairRelationsInner. - :rtype: EdgeTypeVertexTypePairRelationsInnerXCsrParams - """ - return self._x_csr_params - - @x_csr_params.setter - def x_csr_params(self, x_csr_params: EdgeTypeVertexTypePairRelationsInnerXCsrParams): - """Sets the x_csr_params of this EdgeTypeVertexTypePairRelationsInner. - - - :param x_csr_params: The x_csr_params of this EdgeTypeVertexTypePairRelationsInner. - :type x_csr_params: EdgeTypeVertexTypePairRelationsInnerXCsrParams - """ - - self._x_csr_params = x_csr_params diff --git a/flex/coordinator/gs_flex_coordinator/models/graph.py b/flex/coordinator/gs_flex_coordinator/models/graph.py deleted file mode 100644 index dcd156952761..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/graph.py +++ /dev/null @@ -1,149 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.graph_stored_procedures import GraphStoredProcedures -from gs_flex_coordinator.models.model_schema import ModelSchema -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.graph_stored_procedures import GraphStoredProcedures # noqa: E501 -from gs_flex_coordinator.models.model_schema import ModelSchema # noqa: E501 - -class Graph(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, name=None, store_type=None, stored_procedures=None, _schema=None): # noqa: E501 - """Graph - a model defined in OpenAPI - - :param name: The name of this Graph. # noqa: E501 - :type name: str - :param store_type: The store_type of this Graph. # noqa: E501 - :type store_type: str - :param stored_procedures: The stored_procedures of this Graph. # noqa: E501 - :type stored_procedures: GraphStoredProcedures - :param _schema: The _schema of this Graph. # noqa: E501 - :type _schema: ModelSchema - """ - self.openapi_types = { - 'name': str, - 'store_type': str, - 'stored_procedures': GraphStoredProcedures, - '_schema': ModelSchema - } - - self.attribute_map = { - 'name': 'name', - 'store_type': 'store_type', - 'stored_procedures': 'stored_procedures', - '_schema': 'schema' - } - - self._name = name - self._store_type = store_type - self._stored_procedures = stored_procedures - self.__schema = _schema - - @classmethod - def from_dict(cls, dikt) -> 'Graph': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Graph of this Graph. # noqa: E501 - :rtype: Graph - """ - return util.deserialize_model(dikt, cls) - - @property - def name(self) -> str: - """Gets the name of this Graph. - - - :return: The name of this Graph. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this Graph. - - - :param name: The name of this Graph. - :type name: str - """ - - self._name = name - - @property - def store_type(self) -> str: - """Gets the store_type of this Graph. - - - :return: The store_type of this Graph. - :rtype: str - """ - return self._store_type - - @store_type.setter - def store_type(self, store_type: str): - """Sets the store_type of this Graph. - - - :param store_type: The store_type of this Graph. - :type store_type: str - """ - allowed_values = ["mutable_csr"] # noqa: E501 - if store_type not in allowed_values: - raise ValueError( - "Invalid value for `store_type` ({0}), must be one of {1}" - .format(store_type, allowed_values) - ) - - self._store_type = store_type - - @property - def stored_procedures(self) -> GraphStoredProcedures: - """Gets the stored_procedures of this Graph. - - - :return: The stored_procedures of this Graph. - :rtype: GraphStoredProcedures - """ - return self._stored_procedures - - @stored_procedures.setter - def stored_procedures(self, stored_procedures: GraphStoredProcedures): - """Sets the stored_procedures of this Graph. - - - :param stored_procedures: The stored_procedures of this Graph. - :type stored_procedures: GraphStoredProcedures - """ - - self._stored_procedures = stored_procedures - - @property - def _schema(self) -> ModelSchema: - """Gets the _schema of this Graph. - - - :return: The _schema of this Graph. - :rtype: ModelSchema - """ - return self.__schema - - @_schema.setter - def _schema(self, _schema: ModelSchema): - """Sets the _schema of this Graph. - - - :param _schema: The _schema of this Graph. - :type _schema: ModelSchema - """ - - self.__schema = _schema diff --git a/flex/coordinator/gs_flex_coordinator/models/graph_stored_procedures.py b/flex/coordinator/gs_flex_coordinator/models/graph_stored_procedures.py deleted file mode 100644 index 4d8cb869a0f8..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/graph_stored_procedures.py +++ /dev/null @@ -1,67 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class GraphStoredProcedures(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, directory=None): # noqa: E501 - """GraphStoredProcedures - a model defined in OpenAPI - - :param directory: The directory of this GraphStoredProcedures. # noqa: E501 - :type directory: str - """ - self.openapi_types = { - 'directory': str - } - - self.attribute_map = { - 'directory': 'directory' - } - - self._directory = directory - - @classmethod - def from_dict(cls, dikt) -> 'GraphStoredProcedures': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Graph_stored_procedures of this GraphStoredProcedures. # noqa: E501 - :rtype: GraphStoredProcedures - """ - return util.deserialize_model(dikt, cls) - - @property - def directory(self) -> str: - """Gets the directory of this GraphStoredProcedures. - - - :return: The directory of this GraphStoredProcedures. - :rtype: str - """ - return self._directory - - @directory.setter - def directory(self, directory: str): - """Sets the directory of this GraphStoredProcedures. - - - :param directory: The directory of this GraphStoredProcedures. - :type directory: str - """ - allowed_values = ["plugins"] # noqa: E501 - if directory not in allowed_values: - raise ValueError( - "Invalid value for `directory` ({0}), must be one of {1}" - .format(directory, allowed_values) - ) - - self._directory = directory diff --git a/flex/coordinator/gs_flex_coordinator/models/groot_dataloading_job_config.py b/flex/coordinator/gs_flex_coordinator/models/groot_dataloading_job_config.py deleted file mode 100644 index d7a788264e72..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/groot_dataloading_job_config.py +++ /dev/null @@ -1,149 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.groot_dataloading_job_config_edges_inner import GrootDataloadingJobConfigEdgesInner -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.groot_dataloading_job_config_edges_inner import GrootDataloadingJobConfigEdgesInner # noqa: E501 - -class GrootDataloadingJobConfig(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, vertices=None, edges=None, schedule=None, repeat=None): # noqa: E501 - """GrootDataloadingJobConfig - a model defined in OpenAPI - - :param vertices: The vertices of this GrootDataloadingJobConfig. # noqa: E501 - :type vertices: List[str] - :param edges: The edges of this GrootDataloadingJobConfig. # noqa: E501 - :type edges: List[GrootDataloadingJobConfigEdgesInner] - :param schedule: The schedule of this GrootDataloadingJobConfig. # noqa: E501 - :type schedule: str - :param repeat: The repeat of this GrootDataloadingJobConfig. # noqa: E501 - :type repeat: str - """ - self.openapi_types = { - 'vertices': List[str], - 'edges': List[GrootDataloadingJobConfigEdgesInner], - 'schedule': str, - 'repeat': str - } - - self.attribute_map = { - 'vertices': 'vertices', - 'edges': 'edges', - 'schedule': 'schedule', - 'repeat': 'repeat' - } - - self._vertices = vertices - self._edges = edges - self._schedule = schedule - self._repeat = repeat - - @classmethod - def from_dict(cls, dikt) -> 'GrootDataloadingJobConfig': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The GrootDataloadingJobConfig of this GrootDataloadingJobConfig. # noqa: E501 - :rtype: GrootDataloadingJobConfig - """ - return util.deserialize_model(dikt, cls) - - @property - def vertices(self) -> List[str]: - """Gets the vertices of this GrootDataloadingJobConfig. - - - :return: The vertices of this GrootDataloadingJobConfig. - :rtype: List[str] - """ - return self._vertices - - @vertices.setter - def vertices(self, vertices: List[str]): - """Sets the vertices of this GrootDataloadingJobConfig. - - - :param vertices: The vertices of this GrootDataloadingJobConfig. - :type vertices: List[str] - """ - - self._vertices = vertices - - @property - def edges(self) -> List[GrootDataloadingJobConfigEdgesInner]: - """Gets the edges of this GrootDataloadingJobConfig. - - - :return: The edges of this GrootDataloadingJobConfig. - :rtype: List[GrootDataloadingJobConfigEdgesInner] - """ - return self._edges - - @edges.setter - def edges(self, edges: List[GrootDataloadingJobConfigEdgesInner]): - """Sets the edges of this GrootDataloadingJobConfig. - - - :param edges: The edges of this GrootDataloadingJobConfig. - :type edges: List[GrootDataloadingJobConfigEdgesInner] - """ - - self._edges = edges - - @property - def schedule(self) -> str: - """Gets the schedule of this GrootDataloadingJobConfig. - - format with '2023-02-21 11:56:30' # noqa: E501 - - :return: The schedule of this GrootDataloadingJobConfig. - :rtype: str - """ - return self._schedule - - @schedule.setter - def schedule(self, schedule: str): - """Sets the schedule of this GrootDataloadingJobConfig. - - format with '2023-02-21 11:56:30' # noqa: E501 - - :param schedule: The schedule of this GrootDataloadingJobConfig. - :type schedule: str - """ - - self._schedule = schedule - - @property - def repeat(self) -> str: - """Gets the repeat of this GrootDataloadingJobConfig. - - - :return: The repeat of this GrootDataloadingJobConfig. - :rtype: str - """ - return self._repeat - - @repeat.setter - def repeat(self, repeat: str): - """Sets the repeat of this GrootDataloadingJobConfig. - - - :param repeat: The repeat of this GrootDataloadingJobConfig. - :type repeat: str - """ - allowed_values = ["once", "day", "week"] # noqa: E501 - if repeat not in allowed_values: - raise ValueError( - "Invalid value for `repeat` ({0}), must be one of {1}" - .format(repeat, allowed_values) - ) - - self._repeat = repeat diff --git a/flex/coordinator/gs_flex_coordinator/models/groot_edge_type.py b/flex/coordinator/gs_flex_coordinator/models/groot_edge_type.py deleted file mode 100644 index 9d2ae45c5c4e..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/groot_edge_type.py +++ /dev/null @@ -1,117 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.groot_edge_type_relations_inner import GrootEdgeTypeRelationsInner -from gs_flex_coordinator.models.groot_property import GrootProperty -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.groot_edge_type_relations_inner import GrootEdgeTypeRelationsInner # noqa: E501 -from gs_flex_coordinator.models.groot_property import GrootProperty # noqa: E501 - -class GrootEdgeType(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, label=None, relations=None, properties=None): # noqa: E501 - """GrootEdgeType - a model defined in OpenAPI - - :param label: The label of this GrootEdgeType. # noqa: E501 - :type label: str - :param relations: The relations of this GrootEdgeType. # noqa: E501 - :type relations: List[GrootEdgeTypeRelationsInner] - :param properties: The properties of this GrootEdgeType. # noqa: E501 - :type properties: List[GrootProperty] - """ - self.openapi_types = { - 'label': str, - 'relations': List[GrootEdgeTypeRelationsInner], - 'properties': List[GrootProperty] - } - - self.attribute_map = { - 'label': 'label', - 'relations': 'relations', - 'properties': 'properties' - } - - self._label = label - self._relations = relations - self._properties = properties - - @classmethod - def from_dict(cls, dikt) -> 'GrootEdgeType': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The GrootEdgeType of this GrootEdgeType. # noqa: E501 - :rtype: GrootEdgeType - """ - return util.deserialize_model(dikt, cls) - - @property - def label(self) -> str: - """Gets the label of this GrootEdgeType. - - - :return: The label of this GrootEdgeType. - :rtype: str - """ - return self._label - - @label.setter - def label(self, label: str): - """Sets the label of this GrootEdgeType. - - - :param label: The label of this GrootEdgeType. - :type label: str - """ - - self._label = label - - @property - def relations(self) -> List[GrootEdgeTypeRelationsInner]: - """Gets the relations of this GrootEdgeType. - - - :return: The relations of this GrootEdgeType. - :rtype: List[GrootEdgeTypeRelationsInner] - """ - return self._relations - - @relations.setter - def relations(self, relations: List[GrootEdgeTypeRelationsInner]): - """Sets the relations of this GrootEdgeType. - - - :param relations: The relations of this GrootEdgeType. - :type relations: List[GrootEdgeTypeRelationsInner] - """ - - self._relations = relations - - @property - def properties(self) -> List[GrootProperty]: - """Gets the properties of this GrootEdgeType. - - - :return: The properties of this GrootEdgeType. - :rtype: List[GrootProperty] - """ - return self._properties - - @properties.setter - def properties(self, properties: List[GrootProperty]): - """Sets the properties of this GrootEdgeType. - - - :param properties: The properties of this GrootEdgeType. - :type properties: List[GrootProperty] - """ - - self._properties = properties diff --git a/flex/coordinator/gs_flex_coordinator/models/groot_edge_type_relations_inner.py b/flex/coordinator/gs_flex_coordinator/models/groot_edge_type_relations_inner.py deleted file mode 100644 index 9662593b3fec..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/groot_edge_type_relations_inner.py +++ /dev/null @@ -1,87 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class GrootEdgeTypeRelationsInner(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, src_label=None, dst_label=None): # noqa: E501 - """GrootEdgeTypeRelationsInner - a model defined in OpenAPI - - :param src_label: The src_label of this GrootEdgeTypeRelationsInner. # noqa: E501 - :type src_label: str - :param dst_label: The dst_label of this GrootEdgeTypeRelationsInner. # noqa: E501 - :type dst_label: str - """ - self.openapi_types = { - 'src_label': str, - 'dst_label': str - } - - self.attribute_map = { - 'src_label': 'src_label', - 'dst_label': 'dst_label' - } - - self._src_label = src_label - self._dst_label = dst_label - - @classmethod - def from_dict(cls, dikt) -> 'GrootEdgeTypeRelationsInner': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The GrootEdgeType_relations_inner of this GrootEdgeTypeRelationsInner. # noqa: E501 - :rtype: GrootEdgeTypeRelationsInner - """ - return util.deserialize_model(dikt, cls) - - @property - def src_label(self) -> str: - """Gets the src_label of this GrootEdgeTypeRelationsInner. - - - :return: The src_label of this GrootEdgeTypeRelationsInner. - :rtype: str - """ - return self._src_label - - @src_label.setter - def src_label(self, src_label: str): - """Sets the src_label of this GrootEdgeTypeRelationsInner. - - - :param src_label: The src_label of this GrootEdgeTypeRelationsInner. - :type src_label: str - """ - - self._src_label = src_label - - @property - def dst_label(self) -> str: - """Gets the dst_label of this GrootEdgeTypeRelationsInner. - - - :return: The dst_label of this GrootEdgeTypeRelationsInner. - :rtype: str - """ - return self._dst_label - - @dst_label.setter - def dst_label(self, dst_label: str): - """Sets the dst_label of this GrootEdgeTypeRelationsInner. - - - :param dst_label: The dst_label of this GrootEdgeTypeRelationsInner. - :type dst_label: str - """ - - self._dst_label = dst_label diff --git a/flex/coordinator/gs_flex_coordinator/models/groot_graph.py b/flex/coordinator/gs_flex_coordinator/models/groot_graph.py deleted file mode 100644 index 2ea67889ae32..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/groot_graph.py +++ /dev/null @@ -1,201 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.groot_graph_gremlin_interface import GrootGraphGremlinInterface -from gs_flex_coordinator.models.groot_schema import GrootSchema -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.groot_graph_gremlin_interface import GrootGraphGremlinInterface # noqa: E501 -from gs_flex_coordinator.models.groot_schema import GrootSchema # noqa: E501 - -class GrootGraph(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, name=None, type=None, directed=None, creation_time=None, _schema=None, gremlin_interface=None): # noqa: E501 - """GrootGraph - a model defined in OpenAPI - - :param name: The name of this GrootGraph. # noqa: E501 - :type name: str - :param type: The type of this GrootGraph. # noqa: E501 - :type type: str - :param directed: The directed of this GrootGraph. # noqa: E501 - :type directed: bool - :param creation_time: The creation_time of this GrootGraph. # noqa: E501 - :type creation_time: str - :param _schema: The _schema of this GrootGraph. # noqa: E501 - :type _schema: GrootSchema - :param gremlin_interface: The gremlin_interface of this GrootGraph. # noqa: E501 - :type gremlin_interface: GrootGraphGremlinInterface - """ - self.openapi_types = { - 'name': str, - 'type': str, - 'directed': bool, - 'creation_time': str, - '_schema': GrootSchema, - 'gremlin_interface': GrootGraphGremlinInterface - } - - self.attribute_map = { - 'name': 'name', - 'type': 'type', - 'directed': 'directed', - 'creation_time': 'creation_time', - '_schema': 'schema', - 'gremlin_interface': 'gremlin_interface' - } - - self._name = name - self._type = type - self._directed = directed - self._creation_time = creation_time - self.__schema = _schema - self._gremlin_interface = gremlin_interface - - @classmethod - def from_dict(cls, dikt) -> 'GrootGraph': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The GrootGraph of this GrootGraph. # noqa: E501 - :rtype: GrootGraph - """ - return util.deserialize_model(dikt, cls) - - @property - def name(self) -> str: - """Gets the name of this GrootGraph. - - - :return: The name of this GrootGraph. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this GrootGraph. - - - :param name: The name of this GrootGraph. - :type name: str - """ - - self._name = name - - @property - def type(self) -> str: - """Gets the type of this GrootGraph. - - - :return: The type of this GrootGraph. - :rtype: str - """ - return self._type - - @type.setter - def type(self, type: str): - """Sets the type of this GrootGraph. - - - :param type: The type of this GrootGraph. - :type type: str - """ - allowed_values = ["GrootGraph"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" - .format(type, allowed_values) - ) - - self._type = type - - @property - def directed(self) -> bool: - """Gets the directed of this GrootGraph. - - - :return: The directed of this GrootGraph. - :rtype: bool - """ - return self._directed - - @directed.setter - def directed(self, directed: bool): - """Sets the directed of this GrootGraph. - - - :param directed: The directed of this GrootGraph. - :type directed: bool - """ - - self._directed = directed - - @property - def creation_time(self) -> str: - """Gets the creation_time of this GrootGraph. - - - :return: The creation_time of this GrootGraph. - :rtype: str - """ - return self._creation_time - - @creation_time.setter - def creation_time(self, creation_time: str): - """Sets the creation_time of this GrootGraph. - - - :param creation_time: The creation_time of this GrootGraph. - :type creation_time: str - """ - - self._creation_time = creation_time - - @property - def _schema(self) -> GrootSchema: - """Gets the _schema of this GrootGraph. - - - :return: The _schema of this GrootGraph. - :rtype: GrootSchema - """ - return self.__schema - - @_schema.setter - def _schema(self, _schema: GrootSchema): - """Sets the _schema of this GrootGraph. - - - :param _schema: The _schema of this GrootGraph. - :type _schema: GrootSchema - """ - - self.__schema = _schema - - @property - def gremlin_interface(self) -> GrootGraphGremlinInterface: - """Gets the gremlin_interface of this GrootGraph. - - - :return: The gremlin_interface of this GrootGraph. - :rtype: GrootGraphGremlinInterface - """ - return self._gremlin_interface - - @gremlin_interface.setter - def gremlin_interface(self, gremlin_interface: GrootGraphGremlinInterface): - """Sets the gremlin_interface of this GrootGraph. - - - :param gremlin_interface: The gremlin_interface of this GrootGraph. - :type gremlin_interface: GrootGraphGremlinInterface - """ - - self._gremlin_interface = gremlin_interface diff --git a/flex/coordinator/gs_flex_coordinator/models/groot_graph_gremlin_interface.py b/flex/coordinator/gs_flex_coordinator/models/groot_graph_gremlin_interface.py deleted file mode 100644 index 97b719030721..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/groot_graph_gremlin_interface.py +++ /dev/null @@ -1,139 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class GrootGraphGremlinInterface(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, gremlin_endpoint=None, grpc_endpoint=None, username=None, password=None): # noqa: E501 - """GrootGraphGremlinInterface - a model defined in OpenAPI - - :param gremlin_endpoint: The gremlin_endpoint of this GrootGraphGremlinInterface. # noqa: E501 - :type gremlin_endpoint: str - :param grpc_endpoint: The grpc_endpoint of this GrootGraphGremlinInterface. # noqa: E501 - :type grpc_endpoint: str - :param username: The username of this GrootGraphGremlinInterface. # noqa: E501 - :type username: str - :param password: The password of this GrootGraphGremlinInterface. # noqa: E501 - :type password: str - """ - self.openapi_types = { - 'gremlin_endpoint': str, - 'grpc_endpoint': str, - 'username': str, - 'password': str - } - - self.attribute_map = { - 'gremlin_endpoint': 'gremlin_endpoint', - 'grpc_endpoint': 'grpc_endpoint', - 'username': 'username', - 'password': 'password' - } - - self._gremlin_endpoint = gremlin_endpoint - self._grpc_endpoint = grpc_endpoint - self._username = username - self._password = password - - @classmethod - def from_dict(cls, dikt) -> 'GrootGraphGremlinInterface': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The GrootGraph_gremlin_interface of this GrootGraphGremlinInterface. # noqa: E501 - :rtype: GrootGraphGremlinInterface - """ - return util.deserialize_model(dikt, cls) - - @property - def gremlin_endpoint(self) -> str: - """Gets the gremlin_endpoint of this GrootGraphGremlinInterface. - - - :return: The gremlin_endpoint of this GrootGraphGremlinInterface. - :rtype: str - """ - return self._gremlin_endpoint - - @gremlin_endpoint.setter - def gremlin_endpoint(self, gremlin_endpoint: str): - """Sets the gremlin_endpoint of this GrootGraphGremlinInterface. - - - :param gremlin_endpoint: The gremlin_endpoint of this GrootGraphGremlinInterface. - :type gremlin_endpoint: str - """ - - self._gremlin_endpoint = gremlin_endpoint - - @property - def grpc_endpoint(self) -> str: - """Gets the grpc_endpoint of this GrootGraphGremlinInterface. - - - :return: The grpc_endpoint of this GrootGraphGremlinInterface. - :rtype: str - """ - return self._grpc_endpoint - - @grpc_endpoint.setter - def grpc_endpoint(self, grpc_endpoint: str): - """Sets the grpc_endpoint of this GrootGraphGremlinInterface. - - - :param grpc_endpoint: The grpc_endpoint of this GrootGraphGremlinInterface. - :type grpc_endpoint: str - """ - - self._grpc_endpoint = grpc_endpoint - - @property - def username(self) -> str: - """Gets the username of this GrootGraphGremlinInterface. - - - :return: The username of this GrootGraphGremlinInterface. - :rtype: str - """ - return self._username - - @username.setter - def username(self, username: str): - """Sets the username of this GrootGraphGremlinInterface. - - - :param username: The username of this GrootGraphGremlinInterface. - :type username: str - """ - - self._username = username - - @property - def password(self) -> str: - """Gets the password of this GrootGraphGremlinInterface. - - - :return: The password of this GrootGraphGremlinInterface. - :rtype: str - """ - return self._password - - @password.setter - def password(self, password: str): - """Sets the password of this GrootGraphGremlinInterface. - - - :param password: The password of this GrootGraphGremlinInterface. - :type password: str - """ - - self._password = password diff --git a/flex/coordinator/gs_flex_coordinator/models/groot_property.py b/flex/coordinator/gs_flex_coordinator/models/groot_property.py deleted file mode 100644 index c45b332002bd..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/groot_property.py +++ /dev/null @@ -1,145 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class GrootProperty(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, id=None, name=None, type=None, is_primary_key=None): # noqa: E501 - """GrootProperty - a model defined in OpenAPI - - :param id: The id of this GrootProperty. # noqa: E501 - :type id: int - :param name: The name of this GrootProperty. # noqa: E501 - :type name: str - :param type: The type of this GrootProperty. # noqa: E501 - :type type: str - :param is_primary_key: The is_primary_key of this GrootProperty. # noqa: E501 - :type is_primary_key: bool - """ - self.openapi_types = { - 'id': int, - 'name': str, - 'type': str, - 'is_primary_key': bool - } - - self.attribute_map = { - 'id': 'id', - 'name': 'name', - 'type': 'type', - 'is_primary_key': 'is_primary_key' - } - - self._id = id - self._name = name - self._type = type - self._is_primary_key = is_primary_key - - @classmethod - def from_dict(cls, dikt) -> 'GrootProperty': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The GrootProperty of this GrootProperty. # noqa: E501 - :rtype: GrootProperty - """ - return util.deserialize_model(dikt, cls) - - @property - def id(self) -> int: - """Gets the id of this GrootProperty. - - - :return: The id of this GrootProperty. - :rtype: int - """ - return self._id - - @id.setter - def id(self, id: int): - """Sets the id of this GrootProperty. - - - :param id: The id of this GrootProperty. - :type id: int - """ - - self._id = id - - @property - def name(self) -> str: - """Gets the name of this GrootProperty. - - - :return: The name of this GrootProperty. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this GrootProperty. - - - :param name: The name of this GrootProperty. - :type name: str - """ - - self._name = name - - @property - def type(self) -> str: - """Gets the type of this GrootProperty. - - - :return: The type of this GrootProperty. - :rtype: str - """ - return self._type - - @type.setter - def type(self, type: str): - """Sets the type of this GrootProperty. - - - :param type: The type of this GrootProperty. - :type type: str - """ - allowed_values = ["DT_STRING", "DT_SIGNED_INT64", "DT_DOUBLE"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" - .format(type, allowed_values) - ) - - self._type = type - - @property - def is_primary_key(self) -> bool: - """Gets the is_primary_key of this GrootProperty. - - - :return: The is_primary_key of this GrootProperty. - :rtype: bool - """ - return self._is_primary_key - - @is_primary_key.setter - def is_primary_key(self, is_primary_key: bool): - """Sets the is_primary_key of this GrootProperty. - - - :param is_primary_key: The is_primary_key of this GrootProperty. - :type is_primary_key: bool - """ - - self._is_primary_key = is_primary_key diff --git a/flex/coordinator/gs_flex_coordinator/models/groot_schema.py b/flex/coordinator/gs_flex_coordinator/models/groot_schema.py deleted file mode 100644 index 1df5884cdb20..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/groot_schema.py +++ /dev/null @@ -1,91 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.groot_edge_type import GrootEdgeType -from gs_flex_coordinator.models.groot_vertex_type import GrootVertexType -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.groot_edge_type import GrootEdgeType # noqa: E501 -from gs_flex_coordinator.models.groot_vertex_type import GrootVertexType # noqa: E501 - -class GrootSchema(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, vertices=None, edges=None): # noqa: E501 - """GrootSchema - a model defined in OpenAPI - - :param vertices: The vertices of this GrootSchema. # noqa: E501 - :type vertices: List[GrootVertexType] - :param edges: The edges of this GrootSchema. # noqa: E501 - :type edges: List[GrootEdgeType] - """ - self.openapi_types = { - 'vertices': List[GrootVertexType], - 'edges': List[GrootEdgeType] - } - - self.attribute_map = { - 'vertices': 'vertices', - 'edges': 'edges' - } - - self._vertices = vertices - self._edges = edges - - @classmethod - def from_dict(cls, dikt) -> 'GrootSchema': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The GrootSchema of this GrootSchema. # noqa: E501 - :rtype: GrootSchema - """ - return util.deserialize_model(dikt, cls) - - @property - def vertices(self) -> List[GrootVertexType]: - """Gets the vertices of this GrootSchema. - - - :return: The vertices of this GrootSchema. - :rtype: List[GrootVertexType] - """ - return self._vertices - - @vertices.setter - def vertices(self, vertices: List[GrootVertexType]): - """Sets the vertices of this GrootSchema. - - - :param vertices: The vertices of this GrootSchema. - :type vertices: List[GrootVertexType] - """ - - self._vertices = vertices - - @property - def edges(self) -> List[GrootEdgeType]: - """Gets the edges of this GrootSchema. - - - :return: The edges of this GrootSchema. - :rtype: List[GrootEdgeType] - """ - return self._edges - - @edges.setter - def edges(self, edges: List[GrootEdgeType]): - """Sets the edges of this GrootSchema. - - - :param edges: The edges of this GrootSchema. - :type edges: List[GrootEdgeType] - """ - - self._edges = edges diff --git a/flex/coordinator/gs_flex_coordinator/models/groot_vertex_type.py b/flex/coordinator/gs_flex_coordinator/models/groot_vertex_type.py deleted file mode 100644 index 955a907a0bcd..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/groot_vertex_type.py +++ /dev/null @@ -1,89 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.groot_property import GrootProperty -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.groot_property import GrootProperty # noqa: E501 - -class GrootVertexType(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, label=None, properties=None): # noqa: E501 - """GrootVertexType - a model defined in OpenAPI - - :param label: The label of this GrootVertexType. # noqa: E501 - :type label: str - :param properties: The properties of this GrootVertexType. # noqa: E501 - :type properties: List[GrootProperty] - """ - self.openapi_types = { - 'label': str, - 'properties': List[GrootProperty] - } - - self.attribute_map = { - 'label': 'label', - 'properties': 'properties' - } - - self._label = label - self._properties = properties - - @classmethod - def from_dict(cls, dikt) -> 'GrootVertexType': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The GrootVertexType of this GrootVertexType. # noqa: E501 - :rtype: GrootVertexType - """ - return util.deserialize_model(dikt, cls) - - @property - def label(self) -> str: - """Gets the label of this GrootVertexType. - - - :return: The label of this GrootVertexType. - :rtype: str - """ - return self._label - - @label.setter - def label(self, label: str): - """Sets the label of this GrootVertexType. - - - :param label: The label of this GrootVertexType. - :type label: str - """ - - self._label = label - - @property - def properties(self) -> List[GrootProperty]: - """Gets the properties of this GrootVertexType. - - - :return: The properties of this GrootVertexType. - :rtype: List[GrootProperty] - """ - return self._properties - - @properties.setter - def properties(self, properties: List[GrootProperty]): - """Sets the properties of this GrootVertexType. - - - :param properties: The properties of this GrootVertexType. - :type properties: List[GrootProperty] - """ - - self._properties = properties diff --git a/flex/coordinator/gs_flex_coordinator/models/model_property.py b/flex/coordinator/gs_flex_coordinator/models/model_property.py deleted file mode 100644 index d80e193efadf..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/model_property.py +++ /dev/null @@ -1,115 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.property_property_type import PropertyPropertyType -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.property_property_type import PropertyPropertyType # noqa: E501 - -class ModelProperty(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, property_id=None, property_name=None, property_type=None): # noqa: E501 - """ModelProperty - a model defined in OpenAPI - - :param property_id: The property_id of this ModelProperty. # noqa: E501 - :type property_id: int - :param property_name: The property_name of this ModelProperty. # noqa: E501 - :type property_name: str - :param property_type: The property_type of this ModelProperty. # noqa: E501 - :type property_type: PropertyPropertyType - """ - self.openapi_types = { - 'property_id': int, - 'property_name': str, - 'property_type': PropertyPropertyType - } - - self.attribute_map = { - 'property_id': 'property_id', - 'property_name': 'property_name', - 'property_type': 'property_type' - } - - self._property_id = property_id - self._property_name = property_name - self._property_type = property_type - - @classmethod - def from_dict(cls, dikt) -> 'ModelProperty': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Property of this ModelProperty. # noqa: E501 - :rtype: ModelProperty - """ - return util.deserialize_model(dikt, cls) - - @property - def property_id(self) -> int: - """Gets the property_id of this ModelProperty. - - - :return: The property_id of this ModelProperty. - :rtype: int - """ - return self._property_id - - @property_id.setter - def property_id(self, property_id: int): - """Sets the property_id of this ModelProperty. - - - :param property_id: The property_id of this ModelProperty. - :type property_id: int - """ - - self._property_id = property_id - - @property - def property_name(self) -> str: - """Gets the property_name of this ModelProperty. - - - :return: The property_name of this ModelProperty. - :rtype: str - """ - return self._property_name - - @property_name.setter - def property_name(self, property_name: str): - """Sets the property_name of this ModelProperty. - - - :param property_name: The property_name of this ModelProperty. - :type property_name: str - """ - - self._property_name = property_name - - @property - def property_type(self) -> PropertyPropertyType: - """Gets the property_type of this ModelProperty. - - - :return: The property_type of this ModelProperty. - :rtype: PropertyPropertyType - """ - return self._property_type - - @property_type.setter - def property_type(self, property_type: PropertyPropertyType): - """Sets the property_type of this ModelProperty. - - - :param property_type: The property_type of this ModelProperty. - :type property_type: PropertyPropertyType - """ - - self._property_type = property_type diff --git a/flex/coordinator/gs_flex_coordinator/models/model_schema.py b/flex/coordinator/gs_flex_coordinator/models/model_schema.py deleted file mode 100644 index 6bb9e34e5e54..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/model_schema.py +++ /dev/null @@ -1,91 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.edge_type import EdgeType -from gs_flex_coordinator.models.vertex_type import VertexType -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.edge_type import EdgeType # noqa: E501 -from gs_flex_coordinator.models.vertex_type import VertexType # noqa: E501 - -class ModelSchema(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, vertex_types=None, edge_types=None): # noqa: E501 - """ModelSchema - a model defined in OpenAPI - - :param vertex_types: The vertex_types of this ModelSchema. # noqa: E501 - :type vertex_types: List[VertexType] - :param edge_types: The edge_types of this ModelSchema. # noqa: E501 - :type edge_types: List[EdgeType] - """ - self.openapi_types = { - 'vertex_types': List[VertexType], - 'edge_types': List[EdgeType] - } - - self.attribute_map = { - 'vertex_types': 'vertex_types', - 'edge_types': 'edge_types' - } - - self._vertex_types = vertex_types - self._edge_types = edge_types - - @classmethod - def from_dict(cls, dikt) -> 'ModelSchema': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Schema of this ModelSchema. # noqa: E501 - :rtype: ModelSchema - """ - return util.deserialize_model(dikt, cls) - - @property - def vertex_types(self) -> List[VertexType]: - """Gets the vertex_types of this ModelSchema. - - - :return: The vertex_types of this ModelSchema. - :rtype: List[VertexType] - """ - return self._vertex_types - - @vertex_types.setter - def vertex_types(self, vertex_types: List[VertexType]): - """Sets the vertex_types of this ModelSchema. - - - :param vertex_types: The vertex_types of this ModelSchema. - :type vertex_types: List[VertexType] - """ - - self._vertex_types = vertex_types - - @property - def edge_types(self) -> List[EdgeType]: - """Gets the edge_types of this ModelSchema. - - - :return: The edge_types of this ModelSchema. - :rtype: List[EdgeType] - """ - return self._edge_types - - @edge_types.setter - def edge_types(self, edge_types: List[EdgeType]): - """Sets the edge_types of this ModelSchema. - - - :param edge_types: The edge_types of this ModelSchema. - :type edge_types: List[EdgeType] - """ - - self._edge_types = edge_types diff --git a/flex/coordinator/gs_flex_coordinator/models/procedure.py b/flex/coordinator/gs_flex_coordinator/models/procedure.py deleted file mode 100644 index 8fd20f234ff3..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/procedure.py +++ /dev/null @@ -1,277 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.procedure_params_inner import ProcedureParamsInner -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.procedure_params_inner import ProcedureParamsInner # noqa: E501 - -class Procedure(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, name=None, bound_graph=None, description=None, type=None, query=None, enable=None, runnable=None, params=None, returns=None): # noqa: E501 - """Procedure - a model defined in OpenAPI - - :param name: The name of this Procedure. # noqa: E501 - :type name: str - :param bound_graph: The bound_graph of this Procedure. # noqa: E501 - :type bound_graph: str - :param description: The description of this Procedure. # noqa: E501 - :type description: str - :param type: The type of this Procedure. # noqa: E501 - :type type: str - :param query: The query of this Procedure. # noqa: E501 - :type query: str - :param enable: The enable of this Procedure. # noqa: E501 - :type enable: bool - :param runnable: The runnable of this Procedure. # noqa: E501 - :type runnable: bool - :param params: The params of this Procedure. # noqa: E501 - :type params: List[ProcedureParamsInner] - :param returns: The returns of this Procedure. # noqa: E501 - :type returns: List[ProcedureParamsInner] - """ - self.openapi_types = { - 'name': str, - 'bound_graph': str, - 'description': str, - 'type': str, - 'query': str, - 'enable': bool, - 'runnable': bool, - 'params': List[ProcedureParamsInner], - 'returns': List[ProcedureParamsInner] - } - - self.attribute_map = { - 'name': 'name', - 'bound_graph': 'bound_graph', - 'description': 'description', - 'type': 'type', - 'query': 'query', - 'enable': 'enable', - 'runnable': 'runnable', - 'params': 'params', - 'returns': 'returns' - } - - self._name = name - self._bound_graph = bound_graph - self._description = description - self._type = type - self._query = query - self._enable = enable - self._runnable = runnable - self._params = params - self._returns = returns - - @classmethod - def from_dict(cls, dikt) -> 'Procedure': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Procedure of this Procedure. # noqa: E501 - :rtype: Procedure - """ - return util.deserialize_model(dikt, cls) - - @property - def name(self) -> str: - """Gets the name of this Procedure. - - - :return: The name of this Procedure. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this Procedure. - - - :param name: The name of this Procedure. - :type name: str - """ - - self._name = name - - @property - def bound_graph(self) -> str: - """Gets the bound_graph of this Procedure. - - - :return: The bound_graph of this Procedure. - :rtype: str - """ - return self._bound_graph - - @bound_graph.setter - def bound_graph(self, bound_graph: str): - """Sets the bound_graph of this Procedure. - - - :param bound_graph: The bound_graph of this Procedure. - :type bound_graph: str - """ - - self._bound_graph = bound_graph - - @property - def description(self) -> str: - """Gets the description of this Procedure. - - - :return: The description of this Procedure. - :rtype: str - """ - return self._description - - @description.setter - def description(self, description: str): - """Sets the description of this Procedure. - - - :param description: The description of this Procedure. - :type description: str - """ - - self._description = description - - @property - def type(self) -> str: - """Gets the type of this Procedure. - - - :return: The type of this Procedure. - :rtype: str - """ - return self._type - - @type.setter - def type(self, type: str): - """Sets the type of this Procedure. - - - :param type: The type of this Procedure. - :type type: str - """ - allowed_values = ["cpp", "cypher"] # noqa: E501 - if type not in allowed_values: - raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" - .format(type, allowed_values) - ) - - self._type = type - - @property - def query(self) -> str: - """Gets the query of this Procedure. - - - :return: The query of this Procedure. - :rtype: str - """ - return self._query - - @query.setter - def query(self, query: str): - """Sets the query of this Procedure. - - - :param query: The query of this Procedure. - :type query: str - """ - - self._query = query - - @property - def enable(self) -> bool: - """Gets the enable of this Procedure. - - - :return: The enable of this Procedure. - :rtype: bool - """ - return self._enable - - @enable.setter - def enable(self, enable: bool): - """Sets the enable of this Procedure. - - - :param enable: The enable of this Procedure. - :type enable: bool - """ - - self._enable = enable - - @property - def runnable(self) -> bool: - """Gets the runnable of this Procedure. - - - :return: The runnable of this Procedure. - :rtype: bool - """ - return self._runnable - - @runnable.setter - def runnable(self, runnable: bool): - """Sets the runnable of this Procedure. - - - :param runnable: The runnable of this Procedure. - :type runnable: bool - """ - - self._runnable = runnable - - @property - def params(self) -> List[ProcedureParamsInner]: - """Gets the params of this Procedure. - - - :return: The params of this Procedure. - :rtype: List[ProcedureParamsInner] - """ - return self._params - - @params.setter - def params(self, params: List[ProcedureParamsInner]): - """Sets the params of this Procedure. - - - :param params: The params of this Procedure. - :type params: List[ProcedureParamsInner] - """ - - self._params = params - - @property - def returns(self) -> List[ProcedureParamsInner]: - """Gets the returns of this Procedure. - - - :return: The returns of this Procedure. - :rtype: List[ProcedureParamsInner] - """ - return self._returns - - @returns.setter - def returns(self, returns: List[ProcedureParamsInner]): - """Sets the returns of this Procedure. - - - :param returns: The returns of this Procedure. - :type returns: List[ProcedureParamsInner] - """ - - self._returns = returns diff --git a/flex/coordinator/gs_flex_coordinator/models/procedure_params_inner.py b/flex/coordinator/gs_flex_coordinator/models/procedure_params_inner.py deleted file mode 100644 index 9dc0404dee42..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/procedure_params_inner.py +++ /dev/null @@ -1,87 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class ProcedureParamsInner(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, name=None, type=None): # noqa: E501 - """ProcedureParamsInner - a model defined in OpenAPI - - :param name: The name of this ProcedureParamsInner. # noqa: E501 - :type name: str - :param type: The type of this ProcedureParamsInner. # noqa: E501 - :type type: str - """ - self.openapi_types = { - 'name': str, - 'type': str - } - - self.attribute_map = { - 'name': 'name', - 'type': 'type' - } - - self._name = name - self._type = type - - @classmethod - def from_dict(cls, dikt) -> 'ProcedureParamsInner': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The Procedure_params_inner of this ProcedureParamsInner. # noqa: E501 - :rtype: ProcedureParamsInner - """ - return util.deserialize_model(dikt, cls) - - @property - def name(self) -> str: - """Gets the name of this ProcedureParamsInner. - - - :return: The name of this ProcedureParamsInner. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this ProcedureParamsInner. - - - :param name: The name of this ProcedureParamsInner. - :type name: str - """ - - self._name = name - - @property - def type(self) -> str: - """Gets the type of this ProcedureParamsInner. - - - :return: The type of this ProcedureParamsInner. - :rtype: str - """ - return self._type - - @type.setter - def type(self, type: str): - """Sets the type of this ProcedureParamsInner. - - - :param type: The type of this ProcedureParamsInner. - :type type: str - """ - - self._type = type diff --git a/flex/coordinator/gs_flex_coordinator/models/query_statement.py b/flex/coordinator/gs_flex_coordinator/models/query_statement.py deleted file mode 100644 index c0a7404eda8a..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/query_statement.py +++ /dev/null @@ -1,141 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class QueryStatement(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, statement_id=None, name=None, description=None, query=None): # noqa: E501 - """QueryStatement - a model defined in OpenAPI - - :param statement_id: The statement_id of this QueryStatement. # noqa: E501 - :type statement_id: str - :param name: The name of this QueryStatement. # noqa: E501 - :type name: str - :param description: The description of this QueryStatement. # noqa: E501 - :type description: str - :param query: The query of this QueryStatement. # noqa: E501 - :type query: str - """ - self.openapi_types = { - 'statement_id': str, - 'name': str, - 'description': str, - 'query': str - } - - self.attribute_map = { - 'statement_id': 'statement_id', - 'name': 'name', - 'description': 'description', - 'query': 'query' - } - - self._statement_id = statement_id - self._name = name - self._description = description - self._query = query - - @classmethod - def from_dict(cls, dikt) -> 'QueryStatement': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The QueryStatement of this QueryStatement. # noqa: E501 - :rtype: QueryStatement - """ - return util.deserialize_model(dikt, cls) - - @property - def statement_id(self) -> str: - """Gets the statement_id of this QueryStatement. - - generated in server side # noqa: E501 - - :return: The statement_id of this QueryStatement. - :rtype: str - """ - return self._statement_id - - @statement_id.setter - def statement_id(self, statement_id: str): - """Sets the statement_id of this QueryStatement. - - generated in server side # noqa: E501 - - :param statement_id: The statement_id of this QueryStatement. - :type statement_id: str - """ - - self._statement_id = statement_id - - @property - def name(self) -> str: - """Gets the name of this QueryStatement. - - - :return: The name of this QueryStatement. - :rtype: str - """ - return self._name - - @name.setter - def name(self, name: str): - """Sets the name of this QueryStatement. - - - :param name: The name of this QueryStatement. - :type name: str - """ - - self._name = name - - @property - def description(self) -> str: - """Gets the description of this QueryStatement. - - - :return: The description of this QueryStatement. - :rtype: str - """ - return self._description - - @description.setter - def description(self, description: str): - """Sets the description of this QueryStatement. - - - :param description: The description of this QueryStatement. - :type description: str - """ - - self._description = description - - @property - def query(self) -> str: - """Gets the query of this QueryStatement. - - - :return: The query of this QueryStatement. - :rtype: str - """ - return self._query - - @query.setter - def query(self, query: str): - """Sets the query of this QueryStatement. - - - :param query: The query of this QueryStatement. - :type query: str - """ - - self._query = query diff --git a/flex/coordinator/gs_flex_coordinator/models/schema_mapping_loading_config.py b/flex/coordinator/gs_flex_coordinator/models/schema_mapping_loading_config.py deleted file mode 100644 index 8d275543c105..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/schema_mapping_loading_config.py +++ /dev/null @@ -1,123 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.schema_mapping_loading_config_data_source import SchemaMappingLoadingConfigDataSource -from gs_flex_coordinator.models.schema_mapping_loading_config_format import SchemaMappingLoadingConfigFormat -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.schema_mapping_loading_config_data_source import SchemaMappingLoadingConfigDataSource # noqa: E501 -from gs_flex_coordinator.models.schema_mapping_loading_config_format import SchemaMappingLoadingConfigFormat # noqa: E501 - -class SchemaMappingLoadingConfig(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, data_source=None, import_option=None, format=None): # noqa: E501 - """SchemaMappingLoadingConfig - a model defined in OpenAPI - - :param data_source: The data_source of this SchemaMappingLoadingConfig. # noqa: E501 - :type data_source: SchemaMappingLoadingConfigDataSource - :param import_option: The import_option of this SchemaMappingLoadingConfig. # noqa: E501 - :type import_option: str - :param format: The format of this SchemaMappingLoadingConfig. # noqa: E501 - :type format: SchemaMappingLoadingConfigFormat - """ - self.openapi_types = { - 'data_source': SchemaMappingLoadingConfigDataSource, - 'import_option': str, - 'format': SchemaMappingLoadingConfigFormat - } - - self.attribute_map = { - 'data_source': 'data_source', - 'import_option': 'import_option', - 'format': 'format' - } - - self._data_source = data_source - self._import_option = import_option - self._format = format - - @classmethod - def from_dict(cls, dikt) -> 'SchemaMappingLoadingConfig': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The SchemaMapping_loading_config of this SchemaMappingLoadingConfig. # noqa: E501 - :rtype: SchemaMappingLoadingConfig - """ - return util.deserialize_model(dikt, cls) - - @property - def data_source(self) -> SchemaMappingLoadingConfigDataSource: - """Gets the data_source of this SchemaMappingLoadingConfig. - - - :return: The data_source of this SchemaMappingLoadingConfig. - :rtype: SchemaMappingLoadingConfigDataSource - """ - return self._data_source - - @data_source.setter - def data_source(self, data_source: SchemaMappingLoadingConfigDataSource): - """Sets the data_source of this SchemaMappingLoadingConfig. - - - :param data_source: The data_source of this SchemaMappingLoadingConfig. - :type data_source: SchemaMappingLoadingConfigDataSource - """ - - self._data_source = data_source - - @property - def import_option(self) -> str: - """Gets the import_option of this SchemaMappingLoadingConfig. - - - :return: The import_option of this SchemaMappingLoadingConfig. - :rtype: str - """ - return self._import_option - - @import_option.setter - def import_option(self, import_option: str): - """Sets the import_option of this SchemaMappingLoadingConfig. - - - :param import_option: The import_option of this SchemaMappingLoadingConfig. - :type import_option: str - """ - allowed_values = ["init", "overwrite"] # noqa: E501 - if import_option not in allowed_values: - raise ValueError( - "Invalid value for `import_option` ({0}), must be one of {1}" - .format(import_option, allowed_values) - ) - - self._import_option = import_option - - @property - def format(self) -> SchemaMappingLoadingConfigFormat: - """Gets the format of this SchemaMappingLoadingConfig. - - - :return: The format of this SchemaMappingLoadingConfig. - :rtype: SchemaMappingLoadingConfigFormat - """ - return self._format - - @format.setter - def format(self, format: SchemaMappingLoadingConfigFormat): - """Sets the format of this SchemaMappingLoadingConfig. - - - :param format: The format of this SchemaMappingLoadingConfig. - :type format: SchemaMappingLoadingConfigFormat - """ - - self._format = format diff --git a/flex/coordinator/gs_flex_coordinator/models/schema_mapping_loading_config_data_source.py b/flex/coordinator/gs_flex_coordinator/models/schema_mapping_loading_config_data_source.py deleted file mode 100644 index 83763256601c..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/schema_mapping_loading_config_data_source.py +++ /dev/null @@ -1,67 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class SchemaMappingLoadingConfigDataSource(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, scheme=None): # noqa: E501 - """SchemaMappingLoadingConfigDataSource - a model defined in OpenAPI - - :param scheme: The scheme of this SchemaMappingLoadingConfigDataSource. # noqa: E501 - :type scheme: str - """ - self.openapi_types = { - 'scheme': str - } - - self.attribute_map = { - 'scheme': 'scheme' - } - - self._scheme = scheme - - @classmethod - def from_dict(cls, dikt) -> 'SchemaMappingLoadingConfigDataSource': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The SchemaMapping_loading_config_data_source of this SchemaMappingLoadingConfigDataSource. # noqa: E501 - :rtype: SchemaMappingLoadingConfigDataSource - """ - return util.deserialize_model(dikt, cls) - - @property - def scheme(self) -> str: - """Gets the scheme of this SchemaMappingLoadingConfigDataSource. - - - :return: The scheme of this SchemaMappingLoadingConfigDataSource. - :rtype: str - """ - return self._scheme - - @scheme.setter - def scheme(self, scheme: str): - """Sets the scheme of this SchemaMappingLoadingConfigDataSource. - - - :param scheme: The scheme of this SchemaMappingLoadingConfigDataSource. - :type scheme: str - """ - allowed_values = ["file"] # noqa: E501 - if scheme not in allowed_values: - raise ValueError( - "Invalid value for `scheme` ({0}), must be one of {1}" - .format(scheme, allowed_values) - ) - - self._scheme = scheme diff --git a/flex/coordinator/gs_flex_coordinator/models/start_service_request.py b/flex/coordinator/gs_flex_coordinator/models/start_service_request.py deleted file mode 100644 index af6ed3a8e758..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/start_service_request.py +++ /dev/null @@ -1,61 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class StartServiceRequest(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, graph_name=None): # noqa: E501 - """StartServiceRequest - a model defined in OpenAPI - - :param graph_name: The graph_name of this StartServiceRequest. # noqa: E501 - :type graph_name: str - """ - self.openapi_types = { - 'graph_name': str - } - - self.attribute_map = { - 'graph_name': 'graph_name' - } - - self._graph_name = graph_name - - @classmethod - def from_dict(cls, dikt) -> 'StartServiceRequest': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The start_service_request of this StartServiceRequest. # noqa: E501 - :rtype: StartServiceRequest - """ - return util.deserialize_model(dikt, cls) - - @property - def graph_name(self) -> str: - """Gets the graph_name of this StartServiceRequest. - - - :return: The graph_name of this StartServiceRequest. - :rtype: str - """ - return self._graph_name - - @graph_name.setter - def graph_name(self, graph_name: str): - """Sets the graph_name of this StartServiceRequest. - - - :param graph_name: The graph_name of this StartServiceRequest. - :type graph_name: str - """ - - self._graph_name = graph_name diff --git a/flex/coordinator/gs_flex_coordinator/models/update_alert_messages_request.py b/flex/coordinator/gs_flex_coordinator/models/update_alert_messages_request.py deleted file mode 100644 index 49aee5353ab5..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/update_alert_messages_request.py +++ /dev/null @@ -1,125 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.alert_message import AlertMessage -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.alert_message import AlertMessage # noqa: E501 - -class UpdateAlertMessagesRequest(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, messages=None, batch_status=None, batch_delete=False): # noqa: E501 - """UpdateAlertMessagesRequest - a model defined in OpenAPI - - :param messages: The messages of this UpdateAlertMessagesRequest. # noqa: E501 - :type messages: List[AlertMessage] - :param batch_status: The batch_status of this UpdateAlertMessagesRequest. # noqa: E501 - :type batch_status: str - :param batch_delete: The batch_delete of this UpdateAlertMessagesRequest. # noqa: E501 - :type batch_delete: bool - """ - self.openapi_types = { - 'messages': List[AlertMessage], - 'batch_status': str, - 'batch_delete': bool - } - - self.attribute_map = { - 'messages': 'messages', - 'batch_status': 'batch_status', - 'batch_delete': 'batch_delete' - } - - self._messages = messages - self._batch_status = batch_status - self._batch_delete = batch_delete - - @classmethod - def from_dict(cls, dikt) -> 'UpdateAlertMessagesRequest': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The update_alert_messages_request of this UpdateAlertMessagesRequest. # noqa: E501 - :rtype: UpdateAlertMessagesRequest - """ - return util.deserialize_model(dikt, cls) - - @property - def messages(self) -> List[AlertMessage]: - """Gets the messages of this UpdateAlertMessagesRequest. - - - :return: The messages of this UpdateAlertMessagesRequest. - :rtype: List[AlertMessage] - """ - return self._messages - - @messages.setter - def messages(self, messages: List[AlertMessage]): - """Sets the messages of this UpdateAlertMessagesRequest. - - - :param messages: The messages of this UpdateAlertMessagesRequest. - :type messages: List[AlertMessage] - """ - - self._messages = messages - - @property - def batch_status(self) -> str: - """Gets the batch_status of this UpdateAlertMessagesRequest. - - Override the status of each message # noqa: E501 - - :return: The batch_status of this UpdateAlertMessagesRequest. - :rtype: str - """ - return self._batch_status - - @batch_status.setter - def batch_status(self, batch_status: str): - """Sets the batch_status of this UpdateAlertMessagesRequest. - - Override the status of each message # noqa: E501 - - :param batch_status: The batch_status of this UpdateAlertMessagesRequest. - :type batch_status: str - """ - allowed_values = ["solved", "unsolved", "dealing"] # noqa: E501 - if batch_status not in allowed_values: - raise ValueError( - "Invalid value for `batch_status` ({0}), must be one of {1}" - .format(batch_status, allowed_values) - ) - - self._batch_status = batch_status - - @property - def batch_delete(self) -> bool: - """Gets the batch_delete of this UpdateAlertMessagesRequest. - - True will delete all the messages in request body # noqa: E501 - - :return: The batch_delete of this UpdateAlertMessagesRequest. - :rtype: bool - """ - return self._batch_delete - - @batch_delete.setter - def batch_delete(self, batch_delete: bool): - """Sets the batch_delete of this UpdateAlertMessagesRequest. - - True will delete all the messages in request body # noqa: E501 - - :param batch_delete: The batch_delete of this UpdateAlertMessagesRequest. - :type batch_delete: bool - """ - - self._batch_delete = batch_delete diff --git a/flex/coordinator/gs_flex_coordinator/models/vertex_data_source.py b/flex/coordinator/gs_flex_coordinator/models/vertex_data_source.py deleted file mode 100644 index bbb5ee75ac03..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/vertex_data_source.py +++ /dev/null @@ -1,145 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator import util - - -class VertexDataSource(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, data_source=None, type_name=None, location=None, property_mapping=None): # noqa: E501 - """VertexDataSource - a model defined in OpenAPI - - :param data_source: The data_source of this VertexDataSource. # noqa: E501 - :type data_source: str - :param type_name: The type_name of this VertexDataSource. # noqa: E501 - :type type_name: str - :param location: The location of this VertexDataSource. # noqa: E501 - :type location: str - :param property_mapping: The property_mapping of this VertexDataSource. # noqa: E501 - :type property_mapping: Dict[str, object] - """ - self.openapi_types = { - 'data_source': str, - 'type_name': str, - 'location': str, - 'property_mapping': Dict[str, object] - } - - self.attribute_map = { - 'data_source': 'data_source', - 'type_name': 'type_name', - 'location': 'location', - 'property_mapping': 'property_mapping' - } - - self._data_source = data_source - self._type_name = type_name - self._location = location - self._property_mapping = property_mapping - - @classmethod - def from_dict(cls, dikt) -> 'VertexDataSource': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The VertexDataSource of this VertexDataSource. # noqa: E501 - :rtype: VertexDataSource - """ - return util.deserialize_model(dikt, cls) - - @property - def data_source(self) -> str: - """Gets the data_source of this VertexDataSource. - - - :return: The data_source of this VertexDataSource. - :rtype: str - """ - return self._data_source - - @data_source.setter - def data_source(self, data_source: str): - """Sets the data_source of this VertexDataSource. - - - :param data_source: The data_source of this VertexDataSource. - :type data_source: str - """ - allowed_values = ["ODPS", "FILE"] # noqa: E501 - if data_source not in allowed_values: - raise ValueError( - "Invalid value for `data_source` ({0}), must be one of {1}" - .format(data_source, allowed_values) - ) - - self._data_source = data_source - - @property - def type_name(self) -> str: - """Gets the type_name of this VertexDataSource. - - - :return: The type_name of this VertexDataSource. - :rtype: str - """ - return self._type_name - - @type_name.setter - def type_name(self, type_name: str): - """Sets the type_name of this VertexDataSource. - - - :param type_name: The type_name of this VertexDataSource. - :type type_name: str - """ - - self._type_name = type_name - - @property - def location(self) -> str: - """Gets the location of this VertexDataSource. - - - :return: The location of this VertexDataSource. - :rtype: str - """ - return self._location - - @location.setter - def location(self, location: str): - """Sets the location of this VertexDataSource. - - - :param location: The location of this VertexDataSource. - :type location: str - """ - - self._location = location - - @property - def property_mapping(self) -> Dict[str, object]: - """Gets the property_mapping of this VertexDataSource. - - - :return: The property_mapping of this VertexDataSource. - :rtype: Dict[str, object] - """ - return self._property_mapping - - @property_mapping.setter - def property_mapping(self, property_mapping: Dict[str, object]): - """Sets the property_mapping of this VertexDataSource. - - - :param property_mapping: The property_mapping of this VertexDataSource. - :type property_mapping: Dict[str, object] - """ - - self._property_mapping = property_mapping diff --git a/flex/coordinator/gs_flex_coordinator/models/vertex_type.py b/flex/coordinator/gs_flex_coordinator/models/vertex_type.py deleted file mode 100644 index da1f1f16e74e..000000000000 --- a/flex/coordinator/gs_flex_coordinator/models/vertex_type.py +++ /dev/null @@ -1,141 +0,0 @@ -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from gs_flex_coordinator.models.base_model import Model -from gs_flex_coordinator.models.model_property import ModelProperty -from gs_flex_coordinator import util - -from gs_flex_coordinator.models.model_property import ModelProperty # noqa: E501 - -class VertexType(Model): - """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - - Do not edit the class manually. - """ - - def __init__(self, type_id=None, type_name=None, properties=None, primary_keys=None): # noqa: E501 - """VertexType - a model defined in OpenAPI - - :param type_id: The type_id of this VertexType. # noqa: E501 - :type type_id: int - :param type_name: The type_name of this VertexType. # noqa: E501 - :type type_name: str - :param properties: The properties of this VertexType. # noqa: E501 - :type properties: List[ModelProperty] - :param primary_keys: The primary_keys of this VertexType. # noqa: E501 - :type primary_keys: List[str] - """ - self.openapi_types = { - 'type_id': int, - 'type_name': str, - 'properties': List[ModelProperty], - 'primary_keys': List[str] - } - - self.attribute_map = { - 'type_id': 'type_id', - 'type_name': 'type_name', - 'properties': 'properties', - 'primary_keys': 'primary_keys' - } - - self._type_id = type_id - self._type_name = type_name - self._properties = properties - self._primary_keys = primary_keys - - @classmethod - def from_dict(cls, dikt) -> 'VertexType': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The VertexType of this VertexType. # noqa: E501 - :rtype: VertexType - """ - return util.deserialize_model(dikt, cls) - - @property - def type_id(self) -> int: - """Gets the type_id of this VertexType. - - - :return: The type_id of this VertexType. - :rtype: int - """ - return self._type_id - - @type_id.setter - def type_id(self, type_id: int): - """Sets the type_id of this VertexType. - - - :param type_id: The type_id of this VertexType. - :type type_id: int - """ - - self._type_id = type_id - - @property - def type_name(self) -> str: - """Gets the type_name of this VertexType. - - - :return: The type_name of this VertexType. - :rtype: str - """ - return self._type_name - - @type_name.setter - def type_name(self, type_name: str): - """Sets the type_name of this VertexType. - - - :param type_name: The type_name of this VertexType. - :type type_name: str - """ - - self._type_name = type_name - - @property - def properties(self) -> List[ModelProperty]: - """Gets the properties of this VertexType. - - - :return: The properties of this VertexType. - :rtype: List[ModelProperty] - """ - return self._properties - - @properties.setter - def properties(self, properties: List[ModelProperty]): - """Sets the properties of this VertexType. - - - :param properties: The properties of this VertexType. - :type properties: List[ModelProperty] - """ - - self._properties = properties - - @property - def primary_keys(self) -> List[str]: - """Gets the primary_keys of this VertexType. - - - :return: The primary_keys of this VertexType. - :rtype: List[str] - """ - return self._primary_keys - - @primary_keys.setter - def primary_keys(self, primary_keys: List[str]): - """Sets the primary_keys of this VertexType. - - - :param primary_keys: The primary_keys of this VertexType. - :type primary_keys: List[str] - """ - - self._primary_keys = primary_keys diff --git a/flex/coordinator/gs_flex_coordinator/openapi/openapi.yaml b/flex/coordinator/gs_flex_coordinator/openapi/openapi.yaml deleted file mode 100644 index dfbdb2e02ae8..000000000000 --- a/flex/coordinator/gs_flex_coordinator/openapi/openapi.yaml +++ /dev/null @@ -1,3405 +0,0 @@ -openapi: 3.0.3 -info: - contact: - email: graphscope@alibaba-inc.com - name: GraphScope - description: |- - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about - specification at [doc](https://swagger.io/specification/v3/). - - Some useful links: - - [GraphScope Repository](https://github.com/alibaba/GraphScope) - - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - license: - name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html - title: GraphScope FLEX HTTP SERVICE API - version: 0.9.1 -externalDocs: - description: Find out More about GraphScope - url: http://graphscope.io -servers: -- url: / -paths: - /api/v1/alert/message: - get: - operationId: list_alert_messages - parameters: - - explode: true - in: query - name: alert_type - required: false - schema: - type: string - style: form - - explode: true - in: query - name: status - required: false - schema: - enum: - - solved - - unsolved - - dealing - type: string - style: form - - explode: true - in: query - name: severity - required: false - schema: - enum: - - warning - - emergency - type: string - style: form - - description: format with "2023-02-21-11-56-30" - explode: true - in: query - name: start_time - required: false - schema: - type: string - style: form - - description: format with "2023-02-21-11-56-30" - explode: true - in: query - name: end_time - required: false - schema: - type: string - style: form - responses: - "200": - content: - application/json: - example: - - message_id: ALERT-MESSAGE-QWERTYUIOP-1 - alert_name: HighDiskUtilization - severity: warning - metric_type: node - target: - - hostname-1 - trigger_time: 2023-02-21 11:56:30 - status: unsolved - message: "Disk usage node1 85.12%, exceeds threshold" - - message_id: ALERT-MESSAGE-QWERTYUIOP-2 - alert_name: HighDiskUtilization - severity: emergency - metric_type: node - target: - - hostname-1 - trigger_time: 2023-02-21 11:56:30 - status: solved - message: "Disk usage node1 85.12%, exceeds threshold" - - message_id: ALERT-MESSAGE-QWERTYUIOP-3 - alert_name: HighDiskUtilization - severity: warning - metric_type: node - target: - - hostname-1 - trigger_time: 2023-02-21 11:56:30 - status: dealing - message: "Disk usage node1 85.12%, exceeds threshold" - schema: - items: - $ref: '#/components/schemas/AlertMessage' - type: array - description: Successful operation - tags: - - alert - x-openapi-router-controller: gs_flex_coordinator.controllers.alert_controller - put: - description: Update alert messages in batch - operationId: update_alert_messages - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/update_alert_messages_request' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - "404": - description: Alert message not found - tags: - - alert - x-openapi-router-controller: gs_flex_coordinator.controllers.alert_controller - /api/v1/alert/receiver: - get: - operationId: list_receivers - responses: - "200": - content: - application/json: - example: - - type: webhook - receiver_id: RECEIVER-QWERTYUIOP-1 - webhook_url: http://webhook.com - is_at_all: false - at_user_ids: - - 111111 - - 222222 - enable: false - - type: webhook - receiver_id: RECEIVER-QWERTYUIOP-2 - webhook_url: http://webhook.com - is_at_all: false - at_user_ids: - - 111111 - - 222222 - enable: true - message: error message - schema: - items: - $ref: '#/components/schemas/AlertReceiver' - type: array - description: Successful operation - tags: - - alert - x-openapi-router-controller: gs_flex_coordinator.controllers.alert_controller - post: - operationId: register_receiver - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AlertReceiver' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - alert - x-openapi-router-controller: gs_flex_coordinator.controllers.alert_controller - /api/v1/alert/receiver/{receiver_id}: - delete: - operationId: delete_receiver_by_id - parameters: - - explode: false - in: path - name: receiver_id - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - "404": - description: Receiver not found - tags: - - alert - x-openapi-router-controller: gs_flex_coordinator.controllers.alert_controller - put: - operationId: update_receiver_by_id - parameters: - - explode: false - in: path - name: receiver_id - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AlertReceiver' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - "404": - description: Receiver not found - tags: - - alert - x-openapi-router-controller: gs_flex_coordinator.controllers.alert_controller - /api/v1/alert/rule: - get: - operationId: list_alert_rules - responses: - "200": - content: - application/json: - example: - - name: HighDiskUtilization - severity: warning - metric_type: node - conditions_description: disk usage >= 85 - enable: true - - name: GremlinServiceAvailable - severity: emergency - metric_type: node - conditions_description: g.V().limit(1) failed - enable: false - schema: - items: - $ref: '#/components/schemas/AlertRule' - type: array - description: Successful operation - tags: - - alert - x-openapi-router-controller: gs_flex_coordinator.controllers.alert_controller - /api/v1/alert/rule/{rule_name}: - delete: - operationId: delete_alert_rule_by_name - parameters: - - explode: false - in: path - name: rule_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - alert - x-openapi-router-controller: gs_flex_coordinator.controllers.alert_controller - put: - operationId: update_alert_rule_by_name - parameters: - - explode: false - in: path - name: rule_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AlertRule' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - alert - x-openapi-router-controller: gs_flex_coordinator.controllers.alert_controller - /api/v1/connection: - delete: - description: Close the connection with coordinator - operationId: close - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Close connection successfully - tags: - - connection - x-openapi-router-controller: gs_flex_coordinator.controllers.connection_controller - post: - description: Connect to coordinator service - operationId: connect - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Connection' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionStatus' - description: Connect coordinator service successfully - tags: - - connection - x-openapi-router-controller: gs_flex_coordinator.controllers.connection_controller - /api/v1/deployment/info: - get: - description: Get deployment's meta info - operationId: get_deployment_info - responses: - "200": - content: - application/json: - example: - cluster_type: HOSTS - creation_time: 2024-02-07 14:21:28 - graphs_info: - demo: - creation_time: 2024-02-07 14:21:28 - last_dataloading_time: 2024-02-08 14:21:28 - name: demo - update_time: 2024-02-07 14:21:28 - name: demo - solution: INTERACTIVE - version: 0.27.0 - schema: - $ref: '#/components/schemas/DeploymentInfo' - description: successful operation - tags: - - deployment - x-openapi-router-controller: gs_flex_coordinator.controllers.deployment_controller - /api/v1/deployment/log: - get: - operationId: fetch_log - parameters: - - explode: true - in: query - name: component - required: true - schema: - type: string - style: form - - explode: true - in: query - name: pod_name - required: true - schema: - type: string - style: form - - explode: true - in: query - name: container_name - required: true - schema: - type: string - style: form - - explode: true - in: query - name: since_seconds - required: true - schema: - type: integer - style: form - responses: - "200": - content: - application/json: - schema: - items: - $ref: '#/components/schemas/DeploymentStatus' - type: array - description: successful operation - tags: - - deployment - x-openapi-router-controller: gs_flex_coordinator.controllers.deployment_controller - /api/v1/deployment/status: - get: - description: Get deployment's status (k8s only) - operationId: get_deployment_status - responses: - "200": - content: - application/json: - schema: - items: - $ref: '#/components/schemas/DeploymentStatus' - type: array - description: successful operation - tags: - - deployment - x-openapi-router-controller: gs_flex_coordinator.controllers.deployment_controller - /api/v1/file/uploading: - post: - operationId: upload_file - requestBody: - content: - multipart/form-data: - schema: - $ref: '#/components/schemas/upload_file_request' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - utils - x-openapi-router-controller: gs_flex_coordinator.controllers.utils_controller - /api/v1/graph: - get: - description: List all graphs - operationId: list_graphs - responses: - "200": - content: - application/json: - example: - - name: demo - store_type: mutable_csr - stored_procedures: - directory: plugins - schema: - vertex_types: - - type_id: 0 - type_name: person - properties: - - property_id: 0 - property_name: id - property_type: - primitive_type: DT_STRING - - property_id: 1 - property_name: name - property_type: - primitive_type: DT_STRING - primary_keys: - - id - - type_id: 1 - type_name: software - properties: - - property_id: 0 - property_name: id - property_type: - primitive_type: DT_STRING - - property_id: 1 - property_name: name - property_type: - primitive_type: DT_STRING - primary_keys: - - id - edge_types: - - type_id: 0 - type_name: knows - vertex_type_pair_relations: - - source_vertex: person - destination_vertex: person - relation: MANY_TO_MANY - x_csr_params: - edge_storage_strategy: ONLY_IN - properties: - - property_id: 0 - property_name: weight - property_type: - primitive_type: DT_STRING - - type_id: 1 - type_name: created - vertex_type_pair_relations: - - source_vertex: person - destination_vertex: software - relation: MANY_TO_MANY - x_csr_params: - edge_storage_strategy: ONLY_IN - properties: - - property_id: 0 - property_name: weight - property_type: - primitive_type: DT_STRING - schema: - items: - $ref: '#/components/schemas/Graph' - type: array - description: Successful operation - tags: - - graph - x-openapi-router-controller: gs_flex_coordinator.controllers.graph_controller - post: - description: Create a new graph - operationId: create_graph - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Graph' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - graph - x-openapi-router-controller: gs_flex_coordinator.controllers.graph_controller - /api/v1/graph/{graph_name}: - delete: - description: Delete a graph by name - operationId: delete_graph - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - graph - x-openapi-router-controller: gs_flex_coordinator.controllers.graph_controller - /api/v1/graph/{graph_name}/dataloading: - post: - operationId: create_dataloading_job - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/SchemaMapping' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - job - x-openapi-router-controller: gs_flex_coordinator.controllers.job_controller - /api/v1/graph/{graph_name}/dataloading/config: - get: - description: get dataloading configuration - operationId: get_dataloading_config - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - example: - graph: demo - loading_config: overwrite - format: - type: csv - metadata: - delimiter: '|' - vertex_mappings: - - type_name: person - inputs: - - /home/graphscope/path/to/person.csv - column_mappings: - - column: - index: 0 - name: id - property: id - - column: - index: 1 - name: name - property: name - - type_name: software - inputs: - - /home/graphscope/path/to/software.csv - column_mappings: - - column: - index: 0 - name: id - property: id - - column: - index: 1 - name: name - property: name - edge_mappings: - - type_triplet: - edge: knows - source_vertex: person - destination_vertex: person - inputs: - - /home/graphscope/path/to/person_knows_person.csv - source_vertex_mappings: - - column: - index: 0 - name: id - destination_vertex_mappings: - - column: - index: 1 - name: id - column_mappings: - - column: - index: 2 - name: weight - property: weight - - type_triplet: - edge: created - source_vertex: person - destination_vertex: software - inputs: - - /home/graphscope/path/to/person_created_software.csv - source_vertex_mappings: - - column: - index: 0 - name: id - destination_vertex_mappings: - - column: - index: 1 - name: id - column_mappings: - - column: - index: 2 - name: weight - property: weight - schema: - $ref: '#/components/schemas/SchemaMapping' - description: Successful operation - tags: - - job - x-openapi-router-controller: gs_flex_coordinator.controllers.job_controller - /api/v1/graph/{graph_name}/datasource: - get: - description: List data source on graph - operationId: get_datasource - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - example: - vertices_datasource: - - data_source: FILE - type_name: person - location: /home/graphscope/path/to/person.csv - property_mapping: - "0": id - "1": name - - data_source: FILE - type_name: software - location: /home/graphscope/path/to/software.csv - property_mapping: - "0": id - "1": name - edges_datasource: - - data_source: FILE - type_name: knows - source_vertex: person - destination_vertex: person - location: /home/graphscope/path/to/person_knows_person.csv - source_pk_column_map: - "0": id - destination_pk_column_map: - "1": id - property_mapping: - "2": weight - - data_source: FILE - type_name: created - source_vertex: person - destination_vertex: software - location: /home/graphscope/path/to/person_created_software.csv - source_pk_column_map: - "0": id - destination_pk_column_map: - "1": id - property_mapping: - "2": weight - schema: - $ref: '#/components/schemas/DataSource' - description: Successful operation - tags: - - datasource - x-openapi-router-controller: gs_flex_coordinator.controllers.datasource_controller - post: - description: Import data source in batch - operationId: import_datasource - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DataSource' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - datasource - x-openapi-router-controller: gs_flex_coordinator.controllers.datasource_controller - /api/v1/graph/{graph_name}/datasource/edge_datasource: - post: - description: Bind data source on edge type - operationId: bind_edge_datasource - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/EdgeDataSource' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - datasource - x-openapi-router-controller: gs_flex_coordinator.controllers.datasource_controller - /api/v1/graph/{graph_name}/datasource/edge_datasource/{type_name}: - delete: - description: Unbind datasource on an edge type - operationId: unbind_edge_datasource - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: type_name - required: true - schema: - type: string - style: simple - - explode: true - in: query - name: source_vertex_type - required: true - schema: - type: string - style: form - - explode: true - in: query - name: destination_vertex_type - required: true - schema: - type: string - style: form - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - datasource - x-openapi-router-controller: gs_flex_coordinator.controllers.datasource_controller - get: - description: Get edge data source - operationId: get_edge_datasource - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: type_name - required: true - schema: - type: string - style: simple - - explode: true - in: query - name: source_vertex_type - required: true - schema: - type: string - style: form - - explode: true - in: query - name: destination_vertex_type - required: true - schema: - type: string - style: form - responses: - "200": - content: - application/json: - example: - data_source: FILE - type_name: created - source_vertex: person - destination_vertex: software - location: /home/graphscope/path/to/person_created_software.csv - source_pk_column_map: - "0": id - destination_pk_column_map: - "1": id - property_mapping: - "2": weight - schema: - $ref: '#/components/schemas/EdgeDataSource' - description: Successful operation - tags: - - datasource - x-openapi-router-controller: gs_flex_coordinator.controllers.datasource_controller - /api/v1/graph/{graph_name}/datasource/vertex_datasource: - post: - description: Bind data source on vertex type - operationId: bind_vertex_datasource - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/VertexDataSource' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - datasource - x-openapi-router-controller: gs_flex_coordinator.controllers.datasource_controller - /api/v1/graph/{graph_name}/datasource/vertex_datasource/{type_name}: - delete: - description: Unbind datasource on a vertex type - operationId: unbind_vertex_datasource - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: type_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - datasource - x-openapi-router-controller: gs_flex_coordinator.controllers.datasource_controller - get: - description: Get vertex data source - operationId: get_vertex_datasource - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: type_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - example: - data_source: FILE - type_name: person - location: /home/graphscope/path/to/person.csv - property_mapping: - "0": id - "1": name - schema: - $ref: '#/components/schemas/VertexDataSource' - description: Successful operation - tags: - - datasource - x-openapi-router-controller: gs_flex_coordinator.controllers.datasource_controller - /api/v1/graph/{graph_name}/procedure: - get: - description: List stored procedures on a certain graph - operationId: list_procedures_by_graph - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - example: - - bound_graph: demo - description: stored procedure 1 - enable: true - runnable: true - name: procedure-1 - query: "MATCH (u: person) Return u.id, u.name LIMIT 5;" - type: cypher - params: - - name: id - type: DT_STRING - returns: - - name: name - type: DT_STRING - schema: - items: - $ref: '#/components/schemas/Procedure' - type: array - description: Successful operation - tags: - - procedure - x-openapi-router-controller: gs_flex_coordinator.controllers.procedure_controller - post: - description: Create a new stored procedure on a certain graph - operationId: create_procedure - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Procedure' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - procedure - x-openapi-router-controller: gs_flex_coordinator.controllers.procedure_controller - /api/v1/graph/{graph_name}/procedure/{procedure_name}: - delete: - description: Delete a stored procedure on a certain graph - operationId: delete_procedure - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: procedure_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - procedure - x-openapi-router-controller: gs_flex_coordinator.controllers.procedure_controller - get: - description: Get a procedure by name - operationId: get_procedure - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: procedure_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - example: - bound_graph: demo - description: stored procedure 1 - enable: true - runnable: true - name: procedure-1 - query: "MATCH (u: person) Return u.id, u.name LIMIT 5;" - type: cypher - params: - - name: id - type: DT_STRING - returns: - - name: name - type: DT_STRING - schema: - $ref: '#/components/schemas/Procedure' - description: successful operation - tags: - - procedure - x-openapi-router-controller: gs_flex_coordinator.controllers.procedure_controller - put: - description: Update stored procedure on a certain graph - operationId: update_procedure - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: procedure_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Procedure' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - procedure - x-openapi-router-controller: gs_flex_coordinator.controllers.procedure_controller - /api/v1/graph/{graph_name}/schema: - get: - description: Get graph schema by name - operationId: get_schema - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - example: - vertex_types: - - type_id: 0 - type_name: person - properties: - - property_id: 0 - property_name: id - property_type: - primitive_type: DT_STRING - - property_id: 1 - property_name: name - property_type: - primitive_type: DT_STRING - primary_keys: - - id - - type_id: 1 - type_name: software - properties: - - property_id: 0 - property_name: id - property_type: - primitive_type: DT_STRING - - property_id: 1 - property_name: name - property_type: - primitive_type: DT_STRING - primary_keys: - - id - edge_types: - - type_id: 0 - type_name: knows - vertex_type_pair_relations: - - source_vertex: person - destination_vertex: person - relation: MANY_TO_MANY - x_csr_params: - edge_storage_strategy: ONLY_IN - properties: - - property_id: 0 - property_name: weight - property_type: - primitive_type: DT_STRING - - type_id: 1 - type_name: created - vertex_type_pair_relations: - - source_vertex: person - destination_vertex: software - relation: MANY_TO_MANY - x_csr_params: - edge_storage_strategy: ONLY_IN - properties: - - property_id: 0 - property_name: weight - property_type: - primitive_type: DT_STRING - schema: - $ref: '#/components/schemas/Schema' - description: Successful operation - tags: - - graph - x-openapi-router-controller: gs_flex_coordinator.controllers.graph_controller - /api/v1/graph/{graph_name}/schema/edge_edge/{type_name}: - delete: - description: Delete a edge type by name - operationId: delete_edge_type - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: type_name - required: true - schema: - type: string - style: simple - - explode: true - in: query - name: source_vertex_type - required: true - schema: - type: string - style: form - - explode: true - in: query - name: destination_vertex_type - required: true - schema: - type: string - style: form - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - graph - x-openapi-router-controller: gs_flex_coordinator.controllers.graph_controller - /api/v1/graph/{graph_name}/schema/edge_type: - post: - description: Create a edge type - operationId: create_edge_type - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/EdgeType' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - graph - x-openapi-router-controller: gs_flex_coordinator.controllers.graph_controller - /api/v1/graph/{graph_name}/schema/vertex_type: - post: - description: Create a vertex type - operationId: create_vertex_type - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/VertexType' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - graph - x-openapi-router-controller: gs_flex_coordinator.controllers.graph_controller - /api/v1/graph/{graph_name}/schema/vertex_type/{type_name}: - delete: - description: Delete a vertex type by name - operationId: delete_vertex_type - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: type_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - graph - x-openapi-router-controller: gs_flex_coordinator.controllers.graph_controller - /api/v1/groot/graph: - get: - description: list groot graph - operationId: list_groot_graph - responses: - "200": - content: - application/json: - example: - - name: demo - type: GrootGraph - directed: true - creation_time: 2024-04-01 12:00:00 - schema: - vertices: - - label: person - properties: - - id: 0 - name: id - type: STRING - is_primary_key: true - - id: 1 - name: name - type: STRING - is_primary_key: false - - label: software - properties: - - id: 0 - name: id - type: STRING - is_primary_key: true - - id: 1 - name: name - type: STRING - is_primary_key: false - edges: - - label: knows - relations: - - src_label: person - dst_label: person - properties: - - id: 0 - name: weight - type: DOUBLE - is_primary_key: false - - label: created - relations: - - src_label: person - dst_label: software - properties: - - id: 0 - name: weight - type: DOUBLE - is_primary_key: false - schema: - items: - $ref: '#/components/schemas/GrootGraph' - type: array - description: Successful operation - tags: - - legacy - x-openapi-router-controller: gs_flex_coordinator.controllers.legacy_controller - /api/v1/groot/graph/{graph_name}/dataloading: - post: - operationId: create_groot_dataloading_job - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GrootDataloadingJobConfig' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - legacy - x-openapi-router-controller: gs_flex_coordinator.controllers.legacy_controller - /api/v1/groot/graph/{graph_name}/schema: - get: - description: Get graph schema by name - operationId: get_groot_schema - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - example: - vertices: - - label: person - properties: - - id: 0 - name: id - type: STRING - is_primary_key: true - - id: 1 - name: name - type: STRING - is_primary_key: false - - label: software - properties: - - id: 0 - name: id - type: STRING - is_primary_key: true - - id: 1 - name: name - type: STRING - is_primary_key: false - edges: - - label: knows - relations: - - src_label: person - dst_label: person - properties: - - id: 0 - name: weight - type: DOUBLE - is_primary_key: false - - label: created - relations: - - src_label: person - dst_label: software - properties: - - id: 0 - name: weight - type: DOUBLE - is_primary_key: false - schema: - $ref: '#/components/schemas/GrootSchema' - description: Successful operation - tags: - - legacy - x-openapi-router-controller: gs_flex_coordinator.controllers.legacy_controller - post: - description: Import schema to groot graph - operationId: import_groot_schema - parameters: - - explode: false - in: path - name: graph_name - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GrootSchema' - required: true - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - legacy - x-openapi-router-controller: gs_flex_coordinator.controllers.legacy_controller - /api/v1/job: - get: - operationId: list_jobs - responses: - "200": - content: - application/json: - example: - - job_id: JOB-QWERTYUIOPASDFGH-1 - type: DATA IMPORT - status: RUNNING - start_time: 2024-02-24 00:00:00 - end_time: null - log: logging... - detail: - graph_name: demo - - job_id: JOB-QWERTYUIOPASDFGH-2 - type: DATA IMPORT - status: CANCELLED - start_time: 2024-02-24 00:00:00 - end_time: null - log: logging... - detail: - graph_name: demo - - job_id: JOB-QWERTYUIOPASDFGH-3 - type: DATA IMPORT - status: SUCCESS - start_time: 2024-02-24 00:00:00 - end_time: 2024-02-24 12:00:00 - log: logging... - detail: - graph_name: demo - - job_id: JOB-QWERTYUIOPASDFGH-4 - type: DATA IMPORT - status: FAILED - start_time: 2024-02-24 00:00:00 - end_time: 2024-02-24 12:00:00 - log: logging... - detail: - graph_name: demo - - job_id: JOB-QWERTYUIOPASDFGH-5 - type: DATA IMPORT - status: WAITING - start_time: null - end_time: null - detail: - graph_name: demo - schema: - items: - $ref: '#/components/schemas/JobStatus' - type: array - description: successful operation - tags: - - job - x-openapi-router-controller: gs_flex_coordinator.controllers.job_controller - /api/v1/job/{job_id}: - delete: - operationId: delete_job_by_id - parameters: - - explode: false - in: path - name: job_id - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: Successful operation - tags: - - job - x-openapi-router-controller: gs_flex_coordinator.controllers.job_controller - get: - operationId: get_job_by_id - parameters: - - explode: false - in: path - name: job_id - required: true - schema: - type: string - style: simple - responses: - "200": - content: - application/json: - example: - job_id: JOB-QWERTYUIOPASDFGH-1 - type: DATA IMPORT - status: RUNNING - start_time: 2024-02-24 00:00:00 - end_time: null - log: logging... - schema: - $ref: '#/components/schemas/JobStatus' - description: successful operation - tags: - - job - x-openapi-router-controller: gs_flex_coordinator.controllers.job_controller - /api/v1/node/status: - get: - description: "Get node status (cpu/memory/disk, local only)" - operationId: get_node_status - responses: - "200": - content: - application/json: - example: - - node: hostname-1 - cpu_usage: 80 - memory_usage: 40 - disk_usage: 85 - schema: - items: - $ref: '#/components/schemas/NodeStatus' - type: array - description: successful operation - tags: - - deployment - x-openapi-router-controller: gs_flex_coordinator.controllers.deployment_controller - /api/v1/procedure: - get: - description: List all the stored procedures - operationId: list_procedures - responses: - "200": - content: - application/json: - example: - - bound_graph: demo - description: stored procedure 1 - enable: true - runnable: true - name: procedure-1 - query: "MATCH (u: person) Return u.id, u.name LIMIT 5;" - type: cypher - params: - - name: id - type: DT_STRING - returns: - - name: name - type: DT_STRING - schema: - items: - $ref: '#/components/schemas/Procedure' - type: array - description: Successful operation - tags: - - procedure - x-openapi-router-controller: gs_flex_coordinator.controllers.procedure_controller - /api/v1/service/restart: - post: - description: Restart current service - operationId: restart_service - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - service - x-openapi-router-controller: gs_flex_coordinator.controllers.service_controller - /api/v1/service/start: - post: - description: Start service - operationId: start_service - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/start_service_request' - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - service - x-openapi-router-controller: gs_flex_coordinator.controllers.service_controller - /api/v1/service/status: - get: - description: Get service status - operationId: get_service_status - responses: - "200": - content: - application/json: - example: - status: running - graph_name: demo - sdk_endpoints: - cypher: neo4j://mock.api.cypher:7676 - gremlin: ws://mock.api.gremlin/gremlin - hqps: http://mock.api.hqps:10000 - grpc: http://mock.api.grpc:10000 - schema: - $ref: '#/components/schemas/ServiceStatus' - description: successful operation - tags: - - service - x-openapi-router-controller: gs_flex_coordinator.controllers.service_controller - /api/v1/service/stop: - post: - description: Stop current service - operationId: stop_service - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - description: successful operation - tags: - - service - x-openapi-router-controller: gs_flex_coordinator.controllers.service_controller -components: - schemas: - ApiResponse: - example: operation successful - type: string - Connection: - example: - coordinator_endpoint: coordinator_endpoint - properties: - coordinator_endpoint: - title: coordinator_endpoint - type: string - title: Connection - type: object - x-body-name: connection - ConnectionStatus: - example: - solution: INTERACTIVE - status: CONNECTED - properties: - status: - enum: - - CONNECTED - title: status - type: string - solution: - enum: - - INTERACTIVE - - GRAPHSCOPE_INSIGHT - title: solution - type: string - title: ConnectionStatus - type: object - x-body-name: connection_status - Graph: - example: - schema: - vertex_types: - - type_name: type_name - primary_keys: - - primary_keys - - primary_keys - type_id: 0 - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - type_name: type_name - primary_keys: - - primary_keys - - primary_keys - type_id: 0 - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - edge_types: - - type_name: type_name - type_id: 1 - vertex_type_pair_relations: - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - type_name: type_name - type_id: 1 - vertex_type_pair_relations: - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - stored_procedures: - directory: plugins - name: name - store_type: mutable_csr - properties: - name: - title: name - type: string - store_type: - enum: - - mutable_csr - title: store_type - type: string - stored_procedures: - $ref: '#/components/schemas/Graph_stored_procedures' - schema: - $ref: '#/components/schemas/Schema' - title: Graph - type: object - x-body-name: graph - Schema: - example: - vertex_types: - - type_name: type_name - primary_keys: - - primary_keys - - primary_keys - type_id: 0 - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - type_name: type_name - primary_keys: - - primary_keys - - primary_keys - type_id: 0 - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - edge_types: - - type_name: type_name - type_id: 1 - vertex_type_pair_relations: - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - type_name: type_name - type_id: 1 - vertex_type_pair_relations: - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - properties: - vertex_types: - items: - $ref: '#/components/schemas/VertexType' - title: vertex_types - type: array - edge_types: - items: - $ref: '#/components/schemas/EdgeType' - title: edge_types - type: array - title: Schema - type: object - x-body-name: schema - VertexType: - example: - type_name: type_name - primary_keys: - - primary_keys - - primary_keys - type_id: 0 - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - properties: - type_id: - format: int32 - title: type_id - type: integer - type_name: - title: type_name - type: string - properties: - items: - $ref: '#/components/schemas/Property' - title: properties - type: array - primary_keys: - items: - type: string - title: primary_keys - type: array - title: VertexType - type: object - x-body-name: vertex_type - EdgeType: - example: - type_name: type_name - type_id: 1 - vertex_type_pair_relations: - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - properties: - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - properties: - type_id: - format: int32 - title: type_id - type: integer - type_name: - title: type_name - type: string - vertex_type_pair_relations: - items: - $ref: '#/components/schemas/EdgeType_vertex_type_pair_relations_inner' - title: vertex_type_pair_relations - type: array - properties: - items: - $ref: '#/components/schemas/Property' - title: properties - type: array - title: EdgeType - type: object - x-body-name: edge_type - Property: - example: - property_type: - primitive_type: DT_DOUBLE - property_id: 6 - property_name: property_name - properties: - property_id: - format: int32 - title: property_id - type: integer - property_name: - title: property_name - type: string - property_type: - $ref: '#/components/schemas/Property_property_type' - title: Property - type: object - x-body-name: property - Procedure: - example: - runnable: true - bound_graph: bound_graph - enable: true - query: query - name: name - description: description - returns: - - name: name - type: type - - name: name - type: type - type: cpp - params: - - name: name - type: type - - name: name - type: type - properties: - name: - title: name - type: string - bound_graph: - title: bound_graph - type: string - description: - title: description - type: string - type: - enum: - - cpp - - cypher - title: type - type: string - query: - title: query - type: string - enable: - title: enable - type: boolean - runnable: - title: runnable - type: boolean - params: - items: - $ref: '#/components/schemas/Procedure_params_inner' - title: params - type: array - returns: - items: - $ref: '#/components/schemas/Procedure_params_inner' - title: returns - type: array - title: Procedure - type: object - x-body-name: procedure - DeploymentInfo: - example: - creation_time: creation_time - graphs_info: - key: - creation_time: creation_time - update_time: update_time - last_dataloading_time: last_dataloading_time - name: name - solution: INTERACTIVE - name: name - cluster_type: HOSTS - version: version - properties: - name: - title: name - type: string - cluster_type: - enum: - - HOSTS - - KUBERNETES - title: cluster_type - type: string - version: - title: version - type: string - solution: - enum: - - INTERACTIVE - - GRAPHSCOPE_INSIGHT - title: solution - type: string - creation_time: - title: creation_time - type: string - graphs_info: - additionalProperties: - $ref: '#/components/schemas/DeploymentInfo_graphs_info_value' - title: graphs_info - type: object - title: DeploymentInfo - type: object - x-body-name: deployment_info - DeploymentStatus: - description: K8s only - example: - container: - - container - - container - creation_time: creation_time - image: - - image - - image - node: node - restart_count: 0 - memory_value: 1 - cpu_value: 6 - name: name - labels: - - labels - - labels - status: status - timestamp: timestamp - properties: - name: - title: name - type: string - container: - items: - type: string - title: container - type: array - image: - items: - type: string - title: image - type: array - labels: - items: - type: string - title: labels - type: array - node: - title: node - type: string - status: - title: status - type: string - restart_count: - format: int32 - title: restart_count - type: integer - cpu_value: - description: cpu value in millicore - format: int32 - title: cpu_value - type: integer - memory_value: - description: memory value in megabytes - format: int32 - title: memory_value - type: integer - timestamp: - title: timestamp - type: string - creation_time: - title: creation_time - type: string - title: DeploymentStatus - type: object - x-body-name: deployment_status - NodeStatus: - example: - node: node - memory_usage: 6.027456183070403 - disk_usage: 1.4658129805029452 - cpu_usage: 0.8008281904610115 - properties: - node: - title: node - type: string - cpu_usage: - format: double - title: cpu_usage - type: number - memory_usage: - format: double - title: memory_usage - type: number - disk_usage: - format: double - title: disk_usage - type: number - title: NodeStatus - type: object - x-body-name: node_status - ServiceStatus: - example: - graph_name: graph_name - sdk_endpoints: - gremlin: gremlin - cypher: cypher - hqps: hqps - grpc: grpc - status: status - properties: - status: - title: status - type: string - graph_name: - description: which graph is serving now - title: graph_name - type: string - sdk_endpoints: - $ref: '#/components/schemas/ServiceStatus_sdk_endpoints' - title: ServiceStatus - type: object - x-body-name: service_status - AlertRule: - example: - severity: warning - conditions_description: conditions_description - enable: true - name: name - metric_type: node - frequency: 0 - properties: - name: - title: name - type: string - severity: - enum: - - warning - - emergency - title: severity - type: string - metric_type: - enum: - - node - - service - title: metric_type - type: string - conditions_description: - title: conditions_description - type: string - frequency: - description: (mins) - title: frequency - type: integer - enable: - title: enable - type: boolean - title: AlertRule - type: object - x-body-name: alert_rule - AlertMessage: - example: - severity: warning - trigger_time: trigger_time - metric_type: node - message_id: message_id - message: message - alert_name: alert_name - target: - - target - - target - status: unsolved - properties: - message_id: - description: Generated in server side - title: message_id - type: string - alert_name: - title: alert_name - type: string - severity: - enum: - - warning - - emergency - title: severity - type: string - metric_type: - enum: - - node - - service - title: metric_type - type: string - target: - items: - type: string - title: target - type: array - trigger_time: - title: trigger_time - type: string - status: - enum: - - unsolved - - solved - - dealing - title: status - type: string - message: - title: message - type: string - title: AlertMessage - type: object - x-body-name: alert_message - AlertReceiver: - example: - webhook_url: webhook_url - is_at_all: true - receiver_id: receiver_id - enable: true - at_user_ids: - - at_user_ids - - at_user_ids - type: webhook - message: message - properties: - type: - enum: - - webhook - title: type - type: string - receiver_id: - description: Generated in server side - title: receiver_id - type: string - webhook_url: - title: webhook_url - type: string - at_user_ids: - items: - type: string - title: at_user_ids - type: array - is_at_all: - title: is_at_all - type: boolean - enable: - title: enable - type: boolean - message: - description: error message generated in server side - title: message - type: string - title: AlertReceiver - type: object - x-body-name: alert_receiver - SchemaMapping: - example: - loading_config: - format: - metadata: - key: "" - type: type - import_option: init - data_source: - scheme: file - edge_mappings: - - inputs: - - inputs - - inputs - source_vertex_mappings: - - column: - name: name - index: 0 - - column: - name: name - index: 0 - destination_vertex_mappings: - - column: - name: name - index: 0 - - column: - name: name - index: 0 - column_mappings: - - column: - name: name - index: 0 - property: property - - column: - name: name - index: 0 - property: property - type_triplet: - edge: edge - source_vertex: source_vertex - destination_vertex: destination_vertex - - inputs: - - inputs - - inputs - source_vertex_mappings: - - column: - name: name - index: 0 - - column: - name: name - index: 0 - destination_vertex_mappings: - - column: - name: name - index: 0 - - column: - name: name - index: 0 - column_mappings: - - column: - name: name - index: 0 - property: property - - column: - name: name - index: 0 - property: property - type_triplet: - edge: edge - source_vertex: source_vertex - destination_vertex: destination_vertex - graph: graph - vertex_mappings: - - type_name: type_name - inputs: - - inputs - - inputs - column_mappings: - - column: - name: name - index: 0 - property: property - - column: - name: name - index: 0 - property: property - - type_name: type_name - inputs: - - inputs - - inputs - column_mappings: - - column: - name: name - index: 0 - property: property - - column: - name: name - index: 0 - property: property - properties: - graph: - title: graph - type: string - loading_config: - $ref: '#/components/schemas/SchemaMapping_loading_config' - vertex_mappings: - items: - $ref: '#/components/schemas/VertexMapping' - title: vertex_mappings - type: array - edge_mappings: - items: - $ref: '#/components/schemas/EdgeMapping' - title: edge_mappings - type: array - title: SchemaMapping - type: object - x-body-name: schema_mapping - VertexMapping: - example: - type_name: type_name - inputs: - - inputs - - inputs - column_mappings: - - column: - name: name - index: 0 - property: property - - column: - name: name - index: 0 - property: property - properties: - type_name: - title: type_name - type: string - inputs: - items: - type: string - title: inputs - type: array - column_mappings: - items: - $ref: '#/components/schemas/ColumnMapping' - title: column_mappings - type: array - title: VertexMapping - type: object - x-body-name: vertex_mapping - EdgeMapping: - example: - inputs: - - inputs - - inputs - source_vertex_mappings: - - column: - name: name - index: 0 - - column: - name: name - index: 0 - destination_vertex_mappings: - - column: - name: name - index: 0 - - column: - name: name - index: 0 - column_mappings: - - column: - name: name - index: 0 - property: property - - column: - name: name - index: 0 - property: property - type_triplet: - edge: edge - source_vertex: source_vertex - destination_vertex: destination_vertex - properties: - type_triplet: - $ref: '#/components/schemas/EdgeMapping_type_triplet' - inputs: - items: - type: string - title: inputs - type: array - source_vertex_mappings: - items: - $ref: '#/components/schemas/EdgeMapping_source_vertex_mappings_inner' - title: source_vertex_mappings - type: array - destination_vertex_mappings: - items: - $ref: '#/components/schemas/EdgeMapping_destination_vertex_mappings_inner' - title: destination_vertex_mappings - type: array - column_mappings: - items: - $ref: '#/components/schemas/ColumnMapping' - title: column_mappings - type: array - title: EdgeMapping - type: object - x-body-name: edge_mapping - ColumnMapping: - example: - column: - name: name - index: 0 - property: property - properties: - column: - $ref: '#/components/schemas/EdgeMapping_source_vertex_mappings_inner_column' - property: - description: must align with the schema - title: property - type: string - title: ColumnMapping - type: object - x-body-name: column_mapping - JobStatus: - example: - start_time: start_time - log: log - job_id: job_id - end_time: end_time - detail: - key: "" - type: type - status: RUNNING - properties: - job_id: - title: job_id - type: string - type: - title: type - type: string - status: - enum: - - RUNNING - - SUCCESS - - FAILED - - CANCELLED - - WAITING - title: status - type: string - start_time: - title: start_time - type: string - end_time: - title: end_time - type: string - log: - description: URL or log string - title: log - type: string - detail: - additionalProperties: true - title: detail - type: object - title: JobStatus - type: object - x-body-name: job_status - VertexDataSource: - example: - type_name: type_name - property_mapping: - key: "" - location: location - data_source: ODPS - properties: - data_source: - enum: - - ODPS - - FILE - title: data_source - type: string - type_name: - title: type_name - type: string - location: - title: location - type: string - property_mapping: - additionalProperties: true - title: property_mapping - type: object - title: VertexDataSource - type: object - x-body-name: vertex_data_source - EdgeDataSource: - example: - source_pk_column_map: - key: "" - type_name: type_name - destination_pk_column_map: - key: "" - source_vertex: source_vertex - destination_vertex: destination_vertex - property_mapping: - key: "" - location: location - data_source: ODPS - properties: - data_source: - enum: - - ODPS - - FILE - title: data_source - type: string - type_name: - title: type_name - type: string - source_vertex: - title: source_vertex - type: string - destination_vertex: - title: destination_vertex - type: string - location: - title: location - type: string - source_pk_column_map: - additionalProperties: true - title: source_pk_column_map - type: object - destination_pk_column_map: - additionalProperties: true - title: destination_pk_column_map - type: object - property_mapping: - additionalProperties: true - title: property_mapping - type: object - title: EdgeDataSource - type: object - x-body-name: edge_data_source - DataSource: - example: - edges_datasource: - - source_pk_column_map: - key: "" - type_name: type_name - destination_pk_column_map: - key: "" - source_vertex: source_vertex - destination_vertex: destination_vertex - property_mapping: - key: "" - location: location - data_source: ODPS - - source_pk_column_map: - key: "" - type_name: type_name - destination_pk_column_map: - key: "" - source_vertex: source_vertex - destination_vertex: destination_vertex - property_mapping: - key: "" - location: location - data_source: ODPS - vertices_datasource: - - type_name: type_name - property_mapping: - key: "" - location: location - data_source: ODPS - - type_name: type_name - property_mapping: - key: "" - location: location - data_source: ODPS - properties: - vertices_datasource: - items: - $ref: '#/components/schemas/VertexDataSource' - title: vertices_datasource - type: array - edges_datasource: - items: - $ref: '#/components/schemas/EdgeDataSource' - title: edges_datasource - type: array - title: DataSource - type: object - x-body-name: data_source - GrootGraph: - example: - creation_time: creation_time - schema: - vertices: - - label: label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - label: label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - edges: - - label: label - relations: - - src_label: src_label - dst_label: dst_label - - src_label: src_label - dst_label: dst_label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - label: label - relations: - - src_label: src_label - dst_label: dst_label - - src_label: src_label - dst_label: dst_label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - directed: true - gremlin_interface: - grpc_endpoint: grpc_endpoint - password: password - gremlin_endpoint: gremlin_endpoint - username: username - name: name - type: GrootGraph - properties: - name: - title: name - type: string - type: - enum: - - GrootGraph - title: type - type: string - directed: - title: directed - type: boolean - creation_time: - title: creation_time - type: string - schema: - $ref: '#/components/schemas/GrootSchema' - gremlin_interface: - $ref: '#/components/schemas/GrootGraph_gremlin_interface' - title: GrootGraph - type: object - x-body-name: groot_graph - GrootSchema: - example: - vertices: - - label: label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - label: label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - edges: - - label: label - relations: - - src_label: src_label - dst_label: dst_label - - src_label: src_label - dst_label: dst_label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - label: label - relations: - - src_label: src_label - dst_label: dst_label - - src_label: src_label - dst_label: dst_label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - properties: - vertices: - items: - $ref: '#/components/schemas/GrootVertexType' - title: vertices - type: array - edges: - items: - $ref: '#/components/schemas/GrootEdgeType' - title: edges - type: array - title: GrootSchema - type: object - x-body-name: groot_schema - GrootVertexType: - example: - label: label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - properties: - label: - title: label - type: string - properties: - items: - $ref: '#/components/schemas/GrootProperty' - title: properties - type: array - title: GrootVertexType - type: object - x-body-name: groot_vertex_type - GrootEdgeType: - example: - label: label - relations: - - src_label: src_label - dst_label: dst_label - - src_label: src_label - dst_label: dst_label - properties: - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - - is_primary_key: true - name: name - id: 0 - type: DT_STRING - properties: - label: - title: label - type: string - relations: - items: - $ref: '#/components/schemas/GrootEdgeType_relations_inner' - title: relations - type: array - properties: - items: - $ref: '#/components/schemas/GrootProperty' - title: properties - type: array - title: GrootEdgeType - type: object - x-body-name: groot_edge_type - GrootProperty: - example: - is_primary_key: true - name: name - id: 0 - type: DT_STRING - properties: - id: - format: int32 - title: id - type: integer - name: - title: name - type: string - type: - enum: - - DT_STRING - - DT_SIGNED_INT64 - - DT_DOUBLE - title: type - type: string - is_primary_key: - title: is_primary_key - type: boolean - title: GrootProperty - type: object - x-body-name: groot_property - GrootDataloadingJobConfig: - example: - schedule: schedule - vertices: - - vertices - - vertices - repeat: once - edges: - - type_name: type_name - source_vertex: source_vertex - destination_vertex: destination_vertex - - type_name: type_name - source_vertex: source_vertex - destination_vertex: destination_vertex - properties: - vertices: - items: - type: string - title: vertices - type: array - edges: - items: - $ref: '#/components/schemas/GrootDataloadingJobConfig_edges_inner' - title: edges - type: array - schedule: - description: format with '2023-02-21 11:56:30' - title: schedule - type: string - repeat: - enum: - - once - - day - - week - title: repeat - type: string - title: GrootDataloadingJobConfig - type: object - x-body-name: groot_dataloading_job_config - start_service_request: - properties: - graph_name: - title: graph_name - type: string - title: start_service_request - type: object - update_alert_messages_request: - properties: - messages: - items: - $ref: '#/components/schemas/AlertMessage' - title: messages - type: array - batch_status: - description: Override the status of each message - enum: - - solved - - unsolved - - dealing - title: batch_status - type: string - batch_delete: - default: false - description: True will delete all the messages in request body - title: batch_delete - type: boolean - title: update_alert_messages_request - type: object - upload_file_request: - properties: - filestorage: - format: binary - type: string - type: object - Graph_stored_procedures: - example: - directory: plugins - properties: - directory: - enum: - - plugins - title: directory - type: string - title: Graph_stored_procedures - type: object - EdgeType_vertex_type_pair_relations_inner_x_csr_params: - description: Used for storage optimization - example: - edge_storage_strategy: ONLY_IN - properties: - edge_storage_strategy: - enum: - - ONLY_IN - - ONLY_OUT - - BOTH_OUT_IN - title: edge_storage_strategy - type: string - title: EdgeType_vertex_type_pair_relations_inner_x_csr_params - type: object - EdgeType_vertex_type_pair_relations_inner: - example: - source_vertex: source_vertex - destination_vertex: destination_vertex - x_csr_params: - edge_storage_strategy: ONLY_IN - relation: MANY_TO_MANY - properties: - source_vertex: - title: source_vertex - type: string - destination_vertex: - title: destination_vertex - type: string - relation: - enum: - - MANY_TO_MANY - - ONE_TO_MANY - - MANY_TO_ONE - - ONE_TO_ONE - title: relation - type: string - x_csr_params: - $ref: '#/components/schemas/EdgeType_vertex_type_pair_relations_inner_x_csr_params' - title: EdgeType_vertex_type_pair_relations_inner - type: object - Property_property_type: - example: - primitive_type: DT_DOUBLE - properties: - primitive_type: - enum: - - DT_DOUBLE - - DT_STRING - - DT_SIGNED_INT32 - - DT_SIGNED_INT64 - - DT_DATE32 - title: primitive_type - type: string - title: Property_property_type - type: object - Procedure_params_inner: - example: - name: name - type: type - properties: - name: - title: name - type: string - type: - title: type - type: string - title: Procedure_params_inner - type: object - DeploymentInfo_graphs_info_value: - example: - creation_time: creation_time - update_time: update_time - last_dataloading_time: last_dataloading_time - name: name - properties: - name: - title: name - type: string - creation_time: - title: creation_time - type: string - update_time: - title: update_time - type: string - last_dataloading_time: - title: last_dataloading_time - type: string - title: DeploymentInfo_graphs_info_value - type: object - ServiceStatus_sdk_endpoints: - example: - gremlin: gremlin - cypher: cypher - hqps: hqps - grpc: grpc - properties: - cypher: - title: cypher - type: string - gremlin: - title: gremlin - type: string - hqps: - title: hqps - type: string - grpc: - title: grpc - type: string - title: ServiceStatus_sdk_endpoints - type: object - SchemaMapping_loading_config_data_source: - example: - scheme: file - properties: - scheme: - enum: - - file - title: scheme - type: string - title: SchemaMapping_loading_config_data_source - type: object - SchemaMapping_loading_config_format: - example: - metadata: - key: "" - type: type - properties: - type: - title: type - type: string - metadata: - additionalProperties: true - title: metadata - type: object - title: SchemaMapping_loading_config_format - type: object - SchemaMapping_loading_config: - example: - format: - metadata: - key: "" - type: type - import_option: init - data_source: - scheme: file - properties: - data_source: - $ref: '#/components/schemas/SchemaMapping_loading_config_data_source' - import_option: - enum: - - init - - overwrite - title: import_option - type: string - format: - $ref: '#/components/schemas/SchemaMapping_loading_config_format' - title: SchemaMapping_loading_config - type: object - EdgeMapping_type_triplet: - description: "source label -> [edge label] -> destination label" - example: - edge: edge - source_vertex: source_vertex - destination_vertex: destination_vertex - properties: - edge: - title: edge - type: string - source_vertex: - title: source_vertex - type: string - destination_vertex: - title: destination_vertex - type: string - title: EdgeMapping_type_triplet - type: object - EdgeMapping_source_vertex_mappings_inner_column: - example: - name: name - index: 0 - properties: - index: - format: int32 - title: index - type: integer - name: - title: name - type: string - title: EdgeMapping_source_vertex_mappings_inner_column - type: object - EdgeMapping_source_vertex_mappings_inner: - description: Mapping column index to the primary key of source vertex - example: - column: - name: name - index: 0 - properties: - column: - $ref: '#/components/schemas/EdgeMapping_source_vertex_mappings_inner_column' - title: EdgeMapping_source_vertex_mappings_inner - type: object - EdgeMapping_destination_vertex_mappings_inner: - description: Mapping column index to the primary key of destination vertex - example: - column: - name: name - index: 0 - properties: - column: - $ref: '#/components/schemas/EdgeMapping_source_vertex_mappings_inner_column' - title: EdgeMapping_destination_vertex_mappings_inner - type: object - GrootGraph_gremlin_interface: - example: - grpc_endpoint: grpc_endpoint - password: password - gremlin_endpoint: gremlin_endpoint - username: username - properties: - gremlin_endpoint: - title: gremlin_endpoint - type: string - grpc_endpoint: - title: grpc_endpoint - type: string - username: - title: username - type: string - password: - title: password - type: string - title: GrootGraph_gremlin_interface - type: object - GrootEdgeType_relations_inner: - example: - src_label: src_label - dst_label: dst_label - properties: - src_label: - title: src_label - type: string - dst_label: - title: dst_label - type: string - title: GrootEdgeType_relations_inner - type: object - GrootDataloadingJobConfig_edges_inner: - example: - type_name: type_name - source_vertex: source_vertex - destination_vertex: destination_vertex - properties: - type_name: - title: type_name - type: string - source_vertex: - title: source_vertex - type: string - destination_vertex: - title: destination_vertex - type: string - title: GrootDataloadingJobConfig_edges_inner - type: object diff --git a/flex/coordinator/gs_flex_coordinator/test/__init__.py b/flex/coordinator/gs_flex_coordinator/test/__init__.py deleted file mode 100644 index 1e4bf4ab1e42..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -import logging - -import connexion -from flask_testing import TestCase - -from gs_flex_coordinator.encoder import JSONEncoder - - -class BaseTestCase(TestCase): - - def create_app(self): - logging.getLogger('connexion.operation').setLevel('ERROR') - app = connexion.App(__name__, specification_dir='../openapi/') - app.app.json_encoder = JSONEncoder - app.add_api('openapi.yaml', pythonic_params=True) - return app.app diff --git a/flex/coordinator/gs_flex_coordinator/test/test_alert_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_alert_controller.py deleted file mode 100644 index 99ccb9f5dc58..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_alert_controller.py +++ /dev/null @@ -1,174 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.alert_message import AlertMessage # noqa: E501 -from gs_flex_coordinator.models.alert_receiver import AlertReceiver # noqa: E501 -from gs_flex_coordinator.models.alert_rule import AlertRule # noqa: E501 -from gs_flex_coordinator.models.update_alert_messages_request import UpdateAlertMessagesRequest # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestAlertController(BaseTestCase): - """AlertController integration test stubs""" - - def test_delete_alert_rule(self): - """Test case for delete_alert_rule - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/alert/rule/{rule_name}'.format(rule_name='rule_name_example'), - method='DELETE', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_delete_receiverby_id(self): - """Test case for delete_receiverby_id - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/alert/receiver/{receiver_id}'.format(receiver_id='receiver_id_example'), - method='DELETE', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_list_alert_messages(self): - """Test case for list_alert_messages - - - """ - query_string = [('type', 'type_example'), - ('status', 'status_example'), - ('severity', 'severity_example'), - ('start_time', 'start_time_example'), - ('end_time', 'end_time_example')] - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/alert/message', - method='GET', - headers=headers, - query_string=query_string) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_list_alert_rules(self): - """Test case for list_alert_rules - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/alert/rule', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_list_receivers(self): - """Test case for list_receivers - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/alert/receiver', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_register_receiver(self): - """Test case for register_receiver - - - """ - alert_receiver = {"webhook_url":"webhook_url","is_at_all":True,"receiver_id":"receiver_id","enable":True,"at_user_ids":["at_user_ids","at_user_ids"],"type":"webhook","message":"message"} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/alert/receiver', - method='POST', - headers=headers, - data=json.dumps(alert_receiver), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_update_alert_messages(self): - """Test case for update_alert_messages - - - """ - update_alert_messages_request = gs_flex_coordinator.UpdateAlertMessagesRequest() - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/alert/message', - method='PUT', - headers=headers, - data=json.dumps(update_alert_messages_request), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_update_alert_rule_by_name(self): - """Test case for update_alert_rule_by_name - - - """ - alert_rule = {"severity":"warning","conditions_description":"conditions_description","enable":True,"name":"name","metric_type":"node","frequency":0} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/alert/rule/{rule_name}'.format(rule_name='rule_name_example'), - method='PUT', - headers=headers, - data=json.dumps(alert_rule), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_update_receiverby_id(self): - """Test case for update_receiverby_id - - - """ - alert_receiver = {"webhook_url":"webhook_url","is_at_all":True,"receiver_id":"receiver_id","enable":True,"at_user_ids":["at_user_ids","at_user_ids"],"type":"webhook","message":"message"} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/alert/receiver/{receiver_id}'.format(receiver_id='receiver_id_example'), - method='PUT', - headers=headers, - data=json.dumps(alert_receiver), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_connection_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_connection_controller.py deleted file mode 100644 index 949f2ac813d5..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_connection_controller.py +++ /dev/null @@ -1,49 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.connection import Connection # noqa: E501 -from gs_flex_coordinator.models.connection_status import ConnectionStatus # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestConnectionController(BaseTestCase): - """ConnectionController integration test stubs""" - - def test_close(self): - """Test case for close - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/connection', - method='DELETE', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_connect(self): - """Test case for connect - - - """ - connection = {"coordinator_endpoint":"coordinator_endpoint"} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/connection', - method='POST', - headers=headers, - data=json.dumps(connection), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_datasource_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_datasource_controller.py deleted file mode 100644 index 800687efa531..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_datasource_controller.py +++ /dev/null @@ -1,154 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.data_source import DataSource # noqa: E501 -from gs_flex_coordinator.models.edge_data_source import EdgeDataSource # noqa: E501 -from gs_flex_coordinator.models.vertex_data_source import VertexDataSource # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestDatasourceController(BaseTestCase): - """DatasourceController integration test stubs""" - - def test_bind_edge_datasource(self): - """Test case for bind_edge_datasource - - - """ - edge_data_source = {"source_pk_column_map":{"key":""},"type_name":"type_name","destination_pk_column_map":{"key":""},"source_vertex":"source_vertex","destination_vertex":"destination_vertex","property_mapping":{"key":""},"location":"location","data_source":"ODPS"} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/datasource/edge_datasource'.format(graph_name='graph_name_example'), - method='POST', - headers=headers, - data=json.dumps(edge_data_source), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_bind_vertex_datasource(self): - """Test case for bind_vertex_datasource - - - """ - vertex_data_source = {"type_name":"type_name","property_mapping":{"key":""},"location":"location","data_source":"ODPS"} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/datasource/vertex_datasource'.format(graph_name='graph_name_example'), - method='POST', - headers=headers, - data=json.dumps(vertex_data_source), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_get_datasource(self): - """Test case for get_datasource - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/datasource'.format(graph_name='graph_name_example'), - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_get_edge_datasource(self): - """Test case for get_edge_datasource - - - """ - query_string = [('source_vertex_type', 'source_vertex_type_example'), - ('destination_vertex_type', 'destination_vertex_type_example')] - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/datasource/edge_datasource/{type_name}'.format(graph_name='graph_name_example', type_name='type_name_example'), - method='GET', - headers=headers, - query_string=query_string) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_get_vertex_datasource(self): - """Test case for get_vertex_datasource - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/datasource/vertex_datasource/{type_name}'.format(graph_name='graph_name_example', type_name='type_name_example'), - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_import_datasource(self): - """Test case for import_datasource - - - """ - data_source = {"edges_datasource":[{"source_pk_column_map":{"key":""},"type_name":"type_name","destination_pk_column_map":{"key":""},"source_vertex":"source_vertex","destination_vertex":"destination_vertex","property_mapping":{"key":""},"location":"location","data_source":"ODPS"},{"source_pk_column_map":{"key":""},"type_name":"type_name","destination_pk_column_map":{"key":""},"source_vertex":"source_vertex","destination_vertex":"destination_vertex","property_mapping":{"key":""},"location":"location","data_source":"ODPS"}],"vertices_datasource":[{"type_name":"type_name","property_mapping":{"key":""},"location":"location","data_source":"ODPS"},{"type_name":"type_name","property_mapping":{"key":""},"location":"location","data_source":"ODPS"}]} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/datasource'.format(graph_name='graph_name_example'), - method='POST', - headers=headers, - data=json.dumps(data_source), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_unbind_edge_datasource(self): - """Test case for unbind_edge_datasource - - - """ - query_string = [('source_vertex_type', 'source_vertex_type_example'), - ('destination_vertex_type', 'destination_vertex_type_example')] - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/datasource/edge_datasource/{type_name}'.format(graph_name='graph_name_example', type_name='type_name_example'), - method='DELETE', - headers=headers, - query_string=query_string) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_unbind_vertex_datasource(self): - """Test case for unbind_vertex_datasource - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/datasource/vertex_datasource/{type_name}'.format(graph_name='graph_name_example', type_name='type_name_example'), - method='DELETE', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_deployment_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_deployment_controller.py deleted file mode 100644 index 73a5f7f19f52..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_deployment_controller.py +++ /dev/null @@ -1,45 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.deployment_info import DeploymentInfo # noqa: E501 -from gs_flex_coordinator.models.node_status import NodeStatus # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestDeploymentController(BaseTestCase): - """DeploymentController integration test stubs""" - - def test_get_deployment_info(self): - """Test case for get_deployment_info - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/deployment/info', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_get_node_status(self): - """Test case for get_node_status - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/node/status', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_extension_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_extension_controller.py deleted file mode 100644 index 69353a7fd8a9..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_extension_controller.py +++ /dev/null @@ -1,82 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.query_statement import QueryStatement # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestExtensionController(BaseTestCase): - """ExtensionController integration test stubs""" - - def test_create_query_statements(self): - """Test case for create_query_statements - - - """ - query_statement = {"query":"query","name":"name","description":"description","statement_id":"statement_id"} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/statement', - method='POST', - headers=headers, - data=json.dumps(query_statement), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_delete_queryby_name(self): - """Test case for delete_queryby_name - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/statement/{statement_id}'.format(statement_id='statement_id_example'), - method='DELETE', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_list_query_statement(self): - """Test case for list_query_statement - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/statement', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_update_query_statement_by_id(self): - """Test case for update_query_statement_by_id - - - """ - query_statement = {"query":"query","name":"name","description":"description","statement_id":"statement_id"} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/statement/{statement_id}'.format(statement_id='statement_id_example'), - method='PUT', - headers=headers, - data=json.dumps(query_statement), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_graph_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_graph_controller.py deleted file mode 100644 index e21b88e26140..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_graph_controller.py +++ /dev/null @@ -1,152 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.edge_type import EdgeType # noqa: E501 -from gs_flex_coordinator.models.graph import Graph # noqa: E501 -from gs_flex_coordinator.models.model_schema import ModelSchema # noqa: E501 -from gs_flex_coordinator.models.vertex_type import VertexType # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestGraphController(BaseTestCase): - """GraphController integration test stubs""" - - def test_create_edge_type(self): - """Test case for create_edge_type - - - """ - edge_type = {"type_name":"type_name","type_id":1,"vertex_type_pair_relations":[{"source_vertex":"source_vertex","destination_vertex":"destination_vertex","x_csr_params":{"edge_storage_strategy":"ONLY_IN"},"relation":"MANY_TO_MANY"},{"source_vertex":"source_vertex","destination_vertex":"destination_vertex","x_csr_params":{"edge_storage_strategy":"ONLY_IN"},"relation":"MANY_TO_MANY"}],"properties":[{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"},{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"}]} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/schema/edge_type'.format(graph_name='graph_name_example'), - method='POST', - headers=headers, - data=json.dumps(edge_type), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_create_graph(self): - """Test case for create_graph - - - """ - graph = {"schema":{"vertex_types":[{"type_name":"type_name","primary_keys":["primary_keys","primary_keys"],"type_id":0,"properties":[{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"},{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"}]},{"type_name":"type_name","primary_keys":["primary_keys","primary_keys"],"type_id":0,"properties":[{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"},{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"}]}],"edge_types":[{"type_name":"type_name","type_id":1,"vertex_type_pair_relations":[{"source_vertex":"source_vertex","destination_vertex":"destination_vertex","x_csr_params":{"edge_storage_strategy":"ONLY_IN"},"relation":"MANY_TO_MANY"},{"source_vertex":"source_vertex","destination_vertex":"destination_vertex","x_csr_params":{"edge_storage_strategy":"ONLY_IN"},"relation":"MANY_TO_MANY"}],"properties":[{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"},{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"}]},{"type_name":"type_name","type_id":1,"vertex_type_pair_relations":[{"source_vertex":"source_vertex","destination_vertex":"destination_vertex","x_csr_params":{"edge_storage_strategy":"ONLY_IN"},"relation":"MANY_TO_MANY"},{"source_vertex":"source_vertex","destination_vertex":"destination_vertex","x_csr_params":{"edge_storage_strategy":"ONLY_IN"},"relation":"MANY_TO_MANY"}],"properties":[{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"},{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"}]}]},"stored_procedures":{"directory":"plugins"},"name":"name","store_type":"mutable_csr"} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/graph', - method='POST', - headers=headers, - data=json.dumps(graph), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_create_vertex_type(self): - """Test case for create_vertex_type - - - """ - vertex_type = {"type_name":"type_name","primary_keys":["primary_keys","primary_keys"],"type_id":0,"properties":[{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"},{"property_type":{"primitive_type":"DT_DOUBLE"},"property_id":6,"property_name":"property_name"}]} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/schema/vertex_type'.format(graph_name='graph_name_example'), - method='POST', - headers=headers, - data=json.dumps(vertex_type), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_delete_edge_type(self): - """Test case for delete_edge_type - - - """ - query_string = [('source_vertex_type', 'source_vertex_type_example'), - ('destination_vertex_type', 'destination_vertex_type_example')] - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/schema/edge_edge/{type_name}'.format(graph_name='graph_name_example', type_name='type_name_example'), - method='DELETE', - headers=headers, - query_string=query_string) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_delete_graph(self): - """Test case for delete_graph - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}'.format(graph_name='graph_name_example'), - method='DELETE', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_delete_vertex_type(self): - """Test case for delete_vertex_type - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/schema/vertex_type/{type_name}'.format(graph_name='graph_name_example', type_name='type_name_example'), - method='DELETE', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_get_schema(self): - """Test case for get_schema - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/schema'.format(graph_name='graph_name_example'), - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_list_graphs(self): - """Test case for list_graphs - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_job_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_job_controller.py deleted file mode 100644 index 1cbd07019ce7..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_job_controller.py +++ /dev/null @@ -1,80 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.job_response import JobResponse # noqa: E501 -from gs_flex_coordinator.models.job_status import JobStatus # noqa: E501 -from gs_flex_coordinator.models.schema_mapping import SchemaMapping # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestJobController(BaseTestCase): - """JobController integration test stubs""" - - def test_create_dataloading_job(self): - """Test case for create_dataloading_job - - - """ - schema_mapping = {"loading_config":{"format":{"metadata":{"key":""},"type":"type"},"import_option":"init","data_source":{"scheme":"file"}},"edge_mappings":[{"inputs":["inputs","inputs"],"source_vertex_mappings":[{"column":{"name":"name","index":0}},{"column":{"name":"name","index":0}}],"destination_vertex_mappings":[{"column":{"name":"name","index":0}},{"column":{"name":"name","index":0}}],"column_mappings":[{"column":{"name":"name","index":0},"property":"property"},{"column":{"name":"name","index":0},"property":"property"}],"type_triplet":{"edge":"edge","source_vertex":"source_vertex","destination_vertex":"destination_vertex"}},{"inputs":["inputs","inputs"],"source_vertex_mappings":[{"column":{"name":"name","index":0}},{"column":{"name":"name","index":0}}],"destination_vertex_mappings":[{"column":{"name":"name","index":0}},{"column":{"name":"name","index":0}}],"column_mappings":[{"column":{"name":"name","index":0},"property":"property"},{"column":{"name":"name","index":0},"property":"property"}],"type_triplet":{"edge":"edge","source_vertex":"source_vertex","destination_vertex":"destination_vertex"}}],"graph":"graph","vertex_mappings":[{"type_name":"type_name","inputs":["inputs","inputs"],"column_mappings":[{"column":{"name":"name","index":0},"property":"property"},{"column":{"name":"name","index":0},"property":"property"}]},{"type_name":"type_name","inputs":["inputs","inputs"],"column_mappings":[{"column":{"name":"name","index":0},"property":"property"},{"column":{"name":"name","index":0},"property":"property"}]}]} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/dataloading'.format(graph_name='graph_name_example'), - method='POST', - headers=headers, - data=json.dumps(schema_mapping), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_delete_job_by_id(self): - """Test case for delete_job_by_id - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/job/{job_id}'.format(job_id='job_id_example'), - method='DELETE', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_get_job_by_id(self): - """Test case for get_job_by_id - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/job/{job_id}'.format(job_id='job_id_example'), - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_list_jobs(self): - """Test case for list_jobs - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/job', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_legacy_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_legacy_controller.py deleted file mode 100644 index 22439ac340ed..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_legacy_controller.py +++ /dev/null @@ -1,64 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.groot_graph import GrootGraph # noqa: E501 -from gs_flex_coordinator.models.groot_schema import GrootSchema # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestLegacyController(BaseTestCase): - """LegacyController integration test stubs""" - - def test_get_groot_schema(self): - """Test case for get_groot_schema - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/groot/graph/{graph_name}/schema'.format(graph_name='graph_name_example'), - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_import_schema(self): - """Test case for import_schema - - - """ - groot_schema = {"vertices":[{"label":"label","properties":[{"is_primary_key":True,"name":"name","id":0,"type":"STRING"},{"is_primary_key":True,"name":"name","id":0,"type":"STRING"}]},{"label":"label","properties":[{"is_primary_key":True,"name":"name","id":0,"type":"STRING"},{"is_primary_key":True,"name":"name","id":0,"type":"STRING"}]}],"edges":[{"label":"label","relations":[{"src_label":"src_label","dst_label":"dst_label"},{"src_label":"src_label","dst_label":"dst_label"}],"properties":[{"is_primary_key":True,"name":"name","id":0,"type":"STRING"},{"is_primary_key":True,"name":"name","id":0,"type":"STRING"}]},{"label":"label","relations":[{"src_label":"src_label","dst_label":"dst_label"},{"src_label":"src_label","dst_label":"dst_label"}],"properties":[{"is_primary_key":True,"name":"name","id":0,"type":"STRING"},{"is_primary_key":True,"name":"name","id":0,"type":"STRING"}]}]} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/groot/graph/{graph_name}/schema'.format(graph_name='graph_name_example'), - method='POST', - headers=headers, - data=json.dumps(groot_schema), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_list_groot_graph(self): - """Test case for list_groot_graph - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/groot/graph', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_procedure_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_procedure_controller.py deleted file mode 100644 index 738c353e5168..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_procedure_controller.py +++ /dev/null @@ -1,97 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.procedure import Procedure # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestProcedureController(BaseTestCase): - """ProcedureController integration test stubs""" - - def test_create_procedure(self): - """Test case for create_procedure - - - """ - procedure = {"bound_graph":"bound_graph","enable":True,"query":"query","name":"name","description":"description","returns":[{"name":"name","type":"type"},{"name":"name","type":"type"}],"type":"cpp","params":[{"name":"name","type":"type"},{"name":"name","type":"type"}]} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/procedure'.format(graph_name='graph_name_example'), - method='POST', - headers=headers, - data=json.dumps(procedure), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_delete_procedure(self): - """Test case for delete_procedure - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/procedure/{procedure_name}'.format(graph_name='graph_name_example', procedure_name='procedure_name_example'), - method='DELETE', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_list_procedures(self): - """Test case for list_procedures - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/procedure', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_list_procedures_in_graph(self): - """Test case for list_procedures_in_graph - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/procedure'.format(graph_name='graph_name_example'), - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_update_procedure(self): - """Test case for update_procedure - - - """ - procedure = {"bound_graph":"bound_graph","enable":True,"query":"query","name":"name","description":"description","returns":[{"name":"name","type":"type"},{"name":"name","type":"type"}],"type":"cpp","params":[{"name":"name","type":"type"},{"name":"name","type":"type"}]} - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/graph/{graph_name}/procedure/{procedure_name}'.format(graph_name='graph_name_example', procedure_name='procedure_name_example'), - method='PUT', - headers=headers, - data=json.dumps(procedure), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_service_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_service_controller.py deleted file mode 100644 index c0b1441f373c..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_service_controller.py +++ /dev/null @@ -1,79 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.models.service_status import ServiceStatus # noqa: E501 -from gs_flex_coordinator.models.start_service_request import StartServiceRequest # noqa: E501 -from gs_flex_coordinator.test import BaseTestCase - - -class TestServiceController(BaseTestCase): - """ServiceController integration test stubs""" - - def test_get_service_status(self): - """Test case for get_service_status - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/service/status', - method='GET', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_restart_service(self): - """Test case for restart_service - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/service/restart', - method='POST', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_start_service(self): - """Test case for start_service - - - """ - start_service_request = gs_flex_coordinator.StartServiceRequest() - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - } - response = self.client.open( - '/api/v1/service/start', - method='POST', - headers=headers, - data=json.dumps(start_service_request), - content_type='application/json') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - def test_stop_service(self): - """Test case for stop_service - - - """ - headers = { - 'Accept': 'application/json', - } - response = self.client.open( - '/api/v1/service/stop', - method='POST', - headers=headers) - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/test/test_utils_controller.py b/flex/coordinator/gs_flex_coordinator/test/test_utils_controller.py deleted file mode 100644 index 783a4d2810a1..000000000000 --- a/flex/coordinator/gs_flex_coordinator/test/test_utils_controller.py +++ /dev/null @@ -1,33 +0,0 @@ -import unittest - -from flask import json - -from gs_flex_coordinator.test import BaseTestCase - - -class TestUtilsController(BaseTestCase): - """UtilsController integration test stubs""" - - @unittest.skip("application/octet-stream not supported by Connexion") - def test_upload_file(self): - """Test case for upload_file - - - """ - body = '/path/to/file' - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/octet-stream', - } - response = self.client.open( - '/api/v1/file/uploading', - method='POST', - headers=headers, - data=json.dumps(body), - content_type='application/octet-stream') - self.assert200(response, - 'Response body is : ' + response.data.decode('utf-8')) - - -if __name__ == '__main__': - unittest.main() diff --git a/flex/coordinator/gs_flex_coordinator/version.py b/flex/coordinator/gs_flex_coordinator/version.py deleted file mode 100644 index b54d11f153b5..000000000000 --- a/flex/coordinator/gs_flex_coordinator/version.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. All Rights Reserved. -# -# 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. - - -import os - -from packaging import version - -version_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION") - -with open(version_file_path, "r", encoding="utf-8") as fp: - sv = version.parse(fp.read().strip()) - __is_prerelease__ = sv.is_prerelease - __version__ = str(sv) - -__version_tuple__ = (v for v in __version__.split(".")) - -del version_file_path diff --git a/flex/coordinator/requirements.txt b/flex/coordinator/requirements.txt deleted file mode 100644 index 5018f3d675f0..000000000000 --- a/flex/coordinator/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -connexion == 2.14.2 -werkzeug == 2.3.8; python_version=="3.5" or python_version=="3.4" -swagger-ui-bundle >= 0.0.2 -python_dateutil >= 2.6.0 -setuptools >= 21.0.0 -Flask == 2.2.5 -urllib3 >= 1.25.3, < 2.1.0 -pydantic >= 2 -typing-extensions >= 4.7.1 -psutil -schedule -graphscope-client >= 0.26.0 diff --git a/flex/coordinator/setup.py b/flex/coordinator/setup.py deleted file mode 100644 index 48beab34fd92..000000000000 --- a/flex/coordinator/setup.py +++ /dev/null @@ -1,144 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. -# -# 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. -# - -import os -import shutil -import subprocess -import sys -import tempfile -from distutils.cmd import Command - -from setuptools import find_packages, setup - -NAME = "gs_flex_coordinator" -VERSION = "1.0.0" - -pkg_root = os.path.dirname(os.path.abspath(__file__)) - - -def parsed_reqs(): - with open(os.path.join(pkg_root, "requirements.txt"), "r", encoding="utf-8") as fp: - return fp.read().splitlines() - - -class GenerateFlexServer(Command): - description = "generate flex server from openapi specification file" - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - # generate server code, note that controllers are not included here, - # see from .openapi-generator-ignore - specification = os.path.join( - pkg_root, "..", "openapi", "openapi_coordinator.yaml" - ) - cmd = [ - "openapi-generator-cli", - "generate", - "-g", - "python-flask", - "-i", - str(specification), - "-o", - str(pkg_root), - "--package-name", - "gs_flex_coordinator", - ] - print(" ".join(cmd)) - env = os.environ.copy() - env["OPENAPI_GENERATOR_VERSION"] = "7.3.0" - subprocess.check_call( - cmd, - env=env, - ) - - -class GenerateInteractiveSDK(Command): - description = "generate interactive client sdk from openapi specification file" - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - # remove - tempdir = os.path.join("/", tempfile.gettempprefix(), "flex_interactive") - if os.path.exists(tempdir): - shutil.rmtree(tempdir) - targetdir = os.path.join( - pkg_root, "gs_flex_coordinator", "core", "interactive", "hqps_client" - ) - if os.path.exists(targetdir): - shutil.rmtree(targetdir) - # generate - specification = os.path.join( - pkg_root, "..", "openapi", "openapi_interactive.yaml" - ) - cmd = [ - "openapi-generator-cli", - "generate", - "-g", - "python", - "-i", - str(specification), - "-o", - str(tempdir), - "--package-name", - "hqps_client", - ] - print(" ".join(cmd)) - env = os.environ.copy() - env["OPENAPI_GENERATOR_VERSION"] = "7.3.0" - subprocess.check_call( - cmd, - env=env, - ) - # cp - subprocess.run(["cp", "-r", os.path.join(tempdir, "hqps_client"), targetdir]) - - -setup( - name=NAME, - version=VERSION, - description="GraphScope FLEX HTTP SERVICE API", - author_email="graphscope@alibaba-inc.com", - url="", - keywords=["OpenAPI", "GraphScope FLEX HTTP SERVICE API"], - install_requires=parsed_reqs(), - packages=find_packages(), - package_data={"": ["openapi/openapi.yaml", "VERSION"]}, - cmdclass={ - "generate_flex_server": GenerateFlexServer, - "generate_interactive_sdk": GenerateInteractiveSDK, - }, - include_package_data=True, - entry_points={ - "console_scripts": ["gs_flex_coordinator=gs_flex_coordinator.__main__:main"] - }, - long_description="""\ - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - """, -) diff --git a/flex/coordinator/test-requirements.txt b/flex/coordinator/test-requirements.txt deleted file mode 100644 index 58f51d6a0027..000000000000 --- a/flex/coordinator/test-requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -pytest~=7.1.0 -pytest-cov>=2.8.1 -pytest-randomly>=1.2.3 -Flask-Testing==0.8.1 diff --git a/flex/coordinator/tox.ini b/flex/coordinator/tox.ini deleted file mode 100644 index 495f7daf4145..000000000000 --- a/flex/coordinator/tox.ini +++ /dev/null @@ -1,11 +0,0 @@ -[tox] -envlist = py3 -skipsdist=True - -[testenv] -deps=-r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - {toxinidir} - -commands= - pytest --cov=gs_flex_coordinator diff --git a/flex/engines/graph_db/database/graph_db_session.cc b/flex/engines/graph_db/database/graph_db_session.cc index c51a1e017385..160cf7fea11a 100644 --- a/flex/engines/graph_db/database/graph_db_session.cc +++ b/flex/engines/graph_db/database/graph_db_session.cc @@ -20,6 +20,11 @@ #include "flex/engines/graph_db/database/graph_db_session.h" #include "flex/utils/app_utils.h" +#ifdef BUILD_HQPS +#include "flex/proto_generated_gie/stored_procedure.pb.h" +#include "nlohmann/json.hpp" +#endif // BUILD_HQPS + namespace gs { ReadTransaction GraphDBSession::GetReadTransaction() const { @@ -224,6 +229,61 @@ AppBase* GraphDBSession::GetApp(int type) { #undef likely // likely +#ifdef BUILD_HQPS +Result> +GraphDBSession::parse_query_type_from_cypher_json( + const std::string_view& str_view) { + VLOG(10) << "string view: " << str_view; + nlohmann::json j; + try { + j = nlohmann::json::parse(str_view); + } catch (const nlohmann::json::parse_error& e) { + LOG(ERROR) << "Fail to parse json from input content: " << e.what(); + return Result>(gs::Status( + StatusCode::InternalError, + "Fail to parse json from input content:" + std::string(e.what()))); + } + auto query_name = j["query_name"].get(); + const auto& app_name_to_path_index = schema().GetPlugins(); + if (app_name_to_path_index.count(query_name) <= 0) { + LOG(ERROR) << "Query name is not registered: " << query_name; + return Result>(gs::Status( + StatusCode::NotFound, "Query name is not registered: " + query_name)); + } + if (j.contains("arguments")) { + for (auto& arg : j["arguments"]) { + VLOG(10) << "arg: " << arg; + } + } + VLOG(10) << "Query name: " << query_name; + return std::make_pair(app_name_to_path_index.at(query_name).second, str_view); +} + +Result> +GraphDBSession::parse_query_type_from_cypher_internal( + const std::string_view& str_view) { + procedure::Query cur_query; + if (!cur_query.ParseFromArray(str_view.data(), str_view.size())) { + LOG(ERROR) << "Fail to parse query from input content"; + return Result>(gs::Status( + StatusCode::InternalError, "Fail to parse query from input content")); + } + auto query_name = cur_query.query_name().name(); + if (query_name.empty()) { + LOG(ERROR) << "Query name is empty"; + return Result>( + gs::Status(StatusCode::NotFound, "Query name is empty")); + } + const auto& app_name_to_path_index = schema().GetPlugins(); + if (app_name_to_path_index.count(query_name) <= 0) { + LOG(ERROR) << "Query name is not registered: " << query_name; + return Result>(gs::Status( + StatusCode::NotFound, "Query name is not registered: " + query_name)); + } + return std::make_pair(app_name_to_path_index.at(query_name).second, str_view); +} +#endif + const AppMetric& GraphDBSession::GetAppMetric(int idx) const { return app_metrics_[idx]; } diff --git a/flex/engines/graph_db/database/graph_db_session.h b/flex/engines/graph_db/database/graph_db_session.h index 521e046bc8b4..5d21f13ec28c 100644 --- a/flex/engines/graph_db/database/graph_db_session.h +++ b/flex/engines/graph_db/database/graph_db_session.h @@ -28,11 +28,6 @@ #include "flex/utils/property/column.h" #include "flex/utils/result.h" -#ifdef BUILD_HQPS -#include "flex/proto_generated_gie/stored_procedure.pb.h" -#include "nlohmann/json.hpp" -#endif // BUILD_HQPS - namespace gs { class GraphDB; @@ -52,6 +47,7 @@ class GraphDBSession { static constexpr int32_t MAX_RETRY = 3; static constexpr int32_t MAX_PLUGIN_NUM = 256; // 2^(sizeof(uint8_t)*8) #ifdef BUILD_HQPS + static constexpr const char* kCppEncoder = "\x00"; static constexpr const char* kCypherJson = "\x01"; static constexpr const char* kCypherInternalAdhoc = "\x02"; static constexpr const char* kCypherInternalProcedure = "\x03"; @@ -114,6 +110,12 @@ class GraphDBSession { AppBase* GetApp(int idx); private: +#ifdef BUILD_HQPS + Result> + parse_query_type_from_cypher_json(const std::string_view& input); + Result> + parse_query_type_from_cypher_internal(const std::string_view& input); +#endif // BUILD_HQPS /** * @brief Parse the input format of the query. * There are four formats: @@ -165,58 +167,14 @@ class GraphDBSession { // For cypherJson there is no query-id provided. The query name is // provided in the json string. std::string_view str_view(input.data(), len - 1); - VLOG(10) << "string view: " << str_view; - nlohmann::json j; - try { - j = nlohmann::json::parse(str_view); - } catch (const nlohmann::json::parse_error& e) { - LOG(ERROR) << "Fail to parse json from input content: " << e.what(); - return Result>(gs::Status( - StatusCode::InternalError, - "Fail to parse json from input content:" + std::string(e.what()))); - } - auto query_name = j["query_name"].get(); - const auto& app_name_to_path_index = schema().GetPlugins(); - if (app_name_to_path_index.count(query_name) <= 0) { - LOG(ERROR) << "Query name is not registered: " << query_name; - return Result>( - gs::Status(StatusCode::NotFound, - "Query name is not registered: " + query_name)); - } - if (j.contains("arguments")) { - for (auto& arg : j["arguments"]) { - VLOG(10) << "arg: " << arg; - } - } - VLOG(10) << "Query name: " << query_name; - return std::make_pair(app_name_to_path_index.at(query_name).second, - std::string_view(str_data, len - 1)); + return parse_query_type_from_cypher_json(str_view); } else if (input_tag == static_cast(InputFormat::kCypherInternalProcedure)) { // For cypher internal procedure, the query_name is // provided in the protobuf message. - procedure::Query cur_query; - if (!cur_query.ParseFromArray(input.data(), input.size() - 1)) { - LOG(ERROR) << "Fail to parse query from input content"; - return Result>( - gs::Status(StatusCode::InternalError, - "Fail to parse query from input content")); - } - auto query_name = cur_query.query_name().name(); - if (query_name.empty()) { - LOG(ERROR) << "Query name is empty"; - return Result>( - gs::Status(StatusCode::NotFound, "Query name is empty")); - } - const auto& app_name_to_path_index = schema().GetPlugins(); - if (app_name_to_path_index.count(query_name) <= 0) { - LOG(ERROR) << "Query name is not registered: " << query_name; - return Result>( - gs::Status(StatusCode::NotFound, - "Query name is not registered: " + query_name)); - } - return std::make_pair(app_name_to_path_index.at(query_name).second, - std::string_view(str_data, len - 1)); + std::string_view str_view(input.data(), len - 1); + return parse_query_type_from_cypher_internal(str_view); + } #endif // BUILD_HQPS else { diff --git a/flex/engines/hqps_db/CMakeLists.txt b/flex/engines/hqps_db/CMakeLists.txt index d5e522540748..7a31f6456afa 100644 --- a/flex/engines/hqps_db/CMakeLists.txt +++ b/flex/engines/hqps_db/CMakeLists.txt @@ -35,7 +35,7 @@ add_library(hqps_plan_proto SHARED ${PROTO_SRCS_GIE}) target_include_directories(hqps_plan_proto PUBLIC $ $) -target_link_libraries(hqps_plan_proto PUBLIC protobuf::libprotobuf) +target_link_libraries(hqps_plan_proto PUBLIC ${Protobuf_LIBRARIES}) install_flex_target(hqps_plan_proto) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/flex/engines/hqps_db/core/operator/sink.h b/flex/engines/hqps_db/core/operator/sink.h index 36b6816b86d8..f935cdf71756 100644 --- a/flex/engines/hqps_db/core/operator/sink.h +++ b/flex/engines/hqps_db/core/operator/sink.h @@ -234,7 +234,7 @@ void template_set_key_value(results::KeyValues* map, for (auto& kv : key_value) { auto cur_kv = map->add_key_values(); cur_kv->mutable_key()->set_str(kv.first); - auto value = cur_kv->mutable_value(); + auto value = cur_kv->mutable_element(); set_any_to_element(kv.second, value); } } diff --git a/flex/engines/http_server/actor/admin_actor.act.cc b/flex/engines/http_server/actor/admin_actor.act.cc index 8704c778a0bd..f810e34679a2 100644 --- a/flex/engines/http_server/actor/admin_actor.act.cc +++ b/flex/engines/http_server/actor/admin_actor.act.cc @@ -29,6 +29,53 @@ namespace server { +gs::GraphStatistics get_graph_statistics(const gs::GraphDBSession& sess) { + gs::GraphStatistics stat; + const auto& graph = sess.graph(); + const auto& schema = sess.graph().schema(); + auto vertex_label_num = graph.schema().vertex_label_num(); + auto edge_label_num = graph.schema().edge_label_num(); + for (auto i = 0; i < vertex_label_num; ++i) { + stat.total_vertex_count += graph.vertex_num(i); + stat.vertex_type_statistics.emplace_back( + std::tuple{i, schema.get_vertex_label_name(i), graph.vertex_num(i)}); + } + for (auto edge_label_id = 0; edge_label_id < edge_label_num; + ++edge_label_id) { + auto edge_label_name = schema.get_edge_label_name(edge_label_id); + std::vector> + vertex_type_pair_statistics; + for (auto src_label_id = 0; src_label_id < vertex_label_num; + ++src_label_id) { + auto src_label_name = schema.get_vertex_label_name(src_label_id); + for (auto dst_label_id = 0; dst_label_id < vertex_label_num; + ++dst_label_id) { + auto dst_label_name = schema.get_vertex_label_name(dst_label_id); + if (schema.exist(src_label_id, dst_label_id, edge_label_id)) { + auto oe_csr = + graph.get_oe_csr(src_label_id, dst_label_id, edge_label_id); + auto ie_csr = + graph.get_ie_csr(dst_label_id, src_label_id, edge_label_id); + size_t cur_edge_cnt = 0; + if (oe_csr) { + cur_edge_cnt += oe_csr->size(); + } else if (ie_csr) { + cur_edge_cnt += ie_csr->size(); + } + stat.total_edge_count += cur_edge_cnt; + vertex_type_pair_statistics.emplace_back( + std::tuple{src_label_name, dst_label_name, cur_edge_cnt}); + } + } + } + if (!vertex_type_pair_statistics.empty()) { + stat.edge_type_statistics.emplace_back(std::tuple{ + edge_label_id, edge_label_name, vertex_type_pair_statistics}); + } + } + return stat; +} + std::string merge_graph_and_plugin_meta( std::shared_ptr metadata_store, const std::vector& graph_metas) { @@ -1215,4 +1262,30 @@ seastar::future admin_actor::cancel_job( } } +// Get the statistics of the current running graph, if no graph is running, +// return empty. +seastar::future admin_actor::run_get_graph_statistic( + query_param&& query_param) { + std::string queried_graph = query_param.content.c_str(); + auto cur_running_graph_res = metadata_store_->GetRunningGraph(); + if (!cur_running_graph_res.ok()) { + // no graph is running + return seastar::make_ready_future( + gs::Result(gs::Status( + gs::StatusCode::NotFound, "No graph is running currently"))); + } + auto& graph_id = cur_running_graph_res.value(); + if (graph_id != queried_graph) { + return seastar::make_ready_future( + gs::Result( + gs::Status(gs::StatusCode::NotFound, + "The queried graph is not running: " + graph_id + + ", current running graph is: " + queried_graph))); + } + auto statistics = get_graph_statistics( + gs::GraphDB::get().GetSession(hiactor::local_shard_id())); + return seastar::make_ready_future( + gs::Result(statistics.ToJson())); +} + } // namespace server \ No newline at end of file diff --git a/flex/engines/http_server/actor/admin_actor.act.h b/flex/engines/http_server/actor/admin_actor.act.h index 2d02634b7e3b..0b30475be074 100644 --- a/flex/engines/http_server/actor/admin_actor.act.h +++ b/flex/engines/http_server/actor/admin_actor.act.h @@ -70,6 +70,8 @@ class ANNOTATION(actor:impl) admin_actor : public hiactor::actor { seastar::future ANNOTATION(actor:method) cancel_job(query_param&& param); + seastar::future ANNOTATION(actor:method) run_get_graph_statistic(query_param&& param); + // DECLARE_RUN_QUERIES; /// Declare `do_work` func here, no need to implement. ACTOR_DO_WORK() diff --git a/flex/engines/http_server/handler/admin_http_handler.cc b/flex/engines/http_server/handler/admin_http_handler.cc index 67a1de7ba9cb..f7c7ad3707c2 100644 --- a/flex/engines/http_server/handler/admin_http_handler.cc +++ b/flex/engines/http_server/handler/admin_http_handler.cc @@ -110,6 +110,15 @@ class admin_http_graph_handler_impl : public seastar::httpd::handler_base { return return_reply_with_result(std::move(rep), std::move(fut)); }); + } else if (path.find("statistics") != seastar::sstring::npos) { + return admin_actor_refs_[dst_executor] + .run_get_graph_statistic(query_param{std::move(graph_id)}) + .then_wrapped( + [rep = std::move(rep)]( + seastar::future&& fut) mutable { + return return_reply_with_result(std::move(rep), + std::move(fut)); + }); } else { // Get the metadata of graph. return admin_actor_refs_[dst_executor] @@ -611,6 +620,16 @@ seastar::future<> admin_http_handler::set_routes() { match_rule->add_str("/v1/graph").add_param("graph_id").add_str("/schema"); r.add(match_rule, seastar::httpd::operation_type::GET); } + { + // Get running graph statistics + auto match_rule = + new seastar::httpd::match_rule(new admin_http_graph_handler_impl( + interactive_admin_group_id, shard_admin_graph_concurrency)); + match_rule->add_str("/v1/graph") + .add_param("graph_id") + .add_str("/statistics"); + r.add(match_rule, seastar::httpd::operation_type::GET); + } { // Node and service management diff --git a/flex/engines/http_server/handler/hqps_http_handler.cc b/flex/engines/http_server/handler/hqps_http_handler.cc index 3856547cdd3c..2ddd83c984ab 100644 --- a/flex/engines/http_server/handler/hqps_http_handler.cc +++ b/flex/engines/http_server/handler/hqps_http_handler.cc @@ -27,6 +27,49 @@ #include "flex/engines/http_server/types.h" #include "flex/otel/otel.h" +#include + +namespace seastar { +namespace httpd { +// The seastar::httpd::param_matcher will fail to match if param is not +// specified. +class optional_param_matcher : public matcher { + public: + /** + * Constructor + * @param name the name of the parameter, will be used as the key + * in the parameters object + * @param entire_path when set to true, the matched parameters will + * include all the remaining url until the end of it. + * when set to false the match will terminate at the next slash + */ + explicit optional_param_matcher(const sstring& name) : _name(name) {} + + size_t match(const sstring& url, size_t ind, parameters& param) override { + size_t last = find_end_param(url, ind); + if (last == url.size()) { + // Means we didn't find the parameter, but we still return true, + // and set the value to empty string. + param.set(_name, ""); + return ind; + } + param.set(_name, url.substr(ind, last - ind)); + return last; + } + + private: + size_t find_end_param(const sstring& url, size_t ind) { + size_t pos = url.find('/', ind + 1); + if (pos == sstring::npos) { + return url.length(); + } + return pos; + } + sstring _name; +}; +} // namespace httpd +} // namespace seastar + namespace server { hqps_ic_handler::hqps_ic_handler(uint32_t init_group_id, uint32_t max_group_id, @@ -118,45 +161,45 @@ bool hqps_ic_handler::is_running_graph(const seastar::sstring& graph_id) const { return running_graph_res.value() == graph_id_str; } -// Handles both /v1/graph/{graph_id}/query and /v1/query/ +// Handles both /v1/graph/{graph_id}/query and /v1/graph/current/query/ seastar::future> hqps_ic_handler::handle( const seastar::sstring& path, std::unique_ptr req, std::unique_ptr rep) { auto dst_executor = executor_idx_; executor_idx_ = (executor_idx_ + 1) % shard_concurrency_; - if (req->content.size() <= 0) { - // At least one input format byte is needed + // TODO(zhanglei): choose read or write based on the request, after the + // read/write info is supported in physical plan + auto request_format = req->get_header(INTERACTIVE_REQUEST_FORMAT); + if (request_format.empty()) { + // If no format specfied, we use default format: proto + request_format = PROTOCOL_FORMAT; + } + if (request_format == JSON_FORMAT) { + req->content.append(gs::GraphDBSession::kCypherJson, 1); + } else if (request_format == PROTOCOL_FORMAT) { + req->content.append(gs::GraphDBSession::kCypherInternalProcedure, 1); + } else if (request_format == ENCODER_FORMAT) { + req->content.append(gs::GraphDBSession::kCppEncoder, 1); + } else { + LOG(ERROR) << "Unsupported request format: " << request_format; rep->set_status(seastar::httpd::reply::status_type::internal_server_error); - rep->write_body("bin", seastar::sstring("Empty request!")); + rep->write_body("bin", seastar::sstring("Unsupported request format!")); rep->done(); return seastar::make_ready_future>( std::move(rep)); } - uint8_t input_format = - req->content.back(); // see graph_db_session.h#parse_query_type - // TODO(zhanglei): choose read or write based on the request, after the - // read/write info is supported in physical plan - if (req->param.exists("graph_id")) { + if (path != "/v1/graph/current/query" && req->param.exists("graph_id")) { + // TODO(zhanglei): get from graph_db. if (!is_running_graph(req->param["graph_id"])) { rep->set_status( seastar::httpd::reply::status_type::internal_server_error); - rep->write_body("bin", seastar::sstring("Failed to get running graph!")); + rep->write_body("bin", + seastar::sstring("The querying query is not running:" + + req->param["graph_id"])); rep->done(); return seastar::make_ready_future>( std::move(rep)); } - } else { - req->content.append(gs::GraphDBSession::kCypherInternalProcedure, 1); - // This handler with accept two kinds of queries, /v1/graph/{graph_id}/query - // and /v1/query/ The former one will have a graph_id in the request, and - // the latter one will not. For the first one, the input format is the last - // byte of the request content, and is added at client side; For the second - // one, the request is send from compiler, and currently compiler will not - // add extra bytes to the request content. So we need to add the input - // format here. Finally, we should REMOVE this adhoc appended byte, i.e. the - // input format byte should be added at compiler side - // TODO(zhanglei): remove this adhoc appended byte, add the byte at compiler - // side. Or maybe we should refine the protocol. } #ifdef HAVE_OPENTELEMETRY_CPP auto tracer = otel::get_tracer("hqps_procedure_query_handler"); @@ -173,31 +216,30 @@ seastar::future> hqps_ic_handler::handle( return executor_refs_[dst_executor] .run_graph_db_query(query_param{std::move(req->content)}) - .then([this, input_format + .then([request_format #ifdef HAVE_OPENTELEMETRY_CPP , - outer_span = outer_span + this, outer_span = outer_span #endif // HAVE_OPENTELEMETRY_CPP ](auto&& output) { - if (output.content.size() < 4) { - LOG(ERROR) << "Invalid output size: " << output.content.size(); -#ifdef HAVE_OPENTELEMETRY_CPP - outer_span->SetStatus(opentelemetry::trace::StatusCode::kError, - "Invalid output size"); - outer_span->End(); - std::map labels = {{"status", "fail"}}; - total_counter_->Add(1, labels); -#endif // HAVE_OPENTELEMETRY_CPP - return seastar::make_ready_future(std::move(output)); - } - if (input_format == static_cast( - gs::GraphDBSession::InputFormat::kCppEncoder)) { + if (request_format == ENCODER_FORMAT) { return seastar::make_ready_future( std::move(output.content)); } else { // For cypher input format, the results are written with // output.put_string(), which will add extra 4 bytes. So we need to // remove the first 4 bytes here. + if (output.content.size() < 4) { + LOG(ERROR) << "Invalid output size: " << output.content.size(); +#ifdef HAVE_OPENTELEMETRY_CPP + outer_span->SetStatus(opentelemetry::trace::StatusCode::kError, + "Invalid output size"); + outer_span->End(); + std::map labels = {{"status", "fail"}}; + total_counter_->Add(1, labels); +#endif // HAVE_OPENTELEMETRY_CPP + return seastar::make_ready_future(std::move(output)); + } return seastar::make_ready_future( std::move(output.content.substr(4))); } @@ -425,10 +467,9 @@ hqps_adhoc_query_handler::handle(const seastar::sstring& path, std::move(output.content)); }); }) - .then([this + .then([ #ifdef HAVE_OPENTELEMETRY_CPP - , - outer_span = outer_span + this, outer_span = outer_span #endif // HAVE_OPENTELEMETRY_CPP ](auto&& output) { if (output.content.size() < 4) { @@ -492,26 +533,10 @@ hqps_adhoc_query_handler::handle(const seastar::sstring& path, }); } -seastar::future> -hqps_exit_handler::handle(const seastar::sstring& path, - std::unique_ptr req, - std::unique_ptr rep) { - HQPSService::get().set_exit_state(); - rep->write_body("bin", seastar::sstring{"HQPS service is exiting ..."}); - return seastar::make_ready_future>( - std::move(rep)); -} - -hqps_http_handler::hqps_http_handler(uint16_t http_port) - : http_port_(http_port) { - ic_handler_ = new hqps_ic_handler(ic_query_group_id, max_group_id, - group_inc_step, shard_query_concurrency); - proc_handler_ = new hqps_ic_handler(proc_query_group_id, max_group_id, - group_inc_step, shard_query_concurrency); - adhoc_query_handler_ = new hqps_adhoc_query_handler( - ic_adhoc_group_id, codegen_group_id, max_group_id, group_inc_step, - shard_adhoc_concurrency); - exit_handler_ = new hqps_exit_handler(); +hqps_http_handler::hqps_http_handler(uint16_t http_port, int32_t shard_num) + : http_port_(http_port), actors_running_(true) { + ic_handlers_.resize(shard_num); + adhoc_query_handlers_.resize(shard_num); } hqps_http_handler::~hqps_http_handler() { @@ -527,9 +552,7 @@ uint16_t hqps_http_handler::get_port() const { return http_port_; } bool hqps_http_handler::is_running() const { return running_.load(); } bool hqps_http_handler::is_actors_running() const { - return !ic_handler_->is_current_scope_cancelled() && - !adhoc_query_handler_->is_current_scope_cancelled() && - proc_handler_->is_current_scope_cancelled(); + return actors_running_.load(); } void hqps_http_handler::start() { @@ -563,43 +586,48 @@ void hqps_http_handler::stop() { seastar::future<> hqps_http_handler::stop_query_actors() { // First cancel the scope. - return ic_handler_->cancel_current_scope() + return ic_handlers_[hiactor::local_shard_id()] + ->cancel_current_scope() .then([this] { - LOG(INFO) << "Cancel ic scope"; - return adhoc_query_handler_->cancel_current_scope(); + LOG(INFO) << "Cancelled ic scope"; + return adhoc_query_handlers_[hiactor::local_shard_id()] + ->cancel_current_scope(); }) .then([this] { - LOG(INFO) << "Cancel adhoc scope"; - return proc_handler_->cancel_current_scope(); - }) - .then([] { - LOG(INFO) << "Cancel proc scope"; + LOG(INFO) << "Cancelled proc scope"; + actors_running_.store(false); return seastar::make_ready_future<>(); }); } void hqps_http_handler::start_query_actors() { - ic_handler_->create_actors(); - adhoc_query_handler_->create_actors(); - proc_handler_->create_actors(); - LOG(INFO) << "Restart all actors"; + ic_handlers_[hiactor::local_shard_id()]->create_actors(); + adhoc_query_handlers_[hiactor::local_shard_id()]->create_actors(); + actors_running_.store(true); } seastar::future<> hqps_http_handler::set_routes() { return server_.set_routes([this](seastar::httpd::routes& r) { + auto ic_handler = + new hqps_ic_handler(ic_query_group_id, max_group_id, group_inc_step, + shard_query_concurrency); + auto adhoc_query_handler = new hqps_adhoc_query_handler( + ic_adhoc_group_id, codegen_group_id, max_group_id, group_inc_step, + shard_adhoc_concurrency); + + auto rule_proc = new seastar::httpd::match_rule(ic_handler); + rule_proc->add_str("/v1/graph") + .add_matcher(new seastar::httpd::optional_param_matcher("graph_id")) + .add_str("/query"); + + r.add(rule_proc, seastar::httpd::operation_type::POST); + r.add(seastar::httpd::operation_type::POST, - seastar::httpd::url("/v1/query"), ic_handler_); - { - auto rule_proc = new seastar::httpd::match_rule(proc_handler_); - rule_proc->add_str("/v1/graph").add_param("graph_id").add_str("/query"); - // Get All procedures - r.add(rule_proc, seastar::httpd::operation_type::POST); - } - r.add(seastar::httpd::operation_type::POST, - seastar::httpd::url("/interactive/adhoc_query"), - adhoc_query_handler_); - r.add(seastar::httpd::operation_type::POST, - seastar::httpd::url("/interactive/exit"), exit_handler_); + seastar::httpd::url("/interactive/adhoc_query"), adhoc_query_handler); + + ic_handlers_[hiactor::local_shard_id()] = ic_handler; + adhoc_query_handlers_[hiactor::local_shard_id()] = adhoc_query_handler; + return seastar::make_ready_future<>(); }); } diff --git a/flex/engines/http_server/handler/hqps_http_handler.h b/flex/engines/http_server/handler/hqps_http_handler.h index 1ca5195e2e20..a89e97dfe6e5 100644 --- a/flex/engines/http_server/handler/hqps_http_handler.h +++ b/flex/engines/http_server/handler/hqps_http_handler.h @@ -31,6 +31,12 @@ namespace server { class hqps_ic_handler : public seastar::httpd::handler_base { public: + // extra headers + static constexpr const char* INTERACTIVE_REQUEST_FORMAT = + "X-Interactive-Request-Format"; + static constexpr const char* PROTOCOL_FORMAT = "proto"; + static constexpr const char* JSON_FORMAT = "json"; + static constexpr const char* ENCODER_FORMAT = "encoder"; hqps_ic_handler(uint32_t init_group_id, uint32_t max_group_id, uint32_t group_inc_step, uint32_t shard_concurrency); ~hqps_ic_handler() override; @@ -99,17 +105,9 @@ class hqps_adhoc_query_handler : public seastar::httpd::handler_base { #endif }; -class hqps_exit_handler : public seastar::httpd::handler_base { - public: - seastar::future> handle( - const seastar::sstring& path, - std::unique_ptr req, - std::unique_ptr rep) override; -}; - class hqps_http_handler { public: - hqps_http_handler(uint16_t http_port); + hqps_http_handler(uint16_t http_port, int32_t shard_num); ~hqps_http_handler(); void start(); @@ -131,11 +129,10 @@ class hqps_http_handler { private: const uint16_t http_port_; seastar::httpd::http_server_control server_; - std::atomic running_{false}; + std::atomic running_{false}, actors_running_{false}; - hqps_ic_handler *ic_handler_, *proc_handler_; - hqps_adhoc_query_handler* adhoc_query_handler_; - hqps_exit_handler* exit_handler_; + std::vector ic_handlers_; + std::vector adhoc_query_handlers_; }; } // namespace server diff --git a/flex/engines/http_server/service/hqps_service.cc b/flex/engines/http_server/service/hqps_service.cc index 5502094e39de..b7dc7e85d28a 100644 --- a/flex/engines/http_server/service/hqps_service.cc +++ b/flex/engines/http_server/service/hqps_service.cc @@ -64,7 +64,8 @@ void HQPSService::init(const ServiceConfig& config) { actor_sys_ = std::make_unique( config.shard_num, config.dpdk_mode, config.enable_thread_resource_pool, config.external_thread_num, [this]() { set_exit_state(); }); - query_hdl_ = std::make_unique(config.query_port); + query_hdl_ = + std::make_unique(config.query_port, config.shard_num); if (config.start_admin_service) { admin_hdl_ = std::make_unique(config.admin_port); } diff --git a/flex/engines/http_server/service/hqps_service.h b/flex/engines/http_server/service/hqps_service.h index eeec6691ae88..3193ff0b5bcb 100644 --- a/flex/engines/http_server/service/hqps_service.h +++ b/flex/engines/http_server/service/hqps_service.h @@ -47,6 +47,7 @@ struct ServiceConfig { uint32_t admin_port; uint32_t query_port; uint32_t shard_num; + uint32_t memory_level; bool dpdk_mode; bool enable_thread_resource_pool; unsigned external_thread_num; diff --git a/flex/interactive/docker/Makefile b/flex/interactive/docker/Makefile index 3d84ee082c8f..e3cd84d76c74 100644 --- a/flex/interactive/docker/Makefile +++ b/flex/interactive/docker/Makefile @@ -31,7 +31,7 @@ interactive-runtime: --target final_image \ --build-arg ARCH=$(ARCH) \ --build-arg ENABLE_COORDINATOR=${ENABLE_COORDINATOR} \ - -t registry.cn-hongkong.aliyuncs.com/graphscope/interactive:${SHORT_SHA}-${ARCH} --push . + -t registry.cn-hongkong.aliyuncs.com/graphscope/interactive:${SHORT_SHA}-${ARCH} . hqps-server-base: docker build \ -f $(WORKING_DIR)/Dockerfile \ diff --git a/flex/interactive/docker/entrypoint.sh b/flex/interactive/docker/entrypoint.sh index e3c3c28a7bc4..6616f8ce15d1 100644 --- a/flex/interactive/docker/entrypoint.sh +++ b/flex/interactive/docker/entrypoint.sh @@ -29,6 +29,9 @@ function usage() { inside container. If you want to use a workspace outside the container, you should mount it to the container. Default is /tmp/interactive_workspace + -c, --enable-coordinator: Launch the Interactive service along + with Coordinator. Must enable this option if you want to use + `gsctl` command-line tool. EOF } @@ -82,33 +85,60 @@ function launch_service() { start_cmd="${start_cmd} --enable-admin-service true" start_cmd="${start_cmd} --start-compiler true" echo "Starting the service with command: $start_cmd" + if $ENABLE_COORDINATOR; then start_cmd="${start_cmd} &"; fi eval $start_cmd } +function launch_coordinator() { + if $ENABLE_COORDINATOR; + then + coordinator_config_file="/tmp/coordinator-config.yaml" + cat > $coordinator_config_file << EOF +coordinator: + http_port: 8080 + +launcher_type: hosts + +session: + instance_id: demo +EOF + python3 -m gscoordinator --config-file $coordinator_config_file + fi +} + #################### Entry #################### +ENABLE_COORDINATOR=false WORKSPACE=/tmp/interactive_workspace while [[ $# -gt 0 ]]; do - key="$1" - - case $key in - -h | --help) - usage - exit - ;; - -w | --workspace) - shift - WORKSPACE="$1" - exit 0 - ;; - *) # unknown option - echo "unknown option $1" - usage - exit 1 - ;; + case $1 in + -w | --workspace) + shift + if [[ $# -eq 0 || $1 == -* ]]; then + echo "Option -w requires an argument." >&2 + exit 1 + fi + WORKSPACE=$1 + shift + ;; + -c | --enable-coordinator) + ENABLE_COORDINATOR=true + shift + ;; + -h | --help) + usage + exit 0 + ;; + *) + echo "Invalid option: $1" >&2 + usage + exit 1 + ;; esac done + prepare_workspace $WORKSPACE -launch_service $WORKSPACE \ No newline at end of file +launch_service $WORKSPACE +launch_coordinator diff --git a/flex/interactive/docker/interactive-runtime.Dockerfile b/flex/interactive/docker/interactive-runtime.Dockerfile index 15bffe5c57d3..7d05406c832a 100644 --- a/flex/interactive/docker/interactive-runtime.Dockerfile +++ b/flex/interactive/docker/interactive-runtime.Dockerfile @@ -32,7 +32,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=/opt/flex -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_ # install flex RUN . ${HOME}/.cargo/env && cd ${HOME}/GraphScope/flex && \ - git submodule update --init && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/opt/flex -DBUILD_DOC=OFF && make -j && make install && \ + git submodule update --init && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/opt/flex -DBUILD_DOC=OFF -DBUILD_TEST=OFF && make -j && make install && \ cd ~/GraphScope/interactive_engine/ && mvn clean package -Pexperimental -DskipTests && \ cd ~/GraphScope/interactive_engine/compiler && cp target/compiler-0.0.1-SNAPSHOT.jar /opt/flex/lib/ && \ cp target/libs/*.jar /opt/flex/lib/ && \ @@ -41,7 +41,7 @@ RUN . ${HOME}/.cargo/env && cd ${HOME}/GraphScope/flex && \ # build coordinator RUN if [ "${ENABLE_COORDINATOR}" = "true" ]; then \ - cd ${HOME}/GraphScope/flex/coordinator && \ + cd ${HOME}/GraphScope/coordinator && \ python3 setup.py bdist_wheel && \ mkdir -p /opt/flex/wheel && cp dist/*.whl /opt/flex/wheel/; \ fi @@ -134,6 +134,7 @@ RUN sudo ln -sf /opt/flex/bin/* /usr/local/bin/ \ RUN chmod +x /opt/flex/bin/* RUN if [ "${ENABLE_COORDINATOR}" = "true" ]; then \ + pip3 install --upgrade pip && \ pip3 install /opt/flex/wheel/*.whl; \ fi diff --git a/flex/interactive/sdk/README.md b/flex/interactive/sdk/README.md index 8d9f33775575..bac9d7bc4310 100644 --- a/flex/interactive/sdk/README.md +++ b/flex/interactive/sdk/README.md @@ -13,7 +13,7 @@ To use Interactive Java SDK ```xml com.alibaba.graphscope - interactive-java-sdk + interactive-sdk 0.0.3 ``` diff --git a/flex/interactive/sdk/examples/java/interactive-sdk-example/pom.xml b/flex/interactive/sdk/examples/java/interactive-sdk-example/pom.xml index 9f2008d7ff67..0deabc12e665 100644 --- a/flex/interactive/sdk/examples/java/interactive-sdk-example/pom.xml +++ b/flex/interactive/sdk/examples/java/interactive-sdk-example/pom.xml @@ -22,7 +22,7 @@ com.alibaba.graphscope - interactive-java-sdk + interactive-sdk 0.0.3 diff --git a/flex/interactive/sdk/generate_sdk.sh b/flex/interactive/sdk/generate_sdk.sh index 751f4c0bc1ed..b7406ee8f23c 100755 --- a/flex/interactive/sdk/generate_sdk.sh +++ b/flex/interactive/sdk/generate_sdk.sh @@ -19,7 +19,7 @@ PACKAGE_NAME="com.alibaba.graphscope.interactive.openapi" PYTHON_PACKAGE_NAME="openapi" GROUP_ID="com.alibaba.graphscope" -ARTIFACT_ID="interactive-java-sdk" +ARTIFACT_ID="interactive-sdk" ARTIFACT_URL="https://github.com/alibaba/GraphScope/tree/main/flex/interactive" VERSION="0.0.3" EMAIL="graphscope@alibaba-inc.com" diff --git a/flex/interactive/sdk/java/README.md b/flex/interactive/sdk/java/README.md index f5643762ef71..4148e90a385d 100644 --- a/flex/interactive/sdk/java/README.md +++ b/flex/interactive/sdk/java/README.md @@ -34,7 +34,7 @@ Add this dependency to your project's POM: ```xml com.alibaba.graphscope - interactive-java-sdk + interactive-sdk 0.0.3 compile @@ -50,7 +50,7 @@ mvn clean package Then manually install the following JARs: -* `target/interactive-java-sdk-0.0.3.jar` +* `target/interactive-sdk-0.0.3.jar` * `target/lib/*.jar` ## Getting Started diff --git a/flex/interactive/sdk/java/pom.xml b/flex/interactive/sdk/java/pom.xml index eb10ab58cfc5..a89d0b482e96 100644 --- a/flex/interactive/sdk/java/pom.xml +++ b/flex/interactive/sdk/java/pom.xml @@ -2,23 +2,37 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.alibaba.graphscope - interactive-java-sdk + interactive-sdk jar - interactive-java-sdk + interactive-sdk 0.0.3 https://github.com/alibaba/GraphScope/tree/main/flex/interactive GraphScope Interactive Java SDK + + Alibaba Group Holding Ltd. + https://github.com/alibaba + + - scm:git:git@github.com:openapitools/openapi-generator.git - scm:git:git@github.com:openapitools/openapi-generator.git - https://github.com/openapitools/openapi-generator + main + https://github.com/alibaba/GraphScope/tree/main/flex/interactive/sdk/java + git@github.com:alibaba/graphscope.git + git@github.com:alibaba/graphscope.git + + + + xiaolei.zl@alibaba-inc.com + + + + - Apache-2.0 - http://www.apache.org/licenses/LICENSE-2.0.html - repo + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + actable @@ -31,6 +45,17 @@ + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + @@ -175,6 +200,7 @@ + ${java.home}/bin/javadoc none @@ -280,6 +306,30 @@ + + org.sonatype.plugins + nexus-staging-maven-plugin + ${nexus-staging-maven-plugin.version} + true + + ossrh + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + + jar-no-fork + + + + @@ -291,7 +341,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.1 + ${maven-gpg-plugin.version} sign-artifacts @@ -350,6 +400,11 @@ jackson-databind-nullable ${jackson-databind-nullable-version} + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + javax.ws.rs jsr311-api @@ -408,6 +463,7 @@ 2.10.1 3.14.0 0.2.6 + 2.14.0-rc2 1.3.5 5.10.0 1.10.0 @@ -421,5 +477,8 @@ 3.22.2 1.7.1 1.51.1 + 3.0.1 + 1.6.7 + 2.2.1 diff --git a/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/Driver.java b/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/Driver.java index eb2b8d71389d..5a39debf0460 100644 --- a/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/Driver.java +++ b/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/Driver.java @@ -151,6 +151,9 @@ private Pair getNeo4jEndpointImpl() { } else { ServiceStatus status = serviceStatus.getValue(); Integer boltPort = status.getBoltPort(); + if (!status.getStatus().equals("Running")) { + throw new RuntimeException("Interactive Query Service is not running"); + } // Currently, we assume the host is the same as the gs server return Pair.of(host, boltPort); } diff --git a/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/GraphInterface.java b/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/GraphInterface.java index bdc14e226d44..eb2f87fdb47a 100644 --- a/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/GraphInterface.java +++ b/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/GraphInterface.java @@ -32,6 +32,8 @@ public interface GraphInterface { Result getGraphSchema(String graphId); + Result getGraphStatistics(String graphId); + Result getGraphMeta(String graphId); Result> getAllGraphs(); diff --git a/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/ProcedureInterface.java b/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/ProcedureInterface.java index a6ca594676fb..14a304336076 100644 --- a/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/ProcedureInterface.java +++ b/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/ProcedureInterface.java @@ -40,5 +40,9 @@ Result updateProcedure( Result callProcedure(String graphId, QueryRequest request); - Result callProcedureRaw(String graphId, String request); + Result callProcedure(QueryRequest request); + + Result callProcedureRaw(String graphId, byte[] request); + + Result callProcedureRaw(byte[] request); } diff --git a/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/impl/DefaultSession.java b/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/impl/DefaultSession.java index d1065e712071..dbcbf936a401 100644 --- a/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/impl/DefaultSession.java +++ b/flex/interactive/sdk/java/src/main/java/com/alibaba/graphscope/interactive/client/impl/DefaultSession.java @@ -26,7 +26,6 @@ import com.google.protobuf.InvalidProtocolBufferException; import java.io.Closeable; -import java.nio.charset.StandardCharsets; import java.util.List; /*** @@ -44,6 +43,9 @@ public class DefaultSession implements Session { private static final int DEFAULT_READ_TIMEOUT = 30000; private static final int DEFAULT_WRITE_TIMEOUT = 30000; + private static String JSON_FORMAT_STRING = "json"; + private static String PROTO_FORMAT_STRING = "proto"; + private static String ENCODER_FORMAT_STRING = "encoder"; private final ApiClient client, queryClient; @@ -200,6 +202,18 @@ public Result getGraphSchema(String graphId) { } } + @Override + public Result getGraphStatistics(String graphId) { + try { + ApiResponse response = + graphApi.getGraphStatisticWithHttpInfo(graphId); + return Result.fromResponse(response); + } catch (ApiException e) { + e.printStackTrace(); + return Result.fromException(e); + } + } + @Override public Result getGraphMeta(String graphId) { try { @@ -317,32 +331,47 @@ public Result updateProcedure( } } - private String encodeString(String jsonStr, int lastByte) { - byte[] bytes = new byte[jsonStr.length() + 1]; - // copy string to byte array - for (int i = 0; i < jsonStr.length(); i++) { - bytes[i] = (byte) jsonStr.charAt(i); + @Override + public Result callProcedure( + String graphName, QueryRequest request) { + try { + // Interactive currently support four type of inputformat, see + // flex/engines/graph_db/graph_db_session.h + // Here we add byte of value 1 to denote the input format is in JSON format. + ApiResponse response = + queryApi.procCallWithHttpInfo( + graphName, JSON_FORMAT_STRING, request.toJson().getBytes()); + if (response.getStatusCode() != 200) { + return Result.fromException( + new ApiException(response.getStatusCode(), "Failed to call procedure")); + } + IrResult.CollectiveResults results = + IrResult.CollectiveResults.parseFrom(response.getData()); + return new Result<>(results); + } catch (ApiException e) { + e.printStackTrace(); + return Result.fromException(e); + } catch (InvalidProtocolBufferException e) { + e.printStackTrace(); + return Result.error(e.getMessage()); } - bytes[jsonStr.length()] = (byte) lastByte; - return new String(bytes, StandardCharsets.UTF_8); } @Override - public Result callProcedure( - String graphName, QueryRequest request) { + public Result callProcedure(QueryRequest request) { try { // Interactive currently support four type of inputformat, see // flex/engines/graph_db/graph_db_session.h // Here we add byte of value 1 to denote the input format is in JSON format. - String encodedStr = encodeString(request.toJson(), 1); - ApiResponse response = queryApi.procCallWithHttpInfo(graphName, encodedStr); + ApiResponse response = + queryApi.procCallCurrentWithHttpInfo( + JSON_FORMAT_STRING, request.toJson().getBytes()); if (response.getStatusCode() != 200) { return Result.fromException( - new ApiException(response.getStatusCode(), response.getData())); + new ApiException(response.getStatusCode(), "Failed to call procedure")); } IrResult.CollectiveResults results = - IrResult.CollectiveResults.parseFrom( - response.getData().getBytes(StandardCharsets.UTF_8)); + IrResult.CollectiveResults.parseFrom(response.getData()); return new Result<>(results); } catch (ApiException e) { e.printStackTrace(); @@ -354,19 +383,39 @@ public Result callProcedure( } @Override - public Result callProcedureRaw(String graphName, String request) { + public Result callProcedureRaw(String graphName, byte[] request) { + try { + // Interactive currently support four type of inputformat, see + // flex/engines/graph_db/graph_db_session.h + // Here we add byte of value 0 to denote the input format is in raw encoder/decoder + // format. + ApiResponse response = + queryApi.procCallWithHttpInfo(graphName, ENCODER_FORMAT_STRING, request); + if (response.getStatusCode() != 200) { + return Result.fromException( + new ApiException(response.getStatusCode(), "Failed to call procedure")); + } + return new Result(response.getData()); + } catch (ApiException e) { + e.printStackTrace(); + return Result.fromException(e); + } + } + + @Override + public Result callProcedureRaw(byte[] request) { try { // Interactive currently support four type of inputformat, see // flex/engines/graph_db/graph_db_session.h // Here we add byte of value 0 to denote the input format is in raw encoder/decoder // format. - String encodedStr = encodeString(request, 0); - ApiResponse response = queryApi.procCallWithHttpInfo(graphName, encodedStr); + ApiResponse response = + queryApi.procCallCurrentWithHttpInfo(ENCODER_FORMAT_STRING, request); if (response.getStatusCode() != 200) { return Result.fromException( - new ApiException(response.getStatusCode(), response.getData())); + new ApiException(response.getStatusCode(), "Failed to call procedure")); } - return new Result(response.getData()); + return new Result(response.getData()); } catch (ApiException e) { e.printStackTrace(); return Result.fromException(e); diff --git a/flex/interactive/sdk/java/src/test/java/com/alibaba/graphscope/interactive/client/DriverTest.java b/flex/interactive/sdk/java/src/test/java/com/alibaba/graphscope/interactive/client/DriverTest.java index b94b3055b873..8d51492b9d3c 100644 --- a/flex/interactive/sdk/java/src/test/java/com/alibaba/graphscope/interactive/client/DriverTest.java +++ b/flex/interactive/sdk/java/src/test/java/com/alibaba/graphscope/interactive/client/DriverTest.java @@ -483,6 +483,14 @@ public void test8Restart() { @Test @Order(11) + public void test9GetGraphStatistics() { + Result resp = session.getGraphStatistics(graphId); + assertOk(resp); + logger.info("graph statistics: " + resp.getValue()); + } + + @Test + @Order(12) public void test9CallCppProcedure1() { QueryRequest request = new QueryRequest(); request.setQueryName(cppProcedureId1); @@ -500,19 +508,36 @@ public void test9CallCppProcedure1() { } @Test - @Order(12) + @Order(13) + public void test9CallCppProcedure1Current() { + QueryRequest request = new QueryRequest(); + request.setQueryName(cppProcedureId1); + request.addArgumentsItem( + new TypedValue() + .value(1) + .type( + new GSDataType( + new PrimitiveType() + .primitiveType( + PrimitiveType.PrimitiveTypeEnum + .SIGNED_INT32)))); + Result resp = session.callProcedure(request); + assertOk(resp); + } + + @Test + @Order(14) public void test9CallCppProcedure2() { byte[] bytes = new byte[4 + 1]; Encoder encoder = new Encoder(bytes); encoder.put_int(1); encoder.put_byte((byte) 1); // Assume the procedure index is 1 - String encoded = new String(bytes); - Result resp = session.callProcedureRaw(graphId, encoded); + Result resp = session.callProcedureRaw(graphId, bytes); assertOk(resp); } @Test - @Order(13) + @Order(15) public void test10CallCypherProcedureViaNeo4j() { String query = "CALL " + cypherProcedureId + "() YIELD *;"; org.neo4j.driver.Result result = neo4jSession.run(query); diff --git a/flex/interactive/sdk/python/interactive_sdk/client/session.py b/flex/interactive/sdk/python/interactive_sdk/client/session.py index 3c5c0fe154f1..34343c8bc990 100644 --- a/flex/interactive/sdk/python/interactive_sdk/client/session.py +++ b/flex/interactive/sdk/python/interactive_sdk/client/session.py @@ -21,6 +21,7 @@ from pydantic import Field, StrictStr +from interactive_sdk.client.status import Status from interactive_sdk.openapi.api.admin_service_graph_management_api import ( AdminServiceGraphManagementApi, ) @@ -56,6 +57,7 @@ from interactive_sdk.openapi.models.get_graph_schema_response import ( GetGraphSchemaResponse, ) +from interactive_sdk.openapi.models.get_graph_statistics_response import GetGraphStatisticsResponse from interactive_sdk.openapi.models.get_procedure_response import GetProcedureResponse from interactive_sdk.openapi.models.job_response import JobResponse from interactive_sdk.openapi.models.job_status import JobStatus @@ -177,6 +179,14 @@ def get_graph_meta( ) -> Result[GetGraphResponse]: raise NotImplementedError + @abstractmethod + def get_graph_statistics( + graph_id: Annotated[ + StrictStr, Field(description="The id of graph to get") + ], + ) -> Result[GetGraphStatisticsResponse]: + raise NotImplementedError + @abstractmethod def delete_graph( graph_id: Annotated[ @@ -234,11 +244,20 @@ def call_procedure( self, graph_id: StrictStr, params: QueryRequest ) -> Result[CollectiveResults]: raise NotImplementedError - + + @abstractmethod + def call_procedure_current( + self, params: QueryRequest + ) -> Result[CollectiveResults]: + raise NotImplementedError + @abstractmethod def call_procedure_raw(self, graph_id: StrictStr, params: str) -> Result[str]: raise NotImplementedError + @abstractmethod + def call_procedure_current_raw(self, params: str) -> Result[str]: + raise NotImplementedError class QueryServiceInterface: @abstractmethod @@ -290,6 +309,9 @@ class Session( class DefaultSession(Session): + PROTOCOL_FORMAT = "proto" + JSON_FORMAT = "json" + ENCODER_FORMAT = "encoder" def __init__(self, uri: str): self._client = ApiClient(Configuration(host=uri)) @@ -424,6 +446,16 @@ def get_graph_meta( return Result.from_response(response) except Exception as e: return Result.from_exception(e) + + def get_graph_statistics( + self, + graph_id: Annotated[StrictStr, Field(description="The id of graph to get")], + ) -> Result[GetGraphStatisticsResponse]: + try: + response = self._graph_api.get_graph_statistic_with_http_info(graph_id) + return Result.from_response(response) + except Exception as e: + return Result.from_exception(e) def delete_graph( self, @@ -517,17 +549,36 @@ def call_procedure( try: # Interactive currently support four type of inputformat, see flex/engines/graph_db/graph_db_session.h # Here we add byte of value 1 to denote the input format is in json format - params_str = params.to_json() + chr(1) response = self._query_api.proc_call_with_http_info( - graph_id, params_str + graph_id = graph_id, + x_interactive_request_format = self.JSON_FORMAT, + body=params.to_json() ) result = CollectiveResults() if response.status_code == 200: - byte_data = response.data.encode('utf-8') - result.ParseFromString(byte_data) - return Result.from_response(response) + result.ParseFromString(response.data) + return Result.ok(result) else: - return Result.from_response(result) + return Result(Status.from_response(response), result) + except Exception as e: + return Result.from_exception(e) + + def call_procedure_current( + self, params: QueryRequest + ) -> Result[CollectiveResults]: + try: + # Interactive currently support four type of inputformat, see flex/engines/graph_db/graph_db_session.h + # Here we add byte of value 1 to denote the input format is in json format + response = self._query_api.proc_call_current_with_http_info( + x_interactive_request_format = self.JSON_FORMAT, + body = params.to_json() + ) + result = CollectiveResults() + if response.status_code == 200: + result.ParseFromString(response.data) + return Result.ok(result) + else: + return Result(Status.from_response(response), result) except Exception as e: return Result.from_exception(e) @@ -535,9 +586,22 @@ def call_procedure_raw(self, graph_id: StrictStr, params: str) -> Result[str]: try: # Interactive currently support four type of inputformat, see flex/engines/graph_db/graph_db_session.h # Here we add byte of value 1 to denote the input format is in encoder/decoder format - params = params + chr(0) response = self._query_api.proc_call_with_http_info( - graph_id, params + graph_id = graph_id, + x_interactive_request_format = self.ENCODER_FORMAT, + body = params + ) + return Result.from_response(response) + except Exception as e: + return Result.from_exception(e) + + def call_procedure_current_raw(self, params: str) -> Result[str]: + try: + # Interactive currently support four type of inputformat, see flex/engines/graph_db/graph_db_session.h + # Here we add byte of value 1 to denote the input format is in encoder/decoder format + response = self._query_api.proc_call_current_with_http_info( + x_interactive_request_format = self.ENCODER_FORMAT, + body = params ) return Result.from_response(response) except Exception as e: diff --git a/flex/interactive/sdk/python/test/test_driver.py b/flex/interactive/sdk/python/test/test_driver.py index 498ea13feca8..29a488df8e46 100644 --- a/flex/interactive/sdk/python/test/test_driver.py +++ b/flex/interactive/sdk/python/test/test_driver.py @@ -94,14 +94,16 @@ def test_example(self): self.createGraph() self.bulkLoading() self.waitJobFinish() - self.test_list_graph() + self.list_graph() self.runCypherQuery() self.runGremlinQuery() self.createCypherProcedure() self.createCppProcedure() self.restart() + self.getStatistics() self.callProcedure() self.callProcedureWithHttp() + self.callProcedureWithHttpCurrent() def createGraph(self): create_graph = CreateGraphRequest(name="test_graph", description="test graph") @@ -197,7 +199,7 @@ def waitJobFinish(self): time.sleep(1) print("job finished") - def test_list_graph(self): + def list_graph(self): resp = self._sess.list_graphs() assert resp.is_ok() print("list graph: ", resp.get_value()) @@ -259,6 +261,11 @@ def restart(self): # wait 5 seconds time.sleep(5) + def getStatistics(self): + resp = self._sess.get_graph_statistics(self._graph_id) + assert resp.is_ok() + print("get graph statistics: ", resp.get_value()) + def callProcedure(self): with self._driver.getNeo4jSession() as session: result = session.run("CALL test_procedure();") @@ -276,10 +283,25 @@ def callProcedureWithHttp(self): ) ] ) - resp = self._sess.call_procedure(self._graph_id, req) + resp = self._sess.call_procedure(graph_id = self._graph_id, params = req) assert resp.is_ok() print("call procedure result: ", resp.get_value()) + def callProcedureWithHttpCurrent(self): + req = QueryRequest( + query_name=self._cpp_proc_name, + arguments=[ + TypedValue( + type=GSDataType( + PrimitiveType(primitive_type="DT_SIGNED_INT32") + ), + value = 1 + ) + ] + ) + resp = self._sess.call_procedure_current(params = req) + assert resp.is_ok() + print("call procedure result: ", resp.get_value()) if __name__ == "__main__": unittest.main() diff --git a/flex/openapi/openapi_coordinator.yaml b/flex/openapi/openapi_coordinator.yaml index 0513ffabb3cd..9201723ce6a4 100644 --- a/flex/openapi/openapi_coordinator.yaml +++ b/flex/openapi/openapi_coordinator.yaml @@ -1,4 +1,5 @@ openapi: 3.0.3 + info: title: GraphScope FLEX HTTP SERVICE API description: |- @@ -14,669 +15,1134 @@ info: license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html - version: 0.9.1 + version: 1.0.0 + externalDocs: description: Find out More about GraphScope url: http://graphscope.io -paths: - /api/v1/connection: - post: - tags: - - connection - description: Connect to coordinator service - operationId: connect - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Connection' - required: true - responses: - '200': - description: Connect coordinator service successfully - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionStatus' - delete: - tags: - - connection - description: Close the connection with coordinator - operationId: close - responses: - '200': - description: Close connection successfully - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph: - post: - tags: - - graph - description: Create a new graph - operationId: create_graph - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Graph' - required: true - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - get: - tags: - - graph - description: List all graphs - operationId: list_graphs - responses: - '200': - description: Successful operation - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Graph' - example: - - name: demo - store_type: mutable_csr - stored_procedures: - directory: plugins - schema: - vertex_types: - - type_id: 0 - type_name: person - properties: - - property_id: 0 - property_name: id - property_type: - primitive_type: DT_STRING - - property_id: 1 - property_name: name - property_type: - primitive_type: DT_STRING - primary_keys: - - id - - type_id: 1 - type_name: software - properties: - - property_id: 0 - property_name: id - property_type: - primitive_type: DT_STRING - - property_id: 1 - property_name: name - property_type: - primitive_type: DT_STRING - primary_keys: - - id - edge_types: - - type_id: 0 - type_name: knows - vertex_type_pair_relations: - - source_vertex: person - destination_vertex: person - relation: MANY_TO_MANY - x_csr_params: - edge_storage_strategy: ONLY_IN - properties: - - property_id: 0 - property_name: weight - property_type: - primitive_type: DT_STRING - - type_id: 1 - type_name: created - vertex_type_pair_relations: - - source_vertex: person - destination_vertex: software - relation: MANY_TO_MANY - x_csr_params: - edge_storage_strategy: ONLY_IN - properties: - - property_id: 0 - property_name: weight - property_type: - primitive_type: DT_STRING - /api/v1/graph/{graph_name}: - delete: - tags: - - graph - description: Delete a graph by name - operationId: delete_graph - parameters: - - name: graph_name - in: path - required: true + +components: + responses: + 400: + description: Bad request + content: + application/json: schema: - type: string - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/schema: - get: - tags: - - graph - description: Get graph schema by name - operationId: get_schema - parameters: - - name: graph_name - in: path - required: true + $ref: "#/components/schemas/Error" + 404: + description: Not found + content: + application/json: schema: - type: string - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Schema' - example: - vertex_types: - - type_id: 0 - type_name: person - properties: - - property_id: 0 - property_name: id - property_type: - primitive_type: DT_STRING - - property_id: 1 - property_name: name - property_type: - primitive_type: DT_STRING - primary_keys: - - id - - type_id: 1 - type_name: software - properties: - - property_id: 0 - property_name: id - property_type: - primitive_type: DT_STRING - - property_id: 1 - property_name: name - property_type: - primitive_type: DT_STRING - primary_keys: - - id - edge_types: - - type_id: 0 - type_name: knows - vertex_type_pair_relations: - - source_vertex: person - destination_vertex: person - relation: MANY_TO_MANY - x_csr_params: - edge_storage_strategy: ONLY_IN - properties: - - property_id: 0 - property_name: weight - property_type: - primitive_type: DT_STRING - - type_id: 1 - type_name: created - vertex_type_pair_relations: - - source_vertex: person - destination_vertex: software - relation: MANY_TO_MANY - x_csr_params: - edge_storage_strategy: ONLY_IN - properties: - - property_id: 0 - property_name: weight - property_type: - primitive_type: DT_STRING - /api/v1/graph/{graph_name}/schema/vertex_type: - post: - tags: - - graph - description: Create a vertex type - operationId: create_vertex_type - parameters: - - name: graph_name - in: path - required: true + $ref: "#/components/schemas/Error" + 500: + description: Server error + content: + application/json: schema: + $ref: "#/components/schemas/Error" + + schemas: + APIResponse: + type: string + + Error: + required: + - code + - message + properties: + code: + type: integer + format: int32 + description: Error code + message: + type: string + description: Error message + + # https://swagger.io/docs/specification/data-models/data-types/#any + # {} is shorthand syntax for an arbitrary-type schema + AnyValue: {} + + RunningDeploymentInfo: + required: + - instance_name + - cluster_type + - version + - creation_time + - frontend + - engine + - storage + properties: + instance_name: + type: string + cluster_type: + type: string + enum: + - HOSTS + - KUBERNETES + version: + type: string + creation_time: + type: string + frontend: + type: string + enum: + - Cypher/Gremlin + - AnalyticalApps + engine: + type: string + enum: + - Hiactor + - Gaia + storage: + type: string + enum: + - MutableCSR + + NodeStatus: + required: + - name + - cpu_usage + - memory_usage + - disk_usage + properties: + name: + type: string + cpu_usage: + type: number + format: double + memory_usage: + type: number + format: double + disk_usage: + type: number + format: double + + RunningDeploymentStatus: + required: + - cluster_type + - nodes + properties: + cluster_type: + type: string + enum: + - HOSTS + - KUBERNETES + nodes: + type: array + items: + oneOf: + - $ref: '#/components/schemas/NodeStatus' + + StartServiceRequest: + x-body-name: start_service_request + properties: + graph_id: + type: string + + ServiceStatus: + required: + - graph_id + - status + - creation_time + properties: + graph_id: + type: string + status: + type: string + enum: + - Running + - Stopped + sdk_endpoints: + properties: + cypher: + type: string + gremlin: + type: string + hqps: + type: string + grpc: + type: string + start_time: + type: string + + UploadFileResponse: + required: + - file_path + properties: + file_path: + type: string + + LongText: + required: + - long_text + properties: + long_text: + type: string + nullable: true + + PrimitiveType: + required: + - primitive_type + properties: + primitive_type: + type: string + enum: [DT_SIGNED_INT32, DT_UNSIGNED_INT32, DT_SIGNED_INT64, DT_UNSIGNED_INT64, + DT_BOOL, DT_FLOAT, DT_DOUBLE] + + StringType: + required: + - string + properties: + string: + type: object + oneOf: + - $ref: '#/components/schemas/LongText' + + GSDataType: + oneOf: + - $ref: '#/components/schemas/PrimitiveType' + - $ref: '#/components/schemas/StringType' + + Parameter: + required: + - name + - type + properties: + name: + type: string + type: + $ref: '#/components/schemas/GSDataType' + + BasePropertyMeta: + required: + - property_name + - property_type + properties: + property_name: + type: string + property_type: + $ref: '#/components/schemas/GSDataType' + nullable: + type: boolean + default_value: + $ref: '#/components/schemas/AnyValue' + description: + type: string + + CreatePropertyMeta: + x-body-name: create_property_meta + allOf: + - $ref: '#/components/schemas/BasePropertyMeta' + + GetPropertyMeta: + x-body-name: get_property_meta + allOf: + - $ref: '#/components/schemas/BasePropertyMeta' + - type: object + required: + - property_id + properties: + property_id: + type: integer + format: int32 + + BaseVertexType: + required: + - type_name + - primary_keys + properties: + type_name: + type: string + primary_keys: + type: array + items: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/VertexType' - required: true - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/schema/vertex_type/{type_name}: - delete: - tags: - - graph - description: Delete a vertex type by name - operationId: delete_vertex_type - parameters: - - name: graph_name - in: path - required: true - schema: - type: string - - name: type_name - in: path - required: true - schema: - type: string - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/schema/edge_type: - post: - tags: - - graph - description: Create a edge type - operationId: create_edge_type - parameters: - - name: graph_name - in: path - required: true - schema: + x_csr_params: + type: object + description: Used for storage optimization + properties: + max_vertex_num: + type: integer + + CreateVertexType: + x-body-name: create_vertex_type + allOf: + - $ref: '#/components/schemas/BaseVertexType' + - type: object + required: + - properties + properties: + properties: + type: array + items: + $ref: '#/components/schemas/CreatePropertyMeta' + description: + type: string + + BaseEdgeType: + required: + - type_name + - vertex_type_pair_relations + properties: + type_name: + type: string + vertex_type_pair_relations: + type: array + items: + required: + - source_vertex + - destination_vertex + - relation + properties: + source_vertex: + type: string + destination_vertex: + type: string + relation: + type: string + enum: + - MANY_TO_MANY + - ONE_TO_MANY + - MANY_TO_ONE + - ONE_TO_ONE + x_csr_params: + description: Used for storage optimization + properties: + edge_storage_strategy: + type: string + enum: + - ONLY_IN + - ONLY_OUT + - BOTH_OUT_IN + directed: + type: boolean + primary_keys: + type: array + items: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/EdgeType' - required: true - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/schema/edge_edge/{type_name}: - delete: - tags: - - graph - description: Delete a edge type by name - operationId: delete_edge_type - parameters: - - name: graph_name - in: path - required: true - schema: + + CreateEdgeType: + x-body-name: create_edge_type + allOf: + - $ref: '#/components/schemas/BaseEdgeType' + - type: object + required: + - properties + properties: + properties: + type: array + items: + $ref: '#/components/schemas/CreatePropertyMeta' + description: + type: string + + CreateStoredProcRequest: + x-body-name: create_stored_proc_request + required: + - name + - type + - query + properties: + name: + type: string + description: + type: string + type: + type: string + enum: + - cpp + - cypher + query: + type: string + + CreateStoredProcResponse: + required: + - stored_procedure_id + properties: + stored_procedure_id: + type: string + + CreateGraphSchemaRequest: + x-body-name: create_graph_schema_request + required: + - vertex_types + - edge_types + properties: + vertex_types: + type: array + items: + $ref: '#/components/schemas/CreateVertexType' + edge_types: + type: array + items: + $ref: '#/components/schemas/CreateEdgeType' + + CreateGraphRequest: + x-body-name: create_graph_request + properties: + name: + type: string + description: + type: string + stored_procedures: + type: array + items: + $ref: '#/components/schemas/CreateStoredProcRequest' + schema: + $ref: '#/components/schemas/CreateGraphSchemaRequest' + + CreateGraphResponse: + required: + - graph_id + properties: + graph_id: + type: string + + StoredProcedureMeta: + allOf: + - $ref: '#/components/schemas/CreateStoredProcRequest' + - type: object + required: + - id + - library + - params + - returns + properties: + id: + type: string + library: + type: string + params: + type: array + items: + $ref: '#/components/schemas/Parameter' + returns: + type: array + items: + $ref: '#/components/schemas/Parameter' + + GetStoredProcResponse: + allOf: + - $ref: '#/components/schemas/StoredProcedureMeta' + - type: object + required: + - bound_graph + - runnable + properties: + bound_graph: + type: string + runnable: + type: boolean + + UpdateStoredProcRequest: + x-body-name: update_stored_proc_request + required: + - description + properties: + description: + type: string + + GetVertexType: + allOf: + - $ref: '#/components/schemas/BaseVertexType' + - type: object + required: + - type_id + - properties + properties: + type_id: + type: integer + format: int32 + properties: + type: array + items: + $ref: '#/components/schemas/GetPropertyMeta' + description: + type: string + + GetEdgeType: + allOf: + - $ref: '#/components/schemas/BaseEdgeType' + - type: object + required: + - type_id + properties: + type_id: + type: integer + format: int32 + properties: + type: array + items: + $ref: '#/components/schemas/GetPropertyMeta' + description: + type: string + + GetGraphSchemaResponse: + required: + - vertex_types + - edge_types + properties: + vertex_types: + type: array + items: + $ref: '#/components/schemas/GetVertexType' + edge_types: + type: array + items: + $ref: '#/components/schemas/GetEdgeType' + + GetGraphResponse: + required: + - id + - name + - schema + - creation_time + - data_update_time + - schema_update_time + properties: + id: + type: string + name: + type: string + description: + type: string + store_type: + type: string + enum: + - mutable_csr + creation_time: + type: string + data_update_time: + type: string + schema_update_time: + type: string + stored_procedures: + type: array + items: + $ref: '#/components/schemas/GetStoredProcResponse' + schema: + $ref: '#/components/schemas/GetGraphSchemaResponse' + + ColumnMapping: + required: + - column + - property + properties: + column: + properties: + index: + type: integer + format: int32 + name: + type: string + property: + type: string + description: must align with the schema + + VertexMapping: + x-body-name: vertex_mapping + required: + - type_name + - inputs + - column_mappings + properties: + type_name: + type: string + inputs: + type: array + items: type: string - - name: type_name - in: path - required: true - schema: + example: file:///path/to/file.csv + column_mappings: + type: array + items: + $ref: '#/components/schemas/ColumnMapping' + + EdgeMapping: + x-body-name: edge_mapping + required: + - type_triplet + - inputs + - source_vertex_mappings + - destination_vertex_mappings + properties: + type_triplet: + required: + - edge + - source_vertex + - destination_vertex + description: source label -> [edge label] -> destination label + properties: + edge: + type: string + source_vertex: + type: string + destination_vertex: + type: string + inputs: + type: array + items: type: string - - name: source_vertex_type - in: query - required: true - schema: + source_vertex_mappings: + type: array + items: + $ref: '#/components/schemas/ColumnMapping' + destination_vertex_mappings: + type: array + items: + $ref: '#/components/schemas/ColumnMapping' + column_mappings: + type: array + items: + $ref: '#/components/schemas/ColumnMapping' + + SchemaMapping: + x-body-name: schema_mapping + required: + - vertex_mappings + - edge_mappings + properties: + vertex_mappings: + type: array + items: + $ref: '#/components/schemas/VertexMapping' + edge_mappings: + type: array + items: + $ref: '#/components/schemas/EdgeMapping' + + DataloadingJobConfig: + x-body-name: dataloading_job_config + required: + - loading_config + - vertices + - edges + properties: + loading_config: + properties: + import_option: + type: string + enum: + - init + - overwrite + example: overwrite + format: + properties: + type: + type: string + metadata: + type: object + additionalProperties: true + vertices: + type: array + items: + type: object + properties: + type_name: + type: string + edges: + type: array + items: + type: object + properties: + type_name: + type: string + source_vertex: + type: string + destination_vertex: + type: string + schedule: + type: string + nullable: true + description: "format with '2023-02-21 11:56:30'" + repeat: + type: string + nullable: true + enum: + - once + - day + - week + + JobStatus: + required: + - id + - type + - status + properties: + id: + type: string + type: + type: string + status: + type: string + enum: + - RUNNING + - SUCCESS + - FAILED + - CANCELLED + - WAITING + start_time: + type: string + end_time: + type: string + log: + type: string + description: logview URL or log string + detail: + type: object + additionalProperties: true + + CreateDataloadingJobResponse: + required: + - job_id + properties: + job_id: + type: string + + CreateAlertRuleRequest: + x-body-name: create_alert_rule_request + required: + - name + - severity + - metric_type + - conditions_description + - frequency + - enable + properties: + name: + type: string + severity: + type: string + enum: + - warning + - emergency + metric_type: + type: string + enum: + - node + - service + conditions_description: + type: string + frequency: + type: integer + description: (mins) + enable: + type: boolean + + GetAlertRuleResponse: + allOf: + - $ref: '#/components/schemas/CreateAlertRuleRequest' + - type: object + required: + - id + properties: + id: + type: string + + GetAlertMessageResponse: + required: + - id + - alert_name + - severity + - metric_type + - target + - trigger_time + - status + - message + properties: + id: + type: string + description: Generated in server side + alert_name: + type: string + severity: + type: string + enum: + - warning + - emergency + metric_type: + type: string + enum: + - node + - service + target: + type: array + items: type: string - - name: destination_vertex_type - in: query - required: true - schema: + trigger_time: + type: string + status: + type: string + enum: + - unsolved + - solved + - dealing + message: + type: string + + UpdateAlertMessageStatusRequest: + x-body-name: update_alert_message_status_request + required: + - message_ids + - status + properties: + message_ids: + type: array + items: type: string - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/datasource: - post: - tags: - - datasource - description: Import data source in batch - operationId: import_datasource - parameters: - - name: graph_name - in: path - required: true - schema: + status: + type: string + enum: + - unsolved + - solved + - dealing + + CreateAlertReceiverRequest: + x-body-name: create_alert_receiver_request + required: + - type + - webhook_url + - at_user_ids + - is_at_all + - enable + properties: + type: + type: string + enum: + - webhook + webhook_url: + type: string + at_user_ids: + type: array + items: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DataSource' - required: true + is_at_all: + type: boolean + enable: + type: boolean + + GetAlertReceiverResponse: + allOf: + - $ref: '#/components/schemas/CreateAlertReceiverRequest' + - type: object + required: + - id + - message + properties: + id: + type: string + message: + type: string + description: Error message generated in server side + +tags: + - name: Deployment + - name: Graph + - name: DataSource + - name: Job + - name: Stored Procedure + - name: Service + - name: Alert + - name: Utils + +paths: + /api/v1/deployment: + get: + description: Deployment information + tags: [Deployment] + operationId: getDeploymentInfo responses: - '200': - description: successful operation + 200: + description: Successfully returned the deployment information content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' + $ref: '#/components/schemas/RunningDeploymentInfo' + example: + cluster_type: HOSTS + creation_time: 2024-01-01 00:00:00 + instance_name: demo + frontend: Cypher/Gremlin + engine: Hiactor + storage: MutableCSR + version: 0.27.0 + 500: + $ref: "#/components/responses/500" + + /api/v1/deployment/status: get: - tags: - - datasource - description: List data source on graph - operationId: get_datasource - parameters: - - name: graph_name - in: path - required: true - schema: - type: string + description: Deployment status + tags: [Deployment] + operationId: getDeploymentStatus responses: - '200': - description: Successful operation + 200: + description: Successfully returned the deployment status content: application/json: schema: - $ref: '#/components/schemas/DataSource' + $ref: '#/components/schemas/RunningDeploymentStatus' example: - vertices_datasource: - - data_source: FILE - type_name: person - location: /home/graphscope/path/to/person.csv - property_mapping: - "0": id - "1": name - - data_source: FILE - type_name: software - location: /home/graphscope/path/to/software.csv - property_mapping: - "0": id - "1": name - edges_datasource: - - data_source: FILE - type_name: knows - source_vertex: person - destination_vertex: person - location: /home/graphscope/path/to/person_knows_person.csv - source_pk_column_map: - "0": id - destination_pk_column_map: - "1": id - property_mapping: - "2": weight - - data_source: FILE - type_name: created - source_vertex: person - destination_vertex: software - location: /home/graphscope/path/to/person_created_software.csv - source_pk_column_map: - "0": id - destination_pk_column_map: - "1": id - property_mapping: - "2": weight - /api/v1/graph/{graph_name}/datasource/vertex_datasource: + cluster_type: HOSTS + nodes: + - name: HOSTNAME-1 + cpu_usage: 83.0 + memory_usage: 37.5 + disk_usage: 97 + 500: + $ref: "#/components/responses/500" + + /api/v1/graph: post: - tags: - - datasource - description: Bind data source on vertex type - operationId: bind_vertex_datasource - parameters: - - name: graph_name - in: path - required: true - schema: - type: string + description: Create a new graph + tags: [Graph] + operationId: createGraph requestBody: + required: true content: application/json: schema: - $ref: '#/components/schemas/VertexDataSource' - required: true + $ref: '#/components/schemas/CreateGraphRequest' responses: - '200': - description: successful operation + 200: + description: The graph was created content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/datasource/vertex_datasource/{type_name}: + $ref: '#/components/schemas/CreateGraphResponse' + 400: + $ref: "#/components/responses/400" + 500: + $ref: "#/components/responses/500" get: - tags: - - datasource - description: Get vertex data source - operationId: get_vertex_datasource - parameters: - - name: graph_name - in: path - required: true - schema: - type: string - - name: type_name - in: path - required: true - schema: - type: string + description: List all graphs + tags: [Graph] + operationId: listGraphs responses: - '200': - description: Successful operation + 200: + description: Successfully returned all graphs content: application/json: schema: - $ref: '#/components/schemas/VertexDataSource' + type: array + items: + $ref: "#/components/schemas/GetGraphResponse" example: - data_source: FILE - type_name: person - location: /home/graphscope/path/to/person.csv - property_mapping: - "0": id - "1": name - delete: - tags: - - datasource - description: Unbind datasource on a vertex type - operationId: unbind_vertex_datasource - parameters: - - name: graph_name - in: path - required: true - schema: - type: string - - name: type_name - in: path - required: true - schema: - type: string - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/datasource/edge_datasource: - post: - tags: - - datasource - description: Bind data source on edge type - operationId: bind_edge_datasource - parameters: - - name: graph_name - in: path - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/EdgeDataSource' - required: true - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/datasource/edge_datasource/{type_name}: + - id: GRAPHID + name: demo + creation_time: "2024-01-01 00:00:00" + schema_update_time: "2024-01-02 00:00:00" + data_update_time: "2024-01-03 00:00:00" + stored_procedures: + - id: STORED-PROCEDURE-ID + name: stored_procedure_name + type: cypher + query: "MATCH(a) return COUNT(a);" + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: true + schema: + vertex_types: + - type_id: 0 + type_name: person + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + - type_id: 1 + type_name: software + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + edge_types: + - type_id: 0 + type_name: knows + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: person + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + - type_id: 1 + type_name: created + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: software + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}: get: - tags: - - datasource - description: Get edge data source - operationId: get_edge_datasource + description: Get graph by ID + tags: [Graph] + operationId: getGraphById parameters: - - name: graph_name - in: path - required: true - schema: - type: string - - name: type_name - in: path - required: true - schema: - type: string - - name: source_vertex_type - in: query - required: true - schema: - type: string - - name: destination_vertex_type - in: query + - name: graph_id + in : path required: true schema: type: string responses: - '200': - description: Successful operation + 200: + description: Successfully returned the graph content: application/json: schema: - $ref: '#/components/schemas/EdgeDataSource' + $ref: "#/components/schemas/GetGraphResponse" example: - data_source: FILE - type_name: created - source_vertex: person - destination_vertex: software - location: /home/graphscope/path/to/person_created_software.csv - source_pk_column_map: - "0": id - destination_pk_column_map: - "1": id - property_mapping: - "2": weight + id: GRAPHID + name: demo + creation_time: "2024-01-01 00:00:00" + schema_update_time: "2024-01-02 00:00:00" + data_update_time: "2024-01-03 00:00:00" + stored_procedures: + - id: STORED-PROCEDURE-ID + name: stored_procedure_name + type: cypher + query: "MATCH(a) return COUNT(a);" + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: true + schema: + vertex_types: + - type_id: 0 + type_name: person + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + - type_id: 1 + type_name: software + properties: + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + edge_types: + - type_id: 0 + type_name: knows + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: person + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + - type_id: 1 + type_name: created + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: software + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN + properties: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + 500: + $ref: "#/components/responses/500" + delete: - tags: - - datasource - description: Unbind datasource on an edge type - operationId: unbind_edge_datasource + description: Delete graph by ID + tags: [Graph] + operationId: deleteGraphById parameters: - - name: graph_name - in: path - required: true - schema: - type: string - - name: type_name - in: path - required: true - schema: - type: string - - name: source_vertex_type - in: query - required: true - schema: - type: string - - name: destination_vertex_type - in: query + - name: graph_id + in : path required: true schema: type: string responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/groot/graph: - get: - tags: - - legacy - description: list groot graph - operationId: list_groot_graph - responses: - '200': - description: Successful operation + 200: + description: Successfully deleted the graph content: application/json: - schema: - type: array - items: - $ref: '#/components/schemas/GrootGraph' - example: - - name: demo - type: GrootGraph - directed: true - creation_time: 2024-04-01 12:00:00 - schema: - vertices: - - label: person - properties: - - id: 0 - name: id - type: STRING - is_primary_key: true - - id: 1 - name: name - type: STRING - is_primary_key: false - - label: software - properties: - - id: 0 - name: id - type: STRING - is_primary_key: true - - id: 1 - name: name - type: STRING - is_primary_key: false - edges: - - label: knows - relations: - - src_label: person - dst_label: person - properties: - - id: 0 - name: weight - type: DOUBLE - is_primary_key: false - - label: created - relations: - - src_label: person - dst_label: software - properties: - - id: 0 - name: weight - type: DOUBLE - is_primary_key: false - /api/v1/groot/graph/{graph_name}/schema: + schema: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/schema: post: - tags: - - legacy - description: Import schema to groot graph - operationId: import_groot_schema + tags: [Graph] + description: Import graph schema + operationId: importSchemaById parameters: - - name: graph_name - in: path + - name: graph_id + in : path required: true schema: type: string @@ -684,1602 +1150,1152 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/GrootSchema' + $ref: '#/components/schemas/CreateGraphSchemaRequest' required: true responses: - '200': - description: successful operation + 200: + description: Successful imported the graph schema content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' + $ref: '#/components/schemas/APIResponse' + 400: + $ref: "#/components/responses/400" + 500: + $ref: "#/components/responses/500" + get: - tags: - - legacy - description: Get graph schema by name - operationId: get_groot_schema + tags: [Graph] + description: Get graph schema by ID + operationId: getSchemaById parameters: - - name: graph_name - in: path + - name: graph_id + in : path required: true schema: type: string responses: - '200': - description: Successful operation + 200: + description: Successfully returned the graph schema content: application/json: schema: - $ref: '#/components/schemas/GrootSchema' + $ref: '#/components/schemas/GetGraphSchemaResponse' example: - vertices: - - label: person + vertex_types: + - type_id: 0 + type_name: person properties: - - id: 0 - name: id - type: STRING - is_primary_key: true - - id: 1 - name: name - type: STRING - is_primary_key: false - - label: software + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + - type_id: 1 + type_name: software properties: - - id: 0 - name: id - type: STRING - is_primary_key: true - - id: 1 - name: name - type: STRING - is_primary_key: false - edges: - - label: knows - relations: - - src_label: person - dst_label: person + - property_id: 0 + property_name: id + property_type: + string: + long_text: null + - property_id: 1 + property_name: name + property_type: + string: + long_text: null + primary_keys: + - id + edge_types: + - type_id: 0 + type_name: knows + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: person + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN properties: - - id: 0 - name: weight - type: DOUBLE - is_primary_key: false - - label: created - relations: - - src_label: person - dst_label: software + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + - type_id: 1 + type_name: created + vertex_type_pair_relations: + - source_vertex: person + destination_vertex: software + relation: MANY_TO_MANY + x_csr_params: + edge_storage_strategy: ONLY_IN properties: - - id: 0 - name: weight - type: DOUBLE - is_primary_key: false - /api/v1/groot/graph/{graph_name}/dataloading: + - property_id: 0 + property_name: weight + property_type: + primitive_type: DT_DOUBLE + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/schema/vertex: post: - tags: - - legacy - operationId: create_groot_dataloading_job + tags: [Graph] + description: Create a vertex type + operationId: createVertexType parameters: - - name: graph_name - in: path - required: true - schema: - type: string + - name: graph_id + in: path + required: true + schema: + type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/GrootDataloadingJobConfig' + $ref: '#/components/schemas/CreateVertexType' required: true responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/job: - get: - tags: - - job - operationId: list_jobs - responses: - '200': - description: successful operation + 200: + description: Successful created a vertex type content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/JobStatus' - example: - - job_id: JOB-QWERTYUIOPASDFGH-1 - type: DATA IMPORT - status: RUNNING - start_time: 2024-02-24 00:00:00 - end_time: null - log: logging... - detail: - graph_name: demo - - job_id: JOB-QWERTYUIOPASDFGH-2 - type: DATA IMPORT - status: CANCELLED - start_time: 2024-02-24 00:00:00 - end_time: null - log: logging... - detail: - graph_name: demo - - job_id: JOB-QWERTYUIOPASDFGH-3 - type: DATA IMPORT - status: SUCCESS - start_time: 2024-02-24 00:00:00 - end_time: 2024-02-24 12:00:00 - log: logging... - detail: - graph_name: demo - - job_id: JOB-QWERTYUIOPASDFGH-4 - type: DATA IMPORT - status: FAILED - start_time: 2024-02-24 00:00:00 - end_time: 2024-02-24 12:00:00 - log: logging... - detail: - graph_name: demo - - job_id: JOB-QWERTYUIOPASDFGH-5 - type: DATA IMPORT - status: WAITING - start_time: null - end_time: null - detail: - graph_name: demo - /api/v1/job/{job_id}: - get: - tags: - - job - operationId: get_job_by_id + $ref: '#/components/schemas/APIResponse' + 400: + $ref: "#/components/responses/400" + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/schema/vertex/{type_name}: + delete: + tags: [Graph] + description: Delete vertex type by name + operationId: deleteVertexTypeByName parameters: - - name: job_id + - name: graph_id in: path required: true schema: type: string - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/JobStatus' - example: - job_id: JOB-QWERTYUIOPASDFGH-1 - type: DATA IMPORT - status: RUNNING - start_time: 2024-02-24 00:00:00 - end_time: null - log: logging... - delete: - tags: - - job - operationId: delete_job_by_id - parameters: - - name: job_id + - name: type_name in: path required: true schema: type: string responses: - '200': - description: Successful operation + 200: + description: Successful deleted the vertex type content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/dataloading: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/schema/edge: post: - tags: - - job - operationId: create_dataloading_job + tags: [Graph] + description: Create a edge type + operationId: createEdgeType parameters: - - name: graph_name - in: path - required: true - schema: - type: string + - name: graph_id + in: path + required: true + schema: + type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/SchemaMapping' - required: true + $ref: '#/components/schemas/CreateEdgeType' responses: - '200': - description: successful operation + 200: + description: Successful created the edge type content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/graph/{graph_name}/dataloading/config: - get: - tags: - - job - description: get dataloading configuration - operationId: get_dataloading_config + $ref: '#/components/schemas/APIResponse' + 400: + $ref: "#/components/responses/400" + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/schema/edge/{type_name}: + delete: + tags: [Graph] + description: Delete edge type by name + operationId: deleteEdgeTypeByName parameters: - - name: graph_name - in: path - required: true - schema: - type: string - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/SchemaMapping' - example: - graph: demo - loading_config: overwrite - format: - type: csv - metadata: - delimiter: "|" - vertex_mappings: - - type_name: person - inputs: - - /home/graphscope/path/to/person.csv - column_mappings: - - column: - index: 0 - name: id - property: id - - column: - index: 1 - name: name - property: name - - type_name: software - inputs: - - /home/graphscope/path/to/software.csv - column_mappings: - - column: - index: 0 - name: id - property: id - - column: - index: 1 - name: name - property: name - edge_mappings: - - type_triplet: - edge: knows - source_vertex: person - destination_vertex: person - inputs: - - /home/graphscope/path/to/person_knows_person.csv - source_vertex_mappings: - - column: - index: 0 - name: id - destination_vertex_mappings: - - column: - index: 1 - name: id - column_mappings: - - column: - index: 2 - name: weight - property: weight - - type_triplet: - edge: created - source_vertex: person - destination_vertex: software - inputs: - - /home/graphscope/path/to/person_created_software.csv - source_vertex_mappings: - - column: - index: 0 - name: id - destination_vertex_mappings: - - column: - index: 1 - name: id - column_mappings: - - column: - index: 2 - name: weight - property: weight - /api/v1/procedure: - get: - tags: - - procedure - description: List all the stored procedures - operationId: list_procedures + - name: graph_id + in: path + required: true + schema: + type: string + - name: type_name + in: path + required: true + schema: + type: string + - name: source_vertex_type + in: query + required: true + schema: + type: string + - name: destination_vertex_type + in: query + required: true + schema: + type: string responses: - '200': - description: Successful operation + 200: + description: Successful deleted the edge type content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Procedure' - example: - - bound_graph: demo - description: "stored procedure 1" - enable: true - runnable: true - name: procedure-1 - query: "MATCH (u: person) Return u.id, u.name LIMIT 5;" - type: cypher - params: - - name: id - type: DT_STRING - returns: - - name: name - type: DT_STRING - /api/v1/graph/{graph_name}/procedure: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/datasource: post: - tags: - - procedure - description: Create a new stored procedure on a certain graph - operationId: create_procedure + tags: [DataSource] + description: Bind data sources in batches + operationId: bindDatasourceInBatch parameters: - - name: graph_name - in: path - required: true - schema: - type: string + - name: graph_id + in: path + required: true + schema: + type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/Procedure' - required: true - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - get: - tags: - - procedure - description: List stored procedures on a certain graph - operationId: list_procedures_by_graph - parameters: - - name: graph_name - in: path + $ref: '#/components/schemas/SchemaMapping' required: true - schema: - type: string responses: - '200': - description: Successful operation + 200: + description: Successful bind the data sources content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Procedure' - example: - - bound_graph: demo - description: "stored procedure 1" - enable: true - runnable: true - name: procedure-1 - query: "MATCH (u: person) Return u.id, u.name LIMIT 5;" - type: cypher - params: - - name: id - type: DT_STRING - returns: - - name: name - type: DT_STRING - /api/v1/graph/{graph_name}/procedure/{procedure_name}: + $ref: '#/components/schemas/APIResponse' + 400: + $ref: "#/components/responses/400" + 500: + $ref: "#/components/responses/500" get: - tags: - - procedure - description: Get a procedure by name - operationId: get_procedure + tags: [DataSource] + description: Get data source by ID + operationId: getDatasourceById parameters: - - name: graph_name - in : path - required: true - schema: - type: string - - name: procedure_name - in : path - required: true - schema: - type: string + - name: graph_id + in: path + required: true + schema: + type: string responses: - '200': - description: successful operation + 200: + description: Successful returned all data sources content: application/json: schema: - $ref: '#/components/schemas/Procedure' + $ref: '#/components/schemas/SchemaMapping' example: - bound_graph: demo - description: "stored procedure 1" - enable: true - runnable: true - name: procedure-1 - query: "MATCH (u: person) Return u.id, u.name LIMIT 5;" - type: cypher - params: - - name: id - type: DT_STRING - returns: - - name: name - type: DT_STRING - put: - tags: - - procedure - description: Update stored procedure on a certain graph - operationId: update_procedure - parameters: - - name: graph_name - in: path - required: true - schema: - type: string - - name: procedure_name - in : path - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Procedure' - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' + vertex_mappings: + - type_name: person + inputs: + - file:///path/to/person.csv + column_mappings: + - column: + index: 0 + name: id + property: id + - column: + index: 1 + name: name + property: name + - type_name: software + inputs: + - file:///path/to/software.csv + column_mappings: + - column: + index: 0 + name: id + property: id + - column: + index: 1 + name: name + property: name + edge_mappings: + - type_triplet: + edge: knows + source_vertex: person + destination_vertex: person + inputs: + - file:///path/to/knows.csv + source_vertex_mappings: + - column: + index: 0 + name: id + property: id + destination_vertex_mappings: + - column: + index: 1 + name: id + property: id + column_mappings: + - column: + index: 2 + name: weight + property: weight + - type_triplet: + edge: created + source_vertex: person + destination_vertex: software + inputs: + - file:///path/to/created.csv + source_vertex_mappings: + - column: + index: 0 + name: id + property: id + destination_vertex_mappings: + - column: + index: 1 + name: id + property: id + column_mappings: + - column: + index: 2 + name: weight + property: weight + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/datasource/vertex/{type_name}: delete: - tags: - - procedure - description: Delete a stored procedure on a certain graph - operationId: delete_procedure + tags: [DataSource] + description: Unbind data source on a vertex type + operationId: unbindVertexDatasource parameters: - - name: graph_name + - name: graph_id in: path required: true schema: type: string - - name: procedure_name - in : path + - name: type_name + in: path required: true schema: type: string responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/deployment/info: - get: - tags: - - deployment - description: Get deployment's meta info - operationId: get_deployment_info - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/DeploymentInfo' - example: - cluster_type: HOSTS - creation_time: 2024-02-07 14:21:28 - graphs_info: - demo: - creation_time: 2024-02-07 14:21:28 - last_dataloading_time: 2024-02-08 14:21:28 - name: demo - update_time: 2024-02-07 14:21:28 - name: demo - solution: INTERACTIVE - version: 0.27.0 - /api/v1/deployment/status: - get: - tags: - - deployment - description: Get deployment's status (k8s only) - operationId: get_deployment_status - responses: - '200': - description: successful operation + 200: + description: Successfully unbind the data source content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/DeploymentStatus' - /api/v1/deployment/log: - get: - tags: - - deployment - operationId: fetch_log + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/datasource/edge/{type_name}: + delete: + tags: [DataSource] + description: Unbind datas ource on an edge type + operationId: unbindEdgeDatasource parameters: - - name: component - in: query + - name: graph_id + in: path required: true schema: type: string - - name: pod_name - in: query + - name: type_name + in: path required: true schema: type: string - - name: container_name + - name: source_vertex_type in: query required: true schema: type: string - - name: since_seconds + - name: destination_vertex_type in: query required: true schema: - type: integer + type: string responses: - '200': - description: successful operation + 200: + description: Successfully unbind the data source content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/DeploymentStatus' - /api/v1/node/status: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/job: get: - tags: - - deployment - description: Get node status (cpu/memory/disk, local only) - operationId: get_node_status + tags: [Job] + description: List all jobs + operationId: listJobs responses: - '200': - description: successful operation + 200: + description: Successful returned all the jobs content: application/json: schema: type: array items: - $ref: '#/components/schemas/NodeStatus' + $ref: '#/components/schemas/JobStatus' example: - - node: hostname-1 - cpu_usage: 80 - memory_usage: 40 - disk_usage: 85 - /api/v1/service/start: - post: - tags: - - service - description: Start service - operationId: start_service - requestBody: - content: - application/json: - schema: - type: object - properties: - graph_name: - type: string + - id: JOB-QWERTYUIOPASDFGH-1 + type: DATA IMPORT + status: RUNNING + start_time: 2024-02-24 00:00:00 + log: logging... + detail: + graph_id: GRAPHID + - id: JOB-QWERTYUIOPASDFGH-2 + type: DATA IMPORT + status: CANCELLED + start_time: 2024-02-24 00:00:00 + log: logging... + detail: + graph_id: GRAPHID + - id: JOB-QWERTYUIOPASDFGH-3 + type: DATA IMPORT + status: SUCCESS + start_time: 2024-02-24 00:00:00 + end_time: 2024-02-24 12:00:00 + detail: + graph_id: GRAPHID + - id: JOB-QWERTYUIOPASDFGH-4 + type: DATA IMPORT + status: FAILED + start_time: 2024-02-24 00:00:00 + end_time: 2024-02-24 12:00:00 + log: logging... + detail: + graph_id: GRAPHID + - id: JOB-QWERTYUIOPASDFGH-5 + type: DATA IMPORT + status: WAITING + detail: + graph_id: GRAPHID + 500: + $ref: "#/components/responses/500" + + /api/v1/job/{job_id}: + get: + tags: [Job] + description: Get job status by ID + operationId: getJobById + parameters: + - name: job_id + in: path + required: true + schema: + type: string responses: - '200': - description: successful operation + 200: + description: Successfully returned the job status content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/service/stop: - post: - tags: - - service - description: Stop current service - operationId: stop_service + $ref: '#/components/schemas/JobStatus' + 500: + $ref: "#/components/responses/500" + + delete: + tags: [Job] + description: Delete job by ID + operationId: deleteJobById + parameters: + - name: job_id + in: path + required: true + schema: + type: string responses: - '200': - description: successful operation + 200: + description: Successfuly cancelled the job content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/service/restart: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/dataloading: post: - tags: - - service - description: Restart current service - operationId: restart_service - responses: - '200': - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/service/status: - get: - tags: - - service - description: Get service status - operationId: get_service_status + tags: [Job] + description: Submit a dataloading job + operationId: submitDataloadingJob + parameters: + - name: graph_id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DataloadingJobConfig' + required: true responses: - '200': - description: successful operation + 200: + description: Successfully submitted the job content: application/json: schema: - $ref: '#/components/schemas/ServiceStatus' - example: - status: running - graph_name: demo - sdk_endpoints: - cypher: neo4j://mock.api.cypher:7676 - gremlin: ws://mock.api.gremlin/gremlin - hqps: http://mock.api.hqps:10000 - grpc: http://mock.api.grpc:10000 - /api/v1/alert/message: + $ref: '#/components/schemas/CreateDataloadingJobResponse' + 400: + $ref: "#/components/responses/400" + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/dataloading/config: get: - tags: - - alert - operationId: list_alert_messages + tags: [Job] + description: Get the data loading configuration + operationId: getDataloadingJobConfig parameters: - - name: alert_type - in: query - required: false - schema: - type: string - - name: status - in: query - required: false - schema: - type: string - enum: - - solved - - unsolved - - dealing - - name: severity - in: query - required: false - schema: - type: string - enum: - - warning - - emergency - - name: start_time - in: query - required: false - description: format with "2023-02-21-11-56-30" - schema: - type: string - - name: end_time - in: query - required: false - description: format with "2023-02-21-11-56-30" + - name: graph_id + in: path + required: true schema: type: string responses: - '200': - description: Successful operation + 200: + description: Successfully returned the dataloading job configuration content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/AlertMessage' - example: - - message_id: ALERT-MESSAGE-QWERTYUIOP-1 - alert_name: HighDiskUtilization - severity: warning - metric_type: node - target: - - hostname-1 - trigger_time: 2023-02-21 11:56:30 - status: unsolved - message: Disk usage node1 85.12%, exceeds threshold - - message_id: ALERT-MESSAGE-QWERTYUIOP-2 - alert_name: HighDiskUtilization - severity: emergency - metric_type: node - target: - - hostname-1 - trigger_time: 2023-02-21 11:56:30 - status: solved - message: Disk usage node1 85.12%, exceeds threshold - - message_id: ALERT-MESSAGE-QWERTYUIOP-3 - alert_name: HighDiskUtilization - severity: warning - metric_type: node - target: - - hostname-1 - trigger_time: 2023-02-21 11:56:30 - status: dealing - message: Disk usage node1 85.12%, exceeds threshold - put: - tags: - - alert - operationId: update_alert_messages - description: Update alert messages in batch + $ref: '#/components/schemas/DataloadingJobConfig' + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/storedproc: + post: + tags: [Stored Procedure] + description: Create a new stored procedure on a certain graph + operationId: createStoredProcedure + parameters: + - name: graph_id + in: path + required: true + schema: + type: string requestBody: content: application/json: schema: - type: object - properties: - messages: - type: array - items: - $ref: '#/components/schemas/AlertMessage' - batch_status: - type: string - description: Override the status of each message - enum: - - solved - - unsolved - - dealing - batch_delete: - type: boolean - description: True will delete all the messages in request body - default: false + $ref: '#/components/schemas/CreateStoredProcRequest' + required: true + responses: + 200: + description: Successfully created a stored procedure + content: + application/json: + schema: + $ref: '#/components/schemas/CreateStoredProcResponse' + 400: + $ref: "#/components/responses/400" + 500: + $ref: "#/components/responses/500" + + get: + tags: [Stored Procedure] + description: List all stored procedures on a certain graph + operationId: listStoredProcedures + parameters: + - name: graph_id + in: path + required: true + schema: + type: string responses: - '200': + 200: description: Successful operation content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - '404': - description: Alert message not found - /api/v1/alert/rule: + type: array + items: + $ref: '#/components/schemas/GetStoredProcResponse' + example: + - id: STORED-PROCEDUREID-1 + name: stored_procedure_name_1 + type: cypher + query: "MATCH(a) return COUNT(a);" + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: true + - id: STORED-PROCEDUREID-2 + name: stored_procedure_name_2 + type: cypher + query: "MATCH(a) return COUNT(a);" + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: false + 400: + $ref: "#/components/responses/400" + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/storedproc/{stored_procedure_id}: get: - tags: - - alert - operationId: list_alert_rules + tags: [Stored Procedure] + description: Get a stored procedure by ID + operationId: getStoredProcedureById + parameters: + - name: graph_id + in : path + required: true + schema: + type: string + - name: stored_procedure_id + in : path + required: true + schema: + type: string responses: - '200': - description: Successful operation + 200: + description: Successfully returned the stored procedure content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/AlertRule' + $ref: '#/components/schemas/GetStoredProcResponse' example: - - name: HighDiskUtilization - severity: warning - metric_type: node - conditions_description: disk usage >= 85 - enable: true - - name: GremlinServiceAvailable - severity: emergency - metric_type: node - conditions_description: g.V().limit(1) failed - enable: false - /api/v1/alert/rule/{rule_name}: + id: STORED-PROCEDURE-ID + name: stored_procedure_name + type: cypher + query: "MATCH(a) return COUNT(a);" + library: /path/to/library + params: + - name: param1 + type: + string: + long_text: null + returns: + - name: return1 + type: + PrimitiveType: DT_SIGNED_INT64 + bound_graph: demo + runnable: true + 500: + $ref: "#/components/responses/500" + put: - tags: - - alert - operationId: update_alert_rule_by_name + tags: [Stored Procedure] + description: Update a stored procedure by ID + operationId: updateStoredProcedureById parameters: - - name: rule_name + - name: graph_id in: path required: true schema: type: string + - name: stored_procedure_id + in : path + required: true + schema: + type: string requestBody: content: application/json: schema: - $ref: '#/components/schemas/AlertRule' + $ref: '#/components/schemas/UpdateStoredProcRequest' responses: - '200': - description: Successful operation + 200: + description: Successfully updated the stored procedure content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + delete: - tags: - - alert - operationId: delete_alert_rule_by_name + tags: [Stored Procedure] + description: Delete a stored procedure by ID + operationId: deleteStoredProcedureById parameters: - - name: rule_name + - name: graph_id in: path required: true schema: type: string + - name: stored_procedure_id + in : path + required: true + schema: + type: string responses: - '200': - description: Successful operation + 200: + description: Successfully deleted the stored procedure content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - /api/v1/alert/receiver: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/service/start: post: - tags: - - alert - operationId: register_receiver + tags: [Service] + description: Start service + operationId: startService requestBody: content: application/json: schema: - $ref: '#/components/schemas/AlertReceiver' - required: true + $ref: '#/components/schemas/StartServiceRequest' responses: - '200': - description: successful operation + 200: + description: Successfully started the service content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - get: - tags: - - alert - operationId: list_receivers + $ref: '#/components/schemas/APIResponse' + 400: + $ref: "#/components/responses/400" + 500: + $ref: "#/components/responses/500" + + /api/v1/service/stop: + post: + tags: [Service] + description: Stop current service + operationId: stopService responses: - '200': - description: Successful operation + 200: + description: Successfully stopped the service content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/AlertReceiver' - example: - - type: webhook - receiver_id: RECEIVER-QWERTYUIOP-1 - webhook_url: http://webhook.com - is_at_all: false - at_user_ids: - - 111111 - - 222222 - enable: false - - type: webhook - receiver_id: RECEIVER-QWERTYUIOP-2 - webhook_url: http://webhook.com - is_at_all: false - at_user_ids: - - 111111 - - 222222 - enable: true - message: error message - /api/v1/alert/receiver/{receiver_id}: - put: - tags: - - alert - operationId: update_receiver_by_id - parameters: - - name: receiver_id - in: path - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AlertReceiver' + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/service/restart: + post: + tags: [Service] + description: Restart current service + operationId: restartService responses: - '200': - description: Successful operation + 200: + description: Successfully restarted the service content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - '404': - description: Receiver not found - delete: - tags: - - alert - operationId: delete_receiver_by_id + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/service: + get: + tags: [Service] + description: List all service status + operationId: listServiceStatus + responses: + 200: + description: Successfully returned all service status + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ServiceStatus' + example: + - graph_id: GRAPHID + status: Running + sdk_endpoints: + cypher: neo4j://mock.api.cypher:7676 + gremin: ws://mock.api.gremlin/gremlin + hqps: http://mock.api.hqps:10000 + start_time: "2024-01-01 00:00:00" + 500: + $ref: "#/components/responses/500" + + /api/v1/graph/{graph_id}/service: + get: + tags: [Service] + description: Get service status by graph ID + operationId: getServiceStatusById parameters: - - name: receiver_id + - name: graph_id in: path required: true schema: type: string responses: - '200': - description: Successful operation + 200: + description: Successfully returned the service status content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' - '404': - description: Receiver not found - /api/v1/file/uploading: - post: - tags: - - utils - operationId: upload_file - requestBody: - required: true - content: - multipart/form-data: - schema: - type: object - properties: - filestorage: - type: string - format: binary + $ref: '#/components/schemas/ServiceStatus' + example: + graph_id: GRAPHID + status: Running + sdk_endpoints: + cypher: neo4j://mock.api.cypher:7676 + gremin: ws://mock.api.gremlin/gremlin + hqps: http://mock.api.hqps:10000 + start_time: "2024-01-01 00:00:00" + 500: + $ref: "#/components/responses/500" + + /api/v1/alert/rule: + get: + tags: [Alert] + description: List all alert rules + operationId: listAlertRules responses: - '200': - description: successful operation + 200: + description: Successfully returned the alert rules content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' -components: - schemas: - ApiResponse: - type: string - example: operation successful - Connection: - x-body-name: connection - type: object - properties: - coordinator_endpoint: - type: string - ConnectionStatus: - x-body-name: connection_status - type: object - properties: - status: - type: string - enum: - - CONNECTED - solution: - type: string - enum: - - INTERACTIVE - - GRAPHSCOPE_INSIGHT - Graph: - x-body-name: graph - type: object - properties: - name: - type: string - store_type: - type: string - enum: - - mutable_csr - stored_procedures: - type: object - properties: - directory: - type: string - enum: - - plugins - schema: - $ref: '#/components/schemas/Schema' - Schema: - x-body-name: schema - type: object - properties: - vertex_types: - type: array - items: - $ref: '#/components/schemas/VertexType' - edge_types: - type: array - items: - $ref: '#/components/schemas/EdgeType' - VertexType: - x-body-name: vertex_type - type: object - properties: - type_id: - type: integer - format: int32 - type_name: - type: string - properties: - type: array - items: - $ref: '#/components/schemas/Property' - primary_keys: - type: array - items: - type: string - EdgeType: - x-body-name: edge_type - type: object - properties: - type_id: - type: integer - format: int32 - type_name: - type: string - vertex_type_pair_relations: - type: array - items: - type: object - properties: - source_vertex: - type: string - destination_vertex: - type: string - relation: - type: string - enum: - - MANY_TO_MANY - - ONE_TO_MANY - - MANY_TO_ONE - - ONE_TO_ONE - x_csr_params: - type: object - description: Used for storage optimization - properties: - edge_storage_strategy: - type: string - enum: - - ONLY_IN - - ONLY_OUT - - BOTH_OUT_IN - properties: - type: array - items: - $ref: '#/components/schemas/Property' - Property: - x-body-name: property - type: object - properties: - property_id: - type: integer - format: int32 - property_name: - type: string - property_type: - type: object - properties: - primitive_type: - type: string - enum: - - DT_DOUBLE - - DT_STRING - - DT_SIGNED_INT32 - - DT_SIGNED_INT64 - - DT_DATE32 - Procedure: - x-body-name: procedure - type: object - properties: - name: - type: string - bound_graph: - type: string - description: - type: string - type: - type: string - enum: - - cpp - - cypher - query: - type: string - enable: - type: boolean - runnable: - type: boolean - params: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - returns: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - DeploymentInfo: - x-body-name: deployment_info - type: object - properties: - name: - type: string - cluster_type: - type: string - enum: - - HOSTS - - KUBERNETES - version: - type: string - solution: - type: string - enum: - - INTERACTIVE - - GRAPHSCOPE_INSIGHT - creation_time: - type: string - graphs_info: - type: object - additionalProperties: - type: object - properties: - name: - type: string - creation_time: - type: string - update_time: - type: string - last_dataloading_time: - type: string - DeploymentStatus: - x-body-name: deployment_status - type: object - description: K8s only - properties: - name: - type: string - container: - type: array - items: + type: array + items: + $ref: '#/components/schemas/GetAlertRuleResponse' + example: + - id: ALERTRULE-1 + name: HighDiskUtilization + severity: warning + metric_type: node + conditions_description: disk usage >= 85 + enable: true + - id: ALERTRULE-2 + name: GremlinServiceAvailable + severity: emergency + metric_type: node + conditions_description: g.V().limit(1) failed + enable: false + 500: + $ref: "#/components/responses/500" + + /api/v1/alert/rule/{rule_id}: + put: + tags: [Alert] + operationId: Update alert rule by ID + parameters: + - name: rule_id + in: path + required: true + schema: type: string - image: - type: array - items: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAlertRuleRequest' + responses: + 200: + description: Successfully updated the alert rule + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + delete: + tags: [Alert] + operationId: Delete alert rule by ID + parameters: + - name: rule_id + in: path + required: true + schema: type: string - labels: - type: array - items: + responses: + 200: + description: Successfully deleted the alert rule + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/alert/message: + get: + tags: [Alert] + description: List all alert messages + operationId: listAlertMessages + parameters: + - name: alert_type + in: query + required: false + schema: type: string - node: - type: string - status: - type: string - restart_count: - type: integer - format: int32 - cpu_value: - type: integer - format: int32 - description: cpu value in millicore - memory_value: - type: integer - format: int32 - description: memory value in megabytes - timestamp: - type: string - creation_time: - type: string - NodeStatus: - x-body-name: node_status - type: object - properties: - node: - type: string - cpu_usage: - type: number - format: double - memory_usage: - type: number - format: double - disk_usage: - type: number - format: double - ServiceStatus: - x-body-name: service_status - type: object - properties: - status: - type: string - graph_name: - description: which graph is serving now - type: string - sdk_endpoints: - type: object - properties: - cypher: - type: string - gremlin: - type: string - hqps: - type: string - grpc: - type: string - AlertRule: - type: object - x-body-name: alert_rule - properties: - name: - type: string - severity: - type: string - enum: - - warning - - emergency - metric_type: - type: string - enum: - - node - - service - conditions_description: - type: string - frequency: - type: integer - description: (mins) - enable: - type: boolean - AlertMessage: - type: object - x-body-name: alert_message - properties: - message_id: - type: string - description: Generated in server side - alert_name: - type: string - severity: - type: string - enum: - - warning - - emergency - metric_type: - type: string - enum: - - node - - service - target: - type: array - items: + - name: status + in: query + required: false + schema: type: string - trigger_time: - type: string - status: - type: string - enum: - - unsolved - - solved - - dealing - message: - type: string - AlertReceiver: - type: object - x-body-name: alert_receiver - properties: - type: - type: string - enum: - - webhook - receiver_id: - type: string - description: Generated in server side - webhook_url: - type: string - at_user_ids: - type: array - items: + enum: + - solved + - unsolved + - dealing + - name: severity + in: query + required: false + schema: + type: string + enum: + - warning + - emergency + - name: start_time + in: query + required: false + description: format with "2023-02-21-11-56-30" + schema: + type: string + - name: end_time + in: query + required: false + description: format with "2023-02-21-11-56-30" + schema: + type: string + - name: limit + in: query + required: false + schema: + type: integer + format: int32 + responses: + 200: + description: Successfully returned the alert messages + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/GetAlertMessageResponse' + example: + - id: ALERT-MESSAGE-QWERTYUIOP-1 + alert_name: HighDiskUtilization + severity: warning + metric_type: node + target: + - hostname-1 + trigger_time: 2023-02-21 11:56:30 + status: unsolved + message: Disk usage node1 85.12%, exceeds threshold + - id: ALERT-MESSAGE-QWERTYUIOP-2 + alert_name: HighDiskUtilization + severity: emergency + metric_type: node + target: + - hostname-1 + trigger_time: 2023-02-21 11:56:30 + status: solved + message: Disk usage node1 85.12%, exceeds threshold + - id: ALERT-MESSAGE-QWERTYUIOP-3 + alert_name: HighDiskUtilization + severity: warning + metric_type: node + target: + - hostname-1 + trigger_time: 2023-02-21 11:56:30 + status: dealing + message: Disk usage node1 85.12%, exceeds threshold + 500: + $ref: "#/components/responses/500" + + /api/v1/alert/message-collection: + delete: + tags: [Alert] + description: Delete alert message in batch + operationId: deleteAlertMessageInBatch + parameters: + - name: message_ids + in: query + required: true + schema: + type: string + description: A list of message id separated by comma, e.g. id1,id2,id3 + responses: + 200: + description: Successfully deleted the alert message + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/alert/message-collection/status: + put: + tags: [Alert] + description: Update the message status in batch + operationId: updateAlertMessageInBatch + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAlertMessageStatusRequest' + responses: + 200: + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/alert/receiver: + post: + tags: [Alert] + description: Create a new alert receiver + operationId: createAlertReceiver + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAlertReceiverRequest' + required: true + responses: + 200: + description: Successfully created the alert receiver + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + get: + tags: [Alert] + description: List all alert receivers + operationId: listAlertReceivers + responses: + 200: + description: Successfully returned the alert receivers + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/GetAlertReceiverResponse" + example: + - id: RECEIVER-QWERTYUIOP-1 + type: webhook + webhook_url: http://webhook.com + is_at_all: false + at_user_ids: + - 111111 + - 222222 + enable: false + - id: RECEIVER-QWERTYUIOP-2 + type: webhook + webhook_url: http://webhook.com + is_at_all: false + at_user_ids: + - 111111 + - 222222 + enable: true + message: error message + 500: + $ref: "#/components/responses/500" + + /api/v1/alert/receiver/{receiver_id}: + put: + tags: [Alert] + description: Update alert receiver by ID + operationId: updateAlertReceiverById + parameters: + - name: receiver_id + in: path + required: true + schema: type: string - is_at_all: - type: boolean - enable: - type: boolean - message: - type: string - description: error message generated in server side - SchemaMapping: - x-body-name: schema_mapping - type: object - properties: - graph: - type: string - loading_config: - type: object - properties: - data_source: - type: object - properties: - scheme: - type: string - enum: - - file - import_option: - type: string - enum: - - init - - overwrite - format: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAlertReceiverRequest' + responses: + 200: + description: Successfully updated the alert receiver + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + delete: + tags: [Alert] + description: Delete the alert receiver by ID + operationId: deleteAlertReceiverById + parameters: + - name: receiver_id + in: path + required: true + schema: + type: string + responses: + 200: + description: Successfully deleted the alert receiver + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + 500: + $ref: "#/components/responses/500" + + /api/v1/file/uploading: + post: + tags: [Utils] + operationId: uploadFile + requestBody: + required: true + content: + multipart/form-data: + schema: type: object properties: - type: + filestorage: type: string - metadata: - type: object - additionalProperties: true - vertex_mappings: - type: array - items: - $ref: '#/components/schemas/VertexMapping' - edge_mappings: - type: array - items: - $ref: '#/components/schemas/EdgeMapping' - VertexMapping: - x-body-name: vertex_mapping - type: object - properties: - type_name: - type: string - inputs: - type: array - items: - type: string - column_mappings: - type: array - items: - $ref: '#/components/schemas/ColumnMapping' - EdgeMapping: - x-body-name: edge_mapping - type: object - properties: - type_triplet: - type: object - description: source label -> [edge label] -> destination label - properties: - edge: - type: string - source_vertex: - type: string - destination_vertex: - type: string - inputs: - type: array - items: - type: string - source_vertex_mappings: - type: array - items: - type: object - description: Mapping column index to the primary key of source vertex - properties: - column: - type: object - properties: - index: - type: integer - format: int32 - name: - type: string - destination_vertex_mappings: - type: array - items: - type: object - description: Mapping column index to the primary key of destination vertex - properties: - column: - type: object - properties: - index: - type: integer - format: int32 - name: - type: string - column_mappings: - type: array - items: - $ref: '#/components/schemas/ColumnMapping' - ColumnMapping: - x-body-name: column_mapping - type: object - properties: - column: - type: object - properties: - index: - type: integer - format: int32 - name: - type: string - property: - type: string - description: must align with the schema - JobStatus: - type: object - x-body-name: job_status - properties: - job_id: - type: string - type: - type: string - status: - type: string - enum: - - RUNNING - - SUCCESS - - FAILED - - CANCELLED - - WAITING - start_time: - type: string - end_time: - type: string - log: - type: string - description: URL or log string - detail: - type: object - additionalProperties: true - VertexDataSource: - x-body-name: vertex_data_source - type: object - properties: - data_source: - type: string - enum: - - ODPS - - FILE - type_name: - type: string - location: - type: string - property_mapping: - type: object - additionalProperties: true - EdgeDataSource: - x-body-name: edge_data_source - type: object - properties: - data_source: - type: string - enum: - - ODPS - - FILE - type_name: - type: string - source_vertex: - type: string - destination_vertex: - type: string - location: - type: string - source_pk_column_map: - type: object - additionalProperties: true - destination_pk_column_map: - type: object - additionalProperties: true - property_mapping: - type: object - additionalProperties: true - DataSource: - x-body-name: data_source - type: object - properties: - vertices_datasource: - type: array - items: - $ref: '#/components/schemas/VertexDataSource' - edges_datasource: - type: array - items: - $ref: '#/components/schemas/EdgeDataSource' - GrootGraph: - x-body-name: groot_graph - type: object - properties: - name: - type: string - type: - type: string - enum: - - GrootGraph - directed: - type: boolean - creation_time: - type: string - schema: - $ref: '#/components/schemas/GrootSchema' - gremlin_interface: - type: object - properties: - gremlin_endpoint: - type: string - grpc_endpoint: - type: string - username: - type: string - password: - type: string - GrootSchema: - x-body-name: groot_schema - type: object - properties: - vertices: - type: array - items: - $ref: '#/components/schemas/GrootVertexType' - edges: - type: array - items: - $ref: '#/components/schemas/GrootEdgeType' - GrootVertexType: - x-body-name: groot_vertex_type - type: object - properties: - label: - type: string - properties: - type: array - items: - $ref: '#/components/schemas/GrootProperty' - GrootEdgeType: - x-body-name: groot_edge_type - type: object - properties: - label: - type: string - relations: - type: array - items: - type: object - properties: - src_label: - type: string - dst_label: - type: string - properties: - type: array - items: - $ref: '#/components/schemas/GrootProperty' - GrootProperty: - x-body-name: groot_property - type: object - properties: - id: - type: integer - format: int32 - name: - type: string - type: - type: string - enum: - - DT_STRING - - DT_SIGNED_INT64 - - DT_DOUBLE - is_primary_key: - type: boolean - GrootDataloadingJobConfig: - x-body-name: groot_dataloading_job_config - type: object - properties: - vertices: - type: array - items: - type: string - edges: - type: array - items: - type: object - properties: - type_name: - type: string - source_vertex: - type: string - destination_vertex: - type: string - schedule: - type: string - description: "format with '2023-02-21 11:56:30'" - repeat: - type: string - enum: - - once - - day - - week \ No newline at end of file + format: binary + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/UploadFileResponse' + 500: + $ref: "#/components/responses/500" diff --git a/flex/openapi/openapi_interactive.yaml b/flex/openapi/openapi_interactive.yaml index c21fe72aca9c..eaba91d584e2 100644 --- a/flex/openapi/openapi_interactive.yaml +++ b/flex/openapi/openapi_interactive.yaml @@ -170,6 +170,47 @@ paths: application/json: schema: $ref: '#/components/schemas/GetGraphSchemaResponse' + /v1/graph/{graph_id}/statistics: + get: + tags: + - AdminService/GraphManagement + description: Get the statics info of a graph, including number of vertices for each label, number of edges for each label. + operationId: get_graph_statistic + parameters: + - name: graph_id + in : path + required: true + schema: + type: string + description: The id of graph to get statistics + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/GetGraphStatisticsResponse' + '500': + description: Server Internal Error + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + example: "Internal error" + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + example: "Graph not running or graph not exists" + '503': + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + example: "Service unavailable, try again later" /v1/graph/{graph_id}/dataloading: post: @@ -904,18 +945,57 @@ paths: required: true schema: type: string + - name: X-Interactive-Request-Format + in: header + required: true + schema: + type: string + enum: [proto, encoder, json] requestBody: content: text/plain: schema: type: string + format: byte responses: '200': description: Successfully runned. Empty if failed? content: - application/json: + text/plain: + schema: + type: string + format: byte + '500': + description: Server internal error + /v1/graph/current/query: + post: + tags: + - QueryService + summary: run queries on the running graph + operationId: proc_call_current + description: | + Submit a query to the running graph. + parameters: + - name: X-Interactive-Request-Format + in: header + required: true + schema: + type: string + enum: [proto, encoder, json] + requestBody: + content: + text/plain: + schema: + type: string + format: byte + responses: + '200': + description: Successfully runned. Empty if failed? + content: + text/plain: schema: type: string + format: byte '500': description: Server internal error components: @@ -998,11 +1078,24 @@ components: properties: timestamp: type: string + DateType: + x-body-name: date_type + type: object + required: + - date32 + properties: + date32: + type: string TemporalType: x-body-name: temporal_type type: object - oneOf: - - $ref: '#/components/schemas/TimeStampType' + required: + - temporal + properties: + temporal: + oneOf: + - $ref: '#/components/schemas/TimeStampType' + - $ref: '#/components/schemas/DateType' GSDataType: x-body-name: gs_data_type oneOf: @@ -1239,6 +1332,61 @@ components: x-body-name: api_response type: string example: "Response string" + VertexStatistics: + x-body-name: vertex_statistics + type: object + properties: + type_id: + type: integer + type_name: + type: string + count: + type: integer + VertexTypePairStatistics: + type: object + x-body-name: vertex_type_pair_statistics + required: + - source_vertex + - destination_vertex + - count + properties: + source_vertex: + type: string + destination_vertex: + type: string + count: + type: integer + EdgeStatistics: + x-body-name: edge_statistics + type: object + properties: + type_id: + type: integer + type_name: + type: string + vertex_type_pair_statistics: + type: array + items: + $ref: '#/components/schemas/VertexTypePairStatistics' + GetGraphStatisticsResponse: + x-body-name: graph_statistics_response + type: object + required: + - total_vertex_count + - total_edge_count + properties: + total_vertex_count: + type: integer + total_edge_count: + type: integer + vertex_type_statistics: + type: array + items: + $ref: '#/components/schemas/VertexStatistics' + edge_type_statistics: + type: array + items: + $ref: '#/components/schemas/EdgeStatistics' GetGraphResponse: x-body-name: get_graph_response type: object @@ -1364,6 +1512,10 @@ components: - BOTH_OUT_IN sort_on_compaction: type: boolean + oe_mutability: + type: string + ie_mutability: + type: string CreateEdgeType: x-body-name: create_edge_type allOf: diff --git a/flex/scripts/install_dependencies.sh b/flex/scripts/install_dependencies.sh index 869e7f39b50f..8cb00881744d 100755 --- a/flex/scripts/install_dependencies.sh +++ b/flex/scripts/install_dependencies.sh @@ -42,7 +42,7 @@ popd && rm -rf /tmp/apache-arrow-apt-source-latest.deb # install opentelemetry cd /tmp -git clone https://github.com/open-telemetry/opentelemetry-cpp +git clone https://github.com/open-telemetry/opentelemetry-cpp -b v1.15.0 cd opentelemetry-cpp cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON \ @@ -62,4 +62,4 @@ make -j ${parallelism} && sudo make install popd && rm -rf /tmp/hiactor sudo sh -c 'echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf' -sudo sysctl -p /etc/sysctl.conf \ No newline at end of file +sudo sysctl -p /etc/sysctl.conf diff --git a/flex/storages/metadata/default_graph_meta_store.cc b/flex/storages/metadata/default_graph_meta_store.cc index 8cde497f27be..59f8b9fee3f8 100644 --- a/flex/storages/metadata/default_graph_meta_store.cc +++ b/flex/storages/metadata/default_graph_meta_store.cc @@ -129,7 +129,11 @@ Result DefaultGraphMetaStore::GetPluginMeta( return Result( Status(StatusCode::InValidArgument, "Plugin not belongs to the graph")); } - meta.id = plugin_id; + if (meta.id != plugin_id) { + return Result( + Status(StatusCode::InValidArgument, + "Plugin id not match: " + plugin_id + " vs " + meta.id)); + } return Result(meta); } @@ -143,8 +147,6 @@ Result> DefaultGraphMetaStore::GetAllPluginMeta( VLOG(10) << "Found plugin metas: " << res.move_value().size(); for (auto& pair : res.move_value()) { auto plugin_meta = PluginMeta::FromJson(pair.second); - // the key is id. - plugin_meta.id = pair.first; if (plugin_meta.bound_graph == graph_id) { metas.push_back(plugin_meta); } @@ -176,7 +178,7 @@ Result DefaultGraphMetaStore::DeletePluginMetaByGraphId( } VLOG(10) << "Found plugin_ids: " << plugin_ids.size(); for (auto& plugin_id : plugin_ids) { - RETURN_IF_NOT_OK(base_store_->DeleteMeta(PLUGIN_META, plugin_id)); + RETURN_IF_NOT_OK(DeletePluginMeta(graph_id, plugin_id)); } return Result(true); } diff --git a/flex/storages/metadata/graph_meta_store.cc b/flex/storages/metadata/graph_meta_store.cc index ce575db6c1f2..d99d17a9817f 100644 --- a/flex/storages/metadata/graph_meta_store.cc +++ b/flex/storages/metadata/graph_meta_store.cc @@ -99,6 +99,8 @@ GraphMeta GraphMeta::FromJson(const nlohmann::json& json) { if (json.contains("data_update_time")) { meta.data_update_time = json["data_update_time"].get(); + } else { + meta.data_update_time = 0; } if (json.contains("data_import_config")) { meta.data_import_config = json["data_import_config"].dump(); @@ -306,6 +308,7 @@ JobMeta JobMeta::FromJson(const nlohmann::json& json) { CreateGraphMetaRequest CreateGraphMetaRequest::FromJson( const std::string& json_str) { + LOG(INFO) << "CreateGraphMetaRequest::FromJson: " << json_str; CreateGraphMetaRequest request; nlohmann::json json; try { @@ -326,9 +329,13 @@ CreateGraphMetaRequest CreateGraphMetaRequest::FromJson( } if (json.contains("data_update_time")) { request.data_update_time = json["data_update_time"].get(); + } else { + request.data_update_time = 0; } if (json.contains("creation_time")) { request.creation_time = json["creation_time"].get(); + } else { + request.creation_time = GetCurrentTimeStamp(); } return request; } @@ -340,6 +347,8 @@ std::string CreateGraphMetaRequest::ToString() const { json["schema"] = nlohmann::json::parse(schema); if (data_update_time.has_value()) { json["data_update_time"] = data_update_time.value(); + } else { + json["data_update_time"] = 0; } json["creation_time"] = creation_time; return json.dump(); @@ -441,6 +450,8 @@ CreatePluginMetaRequest CreatePluginMetaRequest::FromJson( } if (j.contains("creation_time")) { request.creation_time = j["creation_time"].get(); + } else { + request.creation_time = GetCurrentTimeStamp(); } if (j.contains("description")) { request.description = j["description"].get(); @@ -684,6 +695,68 @@ JobStatus parseFromString(const std::string& status_string) { } } +std::string GraphStatistics::ToJson() const { + nlohmann::json json; + json["total_vertex_count"] = total_vertex_count; + json["total_edge_count"] = total_edge_count; + json["vertex_type_statistics"] = nlohmann::json::array(); + for (auto& type_stat : vertex_type_statistics) { + nlohmann::json type_stat_json; + type_stat_json["type_id"] = std::get<0>(type_stat); + type_stat_json["type_name"] = std::get<1>(type_stat); + type_stat_json["count"] = std::get<2>(type_stat); + json["vertex_type_statistics"].push_back(type_stat_json); + } + json["edge_type_statistics"] = nlohmann::json::array(); + for (auto& type_stat : edge_type_statistics) { + nlohmann::json type_stat_json; + type_stat_json["type_id"] = std::get<0>(type_stat); + type_stat_json["type_name"] = std::get<1>(type_stat); + type_stat_json["vertex_type_pair_statistics"] = nlohmann::json::array(); + for (auto& pair_stat : std::get<2>(type_stat)) { + nlohmann::json pair_stat_json; + pair_stat_json["source_vertex"] = std::get<0>(pair_stat); + pair_stat_json["destination_vertex"] = std::get<1>(pair_stat); + pair_stat_json["count"] = std::get<2>(pair_stat); + type_stat_json["vertex_type_pair_statistics"].push_back(pair_stat_json); + } + json["edge_type_statistics"].push_back(type_stat_json); + } + return json.dump(); +} + +Result GraphStatistics::FromJson(const std::string& json_str) { + auto j = nlohmann::json::parse(json_str); + return GraphStatistics::FromJson(j); +} + +Result GraphStatistics::FromJson(const nlohmann::json& json) { + GraphStatistics stat; + stat.total_vertex_count = json["total_vertex_count"].get(); + stat.total_edge_count = json["total_edge_count"].get(); + for (auto& type_stat : json["vertex_type_statistics"]) { + stat.vertex_type_statistics.push_back( + {type_stat["type_id"].get(), + type_stat["type_name"].get(), + type_stat["count"].get()}); + } + for (auto& type_stat : json["edge_type_statistics"]) { + std::vector + vertex_type_pair_statistics; + for (auto& pair : type_stat["vertex_type_pair_statistics"]) { + vertex_type_pair_statistics.push_back( + {pair["source_vertex"].get(), + pair["destination_vertex"].get(), + pair["count"].get()}); + } + stat.edge_type_statistics.push_back( + {type_stat["type_id"].get(), + type_stat["type_name"].get(), + vertex_type_pair_statistics}); + } + return stat; +} + } // namespace gs namespace std { diff --git a/flex/storages/metadata/graph_meta_store.h b/flex/storages/metadata/graph_meta_store.h index 6ab649e6a5d4..d42337f13895 100644 --- a/flex/storages/metadata/graph_meta_store.h +++ b/flex/storages/metadata/graph_meta_store.h @@ -223,6 +223,28 @@ struct UpdateJobMetaRequest { static UpdateJobMetaRequest NewFinished(int rc); }; +struct GraphStatistics { + // type_id, type_name, count + using vertex_type_statistic = std::tuple; + // src_vertex_type_name, dst_vertex_type_name, count + using vertex_type_pair_statistic = + std::tuple; + // edge_type_id, edge_type_name, Vec + using edge_type_statistic = + std::tuple>; + + GraphStatistics() : total_vertex_count(0), total_edge_count(0) {} + + uint64_t total_vertex_count; + uint64_t total_edge_count; + std::vector vertex_type_statistics; + std::vector edge_type_statistics; + + std::string ToJson() const; + static Result FromJson(const std::string& json_str); + static Result FromJson(const nlohmann::json& json); +}; + /* * The metadata store is responsible for storing metadata of the graph, plugins * and other information. diff --git a/flex/storages/rt_mutable_graph/schema.cc b/flex/storages/rt_mutable_graph/schema.cc index 301e37ad31ab..4d3ab9a82a4d 100644 --- a/flex/storages/rt_mutable_graph/schema.cc +++ b/flex/storages/rt_mutable_graph/schema.cc @@ -701,12 +701,14 @@ static Status parse_vertex_schema(YAML::Node node, Schema& schema) { property_types[primary_key_inds[i]] != PropertyType::kString && property_types[primary_key_inds[i]] != PropertyType::kUInt64 && property_types[primary_key_inds[i]] != PropertyType::kInt32 && - property_types[primary_key_inds[i]] != PropertyType::kUInt32) { + property_types[primary_key_inds[i]] != PropertyType::kUInt32 && + !property_types[primary_key_inds[i]].IsVarchar()) { LOG(ERROR) << "Primary key " << primary_key_name - << " should be int64 or string"; - return Status( - StatusCode::InvalidSchema, - "Primary key " + primary_key_name + " should be int64 or string"); + << " should be int64/int32/uint64/uint32 or string/varchar"; + return Status(StatusCode::InvalidSchema, + "Primary key " + primary_key_name + + " should be int64/int32/uint64/" + "uint32 or string/varchar"); } primary_keys.emplace_back(property_types[primary_key_inds[i]], property_names[primary_key_inds[i]], diff --git a/flex/tests/hqps/CMakeLists.txt b/flex/tests/hqps/CMakeLists.txt index 57976bfbe043..5fec7d0acda2 100644 --- a/flex/tests/hqps/CMakeLists.txt +++ b/flex/tests/hqps/CMakeLists.txt @@ -10,4 +10,4 @@ if (BUILD_HQPS) add_executable(${T_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/${T_NAME}.cc) target_link_libraries(${T_NAME} hqps_plan_proto flex_rt_mutable_graph flex_graph_db flex_utils ${GLOG_LIBRARIES} ${LIBGRAPELITE_LIBRARIES}) endforeach() -endif() \ No newline at end of file +endif() diff --git a/flex/tests/hqps/admin_http_test.cc b/flex/tests/hqps/admin_http_test.cc index d15792dba540..8ea2e4a3895a 100644 --- a/flex/tests/hqps/admin_http_test.cc +++ b/flex/tests/hqps/admin_http_test.cc @@ -132,8 +132,8 @@ void run_builtin_graph_test( for (auto& proc_id : plugin_ids) { procedure::Query query; query.mutable_query_name()->set_name(proc_id); - auto res = query_client.Post("/v1/query", query.SerializeAsString(), - "text/plain"); + auto res = query_client.Post("/v1/graph/current/query", + query.SerializeAsString(), "text/plain"); CHECK(res->status != 200); LOG(INFO) << "call procedure response: " << res->body; // find failed in res->body @@ -160,8 +160,8 @@ void run_builtin_graph_test( for (auto& plugin_id : plugin_ids) { procedure::Query query; query.mutable_query_name()->set_name(plugin_id); - auto res = query_client.Post("/v1/query", query.SerializeAsString(), - "text/plain"); + auto res = query_client.Post("/v1/graph/current/query", + query.SerializeAsString(), "text/plain"); CHECK(res->status == 200) << "call procedure should success: " << res->body << ", for query: " << query.DebugString(); @@ -298,8 +298,8 @@ void run_procedure_test(httplib::Client& client, httplib::Client& query_client, auto query_str = pair.second; procedure::Query query; query.mutable_query_name()->set_name(query_name); - auto res = query_client.Post("/v1/query", query.SerializeAsString(), - "text/plain"); + auto res = query_client.Post("/v1/graph/current/query", + query.SerializeAsString(), "text/plain"); CHECK(res->status != 200) << "call previous procedure on current graph should fail: " << res->body; @@ -309,7 +309,8 @@ void run_procedure_test(httplib::Client& client, httplib::Client& query_client, //----4. call procedures----------------------------------------------- for (auto& proc_id : plugin_ids) { auto call_proc_payload = generate_call_procedure_payload(graph_id, proc_id); - res = query_client.Post("/v1/query", call_proc_payload, "text/plain"); + res = query_client.Post("/v1/graph/current/query", call_proc_payload, + "text/plain"); CHECK(res->status == 200) << "call procedure failed: " << res->body << ", for query: " << call_proc_payload; } @@ -325,7 +326,8 @@ void run_procedure_test(httplib::Client& client, httplib::Client& query_client, if (procedures.size() > 0) { auto call_proc_payload = generate_call_procedure_payload(graph_id, plugin_ids[0]); - res = query_client.Post("/v1/query", call_proc_payload, "text/plain"); + res = query_client.Post("/v1/graph/current/query", call_proc_payload, + "text/plain"); CHECK(res->status == 200) << "call procedure failed: " << res->body << ", for query: " << call_proc_payload; } @@ -337,7 +339,7 @@ void run_procedure_test(httplib::Client& client, httplib::Client& query_client, } } -void run_get_node_status(httplib::Client& cli) { +void run_get_node_status(httplib::Client& cli, const std::string& graph_id) { auto res = cli.Get("/v1/node/status"); if (res->status != 200) { LOG(FATAL) << "get node status failed: " << res->body; @@ -357,6 +359,31 @@ void run_get_node_status(httplib::Client& cli) { LOG(FATAL) << "Empty response: "; } LOG(INFO) << "get service status response: " << body; + // Get current running graph's status + { + auto res = cli.Get("/v1/graph/" + graph_id + "/statistics"); + if (res->status != 200) { + LOG(FATAL) << "get current graph status failed: " << res->body; + } + auto body = res->body; + if (body.empty()) { + LOG(FATAL) << "Empty response: "; + } + // check whether has total_edge_count, total_vertex_count, and the value + // should be greater than 0 + nlohmann::json j = nlohmann::json::parse(body); + if (!j.contains("total_edge_count") || !j.contains("total_vertex_count")) { + LOG(FATAL) << "get current graph status response does not contain " + "total_edge_count or total_vertex_count: " + << body; + } + if (j["total_edge_count"].get() <= 0 || + j["total_vertex_count"].get() <= 0) { + LOG(FATAL) << "get current graph status response total_edge_count or " + "total_vertex_count should be greater than 0: " + << body; + } + } } void test_delete_graph(httplib::Client& cli, const std::string& graph_id) { @@ -426,7 +453,7 @@ int main(int argc, char** argv) { run_procedure_test(cli, cli_query, graph_id, builtin_graph_queries, procedure_paths); LOG(INFO) << "run procedure tests done"; - run_get_node_status(cli); + run_get_node_status(cli, graph_id); LOG(INFO) << "test delete graph done"; return 0; } \ No newline at end of file diff --git a/flex/tests/interactive/test_call_proc.py b/flex/tests/interactive/test_call_proc.py index 96abe353c2c1..f4c1b81c97bc 100644 --- a/flex/tests/interactive/test_call_proc.py +++ b/flex/tests/interactive/test_call_proc.py @@ -91,6 +91,8 @@ def callProcedureWithJsonFormat(self, graph_id : str): if not resp.is_ok(): print("call sample_app failed: ", resp.get_status_message()) exit(1) + res = resp.get_value() + print("call sample_app result: ", res) self.call_cypher_queries() def callProcedureWithEncoder(self, graph_id : str): diff --git a/flex/utils/id_indexer.h b/flex/utils/id_indexer.h index 6313b3228726..a1c4791c70cd 100644 --- a/flex/utils/id_indexer.h +++ b/flex/utils/id_indexer.h @@ -239,6 +239,13 @@ class LFIndexer { } else if (type.type_enum == impl::PropertyTypeImpl::kVarChar) { keys_ = new StringColumn(StorageStrategy::kMem, type.additional_type_info.max_length); + } else if (type.type_enum == impl::PropertyTypeImpl::kString) { + LOG(WARNING) << "String type is a deprecated type, use varchar instead."; + LOG(WARNING) << "Use default max length" + << PropertyType::STRING_DEFAULT_MAX_LENGTH + << " for varchar type."; + keys_ = new StringColumn(StorageStrategy::kMem, + PropertyType::STRING_DEFAULT_MAX_LENGTH); } else { LOG(FATAL) << "Not support type [" << type << "] as pk type .."; } diff --git a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/mapper/EdgeTypeMapper.java b/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/mapper/EdgeTypeMapper.java index 1df42344114f..4e42b63006af 100644 --- a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/mapper/EdgeTypeMapper.java +++ b/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/mapper/EdgeTypeMapper.java @@ -34,10 +34,10 @@ public class EdgeTypeMapper extends SchemaElementMapper { public static SchemaElementMapper parseFromEdgeType(GraphEdge graphEdge) { EdgeTypeMapper edgeTypeMapper = new EdgeTypeMapper(); + edgeTypeMapper.setVersionId(graphEdge.getVersionId()); edgeTypeMapper.setId(graphEdge.getLabelId()); edgeTypeMapper.setLabel(graphEdge.getLabel()); edgeTypeMapper.setType(TypeEnum.EDGE.toString()); - ElementIndexMapper elementIndexMapper = new ElementIndexMapper(); elementIndexMapper.setName("primary_key"); elementIndexMapper.setIndexType("PRIMARY_KEY"); diff --git a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/wrapper/GraphDef.java b/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/wrapper/GraphDef.java index 490d0759322e..b304d180567b 100644 --- a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/wrapper/GraphDef.java +++ b/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/wrapper/GraphDef.java @@ -141,7 +141,19 @@ public static GraphDef parseProto(GraphDefPb proto) { } Map> idToKinds = new HashMap<>(); for (EdgeKindPb edgeKindPb : proto.getEdgeKindsList()) { - EdgeKind edgeKind = EdgeKind.parseProto(edgeKindPb); + LabelId edgeLabelId = LabelId.parseProto(edgeKindPb.getEdgeLabelId()); + LabelId srcLabelId = LabelId.parseProto(edgeKindPb.getSrcVertexLabelId()); + LabelId dstLabelId = LabelId.parseProto(edgeKindPb.getDstVertexLabelId()); + EdgeKind edgeKind = + EdgeKind.newBuilder() + .setEdgeLabelId(edgeLabelId) + .setSrcVertexLabelId(srcLabelId) + .setDstVertexLabelId(dstLabelId) + .setEdgeLabel(idToType.get(edgeLabelId).getLabel()) + .setSrcVertexLabel(idToType.get(srcLabelId).getLabel()) + .setDstVertexLabel(idToType.get(dstLabelId).getLabel()) + .build(); + Set edgeKindSet = idToKinds.computeIfAbsent(edgeKind.getEdgeLabelId(), k -> new HashSet<>()); edgeKindSet.add(edgeKind); diff --git a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/wrapper/TypeDef.java b/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/wrapper/TypeDef.java index 639d8935bc1c..81a046924888 100644 --- a/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/wrapper/TypeDef.java +++ b/interactive_engine/common/src/main/java/com/alibaba/graphscope/groot/common/schema/wrapper/TypeDef.java @@ -163,6 +163,7 @@ public TypeDefPb toProto() { public TypeDefPb toDdlProto() { TypeDefPb.Builder builder = TypeDefPb.newBuilder(); builder.setLabel(label); + builder.setVersionId(versionId); for (PropertyDef property : properties) { builder.addProps(property.toProto()); } @@ -259,6 +260,11 @@ public Builder setComment(String comment) { return this; } + public Builder setVersionId(int versionId) { + this.versionId = versionId; + return this; + } + public TypeDef build() { return new TypeDef(typeEnum, versionId, label, labelId, properties, comment); } diff --git a/interactive_engine/compiler/src/main/antlr4/GremlinGS.g4 b/interactive_engine/compiler/src/main/antlr4/GremlinGS.g4 index 9f9dbc10894c..3d400f0b84f1 100644 --- a/interactive_engine/compiler/src/main/antlr4/GremlinGS.g4 +++ b/interactive_engine/compiler/src/main/antlr4/GremlinGS.g4 @@ -189,6 +189,7 @@ traversalMethod_bothE traversalMethod_with : 'with' LPAREN StringLiteral COMMA oC_Literal RPAREN | 'with' LPAREN evaluationTimeoutKey COMMA evaluationTimeoutValue RPAREN + | 'with' LPAREN StringLiteral COMMA (ANON_TRAVERSAL_ROOT DOT)? traversalMethod_expr RPAREN // to support path until condition in gremlin-calcite, i.e. with('UNTIL', expr(_.age > 20)) ; evaluationTimeoutKey diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/GraphServer.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/GraphServer.java index f5ee93fd4a9c..d5787d2fae53 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/GraphServer.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/GraphServer.java @@ -23,11 +23,14 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.config.FrontendConfig; import com.alibaba.graphscope.common.config.GraphConfig; -import com.alibaba.graphscope.common.ir.meta.reader.LocalMetaDataReader; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.IrMetaTracker; +import com.alibaba.graphscope.common.ir.meta.fetcher.IrMetaFetcher; +import com.alibaba.graphscope.common.ir.meta.fetcher.StaticIrMetaFetcher; +import com.alibaba.graphscope.common.ir.meta.reader.LocalIrMetaReader; +import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.common.ir.tools.*; import com.alibaba.graphscope.common.manager.IrMetaQueryCallback; -import com.alibaba.graphscope.common.store.ExperimentalMetaFetcher; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.cypher.antlr4.parser.CypherAntlr4Parser; import com.alibaba.graphscope.cypher.antlr4.visitor.LogicalPlanVisitor; import com.alibaba.graphscope.cypher.service.CypherBootstrapper; @@ -57,6 +60,7 @@ public class GraphServer { private final ChannelFetcher channelFetcher; private final IrMetaQueryCallback metaQueryCallback; private final GraphProperties testGraph; + private final GraphRelOptimizer optimizer; private IrGremlinServer gremlinServer; private CypherBootstrapper cypherBootstrapper; @@ -65,11 +69,13 @@ public GraphServer( Configs configs, ChannelFetcher channelFetcher, IrMetaQueryCallback metaQueryCallback, - GraphProperties testGraph) { + GraphProperties testGraph, + GraphRelOptimizer optimizer) { this.configs = configs; this.channelFetcher = channelFetcher; this.metaQueryCallback = metaQueryCallback; this.testGraph = testGraph; + this.optimizer = optimizer; } public void start() throws Exception { @@ -83,7 +89,8 @@ public void start() throws Exception { new LogicalPlan( new GraphBuilderVisitor(builder) .visit(new GremlinAntlr4Parser().parse(query)) - .build())); + .build()), + optimizer); QueryCache queryCache = new QueryCache(configs, graphPlanner); this.gremlinServer = new IrGremlinServer( @@ -102,7 +109,8 @@ public void start() throws Exception { configs, (GraphBuilder builder, IrMeta irMeta, String query) -> new LogicalPlanVisitor(builder, irMeta) - .visit(new CypherAntlr4Parser().parse(query))); + .visit(new CypherAntlr4Parser().parse(query)), + optimizer); QueryCache queryCache = new QueryCache(configs, graphPlanner); this.cypherBootstrapper = new CypherBootstrapper( @@ -164,15 +172,24 @@ public static void main(String[] args) throws Exception { throw new IllegalArgumentException("usage: GraphServer ''"); } Configs configs = Configs.Factory.create(args[0]); + GraphRelOptimizer optimizer = new GraphRelOptimizer(configs); IrMetaQueryCallback queryCallback = - new IrMetaQueryCallback( - new ExperimentalMetaFetcher(new LocalMetaDataReader(configs))); + new IrMetaQueryCallback(createIrMetaFetcher(configs, optimizer.getGlogueHolder())); GraphServer server = new GraphServer( - configs, getChannelFetcher(configs), queryCallback, getTestGraph(configs)); + configs, + getChannelFetcher(configs), + queryCallback, + getTestGraph(configs), + optimizer); server.start(); } + private static IrMetaFetcher createIrMetaFetcher(Configs configs, IrMetaTracker tracker) + throws IOException { + return new StaticIrMetaFetcher(new LocalIrMetaReader(configs), tracker); + } + private static GraphProperties getTestGraph(Configs configs) { GraphProperties testGraph; switch (GraphConfig.GRAPH_STORE.get(configs)) { diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/IrPlan.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/IrPlan.java index 29e15ff49912..600cedab8f31 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/IrPlan.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/IrPlan.java @@ -27,9 +27,9 @@ import com.alibaba.graphscope.common.intermediate.process.SinkArg; import com.alibaba.graphscope.common.intermediate.process.SinkByColumns; import com.alibaba.graphscope.common.intermediate.process.SinkGraph; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.jna.IrCoreLibrary; import com.alibaba.graphscope.common.jna.type.*; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.common.utils.ClassUtils; import com.alibaba.graphscope.gaia.proto.Common; import com.alibaba.graphscope.gaia.proto.GraphAlgebra; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/client/HttpExecutionClient.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/client/HttpExecutionClient.java index 8fd8020e5ac8..2b10ebbc6506 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/client/HttpExecutionClient.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/client/HttpExecutionClient.java @@ -55,8 +55,10 @@ public class HttpExecutionClient extends ExecutionClient { private static final Logger logger = LoggerFactory.getLogger(HttpExecutionClient.class); private static final String CONTENT_TYPE = "Content-Type"; + private static final String INTERACTIVE_REQUEST_FORMAT = "X-Interactive-Request-Format"; private static final String TEXT_PLAIN = "text/plain;charset=UTF-8"; - private static final String INTERACTIVE_QUERY_PATH = "/v1/query"; + private static final String PROTOCOL_FORMAT = "proto"; + private static final String INTERACTIVE_QUERY_PATH = "/v1/graph/current/query"; private static final String INTERACTIVE_ADHOC_QUERY_PATH = "/interactive/adhoc_query"; private final HttpClient httpClient; @@ -96,6 +98,7 @@ public void submit( HttpRequest.newBuilder() .uri(uri) .headers(CONTENT_TYPE, TEXT_PLAIN) + .headers(INTERACTIVE_REQUEST_FORMAT, PROTOCOL_FORMAT) .POST( HttpRequest.BodyPublishers.ofByteArray( (byte[]) diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/config/GraphConfig.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/config/GraphConfig.java index 9499a0d7bded..7ec5e1c48769 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/config/GraphConfig.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/config/GraphConfig.java @@ -21,18 +21,4 @@ public class GraphConfig { public static final Config GRAPH_STATISTICS = Config.stringConfig("graph.statistics", ""); public static final Config GRAPH_STORE = Config.stringConfig("graph.store", "exp"); - - @Deprecated - public static final Config GRAPH_STORED_PROCEDURES = - Config.stringConfig("graph.stored.procedures", ""); - - @Deprecated - public static final Config GRAPH_STORED_PROCEDURES_ENABLE_LISTS = - Config.stringConfig("graph.stored.procedures.enable.lists", ""); - - // denote stored procedures in yaml format, refer to test resource file - // 'config/modern/graph.yaml' for more info about - // the format - public static final Config GRAPH_STORED_PROCEDURES_YAML = - Config.stringConfig("graph.stored.procedures.yaml", ""); } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/config/YamlConfigs.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/config/YamlConfigs.java index 3e9c79f07b4c..55f481acbf47 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/config/YamlConfigs.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/config/YamlConfigs.java @@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils; import org.yaml.snakeyaml.Yaml; -import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -75,26 +74,6 @@ public class YamlConfigs extends Configs { return "cpp-mcsr"; } }) - .put( - "graph.stored.procedures.yaml", - (Configs configs) -> { - File schemaFile = new File(GraphConfig.GRAPH_SCHEMA.get(configs)); - if (!schemaFile.exists() || !schemaFile.getName().endsWith(".yaml")) { - return null; - } - try { - Yaml yaml = new Yaml(); - Map yamlAsMap = - yaml.load(new FileInputStream(schemaFile)); - Object value; - if ((value = yamlAsMap.get("stored_procedures")) == null) { - return null; - } - return yaml.dump(value); - } catch (IOException e) { - throw new RuntimeException(e); - } - }) .put( "pegasus.worker.num", (Configs configs) -> { diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/GraphId.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/GraphId.java new file mode 100644 index 000000000000..bda93af32ab9 --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/GraphId.java @@ -0,0 +1,39 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.meta; + +import org.checkerframework.checker.nullness.qual.Nullable; + +/** + * This class is used to uniquely identify a graph instance in scenarios that support multiple graphs. + * @param + */ +public class GraphId { + public static final GraphId DEFAULT = new GraphId(null); + + private final @Nullable T id; + + public GraphId(T id) { + this.id = id; + } + + public @Nullable T getId() { + return id; + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMeta.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMeta.java new file mode 100644 index 000000000000..6035e96490cb --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMeta.java @@ -0,0 +1,76 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.meta; + +import com.alibaba.graphscope.common.ir.meta.procedure.GraphStoredProcedures; +import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Objects; + +/** + * This class describes basic metadata information required by IR, including Schema, Procedures. + * They are versioned using the same snapshot id. + */ +public class IrMeta { + protected final GraphId graphId; + protected final SnapshotId snapshotId; + protected final IrGraphSchema schema; + protected final @Nullable GraphStoredProcedures storedProcedures; + + public IrMeta(IrGraphSchema schema) { + this(SnapshotId.createEmpty(), schema); + } + + public IrMeta(IrGraphSchema schema, GraphStoredProcedures storedProcedures) { + this(GraphId.DEFAULT, SnapshotId.createEmpty(), schema, storedProcedures); + } + + public IrMeta(SnapshotId snapshotId, IrGraphSchema schema) { + this(GraphId.DEFAULT, snapshotId, schema, null); + } + + public IrMeta( + GraphId graphId, + SnapshotId snapshotId, + IrGraphSchema schema, + GraphStoredProcedures storedProcedures) { + this.graphId = graphId; + this.snapshotId = Objects.requireNonNull(snapshotId); + this.schema = Objects.requireNonNull(schema); + this.storedProcedures = storedProcedures; + } + + public IrGraphSchema getSchema() { + return schema; + } + + public SnapshotId getSnapshotId() { + return snapshotId; + } + + public @Nullable GraphStoredProcedures getStoredProcedures() { + return storedProcedures; + } + + public GraphId getGraphId() { + return graphId; + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMetaStats.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMetaStats.java new file mode 100644 index 000000000000..b8a0b91f8090 --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMetaStats.java @@ -0,0 +1,54 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.meta; + +import com.alibaba.graphscope.common.ir.meta.procedure.GraphStoredProcedures; +import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; +import com.alibaba.graphscope.groot.common.schema.api.GraphStatistics; + +import org.checkerframework.checker.nullness.qual.Nullable; + +/** + * This class describes all metadata information required by IR, including Schema, Procedures and Statistics. + */ +public class IrMetaStats extends IrMeta { + private final @Nullable GraphStatistics statistics; + + public IrMetaStats( + SnapshotId snapshotId, + IrGraphSchema schema, + GraphStoredProcedures storedProcedures, + GraphStatistics statistics) { + this(GraphId.DEFAULT, snapshotId, schema, storedProcedures, statistics); + } + + public IrMetaStats( + GraphId graphId, + SnapshotId snapshotId, + IrGraphSchema schema, + GraphStoredProcedures storedProcedures, + GraphStatistics statistics) { + super(graphId, snapshotId, schema, storedProcedures); + this.statistics = statistics; + } + + public @Nullable GraphStatistics getStatistics() { + return this.statistics; + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMetaTracker.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMetaTracker.java new file mode 100644 index 000000000000..f5dbd7b4e82a --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/IrMetaTracker.java @@ -0,0 +1,24 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.meta; + +// This interface defines the callback to be invoked when IrMeta changes. +public interface IrMetaTracker { + void onChanged(IrMeta meta); +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/SnapshotId.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/SnapshotId.java new file mode 100644 index 000000000000..147ea59a4693 --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/SnapshotId.java @@ -0,0 +1,41 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.meta; + +public class SnapshotId { + public static final SnapshotId createEmpty() { + return new SnapshotId(false, -1); + } + + private final boolean acquired; + private final long id; + + public SnapshotId(boolean acquired, long id) { + this.acquired = acquired; + this.id = id; + } + + public boolean isAcquired() { + return acquired; + } + + public long getId() { + return id; + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/fetcher/IrMetaFetcher.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/fetcher/IrMetaFetcher.java new file mode 100644 index 000000000000..06985f38a3c5 --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/fetcher/IrMetaFetcher.java @@ -0,0 +1,42 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.meta.fetcher; + +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.IrMetaTracker; +import com.alibaba.graphscope.common.ir.meta.reader.IrMetaReader; + +import java.util.Optional; + +/** + * This interface primarily describes the strategies to obtaining IrMeta, which are mainly of two types: static and dynamic. + * The static strategy {@code StaticIrMetaFetcher} assumes that IrMeta does not change after initialization, + * while the dynamic strategy {@code DynamicIrMetaFetcher} assumes that IrMeta can change. + */ +public abstract class IrMetaFetcher { + protected final IrMetaReader reader; + protected final IrMetaTracker tracker; + + protected IrMetaFetcher(IrMetaReader reader, IrMetaTracker tracker) { + this.reader = reader; + this.tracker = tracker; + } + + public abstract Optional fetch(); +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/fetcher/StaticIrMetaFetcher.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/fetcher/StaticIrMetaFetcher.java new file mode 100644 index 000000000000..b48cc07d81a1 --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/fetcher/StaticIrMetaFetcher.java @@ -0,0 +1,63 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.meta.fetcher; + +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.IrMetaStats; +import com.alibaba.graphscope.common.ir.meta.IrMetaTracker; +import com.alibaba.graphscope.common.ir.meta.reader.IrMetaReader; +import com.alibaba.graphscope.groot.common.schema.api.GraphStatistics; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.Optional; + +public class StaticIrMetaFetcher extends IrMetaFetcher { + private static final Logger logger = LoggerFactory.getLogger(StaticIrMetaFetcher.class); + private final IrMetaStats metaStats; + + public StaticIrMetaFetcher(IrMetaReader dataReader, IrMetaTracker tracker) throws IOException { + super(dataReader, tracker); + IrMeta meta = this.reader.readMeta(); + GraphStatistics stats = (meta == null) ? null : fetchStats(meta); + this.metaStats = + new IrMetaStats( + meta.getSnapshotId(), meta.getSchema(), meta.getStoredProcedures(), stats); + if (tracker != null && stats != null) { + tracker.onChanged(this.metaStats); + } + } + + private @Nullable GraphStatistics fetchStats(IrMeta meta) { + try { + return this.reader.readStats(meta.getGraphId()); + } catch (Exception e) { + logger.warn("failed to read graph statistics, error is {}", e); + return null; + } + } + + @Override + public Optional fetch() { + return Optional.of(this.metaStats); + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/procedure/GraphStoredProcedures.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/procedure/GraphStoredProcedures.java index badc9894fca2..068b9a6e0e8d 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/procedure/GraphStoredProcedures.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/procedure/GraphStoredProcedures.java @@ -16,32 +16,75 @@ package com.alibaba.graphscope.common.ir.meta.procedure; -import com.alibaba.graphscope.common.ir.meta.reader.MetaDataReader; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.reader.IrMetaReader; import com.google.common.collect.Maps; +import org.apache.commons.lang3.ObjectUtils; import org.checkerframework.checker.nullness.qual.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.yaml.snakeyaml.Yaml; +import java.io.ByteArrayInputStream; +import java.io.IOException; import java.io.InputStream; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; -public class GraphStoredProcedures implements StoredProcedures { - private static Logger logger = LoggerFactory.getLogger(GraphStoredProcedures.class); +public class GraphStoredProcedures { + private static final Logger logger = LoggerFactory.getLogger(GraphStoredProcedures.class); private final Map storedProcedureMetaMap; + private final IrMetaReader metaReader; - public GraphStoredProcedures(MetaDataReader reader) throws Exception { - this.storedProcedureMetaMap = Maps.newLinkedHashMap(); - for (InputStream inputStream : reader.getStoredProcedures()) { - StoredProcedureMeta createdMeta = StoredProcedureMeta.Deserializer.perform(inputStream); - this.storedProcedureMetaMap.put(createdMeta.getName(), createdMeta); - logger.debug("Got stored procedure: {} from reader", createdMeta.getName()); - inputStream.close(); + public GraphStoredProcedures(InputStream metaStream, IrMetaReader metaReader) { + Yaml yaml = new Yaml(); + Map yamlAsMap = yaml.load(metaStream); + List procedureList = (List) yamlAsMap.get("stored_procedures"); + if (ObjectUtils.isEmpty(procedureList)) { + this.storedProcedureMetaMap = Maps.newLinkedHashMap(); + } else { + this.storedProcedureMetaMap = + procedureList.stream() + .map( + k -> { + try { + String procedureYaml = yaml.dump(k); + return StoredProcedureMeta.Deserializer.perform( + new ByteArrayInputStream( + procedureYaml.getBytes())); + } catch (IOException e) { + throw new RuntimeException(e); + } + }) + .collect(Collectors.toMap(StoredProcedureMeta::getName, k -> k)); } + this.metaReader = metaReader; } - @Override public @Nullable StoredProcedureMeta getStoredProcedure(String procedureName) { - return this.storedProcedureMetaMap.get(procedureName); + return getStoredProcedure(procedureName, true); + } + + /** + * + * @param procedureName + * @param update determine whether a remote update request should be sent to the admin service when the procedure is not found in the local cache + * @return + */ + private @Nullable StoredProcedureMeta getStoredProcedure(String procedureName, boolean update) { + StoredProcedureMeta cachedProcedure = this.storedProcedureMetaMap.get(procedureName); + if (cachedProcedure == null && update) { + try { + IrMeta meta = this.metaReader.readMeta(); + if (meta != null && meta.getStoredProcedures() != null) { + return meta.getStoredProcedures().getStoredProcedure(procedureName, false); + } + } catch (Exception e) { + logger.warn("failed to read meta data, error is {}", e); + } + } + return cachedProcedure; } } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/procedure/StoredProcedures.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/procedure/StoredProcedures.java deleted file mode 100644 index 7a4fc33d961c..000000000000 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/procedure/StoredProcedures.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ - -package com.alibaba.graphscope.common.ir.meta.procedure; - -import org.checkerframework.checker.nullness.qual.Nullable; - -public interface StoredProcedures { - @Nullable StoredProcedureMeta getStoredProcedure(String procedureName); -} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/FileFormatType.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/FileFormatType.java deleted file mode 100644 index 7ff9cb199363..000000000000 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/FileFormatType.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ - -package com.alibaba.graphscope.common.ir.meta.reader; - -public enum FileFormatType { - YAML, - JSON, - PROPERTIES -} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/MetaDataReader.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/IrMetaReader.java similarity index 56% rename from interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/MetaDataReader.java rename to interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/IrMetaReader.java index 0500bf364baa..62e4142684b3 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/MetaDataReader.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/IrMetaReader.java @@ -16,17 +16,18 @@ package com.alibaba.graphscope.common.ir.meta.reader; -import java.io.InputStream; -import java.util.List; +import com.alibaba.graphscope.common.ir.meta.GraphId; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.groot.common.schema.api.GraphStatistics; -// MetaDataReader is used to read meta data from a data source (can be a local file or -// remote web service) -public interface MetaDataReader { +import java.io.IOException; - // if enableProcedures is null, return all stored procedures - List getStoredProcedures() throws Exception; - - SchemaInputStream getGraphSchema() throws Exception; +/** + * {@code IrMetaReader} is used to read Ir Meta from a data source (can be a local file or remote web service). + */ +public interface IrMetaReader { + IrMeta readMeta() throws IOException; - SchemaInputStream getStatistics() throws Exception; + // get statistics from a graph referenced by graphId + GraphStatistics readStats(GraphId graphId) throws IOException; } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/LocalIrMetaReader.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/LocalIrMetaReader.java new file mode 100644 index 000000000000..ab667c086bac --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/LocalIrMetaReader.java @@ -0,0 +1,70 @@ +/* + * Copyright 2020 Alibaba Group Holding Limited. + * + * 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. + */ + +package com.alibaba.graphscope.common.ir.meta.reader; + +import com.alibaba.graphscope.common.config.Configs; +import com.alibaba.graphscope.common.config.GraphConfig; +import com.alibaba.graphscope.common.ir.meta.GraphId; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.procedure.GraphStoredProcedures; +import com.alibaba.graphscope.common.ir.meta.schema.FileFormatType; +import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; +import com.alibaba.graphscope.common.ir.meta.schema.IrGraphStatistics; +import com.alibaba.graphscope.common.ir.meta.schema.SchemaInputStream; +import com.alibaba.graphscope.common.utils.FileUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Objects; + +/** + * a local file system implementation of {@code IrMetaReader} + */ +public class LocalIrMetaReader implements IrMetaReader { + private static final Logger logger = LoggerFactory.getLogger(LocalIrMetaReader.class); + private final Configs configs; + + public LocalIrMetaReader(Configs configs) { + this.configs = configs; + } + + @Override + public IrMeta readMeta() throws IOException { + String metaPath = + Objects.requireNonNull( + GraphConfig.GRAPH_SCHEMA.get(configs), "ir meta path not exist"); + FileFormatType formatType = FileUtils.getFormatType(metaPath); + IrGraphSchema graphSchema = + new IrGraphSchema(new SchemaInputStream(new FileInputStream(metaPath), formatType)); + IrMeta irMeta = + (formatType == FileFormatType.YAML) + ? new IrMeta( + graphSchema, + new GraphStoredProcedures(new FileInputStream(metaPath), this)) + : new IrMeta(graphSchema); + return irMeta; + } + + @Override + public IrGraphStatistics readStats(GraphId graphId) throws IOException { + String statsPath = GraphConfig.GRAPH_STATISTICS.get(configs); + return statsPath.isEmpty() ? null : new IrGraphStatistics(new FileInputStream(statsPath)); + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/LocalMetaDataReader.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/LocalMetaDataReader.java deleted file mode 100644 index 3e9bc49e9797..000000000000 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/LocalMetaDataReader.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ - -package com.alibaba.graphscope.common.ir.meta.reader; - -import com.alibaba.graphscope.common.config.Configs; -import com.alibaba.graphscope.common.config.GraphConfig; -import com.alibaba.graphscope.common.utils.FileUtils; -import com.google.common.collect.ImmutableList; - -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.yaml.snakeyaml.Yaml; - -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -// a local file system implementation of MetaDataReader -public class LocalMetaDataReader implements MetaDataReader { - private static final Logger logger = LoggerFactory.getLogger(LocalMetaDataReader.class); - private final Configs configs; - - public LocalMetaDataReader(Configs configs) { - this.configs = configs; - } - - @Override - public List getStoredProcedures() throws IOException { - String storedProceduresYaml = GraphConfig.GRAPH_STORED_PROCEDURES_YAML.get(configs); - if (StringUtils.isEmpty(storedProceduresYaml)) { - return ImmutableList.of(); - } - Yaml yaml = new Yaml(); - Object raw = yaml.load(storedProceduresYaml); - if (!(raw instanceof List)) { - logger.error("stored procedures yaml format error"); - return ImmutableList.of(); - } - List procedureList = (List) raw; - return procedureList.stream() - .map( - k -> { - String procedureYaml = yaml.dump(k); - return new ByteArrayInputStream(procedureYaml.getBytes()); - }) - .collect(Collectors.toList()); - } - - @Override - public SchemaInputStream getGraphSchema() throws IOException { - String schemaPath = - Objects.requireNonNull( - GraphConfig.GRAPH_SCHEMA.get(configs), "schema path not exist"); - return new SchemaInputStream( - new FileInputStream(schemaPath), FileUtils.getFormatType(schemaPath)); - } - - @Override - public SchemaInputStream getStatistics() throws Exception { - String statisticsPath = GraphConfig.GRAPH_STATISTICS.get(configs); - if (StringUtils.isEmpty(statisticsPath)) { - return null; - } else { - return new SchemaInputStream( - new FileInputStream(statisticsPath), FileUtils.getFormatType(statisticsPath)); - } - } -} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/SchemaInputStream.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/SchemaInputStream.java deleted file mode 100644 index 2516ee843b90..000000000000 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/reader/SchemaInputStream.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ - -package com.alibaba.graphscope.common.ir.meta.reader; - -import java.io.InputStream; - -public class SchemaInputStream { - private final InputStream inputStream; - private final FileFormatType formatType; - - public SchemaInputStream(InputStream inputStream, FileFormatType formatType) { - this.inputStream = inputStream; - this.formatType = formatType; - } - - public InputStream getInputStream() { - return inputStream; - } - - public FileFormatType getFormatType() { - return formatType; - } -} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/FileFormatType.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/FileFormatType.java new file mode 100644 index 000000000000..0d56fcce79b5 --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/FileFormatType.java @@ -0,0 +1,25 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.meta.schema; + +public enum FileFormatType { + YAML, + JSON, + PROPERTIES +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/IrGraphSchema.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/IrGraphSchema.java index d52a9ae78e9c..2a288da38e7a 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/IrGraphSchema.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/IrGraphSchema.java @@ -16,13 +16,12 @@ package com.alibaba.graphscope.common.ir.meta.schema; -import com.alibaba.graphscope.common.ir.meta.reader.MetaDataReader; -import com.alibaba.graphscope.common.ir.meta.reader.SchemaInputStream; import com.alibaba.graphscope.groot.common.exception.GraphElementNotFoundException; import com.alibaba.graphscope.groot.common.exception.GraphPropertyNotFoundException; import com.alibaba.graphscope.groot.common.schema.api.*; import com.alibaba.graphscope.groot.common.util.IrSchemaParser; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; @@ -35,9 +34,8 @@ public class IrGraphSchema implements GraphSchema { private final String schemeJson; private final boolean isColumnId; - public IrGraphSchema(MetaDataReader dataReader) throws Exception { + public IrGraphSchema(SchemaInputStream schemaInputStream) throws IOException { this.isColumnId = false; - SchemaInputStream schemaInputStream = dataReader.getGraphSchema(); String content = new String( schemaInputStream.getInputStream().readAllBytes(), StandardCharsets.UTF_8); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/IrGraphStatistics.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/IrGraphStatistics.java index 673de9761a00..fb71cc745170 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/IrGraphStatistics.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/IrGraphStatistics.java @@ -16,12 +16,10 @@ package com.alibaba.graphscope.common.ir.meta.schema; -import com.alibaba.graphscope.common.ir.meta.reader.MetaDataReader; -import com.alibaba.graphscope.common.ir.meta.reader.SchemaInputStream; -import com.alibaba.graphscope.groot.common.schema.api.*; - -import org.apache.commons.lang3.ObjectUtils; +import com.alibaba.graphscope.groot.common.schema.api.GraphStatistics; +import java.io.IOException; +import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.Optional; @@ -31,18 +29,10 @@ public class IrGraphStatistics implements GraphStatistics { private final GraphStatistics graphStatistics; - public IrGraphStatistics(MetaDataReader dataReader) throws Exception { - SchemaInputStream schemaInputStream = dataReader.getStatistics(); - if (ObjectUtils.isEmpty(schemaInputStream)) { - this.graphStatistics = null; - } else { - String content = - new String( - schemaInputStream.getInputStream().readAllBytes(), - StandardCharsets.UTF_8); - schemaInputStream.getInputStream().close(); - this.graphStatistics = Utils.buildStatisticsFromJson(content); - } + public IrGraphStatistics(InputStream statisticsStream) throws IOException { + String content = new String(statisticsStream.readAllBytes(), StandardCharsets.UTF_8); + statisticsStream.close(); + this.graphStatistics = Utils.buildStatisticsFromJson(content); } public IrGraphStatistics(GraphStatistics statistics) { diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/SchemaInputStream.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/SchemaInputStream.java new file mode 100644 index 000000000000..91c6a2847f34 --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/meta/schema/SchemaInputStream.java @@ -0,0 +1,39 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.meta.schema; + +import java.io.InputStream; + +public class SchemaInputStream { + private final InputStream inputStream; + private final FileFormatType formatType; + + public SchemaInputStream(InputStream inputStream, FileFormatType formatType) { + this.inputStream = inputStream; + this.formatType = formatType; + } + + public InputStream getInputStream() { + return inputStream; + } + + public FileFormatType getFormatType() { + return formatType; + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GlogueHolder.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GlogueHolder.java new file mode 100644 index 000000000000..e083133da51f --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GlogueHolder.java @@ -0,0 +1,58 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.planner; + +import com.alibaba.graphscope.common.config.Configs; +import com.alibaba.graphscope.common.config.PlannerConfig; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.IrMetaStats; +import com.alibaba.graphscope.common.ir.meta.IrMetaTracker; +import com.alibaba.graphscope.common.ir.rel.metadata.glogue.Glogue; +import com.alibaba.graphscope.common.ir.rel.metadata.glogue.GlogueQuery; +import com.alibaba.graphscope.common.ir.rel.metadata.schema.GlogueSchema; + +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.concurrent.atomic.AtomicReference; + +// When IrMeta is updated, Glogue will also be triggered to update. This class defines the specific +// operations for updating Glogue. +public class GlogueHolder implements IrMetaTracker { + private final PlannerConfig config; + private final AtomicReference glogueRef; + + public GlogueHolder(Configs configs) { + this.config = new PlannerConfig(configs); + this.glogueRef = new AtomicReference<>(); + } + + @Override + public void onChanged(IrMeta meta) { + if (meta instanceof IrMetaStats) { + GlogueSchema g = GlogueSchema.fromMeta((IrMetaStats) meta); + Glogue gl = new Glogue(g, config.getGlogueSize()); + GlogueQuery gq = new GlogueQuery(gl); + this.glogueRef.compareAndSet(glogueRef.get(), gq); + } + } + + public @Nullable GlogueQuery getGlogue() { + return this.glogueRef.get(); + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphFieldTrimmer.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphFieldTrimmer.java index 151ee0c617b9..0a535bca43b3 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphFieldTrimmer.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphFieldTrimmer.java @@ -450,6 +450,7 @@ public TrimResult trimFields(GraphLogicalPathExpand pathExpand, UsedFields field pathExpand.getFetch(), pathExpand.getResultOpt(), pathExpand.getPathOpt(), + pathExpand.getUntilCondition(), pathExpand.getAliasName(), pathExpand.getStartAlias()); return result(newPathExpand, mapping, pathExpand); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphIOProcessor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphIOProcessor.java index 599f8004a4ef..6d2ff73cfe5a 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphIOProcessor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphIOProcessor.java @@ -16,6 +16,7 @@ package com.alibaba.graphscope.common.ir.planner; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.meta.schema.CommonOptTable; import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; import com.alibaba.graphscope.common.ir.planner.type.DataKey; @@ -39,7 +40,6 @@ import com.alibaba.graphscope.common.ir.type.GraphLabelType; import com.alibaba.graphscope.common.ir.type.GraphPathType; import com.alibaba.graphscope.common.ir.type.GraphSchemaType; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.groot.common.schema.api.EdgeRelation; import com.alibaba.graphscope.groot.common.schema.api.GraphEdge; import com.alibaba.graphscope.groot.common.schema.api.GraphVertex; @@ -48,7 +48,6 @@ import org.apache.calcite.plan.GraphOptCluster; import org.apache.calcite.plan.RelOptTable; -import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.RelVisitor; import org.apache.calcite.rel.core.JoinRelType; @@ -214,6 +213,10 @@ public void visit(RelNode node, int ordinal, @Nullable RelNode parent) { parent instanceof GraphLogicalGetV, "there should be a getV operator after path expand since" + " edge in patten should have two endpoints"); + Preconditions.checkArgument( + ((GraphLogicalPathExpand) node).getUntilCondition() == null, + "cannot apply optimization if path expand has until" + + " conditions"); PatternVertex vertex = visitAndAddVertex((GraphLogicalGetV) parent); visitAndAddPxdEdge( (GraphLogicalPathExpand) node, lastVisited, vertex); @@ -267,15 +270,20 @@ private PatternVertex visitAndAddVertex( vertexOrEdgeDetails.put(existVertex, new DataValue(alias, filters)); } else if (filters != null) { DataValue value = vertexOrEdgeDetails.get(existVertex); - if (value.getFilter() == null - || !RelOptUtil.conjunctions(value.getFilter()) - .containsAll(RelOptUtil.conjunctions(filters))) { - throw new IllegalArgumentException( - "filters " - + filters - + " not exist in the previous vertex filters " - + value.getFilter()); - } + // reset condition + RexNode newCondition = + (value.getFilter() == null) + ? filters + : RexUtil.composeConjunction( + builder.getRexBuilder(), + ImmutableList.of( + filters, value.getFilter())); + vertexOrEdgeDetails.put( + existVertex, + new DataValue( + value.getAlias(), + newCondition, + value.getParentAlias())); } return existVertex; } @@ -756,11 +764,10 @@ private RelNode createExpandGetV( if (srcInTargetOrderId == null) { srcInTargetOrderId = -1; } + PatternVertex src = + glogueEdge.getSrcPattern().getVertexByOrder(edge.getSrcVertexOrder()); DataValue srcValue = - getVertexValue( - new VertexDataKey(srcInTargetOrderId), - edgeDetails, - glogueEdge.getSrcPattern().getVertexByOrder(edge.getSrcVertexOrder())); + getVertexValue(new VertexDataKey(srcInTargetOrderId), edgeDetails, src); PatternVertex target = glogueEdge.getDstPattern().getVertexByOrder(extendStep.getTargetVertexOrder()); DataValue targetValue = @@ -793,7 +800,12 @@ private RelNode createExpandGetV( GetVConfig innerGetVConfig = new GetVConfig( getVConfig.getOpt(), - createLabels(edge.getElementDetails().getPxdInnerGetVTypes(), true), + createLabels( + createInnerGetVTypes( + src.getVertexTypeIds(), + target.getVertexTypeIds(), + edge.getElementDetails()), + true), getVConfig.getAlias()); pxdBuilder .getV(innerGetVConfig) @@ -805,7 +817,8 @@ private RelNode createExpandGetV( edge.getElementDetails().getRange().getOffset(), edge.getElementDetails().getRange().getFetch()); GraphLogicalPathExpand pxd = - (GraphLogicalPathExpand) builder.pathExpand(pxdBuilder.build()).build(); + (GraphLogicalPathExpand) + builder.pathExpand(pxdBuilder.buildConfig()).build(); GraphLogicalExpand expand = (GraphLogicalExpand) pxd.getExpand(); GraphSchemaType edgeType = (GraphSchemaType) expand.getRowType().getFieldList().get(0).getType(); @@ -819,9 +832,6 @@ private RelNode createExpandGetV( getVConfig.getLabels(), getVConfig.getAlias(), getVConfig.getStartAlias())); - if (targetValue.getFilter() != null) { - builder.filter(targetValue.getFilter()); - } } else { GraphLogicalExpand expand = createExpandWithOptional( @@ -835,13 +845,34 @@ private RelNode createExpandGetV( builder.filter(edgeValue.getFilter()); } builder.getV(getVConfig); - if (targetValue.getFilter() != null) { - builder.filter(targetValue.getFilter()); - } + } + if (targetValue.getFilter() != null) { + builder.filter(targetValue.getFilter()); } return builder.build(); } + // Handle a special case for path expand: re-infer the type of inner getV in path expand. + // Before optimization, the type of path expand is inferred based on the user's query order, + // resulting in the type of inner endV being bound to this order. + // However, if the optimizer reverses the order of the path expand, the type of inner endV + // also needs to be reversed accordingly. + private List createInnerGetVTypes( + List startVTypes, List endVTypes, ElementDetails details) { + List originalInnerVTypes = details.getPxdInnerGetVTypes(); + if (!originalInnerVTypes.isEmpty()) { + if (!endVTypes.isEmpty() && originalInnerVTypes.containsAll(endVTypes)) { + return originalInnerVTypes; + } else if (!startVTypes.isEmpty() && originalInnerVTypes.containsAll(startVTypes)) { + List reverseTypes = Lists.newArrayList(originalInnerVTypes); + reverseTypes.removeAll(startVTypes); + reverseTypes.addAll(endVTypes); + return reverseTypes.stream().distinct().collect(Collectors.toList()); + } + } + return endVTypes; + } + private GraphLogicalPathExpand createPathExpandWithOptional( GraphLogicalPathExpand pxd, boolean optional) { if (pxd.getFused() != null) { @@ -854,6 +885,7 @@ private GraphLogicalPathExpand createPathExpandWithOptional( pxd.getFetch(), pxd.getResultOpt(), pxd.getPathOpt(), + pxd.getUntilCondition(), pxd.getAliasName(), pxd.getStartAlias(), optional); @@ -868,6 +900,7 @@ private GraphLogicalPathExpand createPathExpandWithOptional( pxd.getFetch(), pxd.getResultOpt(), pxd.getPathOpt(), + pxd.getUntilCondition(), pxd.getAliasName(), pxd.getStartAlias(), optional); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphRelOptimizer.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphRelOptimizer.java index 77b4d8289d21..424f376e14df 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphRelOptimizer.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/GraphRelOptimizer.java @@ -18,6 +18,7 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.config.PlannerConfig; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.meta.glogue.calcite.GraphRelMetadataQuery; import com.alibaba.graphscope.common.ir.meta.glogue.calcite.handler.GraphMetadataHandlerProvider; import com.alibaba.graphscope.common.ir.planner.rules.*; @@ -27,12 +28,10 @@ import com.alibaba.graphscope.common.ir.rel.graph.match.AbstractLogicalMatch; import com.alibaba.graphscope.common.ir.rel.graph.match.GraphLogicalMultiMatch; import com.alibaba.graphscope.common.ir.rel.graph.match.GraphLogicalSingleMatch; -import com.alibaba.graphscope.common.ir.rel.metadata.glogue.Glogue; import com.alibaba.graphscope.common.ir.rel.metadata.glogue.GlogueQuery; -import com.alibaba.graphscope.common.ir.rel.metadata.schema.GlogueSchema; import com.alibaba.graphscope.common.ir.tools.GraphBuilderFactory; import com.alibaba.graphscope.common.ir.tools.config.GraphOpt; -import com.alibaba.graphscope.common.store.IrMeta; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @@ -67,6 +66,7 @@ public class GraphRelOptimizer { private final RelOptPlanner matchPlanner; private final RelOptPlanner physicalPlanner; private final RelBuilderFactory relBuilderFactory; + private final GlogueHolder glogueHolder; public GraphRelOptimizer(Configs graphConfig) { this.config = new PlannerConfig(graphConfig); @@ -74,6 +74,11 @@ public GraphRelOptimizer(Configs graphConfig) { this.relPlanner = createRelPlanner(); this.matchPlanner = createMatchPlanner(); this.physicalPlanner = createPhysicalPlanner(); + this.glogueHolder = new GlogueHolder(graphConfig); + } + + public GlogueHolder getGlogueHolder() { + return glogueHolder; } public RelOptPlanner getMatchPlanner() { @@ -90,9 +95,8 @@ public RelOptPlanner getRelPlanner() { public @Nullable RelMetadataQuery createMetaDataQuery(IrMeta irMeta) { if (config.isOn() && config.getOpt() == PlannerConfig.Opt.CBO) { - GlogueSchema g = GlogueSchema.fromMeta(irMeta); - Glogue gl = new Glogue(g, config.getGlogueSize()); - GlogueQuery gq = new GlogueQuery(gl); + GlogueQuery gq = this.glogueHolder.getGlogue(); + Preconditions.checkArgument(gq != null, "glogue is not ready"); return new GraphRelMetadataQuery( new GraphMetadataHandlerProvider(this.matchPlanner, gq, this.config)); } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/rules/ExpandGetVFusionRule.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/rules/ExpandGetVFusionRule.java index 5ba60dee80ca..551492ce773c 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/rules/ExpandGetVFusionRule.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/planner/rules/ExpandGetVFusionRule.java @@ -308,6 +308,7 @@ public void onMatch(RelOptRuleCall call) { pathExpand.getFetch(), pathExpand.getResultOpt(), pathExpand.getPathOpt(), + pathExpand.getUntilCondition(), pathExpand.getAliasName(), pathExpand.getStartAlias(), pathExpand.isOptional()); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rel/graph/GraphLogicalPathExpand.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rel/graph/GraphLogicalPathExpand.java index 68fed08477f5..f7deb4f67bba 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rel/graph/GraphLogicalPathExpand.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rel/graph/GraphLogicalPathExpand.java @@ -63,6 +63,8 @@ public class GraphLogicalPathExpand extends SingleRel { private final boolean optional; + private final @Nullable RexNode untilCondition; + protected GraphLogicalPathExpand( GraphOptCluster cluster, @Nullable List hints, @@ -73,6 +75,7 @@ protected GraphLogicalPathExpand( @Nullable RexNode fetch, GraphOpt.PathExpandResult resultOpt, GraphOpt.PathExpandPath pathOpt, + @Nullable RexNode untilCondition, @Nullable String aliasName, AliasNameWithId startAlias, boolean optional) { @@ -97,6 +100,7 @@ protected GraphLogicalPathExpand( (this.aliasId == AliasInference.DEFAULT_ID) ? resultOpt : GraphOpt.PathExpandResult.ALL_V_E; + this.untilCondition = untilCondition; } protected GraphLogicalPathExpand( @@ -108,6 +112,7 @@ protected GraphLogicalPathExpand( @Nullable RexNode fetch, GraphOpt.PathExpandResult resultOpt, GraphOpt.PathExpandPath pathOpt, + @Nullable RexNode untilCondition, @Nullable String aliasName, AliasNameWithId startAlias, boolean optional) { @@ -125,6 +130,7 @@ protected GraphLogicalPathExpand( this.aliasId = cluster.getIdGenerator().generate(this.aliasName); this.startAlias = Objects.requireNonNull(startAlias); this.optional = optional; + this.untilCondition = untilCondition; } public static GraphLogicalPathExpand create( @@ -137,6 +143,7 @@ public static GraphLogicalPathExpand create( @Nullable RexNode fetch, GraphOpt.PathExpandResult resultOpt, GraphOpt.PathExpandPath pathOpt, + @Nullable RexNode untilCondition, String aliasName, AliasNameWithId startAlias, boolean optional) { @@ -150,6 +157,7 @@ public static GraphLogicalPathExpand create( fetch, resultOpt, pathOpt, + untilCondition, aliasName, startAlias, optional); @@ -165,6 +173,7 @@ public static GraphLogicalPathExpand create( @Nullable RexNode fetch, GraphOpt.PathExpandResult resultOpt, GraphOpt.PathExpandPath pathOpt, + @Nullable RexNode untilCondition, String aliasName, AliasNameWithId startAlias) { return create( @@ -177,6 +186,7 @@ public static GraphLogicalPathExpand create( fetch, resultOpt, pathOpt, + untilCondition, aliasName, startAlias, false); @@ -191,6 +201,7 @@ public static GraphLogicalPathExpand create( @Nullable RexNode fetch, GraphOpt.PathExpandResult resultOpt, GraphOpt.PathExpandPath pathOpt, + @Nullable RexNode untilCondition, String aliasName, AliasNameWithId startAlias) { return create( @@ -202,6 +213,7 @@ public static GraphLogicalPathExpand create( fetch, resultOpt, pathOpt, + untilCondition, aliasName, startAlias, false); @@ -216,6 +228,7 @@ public static GraphLogicalPathExpand create( @Nullable RexNode fetch, GraphOpt.PathExpandResult resultOpt, GraphOpt.PathExpandPath pathOpt, + @Nullable RexNode untilCondition, String aliasName, AliasNameWithId startAlias, boolean optional) { @@ -231,6 +244,7 @@ public static GraphLogicalPathExpand create( fetch, resultOpt, pathOpt, + untilCondition, aliasName, startAlias, optional); @@ -246,6 +260,7 @@ public RelWriter explainTerms(RelWriter pw) { .itemIf("fetch", fetch, fetch != null) .item("path_opt", getPathOpt()) .item("result_opt", getResultOpt()) + .itemIf("until_condition", untilCondition, untilCondition != null) .item("alias", AliasInference.SIMPLE_NAME(getAliasName())) .itemIf( "aliasId", @@ -306,6 +321,10 @@ public boolean isOptional() { return optional; } + public @Nullable RexNode getUntilCondition() { + return untilCondition; + } + @Override protected RelDataType deriveRowType() { return new RelRecordType( @@ -352,6 +371,7 @@ public GraphLogicalPathExpand copy(RelTraitSet traitSet, List inputs) { getFetch(), getResultOpt(), getPathOpt(), + getUntilCondition(), getAliasName(), getStartAlias(), isOptional()); @@ -366,6 +386,7 @@ public GraphLogicalPathExpand copy(RelTraitSet traitSet, List inputs) { getFetch(), getResultOpt(), getPathOpt(), + getUntilCondition(), getAliasName(), getStartAlias(), isOptional()); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rel/metadata/schema/GlogueSchema.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rel/metadata/schema/GlogueSchema.java index bd17534d7651..2d199869c264 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rel/metadata/schema/GlogueSchema.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rel/metadata/schema/GlogueSchema.java @@ -16,15 +16,11 @@ package com.alibaba.graphscope.common.ir.rel.metadata.schema; -import com.alibaba.graphscope.common.store.IrMeta; -import com.alibaba.graphscope.groot.common.schema.api.EdgeRelation; -import com.alibaba.graphscope.groot.common.schema.api.GraphEdge; -import com.alibaba.graphscope.groot.common.schema.api.GraphSchema; -import com.alibaba.graphscope.groot.common.schema.api.GraphStatistics; -import com.alibaba.graphscope.groot.common.schema.api.GraphVertex; +import com.alibaba.graphscope.common.ir.meta.IrMetaStats; +import com.alibaba.graphscope.groot.common.schema.api.*; -import org.jgrapht.*; -import org.jgrapht.graph.*; +import org.jgrapht.Graph; +import org.jgrapht.graph.DirectedPseudograph; import java.util.HashMap; import java.util.List; @@ -84,7 +80,7 @@ public GlogueSchema(GraphSchema graphSchema, GraphStatistics statistics) { } } - public static GlogueSchema fromMeta(IrMeta irMeta) { + public static GlogueSchema fromMeta(IrMetaStats irMeta) { return new GlogueSchema(irMeta.getSchema(), irMeta.getStatistics()); } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rex/ClassifiedFilter.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rex/ClassifiedFilter.java new file mode 100644 index 000000000000..ea6dde0057fe --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rex/ClassifiedFilter.java @@ -0,0 +1,58 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.rex; + +import org.apache.calcite.rex.RexNode; + +import java.util.Collections; +import java.util.List; + +public class ClassifiedFilter { + private final List labelFilters; + private final List labelValues; + private final List uniqueKeyFilters; + private final List extraFilters; + + public ClassifiedFilter( + List labelFilters, + List labelValues, + List uniqueKeyFilters, + List extraFilters) { + this.labelFilters = labelFilters; + this.labelValues = labelValues; + this.uniqueKeyFilters = uniqueKeyFilters; + this.extraFilters = extraFilters; + } + + public List getLabelFilters() { + return Collections.unmodifiableList(labelFilters); + } + + public List getLabelValues() { + return Collections.unmodifiableList(labelValues); + } + + public List getUniqueKeyFilters() { + return Collections.unmodifiableList(uniqueKeyFilters); + } + + public List getExtraFilters() { + return Collections.unmodifiableList(extraFilters); + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rex/RexFilterClassifier.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rex/RexFilterClassifier.java new file mode 100644 index 000000000000..4c268ff1e490 --- /dev/null +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/rex/RexFilterClassifier.java @@ -0,0 +1,430 @@ +/* + * + * * Copyright 2020 Alibaba Group Holding Limited. + * * + * * 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. + * + */ + +package com.alibaba.graphscope.common.ir.rex; + +import com.alibaba.graphscope.common.ir.rel.graph.AbstractBindableTableScan; +import com.alibaba.graphscope.common.ir.rel.graph.GraphLogicalSource; +import com.alibaba.graphscope.common.ir.rel.type.TableConfig; +import com.alibaba.graphscope.common.ir.tools.GraphBuilder; +import com.alibaba.graphscope.common.ir.tools.Utils; +import com.alibaba.graphscope.common.ir.type.GraphLabelType; +import com.alibaba.graphscope.common.ir.type.GraphNameOrId; +import com.alibaba.graphscope.common.ir.type.GraphProperty; +import com.alibaba.graphscope.common.ir.type.GraphSchemaType; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.type.RelDataTypeField; +import org.apache.calcite.rex.*; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlOperator; +import org.apache.calcite.util.ImmutableBitSet; +import org.apache.calcite.util.Sarg; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.javatuples.Pair; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * We use this class to decouple a complex condition that contains nested {@code OR} and {@code AND} operators into different filtering conditions. + * There are mainly three types of filtering: + * 1) filtering based on labels; + * 2) based on the scan's unique key; + * 3) querying other properties. + * + * For example: for the condition _.~label = 'person' AND _.~id = 1 AND _.name = 'marko', + * _.~label = 'person', _.~id = 1, and _.name = 'marko' would be decoupled into three different {@code RexNode} structures. + */ +public class RexFilterClassifier extends RexVisitorImpl { + private final GraphBuilder builder; + private final @Nullable AbstractBindableTableScan tableScan; + + public RexFilterClassifier( + GraphBuilder builder, @Nullable AbstractBindableTableScan tableScan) { + super(true); + this.builder = builder; + this.tableScan = tableScan; + } + + public ClassifiedFilter classify(RexNode condition) { + Filter filter = condition.accept(this); + List labelFilters = Lists.newArrayList(); + List uniqueKeyFilters = Lists.newArrayList(); + filter.getSchemaFilters() + .forEach( + k -> { + switch (k.getSchemaType()) { + case LABEL: + labelFilters.add(k.getFilter()); + break; + case UNIQUE_KEY: + default: + uniqueKeyFilters.add(k.getFilter()); + } + }); + List extraFilters = Lists.newArrayList(); + if (filter.getOtherFilter() != null) { + extraFilters.add(filter.getOtherFilter()); + } + List labelValues = Lists.newArrayList(); + labelFilters.forEach(k -> labelValues.addAll(getLabelValues(k))); + return new ClassifiedFilter(labelFilters, labelValues, uniqueKeyFilters, extraFilters); + } + + private List getLabelValues(RexNode labelFilter) { + return labelFilter.accept(new LabelValueCollector()); + } + + @Override + public Filter visitCall(RexCall call) { + SqlOperator operator = call.getOperator(); + List operands = call.getOperands(); + switch (operator.getKind()) { + case AND: + return conjunctions(call, visitList(operands)); + case OR: + return disjunctions(call); + case EQUALS: + case SEARCH: + RexVariableAliasCollector aliasCollector = + new RexVariableAliasCollector<>( + true, (RexGraphVariable var) -> var.getAliasId()); + if (isLabelEqualFilter(call)) { + Integer tagId = call.accept(aliasCollector).get(0); + return new Filter( + ImmutableList.of( + new Filter.SchemaFilter(tagId, call, Filter.SchemaType.LABEL)), + null); + } else if (tableScan != null && isUniqueKeyEqualFilter(call)) { + Integer tagId = call.accept(aliasCollector).get(0); + return new Filter( + ImmutableList.of( + new Filter.SchemaFilter( + tagId, call, Filter.SchemaType.UNIQUE_KEY)), + null); + } + default: + return new Filter(ImmutableList.of(), call); + } + } + + private Filter conjunctions(RexNode original, List filters) { + Map, RexNode> schemaFilterMap = Maps.newLinkedHashMap(); + List otherFilters = Lists.newArrayList(); + filters.forEach( + k -> { + k.getSchemaFilters() + .forEach( + v -> { + Pair key = + Pair.with(v.getTagId(), v.getSchemaType()); + RexNode filtering = v.getFilter(); + RexNode existing = schemaFilterMap.get(key); + if (existing != null) { + filtering = builder.and(existing, v.getFilter()); + } + if (!filtering.equals(existing)) { + schemaFilterMap.put(key, filtering); + } + }); + if (k.getOtherFilter() != null) { + otherFilters.add(k.getOtherFilter()); + } + }); + List andSchemaFilters = Lists.newArrayList(); + schemaFilterMap.forEach( + (k, v) -> { + andSchemaFilters.add(new Filter.SchemaFilter(k.getValue0(), v, k.getValue1())); + }); + RexNode otherFilter = + otherFilters.isEmpty() + ? null + : RexUtil.composeConjunction(builder.getRexBuilder(), otherFilters, false); + return new Filter(andSchemaFilters, otherFilter); + } + + private Filter disjunctions(RexCall original) { + SqlOperator operator = original.getOperator(); + switch (operator.getKind()) { + case OR: + List operands = original.getOperands(); + Filter.SchemaFilter schemaFilter = null; + for (RexNode operand : operands) { + if (operand.getKind() != SqlKind.EQUALS + && operand.getKind() != SqlKind.SEARCH) { + return new Filter(ImmutableList.of(), original); + } + List curFilters = operand.accept(this).getSchemaFilters(); + if (curFilters.size() != 1) { + return new Filter(ImmutableList.of(), original); + } + Filter.SchemaFilter cur = curFilters.get(0); + if (schemaFilter == null) { + schemaFilter = cur; + } else { + if (schemaFilter.getTagId() == cur.getTagId() + && schemaFilter.getSchemaType() == cur.getSchemaType()) { + schemaFilter = + new Filter.SchemaFilter( + schemaFilter.getTagId(), + builder.or(schemaFilter.getFilter(), cur.getFilter()), + schemaFilter.getSchemaType()); + } else { + return new Filter(ImmutableList.of(), original); + } + } + } + default: + return new Filter(ImmutableList.of(), original); + } + } + + // check the condition if it is the pattern of label equal filter, i.e. ~label = 'person' or + // ~label within ['person', 'software'] + // if it is then return the literal containing label values, otherwise null + private boolean isLabelEqualFilter(RexCall rexCall) { + return isLabelEqualFilter0(rexCall) != null; + } + + // check the condition if it is the pattern of label equal filter, i.e. ~label = 'person' or + // ~label within ['person', 'software'] + // if it is then return the literal containing label values, otherwise null + private static @Nullable RexLiteral isLabelEqualFilter0(RexNode condition) { + if (condition instanceof RexCall) { + RexCall rexCall = (RexCall) condition; + SqlOperator operator = rexCall.getOperator(); + switch (operator.getKind()) { + case EQUALS: + case SEARCH: + RexNode left = rexCall.getOperands().get(0); + RexNode right = rexCall.getOperands().get(1); + if (left.getType() instanceof GraphLabelType && right instanceof RexLiteral) { + Comparable value = ((RexLiteral) right).getValue(); + // if Sarg is a continuous range then the filter is not the 'equal', i.e. + // ~label SEARCH [[1, 10]] which means ~label >= 1 and ~label <= 10 + if (value instanceof Sarg && !((Sarg) value).isPoints()) { + return null; + } + return (RexLiteral) right; + } else if (right.getType() instanceof GraphLabelType + && left instanceof RexLiteral) { + Comparable value = ((RexLiteral) left).getValue(); + if (value instanceof Sarg && !((Sarg) value).isPoints()) { + return null; + } + return (RexLiteral) left; + } + default: + return null; + } + } else { + return null; + } + } + + private boolean isUniqueKeyEqualFilter(RexNode condition) { + if (!(tableScan instanceof GraphLogicalSource)) return false; + if (condition instanceof RexCall) { + RexCall rexCall = (RexCall) condition; + SqlOperator operator = rexCall.getOperator(); + switch (operator.getKind()) { + case EQUALS: + case SEARCH: + RexNode left = rexCall.getOperands().get(0); + RexNode right = rexCall.getOperands().get(1); + if (isUniqueKey(left, tableScan) && isLiteralOrDynamicParams(right)) { + if (right instanceof RexLiteral) { + Comparable value = ((RexLiteral) right).getValue(); + // if Sarg is a continuous range then the filter is not the 'equal', + // i.e. ~id SEARCH [[1, 10]] which means ~id >= 1 and ~id <= 10 + if (value instanceof Sarg && !((Sarg) value).isPoints()) { + return false; + } + } + return true; + } else if (isUniqueKey(right, tableScan) && isLiteralOrDynamicParams(left)) { + if (left instanceof RexLiteral) { + Comparable value = ((RexLiteral) left).getValue(); + if (value instanceof Sarg && !((Sarg) value).isPoints()) { + return false; + } + } + return true; + } + default: + return false; + } + } else { + return false; + } + } + + private boolean isUniqueKey(RexNode rexNode, RelNode tableScan) { + if (rexNode instanceof RexGraphVariable) { + return isUniqueKey((RexGraphVariable) rexNode, tableScan); + } + return false; + } + + private boolean isUniqueKey(RexGraphVariable var, RelNode tableScan) { + if (var.getProperty() == null) return false; + switch (var.getProperty().getOpt()) { + case ID: + return true; + case KEY: + GraphSchemaType schemaType = + (GraphSchemaType) tableScan.getRowType().getFieldList().get(0).getType(); + ImmutableBitSet propertyIds = getPropertyIds(var.getProperty(), schemaType); + TableConfig tableConfig = ((AbstractBindableTableScan) tableScan).getTableConfig(); + if (!propertyIds.isEmpty() + && tableConfig.getTables().stream().allMatch(k -> k.isKey(propertyIds))) { + return true; + } + case LABEL: + case ALL: + case LEN: + default: + return false; + } + } + + private ImmutableBitSet getPropertyIds(GraphProperty property, GraphSchemaType schemaType) { + if (property.getOpt() != GraphProperty.Opt.KEY) return ImmutableBitSet.of(); + GraphNameOrId key = property.getKey(); + if (key.getOpt() == GraphNameOrId.Opt.ID) { + return ImmutableBitSet.of(key.getId()); + } + for (int i = 0; i < schemaType.getFieldList().size(); ++i) { + RelDataTypeField field = schemaType.getFieldList().get(i); + if (field.getName().equals(key.getName())) { + return ImmutableBitSet.of(i); + } + } + return ImmutableBitSet.of(); + } + + private boolean isLiteralOrDynamicParams(RexNode node) { + return node instanceof RexLiteral || node instanceof RexDynamicParam; + } + + private static class LabelValueCollector extends RexVisitorImpl> { + public LabelValueCollector() { + super(true); + } + + @Override + public List visitCall(RexCall call) { + SqlOperator operator = call.getOperator(); + switch (operator.getKind()) { + case AND: + List andLabels = Lists.newArrayList(); + call.getOperands() + .forEach( + k -> { + List cur = k.accept(this); + if (andLabels.isEmpty()) { + andLabels.addAll(cur); + } else { + andLabels.retainAll(cur); + } + if (andLabels.isEmpty()) { + throw new IllegalArgumentException( + "cannot find common labels between values=" + + andLabels + + " and values=" + + cur); + } + }); + case OR: + List orLabels = Lists.newArrayList(); + call.getOperands() + .forEach( + k -> { + orLabels.addAll(k.accept(this)); + }); + return orLabels.stream().distinct().collect(Collectors.toList()); + case EQUALS: + case SEARCH: + RexLiteral labelLiteral = isLabelEqualFilter0(call); + if (labelLiteral != null) { + return Utils.getValuesAsList(labelLiteral.getValueAs(Comparable.class)); + } + default: + return ImmutableList.of(); + } + } + } + + // Here we further differentiate the filter conditions for different tags to prevent the + // grouping of label conditions from various tags. + // For example, _.~label == 'person' OR _.~label = 'software' can be organized into _.~label IN + // ['person', 'software'], + // but a.~label = 'person' OR b.~label = 'software' cannot be. + public static class Filter { + private final List schemaFilters; + private final @Nullable RexNode otherFilter; + + public Filter(List schemaFilters, RexNode otherFilter) { + this.schemaFilters = schemaFilters; + this.otherFilter = otherFilter; + } + + public List getSchemaFilters() { + return Collections.unmodifiableList(schemaFilters); + } + + public @Nullable RexNode getOtherFilter() { + return otherFilter; + } + + public static class SchemaFilter { + private final Integer tagId; + private final RexNode filter; + private final SchemaType schemaType; + + public SchemaFilter(Integer tagId, RexNode filtering, SchemaType schemaType) { + this.tagId = tagId; + this.filter = filtering; + this.schemaType = schemaType; + } + + public Integer getTagId() { + return tagId; + } + + public RexNode getFilter() { + return filter; + } + + public SchemaType getSchemaType() { + return schemaType; + } + } + + public enum SchemaType { + LABEL, + UNIQUE_KEY + } + } +} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/ffi/FfiPhysicalBuilder.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/ffi/FfiPhysicalBuilder.java index a42c294c7c70..d9f08d30f458 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/ffi/FfiPhysicalBuilder.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/ffi/FfiPhysicalBuilder.java @@ -19,6 +19,7 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.config.FrontendConfig; import com.alibaba.graphscope.common.config.PegasusConfig; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.rel.*; import com.alibaba.graphscope.common.ir.rel.GraphLogicalAggregate; import com.alibaba.graphscope.common.ir.rel.GraphLogicalProject; @@ -39,7 +40,6 @@ import com.alibaba.graphscope.common.jna.type.FfiData; import com.alibaba.graphscope.common.jna.type.FfiResult; import com.alibaba.graphscope.common.jna.type.ResultCode; -import com.alibaba.graphscope.common.store.IrMeta; import com.google.common.base.Preconditions; import com.sun.jna.Pointer; import com.sun.jna.ptr.IntByReference; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/GraphRelProtoPhysicalBuilder.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/GraphRelProtoPhysicalBuilder.java index e33739390874..b056aeaff89d 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/GraphRelProtoPhysicalBuilder.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/GraphRelProtoPhysicalBuilder.java @@ -17,13 +17,13 @@ package com.alibaba.graphscope.common.ir.runtime.proto; import com.alibaba.graphscope.common.config.Configs; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.meta.schema.CommonOptTable; import com.alibaba.graphscope.common.ir.rel.CommonTableScan; import com.alibaba.graphscope.common.ir.rel.GraphShuttle; import com.alibaba.graphscope.common.ir.runtime.PhysicalBuilder; import com.alibaba.graphscope.common.ir.runtime.PhysicalPlan; import com.alibaba.graphscope.common.ir.tools.LogicalPlan; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.gaia.proto.GraphAlgebra; import com.alibaba.graphscope.gaia.proto.GraphAlgebraPhysical; import com.google.common.base.Preconditions; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/GraphRelToProtoConverter.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/GraphRelToProtoConverter.java index 53e920b3a355..a642987e10cc 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/GraphRelToProtoConverter.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/GraphRelToProtoConverter.java @@ -260,6 +260,12 @@ public RelNode visit(GraphLogicalPathExpand pxd) { pathExpandBuilder.setResultOpt(Utils.protoPathResultOpt(pxd.getResultOpt())); GraphAlgebra.Range range = buildRange(pxd.getOffset(), pxd.getFetch()); pathExpandBuilder.setHopRange(range); + if (pxd.getUntilCondition() != null) { + OuterExpression.Expression untilCondition = + pxd.getUntilCondition() + .accept(new RexToProtoConverter(true, isColumnId, this.rexBuilder)); + pathExpandBuilder.setCondition(untilCondition); + } if (pxd.getAliasId() != AliasInference.DEFAULT_ID) { pathExpandBuilder.setAlias(Utils.asAliasId(pxd.getAliasId())); } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/RexToProtoConverter.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/RexToProtoConverter.java index b44d67f794f0..63e6d5696f19 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/RexToProtoConverter.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/runtime/proto/RexToProtoConverter.java @@ -174,15 +174,24 @@ private OuterExpression.Expression visitMapValueConstructor(RexCall call) { key instanceof RexLiteral, "key type of 'MAP_VALUE_CONSTRUCTOR' should be 'literal', but is " + key.getClass()); - Preconditions.checkArgument( - value instanceof RexGraphVariable, - "value type of 'MAP_VALUE_CONSTRUCTOR' should be 'variable', but is " - + value.getClass()); - varMapBuilder.addKeyVals( + OuterExpression.ExprOpr valueOpr = value.accept(this).getOperators(0); + OuterExpression.VariableKeyValue.Builder keyValueBuilder = OuterExpression.VariableKeyValue.newBuilder() - .setKey(key.accept(this).getOperators(0).getConst()) - .setValue(value.accept(this).getOperators(0).getVar()) - .build()); + .setKey(key.accept(this).getOperators(0).getConst()); + switch (valueOpr.getItemCase()) { + case VAR: + keyValueBuilder.setVal(valueOpr.getVar()); + break; + case MAP: + keyValueBuilder.setNested(valueOpr.getMap()); + break; + default: + throw new IllegalArgumentException( + "can not convert value [" + + value + + "] of 'MAP_VALUE_CONSTRUCTOR' to physical plan"); + } + varMapBuilder.addKeyVals(keyValueBuilder); } return OuterExpression.Expression.newBuilder() .addOperators( diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/GraphBuilder.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/GraphBuilder.java index 8c83cb7adf47..8c7485178992 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/GraphBuilder.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/GraphBuilder.java @@ -59,10 +59,8 @@ import org.apache.calcite.sql.type.IntervalSqlType; import org.apache.calcite.sql.type.SqlTypeName; import org.apache.calcite.tools.RelBuilder; -import org.apache.calcite.util.ImmutableBitSet; import org.apache.calcite.util.Litmus; import org.apache.calcite.util.Pair; -import org.apache.calcite.util.Sarg; import org.apache.commons.lang3.ObjectUtils; import org.checkerframework.checker.nullness.qual.Nullable; @@ -219,6 +217,7 @@ public GraphBuilder pathExpand(PathExpandConfig pxdConfig) { fetchNode, pxdConfig.getResultOpt(), pxdConfig.getPathOpt(), + pxdConfig.getUntilCondition(), pxdConfig.getAlias(), getAliasNameWithId( pxdConfig.getStartAlias(), @@ -932,10 +931,11 @@ public GraphBuilder filter(Iterable conditions) { private AbstractBindableTableScan fuseFilters( AbstractBindableTableScan tableScan, RexNode condition, GraphBuilder builder) { - List labelValues = Lists.newArrayList(); - List uniqueKeyFilters = Lists.newArrayList(); - List extraFilters = Lists.newArrayList(); - classifyFilters(tableScan, condition, labelValues, uniqueKeyFilters, extraFilters); + RexFilterClassifier classifier = new RexFilterClassifier(builder, tableScan); + ClassifiedFilter filterResult = classifier.classify(condition); + List labelValues = filterResult.getLabelValues(); + List uniqueKeyFilters = Lists.newArrayList(filterResult.getUniqueKeyFilters()); + List extraFilters = Lists.newArrayList(filterResult.getExtraFilters()); if (!labelValues.isEmpty()) { GraphLabelType labelType = ((GraphSchemaType) tableScan.getRowType().getFieldList().get(0).getType()) @@ -983,6 +983,10 @@ private AbstractBindableTableScan fuseFilters( originalUniqueKeyFilters.accept(propertyChecker); builder.filter(originalUniqueKeyFilters); } + if (!uniqueKeyFilters.isEmpty()) { + builder.filter(uniqueKeyFilters); + uniqueKeyFilters.clear(); + } } ImmutableList originalFilters = tableScan.getFilters(); if (ObjectUtils.isNotEmpty(originalFilters)) { @@ -991,6 +995,8 @@ private AbstractBindableTableScan fuseFilters( } if (!extraFilters.isEmpty()) { extraFilters.forEach(k -> k.accept(propertyChecker)); + builder.filter(extraFilters); + extraFilters.clear(); } tableScan = (AbstractBindableTableScan) builder.build(); } @@ -998,11 +1004,11 @@ private AbstractBindableTableScan fuseFilters( } if (tableScan instanceof GraphLogicalSource && !uniqueKeyFilters.isEmpty()) { GraphLogicalSource source = (GraphLogicalSource) tableScan; - Preconditions.checkArgument( - source.getUniqueKeyFilters() == null, - "can not add unique key filters if original is not empty"); - source.setUniqueKeyFilters( - RexUtil.composeDisjunction(this.getRexBuilder(), uniqueKeyFilters)); + if (source.getUniqueKeyFilters() != null || uniqueKeyFilters.size() > 1) { + extraFilters.addAll(uniqueKeyFilters); + } else { + source.setUniqueKeyFilters(uniqueKeyFilters.get(0)); + } } if (!extraFilters.isEmpty()) { ImmutableList originalFilters = tableScan.getFilters(); @@ -1031,14 +1037,10 @@ private AbstractLogicalMatch fuseFilters( RexNode condition, List extraFilters, GraphBuilder builder) { - List labelFilters = Lists.newArrayList(); - for (RexNode conjunction : RelOptUtil.conjunctions(condition)) { - if (isLabelEqualFilter(conjunction) != null) { - labelFilters.add(conjunction); - } else { - extraFilters.add(conjunction); - } - } + RexFilterClassifier classifier = new RexFilterClassifier(builder, null); + ClassifiedFilter filter = classifier.classify(condition); + List labelFilters = filter.getLabelFilters(); + extraFilters.addAll(filter.getExtraFilters()); for (RexNode labelFilter : labelFilters) { PushFilterVisitor visitor = new PushFilterVisitor(builder, labelFilter); match = (AbstractLogicalMatch) match.accept(visitor); @@ -1049,161 +1051,6 @@ private AbstractLogicalMatch fuseFilters( return match; } - private void classifyFilters( - AbstractBindableTableScan tableScan, - RexNode condition, - List labelValues, - List uniqueKeyFilters, // unique key filters int the list are composed by 'OR' - List filters) { - List conjunctions = RelOptUtil.conjunctions(condition); - List filtersToRemove = Lists.newArrayList(); - for (RexNode conjunction : conjunctions) { - RexLiteral labelLiteral = isLabelEqualFilter(conjunction); - if (labelLiteral != null) { - filtersToRemove.add(conjunction); - labelValues.addAll( - com.alibaba.graphscope.common.ir.tools.Utils.getValuesAsList( - labelLiteral.getValueAs(Comparable.class))); - break; - } - } - if (tableScan instanceof GraphLogicalSource - && ((GraphLogicalSource) tableScan).getUniqueKeyFilters() == null) { - // try to extract unique key filters from the original condition - List disjunctions = RelOptUtil.disjunctions(condition); - for (RexNode disjunction : disjunctions) { - if (isUniqueKeyEqualFilter(disjunction, tableScan)) { - filtersToRemove.add(disjunction); - uniqueKeyFilters.add(disjunction); - } - } - } - if (!filtersToRemove.isEmpty()) { - conjunctions.removeAll(filtersToRemove); - } - filters.addAll(conjunctions); - } - - // check the condition if it is the pattern of label equal filter, i.e. ~label = 'person' or - // ~label within ['person', 'software'] - // if it is then return the literal containing label values, otherwise null - private @Nullable RexLiteral isLabelEqualFilter(RexNode condition) { - if (condition instanceof RexCall) { - RexCall rexCall = (RexCall) condition; - SqlOperator operator = rexCall.getOperator(); - switch (operator.getKind()) { - case EQUALS: - case SEARCH: - RexNode left = rexCall.getOperands().get(0); - RexNode right = rexCall.getOperands().get(1); - if (left.getType() instanceof GraphLabelType && right instanceof RexLiteral) { - Comparable value = ((RexLiteral) right).getValue(); - // if Sarg is a continuous range then the filter is not the 'equal', i.e. - // ~label SEARCH [[1, 10]] which means ~label >= 1 and ~label <= 10 - if (value instanceof Sarg && !((Sarg) value).isPoints()) { - return null; - } - return (RexLiteral) right; - } else if (right.getType() instanceof GraphLabelType - && left instanceof RexLiteral) { - Comparable value = ((RexLiteral) left).getValue(); - if (value instanceof Sarg && !((Sarg) value).isPoints()) { - return null; - } - return (RexLiteral) left; - } - default: - return null; - } - } else { - return null; - } - } - - // check the condition if it is the pattern of unique key equal filter, i.e. ~id = 1 or ~id - // within [1, 2] - private boolean isUniqueKeyEqualFilter(RexNode condition, RelNode tableScan) { - if (condition instanceof RexCall) { - RexCall rexCall = (RexCall) condition; - SqlOperator operator = rexCall.getOperator(); - switch (operator.getKind()) { - case EQUALS: - case SEARCH: - RexNode left = rexCall.getOperands().get(0); - RexNode right = rexCall.getOperands().get(1); - if (isUniqueKey(left, tableScan) && isLiteralOrDynamicParams(right)) { - if (right instanceof RexLiteral) { - Comparable value = ((RexLiteral) right).getValue(); - // if Sarg is a continuous range then the filter is not the 'equal', - // i.e. ~id SEARCH [[1, 10]] which means ~id >= 1 and ~id <= 10 - if (value instanceof Sarg && !((Sarg) value).isPoints()) { - return false; - } - } - return true; - } else if (isUniqueKey(right, tableScan) && isLiteralOrDynamicParams(left)) { - if (left instanceof RexLiteral) { - Comparable value = ((RexLiteral) left).getValue(); - if (value instanceof Sarg && !((Sarg) value).isPoints()) { - return false; - } - } - return true; - } - default: - return false; - } - } else { - return false; - } - } - - private boolean isUniqueKey(RexNode rexNode, RelNode tableScan) { - if (rexNode instanceof RexGraphVariable) { - return isUniqueKey((RexGraphVariable) rexNode, tableScan); - } - return false; - } - - private boolean isUniqueKey(RexGraphVariable var, RelNode tableScan) { - if (var.getProperty() == null) return false; - switch (var.getProperty().getOpt()) { - case ID: - return true; - case KEY: - GraphSchemaType schemaType = - (GraphSchemaType) tableScan.getRowType().getFieldList().get(0).getType(); - ImmutableBitSet propertyIds = getPropertyIds(var.getProperty(), schemaType); - if (!propertyIds.isEmpty() && tableScan.getTable().isKey(propertyIds)) { - return true; - } - case LABEL: - case ALL: - case LEN: - default: - return false; - } - } - - private ImmutableBitSet getPropertyIds(GraphProperty property, GraphSchemaType schemaType) { - if (property.getOpt() != GraphProperty.Opt.KEY) return ImmutableBitSet.of(); - GraphNameOrId key = property.getKey(); - if (key.getOpt() == GraphNameOrId.Opt.ID) { - return ImmutableBitSet.of(key.getId()); - } - for (int i = 0; i < schemaType.getFieldList().size(); ++i) { - RelDataTypeField field = schemaType.getFieldList().get(i); - if (field.getName().equals(key.getName())) { - return ImmutableBitSet.of(i); - } - } - return ImmutableBitSet.of(); - } - - private boolean isLiteralOrDynamicParams(RexNode node) { - return node instanceof RexLiteral || node instanceof RexDynamicParam; - } - // return the top node if its type is Filter, otherwise null private Filter topFilter() { if (this.size() > 0 && this.peek() instanceof Filter) { @@ -1971,7 +1818,7 @@ public GraphBuilder as(String alias) { fetch == null ? -1 : ((RexLiteral) fetch).getValueAs(Integer.class)) .startAlias(pxdExpand.getStartAlias().getAliasName()) .alias(alias); - pathExpand(pxdBuilder.build()); + pathExpand(pxdBuilder.buildConfig()); } else if (top instanceof GraphLogicalProject) { GraphLogicalProject project = (GraphLogicalProject) top; project(project.getProjects(), Lists.newArrayList(alias), project.isAppend()); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/GraphPlanner.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/GraphPlanner.java index 9b5c4a2c46e6..4e3f65d1b50a 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/GraphPlanner.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/GraphPlanner.java @@ -18,8 +18,10 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.config.FrontendConfig; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.fetcher.StaticIrMetaFetcher; import com.alibaba.graphscope.common.ir.meta.procedure.StoredProcedureMeta; -import com.alibaba.graphscope.common.ir.meta.reader.LocalMetaDataReader; +import com.alibaba.graphscope.common.ir.meta.reader.LocalIrMetaReader; import com.alibaba.graphscope.common.ir.meta.schema.GraphOptSchema; import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; import com.alibaba.graphscope.common.ir.planner.GraphIOProcessor; @@ -30,8 +32,6 @@ import com.alibaba.graphscope.common.ir.runtime.ffi.FfiPhysicalBuilder; import com.alibaba.graphscope.common.ir.runtime.proto.GraphRelProtoPhysicalBuilder; import com.alibaba.graphscope.common.ir.type.GraphTypeFactoryImpl; -import com.alibaba.graphscope.common.store.ExperimentalMetaFetcher; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.cypher.antlr4.parser.CypherAntlr4Parser; import com.alibaba.graphscope.cypher.antlr4.visitor.LogicalPlanVisitor; import com.google.common.base.Preconditions; @@ -67,11 +67,14 @@ public class GraphPlanner { public static final Function rexBuilderFactory = (Configs configs) -> new GraphRexBuilder(new GraphTypeFactoryImpl(configs)); - public GraphPlanner(Configs graphConfig, LogicalPlanFactory logicalPlanFactory) { + public GraphPlanner( + Configs graphConfig, + LogicalPlanFactory logicalPlanFactory, + GraphRelOptimizer optimizer) { this.graphConfig = graphConfig; - this.optimizer = new GraphRelOptimizer(this.graphConfig); - this.rexBuilder = rexBuilderFactory.apply(graphConfig); + this.optimizer = optimizer; this.logicalPlanFactory = logicalPlanFactory; + this.rexBuilder = rexBuilderFactory.apply(graphConfig); } public PlannerInstance instance(String query, IrMeta irMeta) { @@ -196,15 +199,18 @@ public static void main(String[] args) throws Exception { + " 'optional '"); } Configs configs = Configs.Factory.create(args[0]); - ExperimentalMetaFetcher metaFetcher = - new ExperimentalMetaFetcher(new LocalMetaDataReader(configs)); + GraphRelOptimizer optimizer = new GraphRelOptimizer(configs); + StaticIrMetaFetcher metaFetcher = + new StaticIrMetaFetcher( + new LocalIrMetaReader(configs), optimizer.getGlogueHolder()); String query = FileUtils.readFileToString(new File(args[1]), StandardCharsets.UTF_8); GraphPlanner planner = new GraphPlanner( configs, (GraphBuilder builder, IrMeta irMeta, String q) -> new LogicalPlanVisitor(builder, irMeta) - .visit(new CypherAntlr4Parser().parse(q))); + .visit(new CypherAntlr4Parser().parse(q)), + optimizer); PlannerInstance instance = planner.instance(query, metaFetcher.fetch().get()); Summary summary = instance.plan(); // write physical plan to file diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/LogicalPlanFactory.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/LogicalPlanFactory.java index 276927dff5ea..069062046641 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/LogicalPlanFactory.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/LogicalPlanFactory.java @@ -16,7 +16,7 @@ package com.alibaba.graphscope.common.ir.tools; -import com.alibaba.graphscope.common.store.IrMeta; +import com.alibaba.graphscope.common.ir.meta.IrMeta; public interface LogicalPlanFactory { LogicalPlan create(GraphBuilder builder, IrMeta irMeta, String query); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/QueryCache.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/QueryCache.java index 1e40971112b8..7832667722df 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/QueryCache.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/QueryCache.java @@ -18,8 +18,8 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.config.FrontendConfig; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.runtime.PhysicalPlan; -import com.alibaba.graphscope.common.store.IrMeta; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/config/PathExpandConfig.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/config/PathExpandConfig.java index 10a1c5ae26d6..469dd5b06129 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/config/PathExpandConfig.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/tools/config/PathExpandConfig.java @@ -19,20 +19,15 @@ import com.alibaba.graphscope.common.ir.rel.graph.GraphLogicalExpand; import com.alibaba.graphscope.common.ir.rel.graph.GraphLogicalGetV; import com.alibaba.graphscope.common.ir.rel.type.AliasNameWithId; -import com.alibaba.graphscope.common.ir.rex.RexGraphVariable; import com.alibaba.graphscope.common.ir.tools.AliasInference; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; -import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import org.apache.calcite.plan.GraphOptCluster; import org.apache.calcite.rel.RelNode; -import org.apache.calcite.rex.RexLiteral; import org.apache.calcite.rex.RexNode; -import org.apache.calcite.sql.SqlOperator; import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.List; import java.util.Objects; /** @@ -47,6 +42,7 @@ public class PathExpandConfig { private final GraphOpt.PathExpandPath pathOpt; private final GraphOpt.PathExpandResult resultOpt; + private final @Nullable RexNode untilCondition; @Nullable private final String alias; @Nullable private final String startAlias; @@ -58,17 +54,7 @@ protected PathExpandConfig( int fetch, GraphOpt.PathExpandResult resultOpt, GraphOpt.PathExpandPath pathOpt, - @Nullable String alias) { - this(expand, getV, offset, fetch, resultOpt, pathOpt, alias, null); - } - - protected PathExpandConfig( - RelNode expand, - RelNode getV, - int offset, - int fetch, - GraphOpt.PathExpandResult resultOpt, - GraphOpt.PathExpandPath pathOpt, + @Nullable RexNode untilCondition, @Nullable String alias, @Nullable String startAlias) { this.expand = Objects.requireNonNull(expand); @@ -77,6 +63,7 @@ protected PathExpandConfig( this.fetch = fetch; this.resultOpt = resultOpt; this.pathOpt = pathOpt; + this.untilCondition = untilCondition; this.alias = alias; this.startAlias = startAlias; } @@ -117,6 +104,10 @@ public RelNode getGetV() { return getV; } + public @Nullable RexNode getUntilCondition() { + return untilCondition; + } + @Override public String toString() { StringBuilder builder = new StringBuilder(); @@ -127,14 +118,15 @@ public String toString() { builder.append(", fetch=" + fetch); builder.append(", pathOpt=" + pathOpt); builder.append(", resultOpt=" + resultOpt); + if (untilCondition != null) { + builder.append(", untilCondition=" + untilCondition); + } builder.append(", alias='" + alias + '\''); builder.append("}"); return builder.toString(); } - public static final class Builder { - private final GraphBuilder innerBuilder; - + public static final class Builder extends GraphBuilder { private RelNode expand; private RelNode getV; @@ -144,91 +136,66 @@ public static final class Builder { private GraphOpt.PathExpandPath pathOpt; private GraphOpt.PathExpandResult resultOpt; + private @Nullable RexNode untilCondition; + @Nullable private String alias; @Nullable private String startAlias; - protected Builder(GraphBuilder innerBuilder) { - this.innerBuilder = - GraphBuilder.create( - innerBuilder.getContext(), - (GraphOptCluster) innerBuilder.getCluster(), - innerBuilder.getRelOptSchema()); + protected Builder(GraphBuilder parentBuilder) { + super( + parentBuilder.getContext(), + (GraphOptCluster) parentBuilder.getCluster(), + parentBuilder.getRelOptSchema()); + if (parentBuilder.size() > 0) { + this.push(parentBuilder.peek()); + } this.pathOpt = GraphOpt.PathExpandPath.ARBITRARY; this.resultOpt = GraphOpt.PathExpandResult.END_V; } public Builder expand(ExpandConfig config) { if (this.getV == null && this.expand == null) { + GraphLogicalExpand expandRel = (GraphLogicalExpand) super.expand(config).build(); this.expand = GraphLogicalExpand.create( - (GraphOptCluster) innerBuilder.getCluster(), + (GraphOptCluster) expandRel.getCluster(), ImmutableList.of(), null, - config.getOpt(), - innerBuilder.getTableConfig( - config.getLabels(), GraphOpt.Source.EDGE), + expandRel.getOpt(), + expandRel.getTableConfig(), AliasInference.DEFAULT_NAME, AliasNameWithId.DEFAULT); - innerBuilder.push(this.expand); + push(this.expand); } return this; } public Builder getV(GetVConfig config) { if (this.expand != null && this.getV == null) { + GraphLogicalGetV getVRel = (GraphLogicalGetV) super.getV(config).build(); this.getV = GraphLogicalGetV.create( - (GraphOptCluster) innerBuilder.getCluster(), + (GraphOptCluster) getVRel.getCluster(), ImmutableList.of(), null, - config.getOpt(), - innerBuilder.getTableConfig( - config.getLabels(), GraphOpt.Source.VERTEX), + getVRel.getOpt(), + getVRel.getTableConfig(), AliasInference.DEFAULT_NAME, AliasNameWithId.DEFAULT); - // (the alias of endV is given in the getV - // base) - innerBuilder.push(this.getV); + push(this.getV); } return this; } public Builder filter(RexNode... conjunctions) { - Preconditions.checkArgument( - this.getV != null || this.expand != null, - "expand and getV are all null in path_expand"); - innerBuilder.filter(conjunctions); - return this; + return (Builder) super.filter(conjunctions); } - public Builder filter(List conjunctions) { - Preconditions.checkArgument( - this.getV != null || this.expand != null, - "expand and getV are all null in path_expand"); - innerBuilder.filter(conjunctions); + public Builder untilCondition(@Nullable RexNode untilCondition) { + this.untilCondition = untilCondition; return this; } - public RexGraphVariable variable(@Nullable String alias) { - return innerBuilder.variable(alias); - } - - public RexGraphVariable variable(@Nullable String alias, String property) { - return innerBuilder.variable(alias, property); - } - - public RexLiteral literal(@Nullable Object value) { - return innerBuilder.literal(value); - } - - public RexNode call(SqlOperator operator, RexNode... operands) { - return innerBuilder.call(operator, operands); - } - - public RexNode call(SqlOperator operator, Iterable operands) { - return innerBuilder.call(operator, operands); - } - public Builder range(int offset, int fetch) { this.offset = offset; this.fetch = fetch; @@ -255,13 +222,17 @@ public Builder startAlias(@Nullable String startAlias) { return this; } - public PathExpandConfig build() { + public PathExpandConfig buildConfig() { return new PathExpandConfig( - expand, getV, offset, fetch, resultOpt, pathOpt, alias, startAlias); - } - - public GraphBuilder getInnerBuilder() { - return innerBuilder; + expand, + getV, + offset, + fetch, + resultOpt, + pathOpt, + untilCondition, + alias, + startAlias); } } } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/type/GraphTypeInference.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/type/GraphTypeInference.java index 083257b6b6b6..5efd51bc12c7 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/type/GraphTypeInference.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/ir/type/GraphTypeInference.java @@ -658,6 +658,7 @@ private RelNode newRel(RelNode rel, RelDataType newType) { pxd.getFetch(), pxd.getResultOpt(), pxd.getPathOpt(), + pxd.getUntilCondition(), pxd.getAliasName(), pxd.getStartAlias()); } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/manager/IrMetaQueryCallback.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/manager/IrMetaQueryCallback.java index 98605ae1330f..41f196192c98 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/manager/IrMetaQueryCallback.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/manager/IrMetaQueryCallback.java @@ -16,8 +16,8 @@ package com.alibaba.graphscope.common.manager; -import com.alibaba.graphscope.common.store.IrMeta; -import com.alibaba.graphscope.common.store.IrMetaFetcher; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.fetcher.IrMetaFetcher; import java.util.Optional; @@ -37,6 +37,10 @@ public IrMeta beforeExec() { return metaOpt.get(); } + public IrMetaFetcher getMetaFetcher() { + return fetcher; + } + // do sth after the query is done public void afterExec(IrMeta meta) {} } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/ExperimentalMetaFetcher.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/ExperimentalMetaFetcher.java deleted file mode 100644 index 8e241b0debab..000000000000 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/ExperimentalMetaFetcher.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ - -package com.alibaba.graphscope.common.store; - -import com.alibaba.graphscope.common.ir.meta.procedure.GraphStoredProcedures; -import com.alibaba.graphscope.common.ir.meta.reader.MetaDataReader; -import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; -import com.alibaba.graphscope.common.ir.meta.schema.IrGraphStatistics; - -import java.util.Optional; - -public class ExperimentalMetaFetcher implements IrMetaFetcher { - private final IrMeta meta; - - public ExperimentalMetaFetcher(MetaDataReader dataReader) throws Exception { - this.meta = - new IrMeta( - new IrGraphSchema(dataReader), - new IrGraphStatistics(dataReader), - new GraphStoredProcedures(dataReader)); - } - - @Override - public Optional fetch() { - return Optional.of(this.meta); - } -} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/IrMeta.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/IrMeta.java deleted file mode 100644 index 043cd77b878f..000000000000 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/IrMeta.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ - -package com.alibaba.graphscope.common.store; - -import com.alibaba.graphscope.common.ir.meta.procedure.StoredProcedures; -import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; -import com.alibaba.graphscope.groot.common.schema.api.GraphStatistics; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.io.IOException; -import java.util.Objects; - -public class IrMeta { - private final SnapshotId snapshotId; - private final IrGraphSchema schema; - private final GraphStatistics statistics; - private final @Nullable StoredProcedures storedProcedures; - - public IrMeta(IrGraphSchema schema) throws IOException { - this(SnapshotId.createEmpty(), schema); - } - - public IrMeta(IrGraphSchema schema, StoredProcedures storedProcedures) { - this(SnapshotId.createEmpty(), schema, storedProcedures); - } - - public IrMeta( - IrGraphSchema schema, GraphStatistics statistics, StoredProcedures storedProcedures) { - this(SnapshotId.createEmpty(), schema, statistics, storedProcedures); - } - - public IrMeta(IrGraphSchema schema, GraphStatistics statistics) { - this(SnapshotId.createEmpty(), schema, statistics); - } - - public IrMeta(SnapshotId snapshotId, IrGraphSchema schema) throws IOException { - this.snapshotId = Objects.requireNonNull(snapshotId); - this.schema = Objects.requireNonNull(schema); - this.statistics = null; - this.storedProcedures = null; - } - - public IrMeta(SnapshotId snapshotId, IrGraphSchema schema, StoredProcedures storedProcedures) { - this.snapshotId = Objects.requireNonNull(snapshotId); - this.schema = Objects.requireNonNull(schema); - this.statistics = null; - this.storedProcedures = Objects.requireNonNull(storedProcedures); - } - - public IrMeta(SnapshotId snapshotId, IrGraphSchema schema, GraphStatistics statistics) { - this.snapshotId = Objects.requireNonNull(snapshotId); - this.schema = Objects.requireNonNull(schema); - this.statistics = Objects.requireNonNull(statistics); - this.storedProcedures = null; - } - - public IrMeta( - SnapshotId snapshotId, - IrGraphSchema schema, - GraphStatistics statistics, - StoredProcedures storedProcedures) { - this.snapshotId = Objects.requireNonNull(snapshotId); - this.schema = Objects.requireNonNull(schema); - this.statistics = Objects.requireNonNull(statistics); - this.storedProcedures = Objects.requireNonNull(storedProcedures); - } - - public IrGraphSchema getSchema() { - return schema; - } - - public SnapshotId getSnapshotId() { - return snapshotId; - } - - public @Nullable StoredProcedures getStoredProcedures() { - return storedProcedures; - } - - public GraphStatistics getStatistics() { - return statistics; - } -} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/IrMetaFetcher.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/IrMetaFetcher.java deleted file mode 100644 index 6017a4b030c5..000000000000 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/IrMetaFetcher.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ - -package com.alibaba.graphscope.common.store; - -import java.util.Optional; - -public interface IrMetaFetcher { - Optional fetch(); -} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/SnapshotId.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/SnapshotId.java deleted file mode 100644 index 095143d4f942..000000000000 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/store/SnapshotId.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ - -package com.alibaba.graphscope.common.store; - -public class SnapshotId { - public static final SnapshotId createEmpty() { - return new SnapshotId(false, -1); - } - - private final boolean acquired; - private final long id; - - public SnapshotId(boolean acquired, long id) { - this.acquired = acquired; - this.id = id; - } - - public boolean isAcquired() { - return acquired; - } - - public long getId() { - return id; - } -} diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/utils/FileUtils.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/utils/FileUtils.java index ffa5e8992d22..56963f782550 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/utils/FileUtils.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/common/utils/FileUtils.java @@ -16,7 +16,7 @@ package com.alibaba.graphscope.common.utils; -import com.alibaba.graphscope.common.ir.meta.reader.FileFormatType; +import com.alibaba.graphscope.common.ir.meta.schema.FileFormatType; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.io.Resources; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/GraphBuilderVisitor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/GraphBuilderVisitor.java index 4c01a27c8510..936f21ad321c 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/GraphBuilderVisitor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/GraphBuilderVisitor.java @@ -95,7 +95,9 @@ public GraphBuilder visitOC_PatternElementChain( // path_expand if (literalCtx != null && literalCtx.oC_IntegerLiteral().size() > 1) { builder.pathExpand( - new PathExpandBuilderVisitor(this).visitOC_PatternElementChain(ctx).build()); + new PathExpandBuilderVisitor(this) + .visitOC_PatternElementChain(ctx) + .buildConfig()); // extract the end vertex from path_expand results if (ctx.oC_NodePattern() != null) { builder.getV(Utils.getVConfig(ctx.oC_NodePattern())); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/LogicalPlanVisitor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/LogicalPlanVisitor.java index bfd51e6f475a..8472fd682812 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/LogicalPlanVisitor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/LogicalPlanVisitor.java @@ -16,13 +16,13 @@ package com.alibaba.graphscope.cypher.antlr4.visitor; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.meta.procedure.StoredProcedureMeta; import com.alibaba.graphscope.common.ir.rel.graph.AbstractBindableTableScan; import com.alibaba.graphscope.common.ir.rel.graph.match.GraphLogicalMultiMatch; import com.alibaba.graphscope.common.ir.rel.graph.match.GraphLogicalSingleMatch; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; import com.alibaba.graphscope.common.ir.tools.LogicalPlan; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.grammar.CypherGSBaseVisitor; import com.alibaba.graphscope.grammar.CypherGSParser; import com.google.common.collect.ImmutableList; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/PathExpandBuilderVisitor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/PathExpandBuilderVisitor.java index 3794010fab37..4f2c376f7764 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/PathExpandBuilderVisitor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/PathExpandBuilderVisitor.java @@ -64,11 +64,10 @@ public PathExpandConfig.Builder visitOC_NodePattern(CypherGSParser.OC_NodePatter public PathExpandConfig.Builder visitOC_Properties(CypherGSParser.OC_PropertiesContext ctx) { return (ctx == null) ? builder - : builder.filter( - Utils.propertyFilters( - this.builder.getInnerBuilder(), - this.parent.getExpressionVisitor(), - ctx)); + : (PathExpandConfig.Builder) + builder.filter( + Utils.propertyFilters( + this.builder, this.parent.getExpressionVisitor(), ctx)); } @Override diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/ProcedureCallVisitor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/ProcedureCallVisitor.java index 73573b270870..ffaf9e4f2221 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/ProcedureCallVisitor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/antlr4/visitor/ProcedureCallVisitor.java @@ -16,11 +16,11 @@ package com.alibaba.graphscope.cypher.antlr4.visitor; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.procedure.GraphStoredProcedures; import com.alibaba.graphscope.common.ir.meta.procedure.StoredProcedureMeta; -import com.alibaba.graphscope.common.ir.meta.procedure.StoredProcedures; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; import com.alibaba.graphscope.common.ir.tools.GraphStdOperatorTable; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.grammar.CypherGSBaseVisitor; import com.alibaba.graphscope.grammar.CypherGSParser; import com.google.common.base.Preconditions; @@ -79,7 +79,7 @@ public RexNode visitOC_ImplicitProcedureInvocation( public SqlOperator visitOC_ProcedureNameAsOperator(CypherGSParser.OC_ProcedureNameContext ctx) { String procedureName = ctx.getText(); StoredProcedureMeta meta = null; - StoredProcedures procedures = irMeta.getStoredProcedures(); + GraphStoredProcedures procedures = irMeta.getStoredProcedures(); Preconditions.checkArgument( procedures != null && (meta = procedures.getStoredProcedure(procedureName)) != null, "procedure %s not found", diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/executor/GraphQueryExecutor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/executor/GraphQueryExecutor.java index ff7e914a6791..0abe0b3cfc0f 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/executor/GraphQueryExecutor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/executor/GraphQueryExecutor.java @@ -21,11 +21,11 @@ import com.alibaba.graphscope.common.client.type.ExecutionResponseListener; import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.config.QueryTimeoutConfig; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.tools.GraphPlanner; import com.alibaba.graphscope.common.ir.tools.QueryCache; import com.alibaba.graphscope.common.ir.tools.QueryIdGenerator; import com.alibaba.graphscope.common.manager.IrMetaQueryCallback; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.gaia.proto.IrResult; import com.google.common.base.Preconditions; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/integration/suite/ldbc/LdbcQueries.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/integration/suite/ldbc/LdbcQueries.java index 8781d6dd37eb..528ec6f9cb53 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/integration/suite/ldbc/LdbcQueries.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/integration/suite/ldbc/LdbcQueries.java @@ -145,6 +145,38 @@ public static QueryContext get_ldbc_4_test() { return new QueryContext(query, expected); } + // minor diff with get_ldbc_4_test since in experiment store the date is in a different format + // (e.g., 20120629020000000) + public static QueryContext get_ldbc_4_test_exp() { + String query = + "MATCH (person:PERSON {id:" + + " 10995116278874})-[:KNOWS]-(friend:PERSON)<-[:HASCREATOR]-(post:POST)-[:HASTAG]->(tag:" + + " TAG)\n" + + "WITH DISTINCT tag, post\n" + + "WITH tag,\n" + + " CASE\n" + + " WHEN post.creationDate < 20120629020000000 AND post.creationDate >=" + + " 20120601000000000 THEN 1\n" + + " ELSE 0\n" + + " END AS valid,\n" + + " CASE\n" + + " WHEN 20120601000000000 > post.creationDate THEN 1\n" + + " ELSE 0\n" + + " END AS inValid\n" + + "WITH tag, sum(valid) AS postCount, sum(inValid) AS inValidPostCount\n" + + "WHERE postCount>0 AND inValidPostCount=0\n" + + "\n" + + "RETURN tag.name AS tagName, postCount\n" + + "ORDER BY postCount DESC, tagName ASC\n" + + "LIMIT 10;"; + List expected = + Arrays.asList( + "Record<{tagName: \"Norodom_Sihanouk\", postCount: 3}>", + "Record<{tagName: \"George_Clooney\", postCount: 1}>", + "Record<{tagName: \"Louis_Philippe_I\", postCount: 1}>"); + return new QueryContext(query, expected); + } + public static QueryContext get_ldbc_6_test() { String query = "MATCH (person:PERSON" diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/result/CypherRecordParser.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/result/CypherRecordParser.java index cfb75c3aa219..ae2b90497d86 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/result/CypherRecordParser.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/cypher/result/CypherRecordParser.java @@ -24,6 +24,7 @@ import com.alibaba.graphscope.common.result.Utils; import com.alibaba.graphscope.gaia.proto.Common; import com.alibaba.graphscope.gaia.proto.IrResult; +import com.alibaba.graphscope.gremlin.exception.GremlinResultParserException; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -119,6 +120,30 @@ protected AnyValue parseEntry(IrResult.Entry entry, @Nullable RelDataType dataTy } } + protected AnyValue parseElement(IrResult.KeyValues.KeyValue value, RelDataType type) { + switch (value.getValueCase()) { + case ELEMENT: + return parseElement(value.getElement(), type); + case NESTED: + if (type instanceof ArbitraryMapType) { + return parseKeyValues( + value.getNested(), + ((ArbitraryMapType) type).getKeyTypes(), + ((ArbitraryMapType) type).getValueTypes()); + } else { + return parseKeyValues( + value.getNested(), type.getKeyType(), type.getValueType()); + } + default: + throw new GremlinResultParserException( + "keyValue [" + + value + + "] has invalid value type [" + + value.getValueCase() + + "]"); + } + } + protected AnyValue parseElement(IrResult.Element element, @Nullable RelDataType dataType) { switch (element.getInnerCase()) { case VERTEX: @@ -195,9 +220,7 @@ protected AnyValue parseKeyValues( .getKeyValuesList() .forEach( entry -> { - valueMap.put( - entry.getKey().getStr(), - parseElement(entry.getValue(), valueType)); + valueMap.put(entry.getKey().getStr(), parseElement(entry, valueType)); }); return VirtualValues.fromMap(valueMap, valueMap.size(), 0); } @@ -216,8 +239,7 @@ protected AnyValue parseKeyValues( Map valueMap = Maps.newLinkedHashMap(); for (int i = 0; i < entries.size(); ++i) { IrResult.KeyValues.KeyValue entry = entries.get(i); - valueMap.put( - entry.getKey().getStr(), parseElement(entry.getValue(), valueTypes.get(i))); + valueMap.put(entry.getKey().getStr(), parseElement(entry, valueTypes.get(i))); } return VirtualValues.fromMap(valueMap, valueMap.size(), 0); } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/antlr4x/visitor/GraphBuilderVisitor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/antlr4x/visitor/GraphBuilderVisitor.java index 816513273e60..a8fb65ab15d3 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/antlr4x/visitor/GraphBuilderVisitor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/antlr4x/visitor/GraphBuilderVisitor.java @@ -355,7 +355,7 @@ public GraphBuilder visitTraversalMethod_endV(GremlinGSParser.TraversalMethod_en public GraphBuilder visitTraversalMethod_out(GremlinGSParser.TraversalMethod_outContext ctx) { if (pathExpandPattern(ctx.oC_ListLiteral(), ctx.oC_Expression())) { return builder.pathExpand( - new PathExpandBuilderVisitor(this).visitTraversalMethod_out(ctx).build()); + new PathExpandBuilderVisitor(this).visitTraversalMethod_out(ctx).buildConfig()); } else { return builder.expand( new ExpandConfig( @@ -369,7 +369,7 @@ public GraphBuilder visitTraversalMethod_out(GremlinGSParser.TraversalMethod_out public GraphBuilder visitTraversalMethod_in(GremlinGSParser.TraversalMethod_inContext ctx) { if (pathExpandPattern(ctx.oC_ListLiteral(), ctx.oC_Expression())) { return builder.pathExpand( - new PathExpandBuilderVisitor(this).visitTraversalMethod_in(ctx).build()); + new PathExpandBuilderVisitor(this).visitTraversalMethod_in(ctx).buildConfig()); } else { return builder.expand( new ExpandConfig( @@ -383,7 +383,9 @@ public GraphBuilder visitTraversalMethod_in(GremlinGSParser.TraversalMethod_inCo public GraphBuilder visitTraversalMethod_both(GremlinGSParser.TraversalMethod_bothContext ctx) { if (pathExpandPattern(ctx.oC_ListLiteral(), ctx.oC_Expression())) { return builder.pathExpand( - new PathExpandBuilderVisitor(this).visitTraversalMethod_both(ctx).build()); + new PathExpandBuilderVisitor(this) + .visitTraversalMethod_both(ctx) + .buildConfig()); } else { return builder.expand( new ExpandConfig( @@ -791,6 +793,10 @@ public GraphBuilder getGraphBuilder() { return this.builder; } + public ExprUniqueAliasInfer getAliasInfer() { + return this.aliasInfer; + } + private RelBuilder.GroupKey convertGroupKeyBy( GremlinGSParser.TraversalMethod_group_keybyContext keyCtx) { String defaultAlias = Column.keys.name(); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/antlr4x/visitor/PathExpandBuilderVisitor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/antlr4x/visitor/PathExpandBuilderVisitor.java index 1d90c1726955..d986e58a3bfb 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/antlr4x/visitor/PathExpandBuilderVisitor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/antlr4x/visitor/PathExpandBuilderVisitor.java @@ -16,6 +16,7 @@ package com.alibaba.graphscope.gremlin.antlr4x.visitor; +import com.alibaba.graphscope.common.antlr4.ExprVisitorResult; import com.alibaba.graphscope.common.ir.tools.config.*; import com.alibaba.graphscope.grammar.GremlinGSBaseVisitor; import com.alibaba.graphscope.grammar.GremlinGSParser; @@ -26,10 +27,12 @@ public class PathExpandBuilderVisitor extends GremlinGSBaseVisitor { private final PathExpandConfig.Builder builder; + private final GraphBuilderVisitor parent; public PathExpandBuilderVisitor(GraphBuilderVisitor parent) { // PATH_OPT = ARBITRARY and RESULT_OPT = END_V are set by default this.builder = PathExpandConfig.newBuilder(parent.getGraphBuilder()); + this.parent = parent; } @Override @@ -93,14 +96,21 @@ public PathExpandConfig.Builder visitTraversalMethod_both( public PathExpandConfig.Builder visitTraversalMethod_with( GremlinGSParser.TraversalMethod_withContext ctx) { String optKey = (String) LiteralVisitor.INSTANCE.visit(ctx.StringLiteral()); - Object optValue = LiteralVisitor.INSTANCE.visit(ctx.oC_Literal()); switch (optKey.toUpperCase()) { case "PATH_OPT": + Object pathValue = LiteralVisitor.INSTANCE.visit(ctx.oC_Literal()); return builder.pathOpt( - GraphOpt.PathExpandPath.valueOf(String.valueOf(optValue).toUpperCase())); + GraphOpt.PathExpandPath.valueOf(String.valueOf(pathValue).toUpperCase())); case "RESULT_OPT": + Object resultValue = LiteralVisitor.INSTANCE.visit(ctx.oC_Literal()); return builder.resultOpt( - GraphOpt.PathExpandResult.valueOf(String.valueOf(optValue).toUpperCase())); + GraphOpt.PathExpandResult.valueOf( + String.valueOf(resultValue).toUpperCase())); + case "UNTIL": + ExprVisitorResult exprRes = + new ExtExpressionVisitor(builder, parent.getAliasInfer()) + .visitTraversalMethod_expr(ctx.traversalMethod_expr()); + return builder.untilCondition(exprRes.getExpr()); default: return builder; } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/integration/processor/IrTestOpProcessor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/integration/processor/IrTestOpProcessor.java index 48f820a479cb..42e06e957137 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/integration/processor/IrTestOpProcessor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/integration/processor/IrTestOpProcessor.java @@ -22,11 +22,11 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.config.FrontendConfig; import com.alibaba.graphscope.common.config.QueryTimeoutConfig; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.tools.GraphPlanner; import com.alibaba.graphscope.common.ir.tools.QueryCache; import com.alibaba.graphscope.common.ir.tools.QueryIdGenerator; import com.alibaba.graphscope.common.manager.IrMetaQueryCallback; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.gaia.proto.IrResult; import com.alibaba.graphscope.gremlin.integration.result.GraphProperties; import com.alibaba.graphscope.gremlin.integration.resultx.GremlinTestRecordParser; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/integration/suite/standard/IrGremlinQueryTest.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/integration/suite/standard/IrGremlinQueryTest.java index c82bea1a7b10..1e6c346c0bbc 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/integration/suite/standard/IrGremlinQueryTest.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/integration/suite/standard/IrGremlinQueryTest.java @@ -171,6 +171,21 @@ public abstract class IrGremlinQueryTest extends AbstractGremlinProcessTest { public abstract Traversal get_g_V_where_expr_name_equal_marko_and_age_gt_20_or_age_lt_10_name(); + public abstract Traversal get_g_V_path_expand_until_age_gt_30_values_age(); + + @LoadGraphWith(LoadGraphWith.GraphData.MODERN) + @Test + public void g_V_path_expand_until_age_gt_30_values_age() { + // the until condition follows a sql-like expression syntax, which can only be opened when + // language type is antlr_gremlin_calcite + assumeTrue("antlr_gremlin_calcite".equals(System.getenv("GREMLIN_SCRIPT_LANGUAGE_NAME"))); + final Traversal traversal = + get_g_V_path_expand_until_age_gt_30_values_age(); + printTraversalForm(traversal); + Assert.assertEquals(32, traversal.next()); + Assert.assertFalse(traversal.hasNext()); + } + @LoadGraphWith(LoadGraphWith.GraphData.MODERN) @Test public void g_V_select_expr_power_age_by_2() { @@ -1213,6 +1228,18 @@ public Traversal get_g_V_select_expr_2_xor_3_mult_2_limit_1() { .values("name"); } + @Override + public Traversal get_g_V_path_expand_until_age_gt_30_values_age() { + return ((IrCustomizedTraversal) + g.V().out("1..100", "knows") + .with( + "UNTIL", + com.alibaba.graphscope.gremlin.integration.suite.utils + .__.expr("_.age > 30", ExprStep.Type.FILTER))) + .endV() + .values("age"); + } + @Override public Traversal get_g_V_where_out_out_count() { return g.V().where(__.out().out()).count(); diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/processor/IrStandardOpProcessor.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/processor/IrStandardOpProcessor.java index 6e41705582e4..2f54bef0a07e 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/processor/IrStandardOpProcessor.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/processor/IrStandardOpProcessor.java @@ -33,10 +33,10 @@ import com.alibaba.graphscope.common.config.PegasusConfig; import com.alibaba.graphscope.common.config.QueryTimeoutConfig; import com.alibaba.graphscope.common.intermediate.InterOpCollection; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.tools.QueryCache; import com.alibaba.graphscope.common.ir.tools.QueryIdGenerator; import com.alibaba.graphscope.common.manager.IrMetaQueryCallback; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.gremlin.InterOpCollectionBuilder; import com.alibaba.graphscope.gremlin.Utils; import com.alibaba.graphscope.gremlin.plugin.MetricsCollector; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/processor/LifeCycleSupplier.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/processor/LifeCycleSupplier.java index 31541842a1b6..79691bc64cca 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/processor/LifeCycleSupplier.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/processor/LifeCycleSupplier.java @@ -20,9 +20,9 @@ import com.alibaba.graphscope.common.client.type.ExecutionRequest; import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.config.QueryTimeoutConfig; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.tools.GraphPlanner; import com.alibaba.graphscope.common.ir.tools.QueryCache; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.gaia.proto.IrResult; import com.alibaba.graphscope.gremlin.plugin.QueryStatusCallback; import com.alibaba.graphscope.gremlin.resultx.GremlinRecordParser; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/script/GremlinCalciteScriptEngineFactory.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/script/GremlinCalciteScriptEngineFactory.java index b9609c73f891..018e1495fbf0 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/script/GremlinCalciteScriptEngineFactory.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/plugin/script/GremlinCalciteScriptEngineFactory.java @@ -16,8 +16,8 @@ package com.alibaba.graphscope.gremlin.plugin.script; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.tools.QueryCache; -import com.alibaba.graphscope.common.store.IrMeta; import org.apache.tinkerpop.gremlin.jsr223.AbstractGremlinScriptEngineFactory; import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine; diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/result/ParserUtils.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/result/ParserUtils.java index efa51fa1df8f..9484adaf88a1 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/result/ParserUtils.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/result/ParserUtils.java @@ -217,11 +217,27 @@ public static Object parseEntry(IrResult.Entry entry) { k -> { valueMap.put( ParserUtils.parseCommonValue(k.getKey()), - ParserUtils.parseElement(k.getValue())); + ParserUtils.parseElement(k)); }); return valueMap; default: throw new GremlinResultParserException("invalid " + entry.getInnerCase().name()); } } + + public static Object parseElement(IrResult.KeyValues.KeyValue value) { + switch (value.getValueCase()) { + case ELEMENT: + return parseElement(value.getElement()); + case NESTED: + return parseEntry(IrResult.Entry.newBuilder().setMap(value.getNested()).build()); + default: + throw new GremlinResultParserException( + "keyValue [" + + value + + "] has invalid value type [" + + value.getValueCase() + + "]"); + } + } } diff --git a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/resultx/GremlinRecordParser.java b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/resultx/GremlinRecordParser.java index 5068e2d7e540..fe490220539d 100644 --- a/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/resultx/GremlinRecordParser.java +++ b/interactive_engine/compiler/src/main/java/com/alibaba/graphscope/gremlin/resultx/GremlinRecordParser.java @@ -161,7 +161,7 @@ private Map parseKeyValues( .getKeyValuesList() .forEach( entry -> { - Object value = parseElement(entry.getValue(), valueType); + Object value = parseElement(entry, valueType); if (value != null) { valueMap.put(parseMapKey(entry.getKey().getStr()), value); } @@ -183,7 +183,7 @@ private Map parseKeyValues( Map valueMap = Maps.newLinkedHashMap(); for (int i = 0; i < entries.size(); ++i) { IrResult.KeyValues.KeyValue entry = entries.get(i); - Object value = parseElement(entry.getValue(), valueTypes.get(i)); + Object value = parseElement(entry, valueTypes.get(i)); if (value != null) { valueMap.put(parseMapKey(entry.getKey().getStr()), value); } @@ -219,6 +219,30 @@ private Object parseElement(IrResult.Element element, RelDataType type) { } } + private Object parseElement(IrResult.KeyValues.KeyValue value, RelDataType type) { + switch (value.getValueCase()) { + case ELEMENT: + return parseElement(value.getElement(), type); + case NESTED: + if (type instanceof ArbitraryMapType) { + return parseKeyValues( + value.getNested(), + ((ArbitraryMapType) type).getKeyTypes(), + ((ArbitraryMapType) type).getValueTypes()); + } else { + return parseKeyValues( + value.getNested(), type.getKeyType(), type.getValueType()); + } + default: + throw new GremlinResultParserException( + "keyValue [" + + value + + "] has invalid value type [" + + value.getValueCase() + + "]"); + } + } + private Vertex parseVertex(IrResult.Vertex vertex, RelDataType type) { return new DetachedVertex( vertex.getId(), diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/config/YamlConfigTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/config/YamlConfigTest.java index 8382c92d3f52..addf56aef907 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/config/YamlConfigTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/config/YamlConfigTest.java @@ -16,9 +16,10 @@ package com.alibaba.graphscope.common.config; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.meta.procedure.GraphStoredProcedures; import com.alibaba.graphscope.common.ir.meta.procedure.StoredProcedureMeta; -import com.alibaba.graphscope.common.ir.meta.reader.LocalMetaDataReader; +import com.alibaba.graphscope.common.ir.meta.reader.LocalIrMetaReader; import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; import org.junit.Assert; @@ -36,8 +37,8 @@ public void hiactor_config_test() throws Exception { public void procedure_config_test() throws Exception { YamlConfigs configs = new YamlConfigs("config/gs_interactive_hiactor.yaml", FileLoadType.RESOURCES); - GraphStoredProcedures procedures = - new GraphStoredProcedures(new LocalMetaDataReader(configs)); + IrMeta irMeta = new LocalIrMetaReader(configs).readMeta(); + GraphStoredProcedures procedures = irMeta.getStoredProcedures(); StoredProcedureMeta meta = procedures.getStoredProcedure("ldbc_ic2"); Assert.assertEquals( "StoredProcedureMeta{name='ldbc_ic2', returnType=RecordType(CHAR(1) name)," @@ -75,7 +76,8 @@ public void pegasus_config_test() throws Exception { public void schema_config_test() throws Exception { YamlConfigs configs = new YamlConfigs("config/gs_interactive_hiactor.yaml", FileLoadType.RESOURCES); - IrGraphSchema graphSchema = new IrGraphSchema(new LocalMetaDataReader(configs)); + IrMeta irMeta = new LocalIrMetaReader(configs).readMeta(); + IrGraphSchema graphSchema = irMeta.getSchema(); Assert.assertEquals( "DefaultGraphVertex{labelId=0, label=person," + " propertyList=[DefaultGraphProperty{id=0, name=id, dataType=LONG}," diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/ExpandTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/ExpandTest.java index dd6ec127c8c5..989ba93b32cf 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/ExpandTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/ExpandTest.java @@ -75,7 +75,12 @@ public void expand_2_test() { // SIMPLE).with('RESULT_OPT', ALL_V) @Test public void expand_3_test() { - GraphBuilder builder = Utils.mockGraphBuilder(); + GraphBuilder builder = + Utils.mockGraphBuilder() + .source( + new SourceConfig( + GraphOpt.Source.VERTEX, + new LabelConfig(false).addLabel("person"))); PathExpandConfig.Builder pxdBuilder = PathExpandConfig.newBuilder(builder); PathExpandConfig pxdConfig = pxdBuilder @@ -95,7 +100,7 @@ public void expand_3_test() { .range(1, 3) .pathOpt(GraphOpt.PathExpandPath.SIMPLE) .resultOpt(GraphOpt.PathExpandResult.ALL_V) - .build(); + .buildConfig(); RelNode pathExpand = builder.source( new SourceConfig( @@ -149,7 +154,12 @@ public void expand_4_test() { // g.V().hasLabel("person").as("a").outE("knows").select("a").out("1..3", "knows") @Test public void expand_5_test() { - GraphBuilder builder = Utils.mockGraphBuilder(); + GraphBuilder builder = + Utils.mockGraphBuilder() + .source( + new SourceConfig( + GraphOpt.Source.VERTEX, + new LabelConfig(false).addLabel("person"))); PathExpandConfig.Builder pxdBuilder = PathExpandConfig.newBuilder(builder); PathExpandConfig pxdConfig = pxdBuilder @@ -163,7 +173,7 @@ public void expand_5_test() { new LabelConfig(false).addLabel("person"))) .range(1, 3) .startAlias("a") - .build(); + .buildConfig(); RelNode expand = builder.source( new SourceConfig( diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/QueryCacheTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/QueryCacheTest.java index de2be9cc48fc..28da1579b214 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/QueryCacheTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/QueryCacheTest.java @@ -17,10 +17,11 @@ package com.alibaba.graphscope.common.ir; import com.alibaba.graphscope.common.config.Configs; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; import com.alibaba.graphscope.common.ir.tools.GraphPlanner; import com.alibaba.graphscope.common.ir.tools.QueryCache; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.cypher.antlr4.parser.CypherAntlr4Parser; import com.alibaba.graphscope.cypher.antlr4.visitor.LogicalPlanVisitor; import com.google.common.collect.ImmutableMap; @@ -38,7 +39,8 @@ public void query_cache_1_test() { configs, (GraphBuilder builder, IrMeta irMeta, String q) -> new LogicalPlanVisitor(builder, irMeta) - .visit(new CypherAntlr4Parser().parse(q))); + .visit(new CypherAntlr4Parser().parse(q)), + new GraphRelOptimizer(configs)); QueryCache cache = new QueryCache(configs, graphPlanner); QueryCache.Key key1 = cache.createKey("Match (n {name: 'ma'}) Return n", Utils.schemaMeta); Assert.assertEquals( @@ -61,7 +63,8 @@ public void query_cache_2_test() throws Exception { configs, (GraphBuilder builder, IrMeta irMeta, String q) -> new LogicalPlanVisitor(builder, irMeta) - .visit(new CypherAntlr4Parser().parse(q))); + .visit(new CypherAntlr4Parser().parse(q)), + new GraphRelOptimizer(configs)); QueryCache cache = new QueryCache(configs, graphPlanner); QueryCache.Key key1 = cache.createKey("Match (n {name: 'ma'}) Return n", Utils.schemaMeta); QueryCache.Key key2 = cache.createKey("Match (n {age: 10}) Return n", Utils.schemaMeta); diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/Utils.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/Utils.java index b3a9451f0287..0d94f23b6eea 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/Utils.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/Utils.java @@ -19,7 +19,10 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.config.FrontendConfig; import com.alibaba.graphscope.common.config.GraphConfig; -import com.alibaba.graphscope.common.ir.meta.reader.LocalMetaDataReader; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.IrMetaTracker; +import com.alibaba.graphscope.common.ir.meta.fetcher.StaticIrMetaFetcher; +import com.alibaba.graphscope.common.ir.meta.reader.LocalIrMetaReader; import com.alibaba.graphscope.common.ir.meta.schema.GraphOptSchema; import com.alibaba.graphscope.common.ir.planner.GraphHepPlanner; import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; @@ -27,9 +30,6 @@ import com.alibaba.graphscope.common.ir.tools.GraphBuilderFactory; import com.alibaba.graphscope.common.ir.tools.GraphRexBuilder; import com.alibaba.graphscope.common.ir.type.GraphTypeFactoryImpl; -import com.alibaba.graphscope.common.store.ExperimentalMetaFetcher; -import com.alibaba.graphscope.common.store.IrMeta; -import com.alibaba.graphscope.common.utils.FileUtils; import com.google.common.collect.ImmutableMap; import org.apache.calcite.plan.GraphOptCluster; @@ -41,10 +41,8 @@ import org.apache.calcite.rel.type.RelDataTypeFactory; import org.apache.calcite.rex.RexBuilder; import org.apache.calcite.tools.RelBuilderFactory; -import org.yaml.snakeyaml.Yaml; import java.net.URL; -import java.util.Map; public class Utils { public static final Configs configs = @@ -94,53 +92,36 @@ public static final RelOptPlanner mockPlanner(RelRule.Config... rules) { return new GraphHepPlanner(hepBuilder.build()); } - public static IrMeta mockSchemaMeta(String schemaJson) { + public static IrMeta mockSchemaMeta(String schemaPath) { try { URL schemaResource = - Thread.currentThread().getContextClassLoader().getResource(schemaJson); - URL statisticsResource = - Thread.currentThread() - .getContextClassLoader() - .getResource("statistics/modern_statistics.json"); - String yamlStr = FileUtils.readJsonFromResource("config/modern/graph.yaml"); - Yaml yaml = new Yaml(); - Map yamlMap = yaml.load(yamlStr); - String proceduresYaml = yaml.dump(yamlMap.get("stored_procedures")); + Thread.currentThread().getContextClassLoader().getResource(schemaPath); Configs configs = new Configs( ImmutableMap.of( GraphConfig.GRAPH_SCHEMA.getKey(), - schemaResource.toURI().getPath(), - GraphConfig.GRAPH_STATISTICS.getKey(), - statisticsResource.toURI().getPath(), - GraphConfig.GRAPH_STORED_PROCEDURES_YAML.getKey(), - proceduresYaml)); - return new ExperimentalMetaFetcher(new LocalMetaDataReader(configs)).fetch().get(); + schemaResource.toURI().getPath())); + return new StaticIrMetaFetcher(new LocalIrMetaReader(configs), null).fetch().get(); } catch (Exception e) { throw new RuntimeException(e); } } - public static IrMeta mockIrMeta(String schemaJson, String statisticsJson) { + public static IrMeta mockIrMeta( + String schemaJson, String statisticsJson, IrMetaTracker tracker) { try { URL schemaResource = Thread.currentThread().getContextClassLoader().getResource(schemaJson); URL statisticsResource = Thread.currentThread().getContextClassLoader().getResource(statisticsJson); - String yamlStr = FileUtils.readJsonFromResource("config/modern/graph.yaml"); - Yaml yaml = new Yaml(); - Map yamlMap = yaml.load(yamlStr); - String proceduresYaml = yaml.dump(yamlMap.get("stored_procedures")); Configs configs = new Configs( ImmutableMap.of( GraphConfig.GRAPH_SCHEMA.getKey(), schemaResource.toURI().getPath(), GraphConfig.GRAPH_STATISTICS.getKey(), - statisticsResource.toURI().getPath(), - GraphConfig.GRAPH_STORED_PROCEDURES_YAML.getKey(), - proceduresYaml)); - return new ExperimentalMetaFetcher(new LocalMetaDataReader(configs)).fetch().get(); + statisticsResource.toURI().getPath())); + return new StaticIrMetaFetcher(new LocalIrMetaReader(configs), tracker).fetch().get(); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/BITest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/BITest.java index c5a2bac7c2ee..c6349c8f2b51 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/BITest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/BITest.java @@ -20,10 +20,10 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.ir.Utils; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.planner.GraphIOProcessor; import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; -import com.alibaba.graphscope.common.store.IrMeta; import com.google.common.collect.ImmutableMap; import org.apache.calcite.rel.RelNode; @@ -52,7 +52,8 @@ public static void beforeClass() { irMeta = Utils.mockIrMeta( "schema/ldbc_schema_exp_hierarchy.json", - "statistics/ldbc30_hierarchy_statistics.json"); + "statistics/ldbc30_hierarchy_statistics.json", + optimizer.getGlogueHolder()); } @Test diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/CBOTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/CBOTest.java index 8e4ff6be26c6..8d53370bebea 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/CBOTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/CBOTest.java @@ -2,10 +2,10 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.ir.Utils; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.planner.GraphIOProcessor; import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; -import com.alibaba.graphscope.common.store.IrMeta; import com.google.common.collect.ImmutableMap; import org.apache.calcite.rel.RelNode; @@ -34,7 +34,8 @@ public static void beforeClass() { irMeta = Utils.mockIrMeta( "schema/ldbc_schema_exp_hierarchy.json", - "statistics/ldbc30_hierarchy_statistics.json"); + "statistics/ldbc30_hierarchy_statistics.json", + optimizer.getGlogueHolder()); } @Test @@ -192,4 +193,50 @@ public void Q4_test() { + " alias=[forum], opt=[VERTEX])", com.alibaba.graphscope.common.ir.tools.Utils.toString(after).trim()); } + + @Test + public void Q5_test() { + GraphBuilder builder = Utils.mockGraphBuilder(optimizer, irMeta); + + // The optimized order is from 'b' to 'a', which is opposite to the user-given order. + // Verify that the path expand type is correctly inferred in this situation. + RelNode before1 = + com.alibaba.graphscope.cypher.antlr4.Utils.eval( + "Match (a)-[*1..2]->(b:COMMENT) Return a", builder) + .build(); + RelNode after1 = optimizer.optimize(before1, new GraphIOProcessor(builder, irMeta)); + Assert.assertEquals( + "GraphLogicalProject(a=[a], isAppend=[false])\n" + + " GraphLogicalGetV(tableConfig=[{isAll=false, tables=[PERSON, COMMENT]}]," + + " alias=[a], opt=[END])\n" + + " GraphLogicalPathExpand(fused=[GraphPhysicalExpand(tableConfig=[[EdgeLabel(LIKES," + + " PERSON, COMMENT), EdgeLabel(REPLYOF, COMMENT, COMMENT)]], alias=[_]," + + " opt=[IN], physicalOpt=[VERTEX])\n" + + "], offset=[1], fetch=[1], path_opt=[ARBITRARY], result_opt=[END_V]," + + " alias=[_], start_alias=[b])\n" + + " GraphLogicalSource(tableConfig=[{isAll=false, tables=[COMMENT]}]," + + " alias=[b], opt=[VERTEX])", + after1.explain().trim()); + + // check the type of path expand if the order is from 'a' to 'b' + RelNode before2 = + com.alibaba.graphscope.cypher.antlr4.Utils.eval( + "Match (a {id: 1})-[*1..2]->(b:COMMENT) Return a", builder) + .build(); + RelNode after2 = optimizer.optimize(before2, new GraphIOProcessor(builder, irMeta)); + Assert.assertEquals( + "GraphLogicalProject(a=[a], isAppend=[false])\n" + + " GraphLogicalGetV(tableConfig=[{isAll=false, tables=[COMMENT]}], alias=[b]," + + " opt=[END])\n" + + " GraphLogicalPathExpand(fused=[GraphPhysicalGetV(tableConfig=[{isAll=false," + + " tables=[COMMENT]}], alias=[_], opt=[END], physicalOpt=[ITSELF])\n" + + " GraphPhysicalExpand(tableConfig=[[EdgeLabel(LIKES, PERSON, COMMENT)," + + " EdgeLabel(REPLYOF, COMMENT, COMMENT)]], alias=[_], opt=[OUT]," + + " physicalOpt=[VERTEX])\n" + + "], offset=[1], fetch=[1], path_opt=[ARBITRARY], result_opt=[END_V]," + + " alias=[_], start_alias=[a])\n" + + " GraphLogicalSource(tableConfig=[{isAll=false, tables=[PERSON," + + " COMMENT]}], alias=[a], fusedFilter=[[=(_.id, 1)]], opt=[VERTEX])", + after2.explain().trim()); + } } diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/LdbcTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/LdbcTest.java index 73ea2d1a408a..55f0278d9ec2 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/LdbcTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/LdbcTest.java @@ -2,10 +2,10 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.ir.Utils; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.planner.GraphIOProcessor; import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; -import com.alibaba.graphscope.common.store.IrMeta; import com.google.common.collect.ImmutableMap; import org.apache.calcite.rel.RelNode; @@ -31,7 +31,11 @@ public static void beforeClass() { "NotMatchToAntiJoinRule, FilterIntoJoinRule, FilterMatchRule," + " ExtendIntersectRule, ExpandGetVFusionRule")); optimizer = new GraphRelOptimizer(configs); - irMeta = Utils.mockIrMeta("schema/ldbc.json", "statistics/ldbc30_statistics.json"); + irMeta = + Utils.mockIrMeta( + "schema/ldbc.json", + "statistics/ldbc30_statistics.json", + optimizer.getGlogueHolder()); } @Test diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/STPathTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/STPathTest.java index 32b79316e36d..d31d763a125e 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/STPathTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/cbo/STPathTest.java @@ -20,13 +20,13 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.ir.Utils; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.planner.GraphIOProcessor; import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.common.ir.runtime.PhysicalBuilder; import com.alibaba.graphscope.common.ir.runtime.proto.GraphRelProtoPhysicalBuilder; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; import com.alibaba.graphscope.common.ir.tools.LogicalPlan; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.common.utils.FileUtils; import com.google.common.collect.ImmutableMap; @@ -55,7 +55,11 @@ public static void beforeClass() { + " ExtendIntersectRule, JoinDecompositionRule," + " ExpandGetVFusionRule")); optimizer = new GraphRelOptimizer(configs); - irMeta = Utils.mockIrMeta("schema/ldbc.json", "statistics/ldbc30_statistics.json"); + irMeta = + Utils.mockIrMeta( + "schema/ldbc.json", + "statistics/ldbc30_statistics.json", + optimizer.getGlogueHolder()); } @Test diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/rbo/ExpandGetVFusionTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/rbo/ExpandGetVFusionTest.java index cd71d1a92696..a840b51464ff 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/rbo/ExpandGetVFusionTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/rbo/ExpandGetVFusionTest.java @@ -413,7 +413,12 @@ public void expand_getv_fusion_8_test() { // SIMPLE).with('RESULT_OPT', ALL_V) @Test public void path_expand_getv_fusion_0_test() { - GraphBuilder builder = Utils.mockGraphBuilder(); + GraphBuilder builder = + Utils.mockGraphBuilder() + .source( + new SourceConfig( + GraphOpt.Source.VERTEX, + new LabelConfig(false).addLabel("person"))); PathExpandConfig.Builder pxdBuilder = PathExpandConfig.newBuilder(builder); PathExpandConfig pxdConfig = pxdBuilder @@ -428,7 +433,7 @@ public void path_expand_getv_fusion_0_test() { .range(1, 3) .pathOpt(GraphOpt.PathExpandPath.SIMPLE) .resultOpt(GraphOpt.PathExpandResult.ALL_V) - .build(); + .buildConfig(); RelNode before = builder.source( new SourceConfig( @@ -465,7 +470,12 @@ public void path_expand_getv_fusion_0_test() { // eq(10)).with('PATH_OPT', SIMPLE).with('RESULT_OPT', ALL_V) @Test public void path_expand_getv_fusion_1_test() { - GraphBuilder builder = Utils.mockGraphBuilder(); + GraphBuilder builder = + Utils.mockGraphBuilder() + .source( + new SourceConfig( + GraphOpt.Source.VERTEX, + new LabelConfig(false).addLabel("person"))); PathExpandConfig.Builder pxdBuilder = PathExpandConfig.newBuilder(builder); PathExpandConfig pxdConfig = pxdBuilder @@ -485,7 +495,7 @@ public void path_expand_getv_fusion_1_test() { .range(1, 3) .pathOpt(GraphOpt.PathExpandPath.SIMPLE) .resultOpt(GraphOpt.PathExpandResult.ALL_V) - .build(); + .buildConfig(); RelNode before = builder.source( new SourceConfig( @@ -524,7 +534,12 @@ public void path_expand_getv_fusion_1_test() { // path expand with edge filters @Test public void path_expand_getv_fusion_2_test() { - GraphBuilder builder = Utils.mockGraphBuilder(); + GraphBuilder builder = + Utils.mockGraphBuilder() + .source( + new SourceConfig( + GraphOpt.Source.VERTEX, + new LabelConfig(false).addLabel("person"))); PathExpandConfig.Builder pxdBuilder = PathExpandConfig.newBuilder(builder); PathExpandConfig pxdConfig = pxdBuilder @@ -544,7 +559,7 @@ public void path_expand_getv_fusion_2_test() { .range(1, 3) .pathOpt(GraphOpt.PathExpandPath.SIMPLE) .resultOpt(GraphOpt.PathExpandResult.ALL_V) - .build(); + .buildConfig(); RelNode before = builder.source( new SourceConfig( diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/rbo/FilterPushDownTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/rbo/FilterPushDownTest.java index c988bcc56ab9..be3036e1af52 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/rbo/FilterPushDownTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/planner/rbo/FilterPushDownTest.java @@ -54,7 +54,13 @@ public void push_filter_1_test() { // Match(x:person)-[:knows*1..3]->(z:person {age: 10}) @Test public void push_filter_2_test() { - GraphBuilder builder = Utils.mockGraphBuilder(); + GraphBuilder builder = + Utils.mockGraphBuilder() + .source( + new SourceConfig( + GraphOpt.Source.VERTEX, + new LabelConfig(false).addLabel("person"), + "x")); PathExpandConfig.Builder pxdBuilder = PathExpandConfig.newBuilder(builder); GetVConfig getVConfig = new GetVConfig(GraphOpt.GetV.END, new LabelConfig(false).addLabel("person"), "z"); @@ -68,16 +74,8 @@ public void push_filter_2_test() { .range(1, 3) .pathOpt(GraphOpt.PathExpandPath.SIMPLE) .resultOpt(GraphOpt.PathExpandResult.ALL_V) - .build(); - RelNode sentence = - builder.source( - new SourceConfig( - GraphOpt.Source.VERTEX, - new LabelConfig(false).addLabel("person"), - "x")) - .pathExpand(pxdConfig) - .getV(getVConfig) - .build(); + .buildConfig(); + RelNode sentence = builder.pathExpand(pxdConfig).getV(getVConfig).build(); RelNode before = builder.match(sentence, GraphOpt.Match.INNER) .filter( diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/runtime/FfiLogicalPlanTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/runtime/FfiLogicalPlanTest.java index 5f50439315db..fa2cc42c35e1 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/runtime/FfiLogicalPlanTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/runtime/FfiLogicalPlanTest.java @@ -40,7 +40,12 @@ public class FfiLogicalPlanTest { // Return count(*) @Test public void logical_plan_1_test() throws Exception { - GraphBuilder builder = Utils.mockGraphBuilder(); + GraphBuilder builder = + Utils.mockGraphBuilder() + .source( + new SourceConfig( + GraphOpt.Source.VERTEX, + new LabelConfig(false).addLabel("person"))); PathExpandConfig.Builder pxdBuilder = PathExpandConfig.newBuilder(builder); GetVConfig getVConfig = new GetVConfig(GraphOpt.GetV.END, new LabelConfig(false).addLabel("person")); @@ -54,7 +59,7 @@ public void logical_plan_1_test() throws Exception { .range(1, 3) .pathOpt(GraphOpt.PathExpandPath.SIMPLE) .resultOpt(GraphOpt.PathExpandResult.ALL_V) - .build(); + .buildConfig(); RelNode aggregate = builder.source( new SourceConfig( @@ -153,7 +158,7 @@ public void logical_plan_3_test() throws Exception { public void logical_plan_4_test() throws Exception { LogicalPlan logicalPlan = com.alibaba.graphscope.cypher.antlr4.Utils.evalLogicalPlan( - "Call ldbc_ic2(10l, 20120112l)"); + "Call ldbc_ic2(10l, 20120112l)", "config/modern/graph.yaml"); try (PhysicalBuilder ffiBuilder = new ProcedurePhysicalBuilder(logicalPlan)) { PhysicalPlan plan = ffiBuilder.build(); Assert.assertEquals( diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/runtime/GraphRelToProtoTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/runtime/GraphRelToProtoTest.java index 7ad5b8228796..e86f4dfc1426 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/runtime/GraphRelToProtoTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/common/ir/runtime/GraphRelToProtoTest.java @@ -18,6 +18,7 @@ import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.ir.Utils; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.planner.GraphIOProcessor; import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.common.ir.planner.rules.DegreeFusionRule; @@ -32,7 +33,6 @@ import com.alibaba.graphscope.common.ir.tools.config.LabelConfig; import com.alibaba.graphscope.common.ir.tools.config.PathExpandConfig; import com.alibaba.graphscope.common.ir.tools.config.SourceConfig; -import com.alibaba.graphscope.common.store.IrMeta; import com.alibaba.graphscope.common.utils.FileUtils; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -252,7 +252,12 @@ public void get_v_with_filter_test() throws Exception { @Test public void path_expand_test() throws Exception { - GraphBuilder builder = Utils.mockGraphBuilder(); + GraphBuilder builder = + Utils.mockGraphBuilder() + .source( + new SourceConfig( + GraphOpt.Source.VERTEX, + new LabelConfig(false).addLabel("person"))); PathExpandConfig.Builder pxdBuilder = PathExpandConfig.newBuilder(builder); PathExpandConfig pxdConfig = pxdBuilder @@ -267,7 +272,7 @@ public void path_expand_test() throws Exception { .range(1, 3) .pathOpt(GraphOpt.PathExpandPath.SIMPLE) .resultOpt(GraphOpt.PathExpandResult.ALL_V) - .build(); + .buildConfig(); RelNode pxd = builder.source( new SourceConfig( @@ -1031,7 +1036,12 @@ public void expand_vertex_with_filters_test() throws Exception { @Test public void path_expand_fused_test() throws Exception { - GraphBuilder builder = Utils.mockGraphBuilder(); + GraphBuilder builder = + Utils.mockGraphBuilder() + .source( + new SourceConfig( + GraphOpt.Source.VERTEX, + new LabelConfig(false).addLabel("person"))); PathExpandConfig.Builder pxdBuilder = PathExpandConfig.newBuilder(builder); PathExpandConfig pxdConfig = pxdBuilder @@ -1046,7 +1056,7 @@ public void path_expand_fused_test() throws Exception { .range(1, 3) .pathOpt(GraphOpt.PathExpandPath.SIMPLE) .resultOpt(GraphOpt.PathExpandResult.ALL_V) - .build(); + .buildConfig(); RelNode pxd = builder.source( new SourceConfig( @@ -1082,7 +1092,7 @@ public void path_expand_fused_test() throws Exception { @Test public void intersect_test() throws Exception { GraphRelOptimizer optimizer = getMockCBO(); - IrMeta irMeta = getMockCBOMeta(); + IrMeta irMeta = getMockCBOMeta(optimizer); GraphBuilder builder = Utils.mockGraphBuilder(optimizer, irMeta); RelNode before = com.alibaba.graphscope.cypher.antlr4.Utils.eval( @@ -1117,7 +1127,7 @@ public void intersect_test() throws Exception { try (PhysicalBuilder protoBuilder = new GraphRelProtoPhysicalBuilder( - getMockCBOConfig(), getMockCBOMeta(), new LogicalPlan(after))) { + getMockCBOConfig(), getMockCBOMeta(optimizer), new LogicalPlan(after))) { PhysicalPlan plan = protoBuilder.build(); Assert.assertEquals( FileUtils.readJsonFromResource("proto/intersect_test.json"), @@ -1126,7 +1136,9 @@ public void intersect_test() throws Exception { try (PhysicalBuilder protoBuilder = new GraphRelProtoPhysicalBuilder( - getMockPartitionedCBOConfig(), getMockCBOMeta(), new LogicalPlan(after))) { + getMockPartitionedCBOConfig(), + getMockCBOMeta(optimizer), + new LogicalPlan(after))) { PhysicalPlan plan = protoBuilder.build(); Assert.assertEquals( FileUtils.readJsonFromResource("proto/partitioned_intersect_test.json"), @@ -1137,7 +1149,7 @@ public void intersect_test() throws Exception { @Test public void intersect_test_02() throws Exception { GraphRelOptimizer optimizer = getMockCBO(); - IrMeta irMeta = getMockCBOMeta(); + IrMeta irMeta = getMockCBOMeta(optimizer); GraphBuilder builder = Utils.mockGraphBuilder(optimizer, irMeta); RelNode before = com.alibaba.graphscope.cypher.antlr4.Utils.eval( @@ -1178,7 +1190,7 @@ public void intersect_test_02() throws Exception { try (PhysicalBuilder protoBuilder = new GraphRelProtoPhysicalBuilder( - getMockCBOConfig(), getMockCBOMeta(), new LogicalPlan(after))) { + getMockCBOConfig(), getMockCBOMeta(optimizer), new LogicalPlan(after))) { PhysicalPlan plan = protoBuilder.build(); Assert.assertEquals( FileUtils.readJsonFromResource("proto/intersect_test_2.json"), @@ -1186,7 +1198,9 @@ public void intersect_test_02() throws Exception { } try (PhysicalBuilder protoBuilder = new GraphRelProtoPhysicalBuilder( - getMockPartitionedCBOConfig(), getMockCBOMeta(), new LogicalPlan(after))) { + getMockPartitionedCBOConfig(), + getMockCBOMeta(optimizer), + new LogicalPlan(after))) { PhysicalPlan plan = protoBuilder.build(); Assert.assertEquals( FileUtils.readJsonFromResource("proto/partitioned_intersect_test_2.json"), @@ -1224,10 +1238,11 @@ private GraphRelOptimizer getMockCBO() { return new GraphRelOptimizer(getMockCBOConfig()); } - private IrMeta getMockCBOMeta() { + private IrMeta getMockCBOMeta(GraphRelOptimizer optimizer) { return Utils.mockIrMeta( "schema/ldbc_schema_exp_hierarchy.json", - "statistics/ldbc30_hierarchy_statistics.json"); + "statistics/ldbc30_hierarchy_statistics.json", + optimizer.getGlogueHolder()); } private Configs getMockGraphConfig() { diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/CallProcedureTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/CallProcedureTest.java index 2d6bdd097b8a..21d58c06db55 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/CallProcedureTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/CallProcedureTest.java @@ -23,9 +23,11 @@ import org.junit.Test; public class CallProcedureTest { + @Test public void procedure_1_test() { - LogicalPlan logicalPlan = Utils.evalLogicalPlan("Call ldbc_ic2(10l, 20120112l)"); + LogicalPlan logicalPlan = + Utils.evalLogicalPlan("Call ldbc_ic2(10l, 20120112l)", "config/modern/graph.yaml"); Assert.assertEquals("ldbc_ic2(10:BIGINT, 20120112:BIGINT)", logicalPlan.explain().trim()); Assert.assertEquals( "RecordType(CHAR(1) name)", logicalPlan.getProcedureCall().getType().toString()); @@ -35,7 +37,7 @@ public void procedure_1_test() { @Test public void procedure_2_test() { try { - Utils.evalLogicalPlan("Call ldbc_ic2(10, 20120112l)"); + Utils.evalLogicalPlan("Call ldbc_ic2(10, 20120112l)", "config/modern/graph.yaml"); } catch (CalciteException e) { Assert.assertEquals( "Cannot apply ldbc_ic2 to arguments of type 'ldbc_ic2(, )'." diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/Utils.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/Utils.java index 66458285cce7..01f5d916d97a 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/Utils.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/Utils.java @@ -16,6 +16,7 @@ package com.alibaba.graphscope.cypher.antlr4; +import com.alibaba.graphscope.common.ir.meta.IrMeta; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; import com.alibaba.graphscope.common.ir.tools.LogicalPlan; import com.alibaba.graphscope.cypher.antlr4.parser.CypherAntlr4Parser; @@ -39,4 +40,12 @@ public static LogicalPlan evalLogicalPlan(String query) { graphBuilder, com.alibaba.graphscope.common.ir.Utils.schemaMeta); return logicalPlanVisitor.visit(new CypherAntlr4Parser().parse(query)); } + + public static LogicalPlan evalLogicalPlan(String query, String schemaPath) { + GraphBuilder graphBuilder = + com.alibaba.graphscope.common.ir.Utils.mockGraphBuilder(schemaPath); + IrMeta irMeta = com.alibaba.graphscope.common.ir.Utils.mockSchemaMeta(schemaPath); + LogicalPlanVisitor logicalPlanVisitor = new LogicalPlanVisitor(graphBuilder, irMeta); + return logicalPlanVisitor.visit(new CypherAntlr4Parser().parse(query)); + } } diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/integration/ldbc/IrLdbcTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/integration/ldbc/IrLdbcTest.java index dc4f4ba8816d..e4a553376ba2 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/integration/ldbc/IrLdbcTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/integration/ldbc/IrLdbcTest.java @@ -62,6 +62,14 @@ public void run_ldbc_4_test() { Assert.assertEquals(testQuery.getExpectedResult().toString(), result.list().toString()); } + @Test + public void run_ldbc_4_test_exp() { + assumeTrue("pegasus".equals(System.getenv("ENGINE_TYPE"))); + QueryContext testQuery = LdbcQueries.get_ldbc_4_test_exp(); + Result result = session.run(testQuery.getQuery()); + Assert.assertEquals(testQuery.getExpectedResult().toString(), result.list().toString()); + } + @Test public void run_ldbc_6_test() { QueryContext testQuery = LdbcQueries.get_ldbc_6_test(); diff --git a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/gremlin/antlr4x/GraphBuilderTest.java b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/gremlin/antlr4x/GraphBuilderTest.java index 61eee357fdee..26f5a7d6bb1e 100644 --- a/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/gremlin/antlr4x/GraphBuilderTest.java +++ b/interactive_engine/compiler/src/test/java/com/alibaba/graphscope/gremlin/antlr4x/GraphBuilderTest.java @@ -16,7 +16,11 @@ package com.alibaba.graphscope.gremlin.antlr4x; +import com.alibaba.graphscope.common.config.Configs; import com.alibaba.graphscope.common.ir.Utils; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.planner.GraphIOProcessor; +import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.common.ir.planner.rules.ExpandGetVFusionRule; import com.alibaba.graphscope.common.ir.runtime.proto.RexToProtoConverter; import com.alibaba.graphscope.common.ir.tools.GraphBuilder; @@ -29,6 +33,7 @@ import com.alibaba.graphscope.gremlin.antlr4x.parser.GremlinAntlr4Parser; import com.alibaba.graphscope.gremlin.antlr4x.visitor.GraphBuilderVisitor; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import com.google.protobuf.util.JsonFormat; import org.antlr.v4.runtime.tree.ParseTree; @@ -37,9 +42,36 @@ import org.apache.calcite.rex.RexBuilder; import org.apache.calcite.rex.RexNode; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; public class GraphBuilderTest { + private static Configs configs; + private static IrMeta irMeta; + private static GraphRelOptimizer optimizer; + + @BeforeClass + public static void beforeClass() { + configs = + new Configs( + ImmutableMap.of( + "graph.planner.is.on", + "true", + "graph.planner.opt", + "CBO", + "graph.planner.rules", + "FilterIntoJoinRule, FilterMatchRule, ExtendIntersectRule," + + " ExpandGetVFusionRule", + "graph.planner.cbo.glogue.schema", + "target/test-classes/statistics/modern_statistics.txt")); + optimizer = new GraphRelOptimizer(configs); + irMeta = + Utils.mockIrMeta( + "schema/modern.json", + "statistics/modern_statistics.json", + optimizer.getGlogueHolder()); + } + public static RelNode eval(String query) { GraphBuilder builder = Utils.mockGraphBuilder(); GraphBuilderVisitor visitor = new GraphBuilderVisitor(builder); @@ -47,6 +79,12 @@ public static RelNode eval(String query) { return visitor.visit(parseTree).build(); } + public static RelNode eval(String query, GraphBuilder builder) { + GraphBuilderVisitor visitor = new GraphBuilderVisitor(builder); + ParseTree parseTree = new GremlinAntlr4Parser().parse(query); + return visitor.visit(parseTree).build(); + } + @Test public void g_V_test() { RelNode node = eval("g.V()"); @@ -1595,4 +1633,72 @@ public void g_V_match_as_a_out_as_b_count_test() { + "], matchOpt=[INNER])", node.explain().trim()); } + + // the filter conditions `has('age', 10)` and `has("name", "male")` should be composed and fused + // into the person 'b' + @Test + public void g_V_match_as_a_out_as_b_hasLabel_has_out_as_c_count_test() { + GraphBuilder builder = Utils.mockGraphBuilder(optimizer, irMeta); + RelNode node = + eval( + "g.V().match(__.as(\"a\").out(\"knows\").as(\"b\").has('age', 10)," + + " __.as(\"b\").hasLabel(\"person\").has(\"name\"," + + " \"male\").out(\"knows\").as(\"c\")).count()", + builder); + RelNode after = optimizer.optimize(node, new GraphIOProcessor(builder, irMeta)); + Assert.assertEquals( + "GraphLogicalAggregate(keys=[{variables=[], aliases=[]}], values=[[{operands=[a, b," + + " c], aggFunction=COUNT, alias='$f0', distinct=false}]])\n" + + " GraphPhysicalExpand(tableConfig=[{isAll=false, tables=[knows]}]," + + " alias=[a], startAlias=[b], opt=[IN], physicalOpt=[VERTEX])\n" + + " GraphPhysicalExpand(tableConfig=[{isAll=false, tables=[knows]}]," + + " alias=[c], startAlias=[b], opt=[OUT], physicalOpt=[VERTEX])\n" + + " GraphLogicalSource(tableConfig=[{isAll=false, tables=[person]}]," + + " alias=[b], fusedFilter=[[AND(=(_.name, _UTF-8'male'), =(_.age, 10))]]," + + " opt=[VERTEX])", + after.explain().trim()); + } + + // id is the primary key of label 'person', should be fused as 'uniqueKeyFilters' + @Test + public void g_V_has_label_person_id_test() { + RelNode node = eval("g.V().has(\"person\", \"id\", 1)"); + Assert.assertEquals( + "GraphLogicalProject($f0=[_], isAppend=[false])\n" + + " GraphLogicalSource(tableConfig=[{isAll=false, tables=[person]}]," + + " alias=[_], opt=[VERTEX], uniqueKeyFilters=[=(_.id, 1)])", + node.explain().trim()); + } + + // id is not the primary key of label 'software', should be fused as 'fusedFilter' + @Test + public void g_V_has_label_software_id_test() { + RelNode node = eval("g.V().has(\"software\", \"id\", 1)"); + Assert.assertEquals( + "GraphLogicalProject($f0=[_], isAppend=[false])\n" + + " GraphLogicalSource(tableConfig=[{isAll=false, tables=[software]}]," + + " alias=[_], fusedFilter=[[=(_.id, 1)]], opt=[VERTEX])", + node.explain().trim()); + } + + @Test + public void g_V_path_expand_until_age_gt_30_values_age() { + RelNode node = + eval("g.V().out('1..3').with('UNTIL', expr(_.age > 30)).endV().values('age')"); + Assert.assertEquals( + "GraphLogicalProject(age=[age], isAppend=[false])\n" + + " GraphLogicalProject(age=[_.age], isAppend=[true])\n" + + " GraphLogicalGetV(tableConfig=[{isAll=true, tables=[software, person]}]," + + " alias=[_], opt=[END])\n" + + " " + + " GraphLogicalPathExpand(expand=[GraphLogicalExpand(tableConfig=[{isAll=true," + + " tables=[created, knows]}], alias=[_], opt=[OUT])\n" + + "], getV=[GraphLogicalGetV(tableConfig=[{isAll=true, tables=[software," + + " person]}], alias=[_], opt=[END])\n" + + "], offset=[1], fetch=[2], path_opt=[ARBITRARY], result_opt=[END_V]," + + " until_condition=[>(_.age, 30)], alias=[_])\n" + + " GraphLogicalSource(tableConfig=[{isAll=true, tables=[software," + + " person]}], alias=[_], opt=[VERTEX])", + node.explain().trim()); + } } diff --git a/interactive_engine/data-load-tool/src/main/java/com/alibaba/graphscope/groot/dataload/databuild/Codec.java b/interactive_engine/data-load-tool/src/main/java/com/alibaba/graphscope/groot/dataload/databuild/Codec.java index 0f86de06c722..5d08154b29ec 100644 --- a/interactive_engine/data-load-tool/src/main/java/com/alibaba/graphscope/groot/dataload/databuild/Codec.java +++ b/interactive_engine/data-load-tool/src/main/java/com/alibaba/graphscope/groot/dataload/databuild/Codec.java @@ -38,7 +38,11 @@ public class Codec { public Codec(GraphElement graphElement) { this.version = graphElement.getVersionId(); - + System.out.println( + "Created Codec with " + + graphElement.getLabel() + + " version " + + graphElement.getVersionId()); List propertyList = graphElement.getPropertyList(); propertyList.sort( (p1, p2) -> { diff --git a/interactive_engine/data-load-tool/src/main/java/com/alibaba/graphscope/groot/dataload/databuild/OfflineBuild.java b/interactive_engine/data-load-tool/src/main/java/com/alibaba/graphscope/groot/dataload/databuild/OfflineBuild.java index 59df27a76700..3ae51949a3fe 100644 --- a/interactive_engine/data-load-tool/src/main/java/com/alibaba/graphscope/groot/dataload/databuild/OfflineBuild.java +++ b/interactive_engine/data-load-tool/src/main/java/com/alibaba/graphscope/groot/dataload/databuild/OfflineBuild.java @@ -21,6 +21,7 @@ import com.alibaba.graphscope.groot.dataload.unified.UniConfig; import com.alibaba.graphscope.groot.sdk.GrootClient; import com.alibaba.graphscope.proto.groot.DataLoadTargetPb; +import com.alibaba.graphscope.proto.groot.GraphDefPb; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.hadoop.conf.Configuration; @@ -74,7 +75,9 @@ public static void main(String[] args) mappingConfig = Utils.parseColumnMapping(configStr); } List targets = Utils.getDataLoadTargets(mappingConfig); - GraphSchema schema = GraphDef.parseProto(client.prepareDataLoad(targets)); + GraphDefPb pb = client.prepareDataLoad(targets); + GraphSchema schema = GraphDef.parseProto(pb); + System.out.println("GraphSchema " + pb); int partitionNum = client.getPartitionNum(); Map info = new HashMap<>(); diff --git a/interactive_engine/executor/assembly/groot/src/store/graph.rs b/interactive_engine/executor/assembly/groot/src/store/graph.rs index 91c9e22167ca..a4b18e8f91cc 100644 --- a/interactive_engine/executor/assembly/groot/src/store/graph.rs +++ b/interactive_engine/executor/assembly/groot/src/store/graph.rs @@ -12,8 +12,8 @@ use groot_store::db::api::{ use groot_store::db::common::bytes::util::parse_pb; use groot_store::db::graph::store::GraphStore; use groot_store::db::proto::model::{ - AddEdgeKindPb, ConfigPb, CreateVertexTypePb, DataOperationPb, DdlOperationPb, EdgeIdPb, EdgeLocationPb, - OpTypePb, OperationBatchPb, OperationPb, VertexIdPb, + AddEdgeKindPb, AddVertexTypePropertiesPb, ConfigPb, CreateVertexTypePb, DataOperationPb, + DdlOperationPb, EdgeIdPb, EdgeLocationPb, OpTypePb, OperationBatchPb, OperationPb, VertexIdPb, }; use groot_store::db::proto::model::{CommitDataLoadPb, PrepareDataLoadPb}; use groot_store::db::proto::schema_common::{EdgeKindPb, LabelIdPb, TypeDefPb}; @@ -155,11 +155,21 @@ fn do_write_batch( has_ddl = true; } } + OpTypePb::ADD_VERTEX_TYPE_PROPERTIES => { + if add_vertex_type_properties(graph, snapshot_id, op)? { + has_ddl = true; + } + } OpTypePb::CREATE_EDGE_TYPE => { if create_edge_type(graph, snapshot_id, op)? { has_ddl = true; } } + OpTypePb::ADD_EDGE_TYPE_PROPERTIES => { + if add_edge_type_properties(graph, snapshot_id, op)? { + has_ddl = true; + } + } OpTypePb::ADD_EDGE_KIND => { if add_edge_kind(graph, snapshot_id, op)? { has_ddl = true; @@ -237,6 +247,21 @@ fn create_vertex_type( graph.create_vertex_type(snapshot_id, schema_version, label_id, &typedef, table_id) } +fn add_vertex_type_properties( + graph: &G, snapshot_id: i64, op: &OperationPb, +) -> GraphResult { + trace!("add_vertex_type_properties"); + let ddl_operation_pb = parse_pb::(op.get_dataBytes())?; + let schema_version = ddl_operation_pb.get_schemaVersion(); + let add_vertex_type_properties_pb = + parse_pb::(ddl_operation_pb.get_ddlBlob())?; + let table_id = add_vertex_type_properties_pb.get_tableIdx(); + let typedef_pb = add_vertex_type_properties_pb.get_typeDef(); + let label_id = typedef_pb.get_label_id().get_id(); + let typedef = TypeDef::from_proto(&typedef_pb)?; + graph.add_vertex_type_properties(snapshot_id, schema_version, label_id, &typedef, table_id) +} + fn drop_vertex_type( graph: &G, snapshot_id: i64, op: &OperationPb, ) -> GraphResult { @@ -260,6 +285,18 @@ fn create_edge_type( graph.create_edge_type(snapshot_id, schema_version, label_id, &typedef) } +fn add_edge_type_properties( + graph: &G, snapshot_id: i64, op: &OperationPb, +) -> GraphResult { + trace!("add_edge_type_properties"); + let ddl_operation_pb = parse_pb::(op.get_dataBytes())?; + let schema_version = ddl_operation_pb.get_schemaVersion(); + let typedef_pb = parse_pb::(ddl_operation_pb.get_ddlBlob())?; + let label_id = typedef_pb.get_label_id().get_id(); + let typedef = TypeDef::from_proto(&typedef_pb)?; + graph.add_edge_type_properties(snapshot_id, schema_version, label_id, &typedef) +} + fn drop_edge_type( graph: &G, snapshot_id: i64, op: &OperationPb, ) -> GraphResult { diff --git a/interactive_engine/executor/engine/pegasus/network/src/transport/block/mod.rs b/interactive_engine/executor/engine/pegasus/network/src/transport/block/mod.rs index 0f87123ca34f..936cd41080cd 100644 --- a/interactive_engine/executor/engine/pegasus/network/src/transport/block/mod.rs +++ b/interactive_engine/executor/engine/pegasus/network/src/transport/block/mod.rs @@ -19,6 +19,7 @@ use std::sync::atomic::AtomicBool; use std::sync::Arc; use std::time::Duration; +use crate::config::BlockMode; use crate::receive::start_net_receiver; use crate::send::start_net_sender; use crate::transport::ConnectionParams; @@ -55,6 +56,14 @@ pub fn listen_on( let remote = Server { id: remote_id, addr }; if params.is_nonblocking { stream.set_nonblocking(true).ok(); + } else { + if let BlockMode::Blocking(Some(write_timelout)) = + params.get_write_params().mode + { + stream + .set_write_timeout(Some(write_timelout)) + .ok(); + } } let recv_poisoned = Arc::new(AtomicBool::new(false)); start_net_sender( @@ -127,6 +136,11 @@ pub fn connect( let remote = Server { id: remote_id, addr }; if params.is_nonblocking { conn.set_nonblocking(true).ok(); + } else { + if let BlockMode::Blocking(Some(write_timelout)) = params.get_write_params().mode { + conn.set_write_timeout(Some(write_timelout)) + .ok(); + } } let read_half = conn .try_clone() diff --git a/interactive_engine/executor/ir/core/src/plan/logical.rs b/interactive_engine/executor/ir/core/src/plan/logical.rs index 5f21cfd40c54..e05cf343b95b 100644 --- a/interactive_engine/executor/ir/core/src/plan/logical.rs +++ b/interactive_engine/executor/ir/core/src/plan/logical.rs @@ -1110,7 +1110,14 @@ fn preprocess_expression( common_pb::expr_opr::Item::Map(key_values) => { for key_val in &mut key_values.key_vals { if let Some(value) = key_val.value.as_mut() { - preprocess_var(value, meta, plan_meta, false)?; + match value { + common_pb::variable_key_value::Value::Val(val) => { + preprocess_var(val, meta, plan_meta, false)?; + } + common_pb::variable_key_value::Value::Nested(_) => { + return Err(IrError::Unsupported("nested value in Map".to_string())); + } + } } } count = 0; diff --git a/interactive_engine/executor/ir/graph_proxy/src/utils/expr/eval.rs b/interactive_engine/executor/ir/graph_proxy/src/utils/expr/eval.rs index 5bedf444a24d..5767d14e38ac 100644 --- a/interactive_engine/executor/ir/graph_proxy/src/utils/expr/eval.rs +++ b/interactive_engine/executor/ir/graph_proxy/src/utils/expr/eval.rs @@ -26,6 +26,7 @@ use ir_common::expr_parse::to_suffix_expr; use ir_common::generated::common as common_pb; use ir_common::{NameOrId, ALL_KEY, ID_KEY, LABEL_KEY, LENGTH_KEY}; +use super::eval_pred::PEvaluator; use crate::apis::{Element, PropKey}; use crate::utils::expr::eval_pred::EvalPred; use crate::utils::expr::{ExprEvalError, ExprEvalResult}; @@ -63,13 +64,51 @@ pub enum Function { Extract(common_pb::extract::Interval), } +#[derive(Debug)] +pub struct CaseWhen { + when_then_evals: Vec<(PEvaluator, Evaluator)>, + else_eval: Evaluator, +} + +impl TryFrom for CaseWhen { + type Error = ParsePbError; + + fn try_from(case: common_pb::Case) -> Result { + let mut when_then_evals = Vec::with_capacity(case.when_then_expressions.len()); + for when_then in &case.when_then_expressions { + let when = when_then + .when_expression + .as_ref() + .ok_or(ParsePbError::EmptyFieldError(format!("missing when expression {:?}", case)))?; + let then = when_then + .then_result_expression + .as_ref() + .ok_or(ParsePbError::EmptyFieldError(format!("missing then expression: {:?}", case)))?; + when_then_evals.push((PEvaluator::try_from(when.clone())?, Evaluator::try_from(then.clone())?)); + } + let else_result_expression = case + .else_result_expression + .as_ref() + .ok_or(ParsePbError::EmptyFieldError(format!("missing else expression: {:?}", case)))?; + let else_eval = Evaluator::try_from(else_result_expression.clone())?; + Ok(Self { when_then_evals, else_eval }) + } +} + +/// A conditional expression for evaluating a casewhen. More conditional expressions can be added in the future, e.g., COALESCE(),NULLIF() etc. +#[derive(Debug)] +pub enum Conditional { + Case(CaseWhen), +} + /// An inner representation of `common_pb::ExprOpr` for one-shot translation of `common_pb::ExprOpr`. -#[derive(Debug, Clone)] +#[derive(Debug)] pub(crate) enum InnerOpr { Logical(common_pb::Logical), Arith(common_pb::Arithmetic), Function(Function), Operand(Operand), + Conditional(Conditional), } impl ToString for InnerOpr { @@ -79,6 +118,7 @@ impl ToString for InnerOpr { InnerOpr::Arith(arith) => format!("{:?}", arith), InnerOpr::Operand(item) => format!("{:?}", item), InnerOpr::Function(func) => format!("{:?}", func), + InnerOpr::Conditional(conditional) => format!("{:?}", conditional), } } } @@ -269,6 +309,22 @@ pub(crate) fn apply_logical<'a>( } } +pub(crate) fn apply_condition_expr<'a, E: Element, C: Context>( + condition: &Conditional, context: Option<&C>, +) -> ExprEvalResult { + match condition { + Conditional::Case(case) => { + let else_expr = &case.else_eval; + for (when, then) in case.when_then_evals.iter() { + if when.eval_bool(context)? { + return then.eval(context); + } + } + return else_expr.eval(context); + } + } +} + // Private api impl Evaluator { /// Evaluate simple expression that contains less than three operators @@ -281,7 +337,11 @@ impl Evaluator { if self.suffix_tree.is_empty() { Err(ExprEvalError::EmptyExpression) } else if self.suffix_tree.len() == 1 { - _first.unwrap().eval(context) + if let InnerOpr::Conditional(case) = _first.unwrap() { + apply_condition_expr(case, context) + } else { + _first.unwrap().eval(context) + } } else if self.suffix_tree.len() == 2 { let first = _first.unwrap(); let second = _second.unwrap(); @@ -522,6 +582,32 @@ impl TryFrom for Operand { } } +impl TryFrom for Operand { + type Error = ParsePbError; + + fn try_from(key_vals: common_pb::VariableKeyValues) -> Result { + let mut vec = Vec::with_capacity(key_vals.key_vals.len()); + for key_val in key_vals.key_vals { + let (_key, _value) = (key_val.key, key_val.value); + let key = if let Some(key) = _key { + Object::try_from(key)? + } else { + return Err(ParsePbError::from("empty key provided in Map")); + }; + let value = if let Some(value) = _value { + match value { + common_pb::variable_key_value::Value::Val(val) => Operand::try_from(val)?, + common_pb::variable_key_value::Value::Nested(nested) => Operand::try_from(nested)?, + } + } else { + return Err(ParsePbError::from("empty value provided in Map")); + }; + vec.push((key, value)); + } + Ok(Self::Map(vec)) + } +} + impl TryFrom for Operand { type Error = ParsePbError; @@ -545,25 +631,7 @@ impl TryFrom for Operand { } Ok(Self::VarMap(vec)) } - - Map(key_vals) => { - let mut vec = Vec::with_capacity(key_vals.key_vals.len()); - for key_val in key_vals.key_vals { - let (_key, _value) = (key_val.key, key_val.value); - let key = if let Some(key) = _key { - Object::try_from(key)? - } else { - return Err(ParsePbError::from("empty key provided in Map")); - }; - let value = if let Some(value) = _value { - Operand::try_from(value)? - } else { - return Err(ParsePbError::from("empty value provided in Map")); - }; - vec.push((key, value)); - } - Ok(Self::Map(vec)) - } + Map(key_vals) => Operand::try_from(key_vals), _ => Err(ParsePbError::ParseError("invalid operators for an Operand".to_string())), } } else { @@ -591,6 +659,7 @@ impl TryFrom for InnerOpr { Extract(extract) => Ok(Self::Function(Function::Extract(unsafe { std::mem::transmute::<_, common_pb::extract::Interval>(extract.interval) }))), + Case(case) => Ok(Self::Conditional(Conditional::Case(case.clone().try_into()?))), _ => Ok(Self::Operand(unit.clone().try_into()?)), } } else { @@ -974,7 +1043,7 @@ mod tests { #[test] fn test_eval_variable() { // [v0: id = 1, label = 9, age = 31, name = John, birthday = 19900416, hobbies = [football, guitar]] - // [v1: id = 2, label = 11, age = 26, name = Jimmy, birthday = 19950816] + // [v1: id = 2, label = 11, age = 26, name = Nancy, birthday = 19950816] let ctxt = prepare_context(); let cases: Vec<&str> = vec![ "@0.~id", // 1 @@ -1102,7 +1171,7 @@ mod tests { #[test] fn test_eval_is_null() { // [v0: id = 1, label = 9, age = 31, name = John, birthday = 19900416, hobbies = [football, guitar]] - // [v1: id = 2, label = 11, age = 26, name = Jimmy, birthday = 19950816] + // [v1: id = 2, label = 11, age = 26, name = Nancy, birthday = 19950816] let ctxt = prepare_context(); let cases: Vec<&str> = vec![ "isNull @0.hobbies", // false @@ -1344,4 +1413,58 @@ mod tests { assert_eq!(eval.eval::<(), NoneContext>(None).unwrap(), expected); } } + + fn prepare_casewhen(when_then_exprs: Vec<(&str, &str)>, else_expr: &str) -> common_pb::Expression { + let mut when_then_expressions = vec![]; + for (when_expr, then_expr) in when_then_exprs { + when_then_expressions.push(common_pb::case::WhenThen { + when_expression: Some(str_to_expr_pb(when_expr.to_string()).unwrap()), + then_result_expression: Some(str_to_expr_pb(then_expr.to_string()).unwrap()), + }); + } + let case_when_opr = common_pb::ExprOpr { + node_type: None, + item: Some(common_pb::expr_opr::Item::Case(common_pb::Case { + when_then_expressions, + else_result_expression: Some(str_to_expr_pb(else_expr.to_string()).unwrap()), + })), + }; + common_pb::Expression { operators: vec![case_when_opr] } + } + + #[test] + fn test_eval_casewhen() { + // [v0: id = 1, label = 9, age = 31, name = John, birthday = 19900416, hobbies = [football, guitar]] + // [v1: id = 2, label = 11, age = 26, name = Nancy, birthday = 19950816] + let ctxt = prepare_context(); + let cases = vec![ + (vec![("@0.~id ==1", "1"), ("@0.~id == 2", "2")], "0"), + (vec![("@0.~id > 10", "1"), ("@0.~id<5", "2")], "0"), + (vec![("@0.~id < 10 && @0.~id>20", "true")], "false"), + (vec![("@0.~id < 10 || @0.~id>20", "true")], "false"), + (vec![("@0.~id < 10 && @0.~id>20", "1+2")], "4+5"), + (vec![("@0.~id < 10 || @0.~id>20", "1+2")], "4+5"), + (vec![("true", "@0.name")], "@1.name"), + (vec![("false", "@0.~name")], "@1.name"), + (vec![("isNull @0.hobbies", "true")], "false"), + (vec![("isNull @1.hobbies", "true")], "false"), + ]; + let expected: Vec = vec![ + object!(1), + object!(2), + object!(false), + object!(true), + object!(9), + object!(3), + object!("John"), + object!("Nancy"), + object!(false), + object!(true), + ]; + + for ((when_then_exprs, else_expr), expected) in cases.into_iter().zip(expected.into_iter()) { + let eval = Evaluator::try_from(prepare_casewhen(when_then_exprs, else_expr)).unwrap(); + assert_eq!(eval.eval::<_, Vertices>(Some(&ctxt)).unwrap(), expected); + } + } } diff --git a/interactive_engine/executor/ir/proto/expr.proto b/interactive_engine/executor/ir/proto/expr.proto index b3c9c53bd8a5..c4a5979a5b65 100644 --- a/interactive_engine/executor/ir/proto/expr.proto +++ b/interactive_engine/executor/ir/proto/expr.proto @@ -123,9 +123,16 @@ message VariableKeys { message VariableKeyValue { common.Value key = 1; - Variable value = 2; + oneof value { + Variable val = 2; + VariableKeyValues nested = 3; + } } +// A nested kv projection, which is used to project a nested structure of key-value pairs +// e.g., to project [value(a.name), value(a.age)], or project [key_value('name', a.name), key_value('age', a.age)], +// or more complex nested projection, +// e.g., to project [key_value('tagA', nested{[key_value('name', a.name), key_value('age', a.age)]}), key_value('tagB', nested{key_value(b.name), key_value(b.age)})] message VariableKeyValues { repeated VariableKeyValue key_vals = 1; } @@ -203,7 +210,7 @@ message ExprOpr { DynamicParam param = 9; Case case = 10; Extract extract = 11; - // TODO: the new definition for var_map, that allows user-given key name. Will remove the old var_map soon. + // TODO: the new definition for var_map, that allows user-given key name, and nested maps. Will remove the old var_map finally. VariableKeyValues map = 13; TimeInterval time_interval = 14; DateTimeMinus date_time_minus = 15; diff --git a/interactive_engine/executor/ir/proto/results.proto b/interactive_engine/executor/ir/proto/results.proto index bb19f8e6c261..9938fefc4792 100644 --- a/interactive_engine/executor/ir/proto/results.proto +++ b/interactive_engine/executor/ir/proto/results.proto @@ -68,7 +68,10 @@ message Collection { message KeyValues { message KeyValue { common.Value key = 1; - Element value = 2; + oneof value { + Element element = 2; + KeyValues nested = 3; + } } repeated KeyValue key_values = 1; } diff --git a/interactive_engine/executor/ir/runtime/src/process/entry.rs b/interactive_engine/executor/ir/runtime/src/process/entry.rs index a1dedfb57ab8..168c66404cd0 100644 --- a/interactive_engine/executor/ir/runtime/src/process/entry.rs +++ b/interactive_engine/executor/ir/runtime/src/process/entry.rs @@ -597,17 +597,21 @@ impl TryFrom for DynEntry { let mut map = BTreeMap::new(); for key_val in kv.key_values { let key = key_val.key.unwrap(); - let val_inner = key_val.value.unwrap().inner.unwrap(); - // currently, convert kv into Object::KV - let key_obj: Object = Object::try_from(key)?; - let val_obj: Object = match val_inner { - result_pb::element::Inner::Object(obj) => Object::try_from(obj)?, - _ => Err(ParsePbError::Unsupported(format!( - "unsupported kvs value inner {:?}", - val_inner, - )))?, - }; - map.insert(key_obj, val_obj); + let value_inner = key_val.value.unwrap(); + match value_inner { + result_pb::key_values::key_value::Value::Element(val) => { + let val_inner = val.inner.unwrap(); + let val_obj: Object = match val_inner { + result_pb::element::Inner::Object(obj) => Object::try_from(obj)?, + _ => Err(ParsePbError::Unsupported(format!( + "unsupported kvs value inner {:?}", + val_inner, + )))?, + }; + map.insert(Object::try_from(key)?, val_obj); + } + result_pb::key_values::key_value::Value::Nested(_) => todo!(), + } } Ok(DynEntry::new(Object::KV(map))) } diff --git a/interactive_engine/executor/ir/runtime/src/process/operator/map/project.rs b/interactive_engine/executor/ir/runtime/src/process/operator/map/project.rs index fc8bae3a1f32..7eace8d6acf3 100644 --- a/interactive_engine/executor/ir/runtime/src/process/operator/map/project.rs +++ b/interactive_engine/executor/ir/runtime/src/process/operator/map/project.rs @@ -43,13 +43,46 @@ struct ProjectOperator { } #[derive(Debug)] -pub enum Projector { +enum VariableValue { + Value(TagKey), + Nest(VariableKeyValues), +} + +#[derive(Debug)] +struct VariableKeyValue { + key: Object, + value: VariableValue, +} + +#[derive(Debug)] +struct VariableKeyValues { + key_vals: Vec, +} + +impl VariableKeyValues { + fn exec_projector(&self, input: &Record) -> FnExecResult { + let mut map_collection = Vec::with_capacity(self.key_vals.len()); + for kv in self.key_vals.iter() { + let key = kv.key.clone(); + let value = match &kv.value { + VariableValue::Value(tag_key) => tag_key.get_arc_entry(input)?, + VariableValue::Nest(nest) => nest.exec_projector(input)?, + }; + map_collection.push(PairEntry::new(key.into(), value).into()); + } + Ok(DynEntry::new(CollectionEntry { inner: map_collection })) + } +} + +#[derive(Debug)] +enum Projector { ExprProjector(Evaluator), GraphElementProjector(TagKey), - /// MultiGraphElementProject will output a collection entry. - /// If the key is given, it is a collection of PairEntry with user-given key, and value of projected graph elements (computed via TagKey); - /// If the key is None, it is a collection of projected graph elements (computed via TagKey). - MultiGraphElementProjector(Vec<(Option, TagKey)>), + /// VecProjector will output a collection entry, which is a collection of projected graph elements (computed via TagKey). + VecProjector(Vec), + /// MapProjector will output a collection entry, which is a collection of key-value pairs. The key is a Object (preserve the user-given key), and the value is a projected graph element (computed via TagKey). + /// Besides, MapProjector supports nested map. + MapProjector(VariableKeyValues), /// A simple concatenation of multiple entries. ConcatProjector(Vec), } @@ -69,18 +102,15 @@ fn exec_projector(input: &Record, projector: &Projector) -> FnExecResult tag_key.get_arc_entry(input)?, - Projector::MultiGraphElementProjector(key_vals) => { - let mut collection = Vec::with_capacity(key_vals.len()); - for (key, tag_key) in key_vals.iter() { + Projector::VecProjector(vec) => { + let mut collection = Vec::with_capacity(vec.len()); + for tag_key in vec.iter() { let entry = tag_key.get_arc_entry(input)?; - if let Some(key) = key { - collection.push(PairEntry::new(key.clone().into(), entry).into()); - } else { - collection.push(entry); - } + collection.push(entry); } DynEntry::new(CollectionEntry { inner: collection }) } + Projector::MapProjector(map) => map.exec_projector(input)?, Projector::ConcatProjector(concat_vars) => { if concat_vars.len() != 2 { Err(FnExecError::unsupported_error("Only support concatenated 2 entries now"))? @@ -182,27 +212,13 @@ impl FilterMapFuncGen for pb::Project { let tag_keys = vars .keys .iter() - .map(|var| match TagKey::try_from(var.clone()) { - Ok(tag_key) => Ok((None, tag_key)), - Err(err) => Err(err), - }) - .collect::, TagKey)>, _>>()?; - Projector::MultiGraphElementProjector(tag_keys) + .map(|var| TagKey::try_from(var.clone())) + .collect::, _>>()?; + Projector::VecProjector(tag_keys) } common_pb::ExprOpr { item: Some(common_pb::expr_opr::Item::Map(key_vals)), .. } => { - let mut key_value_vec = Vec::with_capacity(key_vals.key_vals.len()); - for key_val in key_vals.key_vals.iter() { - let key = key_val.key.as_ref().ok_or_else(|| { - ParsePbError::EmptyFieldError(format!("key in Map Expr {:?}", key_val)) - })?; - let key_obj = Object::try_from(key.clone())?; - let val = key_val.value.as_ref().ok_or_else(|| { - ParsePbError::EmptyFieldError(format!("value in Map Expr {:?}", key_val)) - })?; - let tag_key = TagKey::try_from(val.clone())?; - key_value_vec.push((Some(key_obj), tag_key)); - } - Projector::MultiGraphElementProjector(key_value_vec) + let variable_key_values = VariableKeyValues::try_from(key_vals.clone())?; + Projector::MapProjector(variable_key_values) } common_pb::ExprOpr { item: Some(common_pb::expr_opr::Item::Concat(concat_vars)), @@ -234,6 +250,37 @@ impl FilterMapFuncGen for pb::Project { } } +impl TryFrom for VariableKeyValues { + type Error = ParsePbError; + + fn try_from(key_vals: common_pb::VariableKeyValues) -> Result { + let mut vec = Vec::with_capacity(key_vals.key_vals.len()); + for key_val in key_vals.key_vals { + let (_key, _value) = (key_val.key, key_val.value); + let key = if let Some(key) = _key { + Object::try_from(key.clone())? + } else { + return Err(ParsePbError::from("empty key provided in Map")); + }; + let value = if let Some(val) = _value { + match val { + common_pb::variable_key_value::Value::Val(val) => { + VariableValue::Value(TagKey::try_from(val.clone())?) + } + common_pb::variable_key_value::Value::Nested(nested_vals) => { + let nested = VariableKeyValues::try_from(nested_vals)?; + VariableValue::Nest(nested) + } + } + } else { + return Err(ParsePbError::from("empty value provided in Map")); + }; + vec.push(VariableKeyValue { key, value }); + } + Ok(VariableKeyValues { key_vals: vec }) + } +} + #[cfg(test)] mod tests { use ahash::HashMap; @@ -685,7 +732,7 @@ mod tests { } // g.V().valueMap('age', 'name') with alias of 'age' as 'newAge' and 'name' as 'newName', by map - // this is projected by MultiGraphElementProjector + // this is projected by MapProjector #[test] fn simple_project_map_mapping_test() { let project_opr_pb = pb::Project { @@ -816,7 +863,7 @@ mod tests { } // g.V().as("a").select("a").by(valueMap("age", "name")),with alias of 'a.age' as 'newAge' and 'a.tname' as 'newName', by map - // this is projected by MultiGraphElementProjector + // this is projected by MapProjector #[test] fn simple_project_tag_map_mapping_test() { let project_opr_pb = pb::Project { @@ -866,6 +913,102 @@ mod tests { assert_eq!(object_result, expected_result); } + // g.V().as("a").select("a").by(valueMap("age", "name")), with expr_opr as a nested VariableKeyValues + // this is projected by MapProjector (nested) + #[test] + fn project_nested_map_test() { + // project a.{name, age} + let variable_key_value = common_pb::VariableKeyValues { + key_vals: vec![ + common_pb::VariableKeyValue { + key: Some(common_pb::Value::from("name".to_string())), + value: Some(common_pb::variable_key_value::Value::Val(to_var_pb( + None, + Some("name".into()), + ))), + }, + common_pb::VariableKeyValue { + key: Some(common_pb::Value::from("age".to_string())), + value: Some(common_pb::variable_key_value::Value::Val(to_var_pb( + None, + Some("age".into()), + ))), + }, + ], + }; + let nested_variable_key_vals = common_pb::VariableKeyValues { + key_vals: vec![common_pb::VariableKeyValue { + key: Some(common_pb::Value::from("a".to_string())), + value: Some(common_pb::variable_key_value::Value::Nested(variable_key_value)), + }], + }; + let project_opr_pb = pb::Project { + mappings: vec![pb::project::ExprAlias { + expr: Some(common_pb::Expression { + operators: vec![common_pb::ExprOpr { + node_type: None, + item: Some(common_pb::expr_opr::Item::Map(nested_variable_key_vals)), + }], + }), + alias: None, + }], + is_append: false, + }; + let mut result = project_test(init_source_with_tag(), project_opr_pb); + + let mut object_result = vec![]; + while let Some(Ok(res)) = result.next() { + let collection = res + .get(None) + .unwrap() + .as_any_ref() + .downcast_ref::() + .unwrap(); + let mut result = vec![]; + for entry in collection.inner.iter() { + let pair_entry = entry + .as_any_ref() + .downcast_ref::() + .unwrap(); + let key = pair_entry + .get_left() + .as_any_ref() + .downcast_ref::() + .unwrap(); + let value = pair_entry + .get_right() + .as_any_ref() + .downcast_ref::() + .unwrap(); + let mut result_value = vec![]; + for entry in value.inner.iter() { + let inner_pair = entry + .as_any_ref() + .downcast_ref::() + .unwrap(); + let inner_key = inner_pair + .get_left() + .as_any_ref() + .downcast_ref::() + .unwrap(); + let inner_val = inner_pair + .get_right() + .as_any_ref() + .downcast_ref::() + .unwrap(); + result_value.push((inner_key.clone(), inner_val.clone())); + } + result.push((key.clone(), result_value.clone())); + } + object_result.push(result); + } + let expected_result = vec![ + vec![(object!("a"), vec![(object!("name"), object!("marko")), (object!("age"), object!(29))])], + vec![(object!("a"), vec![(object!("name"), object!("vadas")), (object!("age"), object!(27))])], + ]; + assert_eq!(object_result, expected_result); + } + #[test] fn project_multi_mapping_tags() { let project_opr_pb = pb::Project { diff --git a/interactive_engine/executor/ir/runtime/src/process/operator/mod.rs b/interactive_engine/executor/ir/runtime/src/process/operator/mod.rs index 00db86cf7cd9..9428cdb72cda 100644 --- a/interactive_engine/executor/ir/runtime/src/process/operator/mod.rs +++ b/interactive_engine/executor/ir/runtime/src/process/operator/mod.rs @@ -289,7 +289,7 @@ pub(crate) mod tests { .into_iter() .map(|(key, value)| common_pb::VariableKeyValue { key: Some(common_pb::Value::from(key)), - value: Some(to_var_pb(value.0, value.1)), + value: Some(common_pb::variable_key_value::Value::Val(to_var_pb(value.0, value.1))), }) .collect(); common_pb::Expression { diff --git a/interactive_engine/executor/ir/runtime/src/process/operator/sink/sink.rs b/interactive_engine/executor/ir/runtime/src/process/operator/sink/sink.rs index 03e63494c38a..4e3227c5820d 100644 --- a/interactive_engine/executor/ir/runtime/src/process/operator/sink/sink.rs +++ b/interactive_engine/executor/ir/runtime/src/process/operator/sink/sink.rs @@ -140,9 +140,9 @@ impl RecordSinkEncoder { let val_pb: common_pb::Value = val.clone().into(); key_values.push(result_pb::key_values::KeyValue { key: Some(key_pb), - value: Some(result_pb::Element { + value: Some(result_pb::key_values::key_value::Value::Element(result_pb::Element { inner: Some(result_pb::element::Inner::Object(val_pb)), - }), + })), }) } return Some(result_pb::KeyValues { key_values }); @@ -161,8 +161,24 @@ impl RecordSinkEncoder { .unwrap(); if let Some(key_obj) = pair.get_left().as_object() { let key_pb: common_pb::Value = key_obj.clone().into(); - let val_pb = self.element_to_pb(pair.get_right()); - key_values.push(result_pb::key_values::KeyValue { key: Some(key_pb), value: Some(val_pb) }) + let val = pair.get_right(); + if val.get_type() == EntryType::Collection { + let inner_collection = val + .as_any_ref() + .downcast_ref::() + .unwrap(); + let inner_collection_pb = self.collection_map_to_pb(inner_collection.clone())?; + key_values.push(result_pb::key_values::KeyValue { + key: Some(key_pb), + value: Some(result_pb::key_values::key_value::Value::Nested(inner_collection_pb)), + }) + } else { + let val_pb = self.element_to_pb(pair.get_right()); + key_values.push(result_pb::key_values::KeyValue { + key: Some(key_pb), + value: Some(result_pb::key_values::key_value::Value::Element(val_pb)), + }) + } } else { Err(FnExecError::unsupported_error(&format!( "only support map result with object key, while it is {:?}", diff --git a/interactive_engine/executor/store/groot/src/db/api/multi_version_graph.rs b/interactive_engine/executor/store/groot/src/db/api/multi_version_graph.rs index cd869accd059..46db17702699 100644 --- a/interactive_engine/executor/store/groot/src/db/api/multi_version_graph.rs +++ b/interactive_engine/executor/store/groot/src/db/api/multi_version_graph.rs @@ -89,6 +89,15 @@ pub trait MultiVersionGraph { &self, si: SnapshotId, schema_version: i64, label: LabelId, type_def: &TypeDef, table_id: i64, ) -> GraphResult; + /// Add exist vertex type properties with `label` and `type_def` at `si` and `schema_version`. This interface is thread safe. + /// + /// If vertex type not found, `si` is smaller than last operation, get lock error, storage error + /// or other errors, `GraphError` will be returned. + /// Returns true if schema_version changed, false otherwise. + fn add_vertex_type_properties( + &self, si: SnapshotId, schema_version: i64, label: LabelId, type_def: &TypeDef, table_id: i64, + ) -> GraphResult; + /// Create a new edge type with `label` and `type_def` at `si` and `schema_version`. This interface is thread safe. /// /// If edge type already exists, `si` is smaller than last operation, get lock error, storage error @@ -98,6 +107,15 @@ pub trait MultiVersionGraph { &self, si: SnapshotId, schema_version: i64, label: LabelId, type_def: &TypeDef, ) -> GraphResult; + /// Add exist edge type properties with `label` and `type_def` at `si` and `schema_version`. This interface is thread safe. + /// + /// If edge type not found, `si` is smaller than last operation, get lock error, storage error + /// or other errors, `GraphError` will be returned. + /// Returns true if schema_version changed, false otherwise. + fn add_edge_type_properties( + &self, si: SnapshotId, schema_version: i64, label: LabelId, type_def: &TypeDef, + ) -> GraphResult; + /// Add a new edge kind of `kind` to edge type with `kind.label` at `si` and `schema_version`. This interface is thread safe. /// /// If edge type with `kind.label` not exists, edge kind `kind` already exists, `si` is smaller diff --git a/interactive_engine/executor/store/groot/src/db/api/schema.rs b/interactive_engine/executor/store/groot/src/db/api/schema.rs index 24c55d602e48..81d1853cb8ac 100644 --- a/interactive_engine/executor/store/groot/src/db/api/schema.rs +++ b/interactive_engine/executor/store/groot/src/db/api/schema.rs @@ -60,6 +60,26 @@ impl GraphDef { Ok(()) } + pub fn update_type(&mut self, label: LabelId, type_def: TypeDef) -> GraphResult<()> { + if !self.label_to_types.contains_key(&label) { + let msg = format!("labelId {}", label); + return Err(GraphError::new(GraphErrorCode::TypeNotFound, msg)); + } + for property in type_def.get_prop_defs() { + if property.id > self.property_idx { + self.property_idx = property.id + } + self.property_name_to_id + .insert(property.name.clone(), property.id); + } + self.label_to_types.insert(label, type_def); + Ok(()) + } + + pub fn get_type(&self, label_id: &LabelId) -> Option<&TypeDef> { + self.label_to_types.get(label_id) + } + pub fn put_vertex_table_id(&mut self, label: LabelId, table_id: i64) { self.vertex_table_ids.insert(label, table_id); } @@ -180,6 +200,14 @@ impl TypeDef { return self.label_id; } + pub fn add_property(&mut self, prop: PropDef) { + self.properties.insert(prop.id, prop); + } + + pub fn set_version(&mut self, new_version: i32) { + self.version = new_version; + } + pub fn from_proto(proto: &TypeDefPb) -> GraphResult { let version_id = proto.get_version_id(); let label = proto.get_label(); diff --git a/interactive_engine/executor/store/groot/src/db/graph/meta.rs b/interactive_engine/executor/store/groot/src/db/graph/meta.rs index 1de7ae758e0f..8efd4e77b085 100644 --- a/interactive_engine/executor/store/groot/src/db/graph/meta.rs +++ b/interactive_engine/executor/store/groot/src/db/graph/meta.rs @@ -96,6 +96,19 @@ impl Meta { .into_iter() .map(|i| MetaItem::CommitDataLoad(i)), ); + let add_vertex_property_items = + res_unwrap!(get_items::(store_ref), recover)?; + all.extend( + add_vertex_property_items + .into_iter() + .map(|i| MetaItem::AddVertexProperty(i)), + ); + let add_edge_property_items = res_unwrap!(get_items::(store_ref), recover)?; + all.extend( + add_edge_property_items + .into_iter() + .map(|i| MetaItem::AddEdgeProperty(i)), + ); all.sort_by(|a, b| { let s1 = a.get_schema_version(); let s2 = b.get_schema_version(); @@ -203,6 +216,25 @@ impl Meta { .and_then(|info| info.online_table(Table::new(x.si, x.table_id)))?; } } + MetaItem::AddVertexProperty(x) => { + let label_id = x.type_def.get_label_id(); + info!( + "AddVertexProperty label {:?}, table {:?}, si {:?}, type def {:?}", + label_id, x.table_id, x.si, x.type_def + ); + let mut graph_def = self.graph_def_lock.lock()?; + graph_def.update_type(label_id, x.type_def.clone()); + graph_def.increase_version(); + vertex_manager_builder.update_type(x.si, x.label_id, &x.type_def)?; + } + MetaItem::AddEdgeProperty(x) => { + let label_id = x.type_def.get_label_id(); + info!("AddEdgeProperty label {:?}, si {:?}, typedef {:?}", label_id, x.si, x.type_def); + let mut graph_def = self.graph_def_lock.lock()?; + graph_def.update_type(label_id, x.type_def.clone()); + graph_def.increase_version(); + edge_manager_builder.update_edge_type(x.si, x.label_id, &x.type_def)?; + } } } Ok((vertex_manager_builder.build(), edge_manager_builder.build())) @@ -281,6 +313,42 @@ impl Meta { Ok(Table::new(si, table_id)) } + pub fn add_vertex_type_properties( + &self, si: SnapshotId, schema_version: i64, label_id: LabelId, type_def: &TypeDef, table_id: i64, + ) -> GraphResult<(Table, TypeDef)> { + self.check_version(schema_version)?; + // 2. Fetch existing `TypeDef` for the label_id. + let mut graph_def = self.graph_def_lock.lock()?; + if let Some(mut cloned) = graph_def.get_type(&label_id).cloned() { + for new_property in type_def.get_prop_defs() { + let new_property_name = &new_property.name; + if cloned + .get_prop_defs() + .any(|p| &p.id == &new_property.id || p.name == *new_property_name) + { + let msg = format!( + "Property with name '{}' already exists in type for label_id {}", + new_property_name, label_id + ); + return Err(GraphError::new(GraphErrorCode::InvalidOperation, msg)); + } + cloned.add_property(new_property.clone()); + } + cloned.set_version(type_def.get_version()); + let item = AddVertexPropertyItem::new(si, schema_version, label_id, table_id, cloned.clone()); + self.write_item(item)?; + { + let current_label_idx = graph_def.get_label_idx(); + graph_def.update_type(label_id, cloned.clone())?; + graph_def.increase_version(); + } + Ok((Table::new(si, table_id), cloned)) + } else { + let msg = format!("current label id {} not exist.", label_id); + return Err(GraphError::new(GraphErrorCode::InvalidOperation, msg)); + } + } + pub fn drop_vertex_type( &self, si: SnapshotId, schema_version: i64, label_id: LabelId, ) -> GraphResult<()> { @@ -315,6 +383,41 @@ impl Meta { Ok(()) } + pub fn add_edge_type_properties( + &self, si: SnapshotId, schema_version: i64, label_id: LabelId, type_def: &TypeDef, + ) -> GraphResult { + self.check_version(schema_version)?; + let mut graph_def = self.graph_def_lock.lock()?; + if let Some(mut cloned) = graph_def.get_type(&label_id).cloned() { + for new_property in type_def.get_prop_defs() { + let new_property_name = &new_property.name; + if cloned + .get_prop_defs() + .any(|p| &p.id == &new_property.id || p.name == *new_property_name) + { + let msg = format!( + "Property with name '{}' already exists in type for label_id {}", + new_property_name, label_id + ); + return Err(GraphError::new(GraphErrorCode::InvalidOperation, msg)); + } + cloned.add_property(new_property.clone()); + } + cloned.set_version(type_def.get_version()); + let item = AddEdgePropertyItem::new(si, schema_version, label_id, cloned.clone()); + self.write_item(item)?; + { + let current_label_idx = graph_def.get_label_idx(); + graph_def.update_type(label_id, cloned.clone())?; + graph_def.increase_version(); + } + Ok(cloned) + } else { + let msg = format!("current label id {} not exist.", label_id); + return Err(GraphError::new(GraphErrorCode::InvalidOperation, msg)); + } + } + pub fn add_edge_kind( &self, si: SnapshotId, schema_version: i64, edge_kind: &EdgeKind, table_id: i64, ) -> GraphResult { @@ -415,6 +518,8 @@ enum MetaItem { RemoveEdgeKind(RemoveEdgeKindItem), PrepareDataLoad(PrepareDataLoadItem), CommitDataLoad(CommitDataLoadItem), + AddVertexProperty(AddVertexPropertyItem), + AddEdgeProperty(AddEdgePropertyItem), } impl MetaItem { @@ -428,6 +533,8 @@ impl MetaItem { MetaItem::RemoveEdgeKind(ref item) => item.schema_version, MetaItem::PrepareDataLoad(ref item) => item.schema_version, MetaItem::CommitDataLoad(ref item) => item.schema_version, + MetaItem::AddVertexProperty(ref item) => item.schema_version, + MetaItem::AddEdgeProperty(ref item) => item.schema_version, } } } @@ -769,6 +876,90 @@ impl ItemCommon for RemoveEdgeKindItem { } } +#[derive(Debug, Clone, PartialEq)] +struct AddVertexPropertyItem { + si: SnapshotId, + schema_version: i64, + label_id: LabelId, + table_id: TableId, + type_def: TypeDef, +} + +impl AddVertexPropertyItem { + fn new( + si: SnapshotId, schema_version: i64, label_id: LabelId, table_id: TableId, type_def: TypeDef, + ) -> Self { + AddVertexPropertyItem { si, schema_version, label_id, table_id, type_def } + } +} + +impl ItemCommon for AddVertexPropertyItem { + fn from_kv(k: &[u8], v: &[u8]) -> GraphResult { + let items = res_unwrap!(common_parse_key(k, Self::prefix(), 5), from_kv)?; + let label_id = res_unwrap!(parse_str(items[1]), from_kv)?; + let si = res_unwrap!(parse_str(items[2]), from_kv)?; + let schema_version = res_unwrap!(parse_str(items[3]), from_kv)?; + let table_id = res_unwrap!(parse_str(items[4]), from_kv)?; + let type_def = res_unwrap!(TypeDef::from_bytes(v), from_kv)?; + let ret = Self::new(si, schema_version, label_id, table_id, type_def); + Ok(ret) + } + + fn prefix() -> &'static str { + "AddVertexProperty" + } + + fn to_kv(&self) -> GraphResult<(Vec, Vec)> { + let key = format!( + "{}#{}#{}#{}#{}", + Self::prefix(), + self.label_id, + self.si, + self.schema_version, + self.table_id + ); + let typedef_pb = self.type_def.to_proto()?; + let bytes = typedef_pb + .write_to_bytes() + .map_err(|e| GraphError::new(InvalidData, format!("{:?}", e)))?; + Ok((meta_key(&key), bytes)) + } +} + +#[derive(Debug, Clone, PartialEq)] +struct AddEdgePropertyItem { + si: SnapshotId, + schema_version: i64, + label_id: LabelId, + type_def: TypeDef, +} + +impl AddEdgePropertyItem { + fn new(si: SnapshotId, schema_version: i64, label_id: LabelId, type_def: TypeDef) -> Self { + AddEdgePropertyItem { si, schema_version, label_id, type_def } + } +} + +impl ItemCommon for AddEdgePropertyItem { + fn from_kv(k: &[u8], v: &[u8]) -> GraphResult { + let items = res_unwrap!(common_parse_key(k, Self::prefix(), 4), from_kv)?; + let label_id = res_unwrap!(parse_str(items[1]), from_kv)?; + let si = res_unwrap!(parse_str(items[2]), from_kv)?; + let schema_version = res_unwrap!(parse_str(items[3]), from_kv)?; + let type_def = TypeDef::from_bytes(v)?; + Ok(Self::new(si, schema_version, label_id, type_def)) + } + + fn prefix() -> &'static str { + "AddEdgeProperty" + } + + fn to_kv(&self) -> GraphResult<(Vec, Vec)> { + let key = format!("{}#{}#{}#{}", Self::prefix(), self.label_id, self.si, self.schema_version); + Ok((meta_key(&key), self.type_def.to_bytes()?)) + } +} + fn get_items(store: &RocksDB) -> GraphResult> { let mut ret = Vec::new(); let mut prefix = Vec::new(); diff --git a/interactive_engine/executor/store/groot/src/db/graph/store.rs b/interactive_engine/executor/store/groot/src/db/graph/store.rs index de10c4afbb18..5321cad5bdb4 100644 --- a/interactive_engine/executor/store/groot/src/db/graph/store.rs +++ b/interactive_engine/executor/store/groot/src/db/graph/store.rs @@ -271,6 +271,31 @@ impl MultiVersionGraph for GraphStore { Ok(true) } + fn add_vertex_type_properties( + &self, si: i64, schema_version: i64, label_id: LabelId, type_def: &TypeDef, table_id: i64, + ) -> GraphResult { + debug!("add_vertex_type_properties"); + let _guard = res_unwrap!(self.lock.lock(), add_vertex_type_properties)?; + self.check_si_guard(si)?; + if let Err(_) = self.meta.check_version(schema_version) { + return Ok(false); + } + if !self.vertex_manager.contains_type(si, label_id) { + let msg = format!("vertex#{} does not exist", label_id); + let err = gen_graph_err!(GraphErrorCode::InvalidOperation, msg, add_vertex_type_properties); + return Err(err); + } + self.meta + .add_vertex_type_properties(si, schema_version, label_id, type_def, table_id) + .and_then(|(table, cloned_typedef)| { + let codec = Codec::from(&cloned_typedef); + self.vertex_manager + .update_type(si, label_id, codec, table) + }) + .map(|_| self.update_si_guard(si))?; + Ok(true) + } + fn create_edge_type( &self, si: i64, schema_version: i64, label_id: LabelId, type_def: &TypeDef, ) -> GraphResult { @@ -295,6 +320,30 @@ impl MultiVersionGraph for GraphStore { Ok(true) } + fn add_edge_type_properties( + &self, si: i64, schema_version: i64, label_id: LabelId, type_def: &TypeDef, + ) -> GraphResult { + debug!("add_edge_type_properties"); + let _guard = res_unwrap!(self.lock.lock(), add_edge_type_properties)?; + self.check_si_guard(si)?; + if let Err(_) = self.meta.check_version(schema_version) { + return Ok(false); + } + if !self.edge_manager.contains_edge(label_id) { + let msg = format!("edge#{} does not exist", label_id); + let err = gen_graph_err!(GraphErrorCode::InvalidOperation, msg, add_edge_type_properties); + return Err(err); + } + self.meta + .add_edge_type_properties(si, schema_version, label_id, type_def) + .and_then(|cloned| { + self.edge_manager + .update_edge_type(si, label_id, &cloned) + }) + .map(|_| self.update_si_guard(si))?; + Ok(true) + } + fn add_edge_kind( &self, si: i64, schema_version: i64, edge_kind: &EdgeKind, table_id: i64, ) -> GraphResult { diff --git a/interactive_engine/executor/store/groot/src/db/graph/types/edge.rs b/interactive_engine/executor/store/groot/src/db/graph/types/edge.rs index 26c4612b2dad..b67e131deb7d 100644 --- a/interactive_engine/executor/store/groot/src/db/graph/types/edge.rs +++ b/interactive_engine/executor/store/groot/src/db/graph/types/edge.rs @@ -271,6 +271,12 @@ impl EdgeTypeManager { }) } + pub fn update_edge_type(&self, si: SnapshotId, label: LabelId, type_def: &TypeDef) -> GraphResult<()> { + self.modify(|inner| { + res_unwrap!(inner.update_edge_type(si, label, type_def), update_edge, si, label, type_def) + }) + } + pub fn drop_edge_type(&self, si: SnapshotId, label: LabelId) -> GraphResult<()> { self.modify(|inner| res_unwrap!(inner.drop_edge_type(si, label), drop_edge, si, label)) } @@ -336,6 +342,11 @@ impl EdgeManagerBuilder { self.inner.drop_edge_type(si, label) } + pub fn update_edge_type( + &mut self, si: SnapshotId, label: LabelId, type_def: &TypeDef, + ) -> GraphResult<()> { + self.inner.update_edge_type(si, label, type_def) + } pub fn add_edge_kind(&mut self, si: SnapshotId, kind: &EdgeKind) -> GraphResult<()> { self.inner.add_edge_kind(si, kind) } @@ -414,14 +425,7 @@ impl EdgeManagerInner { fn create_edge_type(&mut self, si: SnapshotId, label: LabelId, type_def: &TypeDef) -> GraphResult<()> { if self.info_map.contains_key(&label) { let msg = format!("edge#{} already exists", label); - let err = gen_graph_err!( - GraphErrorCode::InvalidOperation, - msg, - create_edge_type, - si, - label, - type_def - ); + let err = gen_graph_err!(GraphErrorCode::InvalidOperation, msg, create_edge_type); return Err(err); } let info = EdgeInfo::new(si, label); @@ -432,6 +436,20 @@ impl EdgeManagerInner { Ok(()) } + fn update_edge_type(&mut self, si: SnapshotId, label: LabelId, type_def: &TypeDef) -> GraphResult<()> { + if !self.info_map.contains_key(&label) { + let msg = format!("edge#{} not found.", label); + let err = gen_graph_err!(GraphErrorCode::InvalidOperation, msg, update_edge_type); + return Err(err); + } + if let Some(info) = self.info_map.get(&label) { + let codec = Codec::from(type_def); + let res = info.add_codec(si, codec); + res_unwrap!(res, update_edge, si, label, type_def)?; + } + Ok(()) + } + fn drop_edge_type(&mut self, si: SnapshotId, label: LabelId) -> GraphResult<()> { if let Some(info) = self.info_map.get(&label) { info.lifetime.set_end(si); diff --git a/interactive_engine/executor/store/groot/src/db/graph/types/vertex.rs b/interactive_engine/executor/store/groot/src/db/graph/types/vertex.rs index 042b5eee055b..54dbf69a2ea0 100644 --- a/interactive_engine/executor/store/groot/src/db/graph/types/vertex.rs +++ b/interactive_engine/executor/store/groot/src/db/graph/types/vertex.rs @@ -106,8 +106,11 @@ impl VertexTypeManager { pub fn create_type( &self, si: SnapshotId, label: LabelId, codec: Codec, table0: Table, ) -> GraphResult<()> { - assert_eq!(si, table0.start_si, "type start si must be equal to table0.start_si"); - + if si != table0.start_si { + let msg = format!("type si {} must be equal to table0.start_si {}", si, table0.start_si); + let err = gen_graph_err!(GraphErrorCode::InvalidOperation, msg, create_type); + return Err(err); + } let guard = &epoch::pin(); let map = self.get_map(guard); let mut map_clone = unsafe { map.as_ref() } @@ -131,6 +134,36 @@ impl VertexTypeManager { Ok(()) } + pub fn update_type( + &self, si: SnapshotId, label: LabelId, codec: Codec, table0: Table, + ) -> GraphResult<()> { + if si != table0.start_si { + let msg = format!("type si {} must be equal to table0.start_si {}", si, table0.start_si); + let err = gen_graph_err!(GraphErrorCode::InvalidOperation, msg, update_type); + return Err(err); + } + let guard = &epoch::pin(); + let map = self.get_map(guard); + let mut map_clone = unsafe { map.as_ref() } + .ok_or_else(|| { + let msg = "get map reference return `None`".to_string(); + gen_graph_err!(GraphErrorCode::InvalidData, msg, get_map, si, label) + })? + .clone(); + if !map_clone.contains_key(&label) { + let msg = format!("vertex#{} not found.", label); + let err = gen_graph_err!(GraphErrorCode::InvalidOperation, msg, update_type); + return Err(err); + } + if let Some(info) = map_clone.get(&label) { + res_unwrap!(info.update_codec(si, codec), update_type)?; + } + self.map + .store(Owned::new(map_clone).into_shared(guard), Ordering::Release); + unsafe { guard.defer_destroy(map) }; + Ok(()) + } + pub fn get_type(&self, si: SnapshotId, label: LabelId) -> GraphResult> { let guard = epoch::pin(); let map = self.get_map(&guard); @@ -234,12 +267,24 @@ impl VertexTypeManagerBuilder { } let info = VertexTypeInfo::new(si, label); let codec = Codec::from(type_def); - let res = info.update_codec(si, codec); - res_unwrap!(res, create, si, label, type_def)?; + res_unwrap!(info.update_codec(si, codec), create, si, label, type_def)?; self.map.insert(label, Arc::new(info)); Ok(()) } + pub fn update_type(&mut self, si: SnapshotId, label: LabelId, type_def: &TypeDef) -> GraphResult<()> { + if !self.map.contains_key(&label) { + let msg = format!("vertex#{} not found.", label); + let err = gen_graph_err!(GraphErrorCode::InvalidOperation, msg, create_type); + return Err(err); + } + if let Some(info) = self.map.get(&label) { + let codec = Codec::from(type_def); + res_unwrap!(info.update_codec(si, codec), create_type)?; + } + Ok(()) + } + pub fn drop(&mut self, si: SnapshotId, label: LabelId) -> GraphResult<()> { if let Some(info) = self.map.get(&label) { info.lifetime.set_end(si); diff --git a/interactive_engine/executor/store/groot/src/db/storage/rocksdb.rs b/interactive_engine/executor/store/groot/src/db/storage/rocksdb.rs index 20531d8cf865..26b704972de6 100644 --- a/interactive_engine/executor/store/groot/src/db/storage/rocksdb.rs +++ b/interactive_engine/executor/store/groot/src/db/storage/rocksdb.rs @@ -226,6 +226,7 @@ impl RocksDB { } pub fn compact(&self) -> GraphResult<()> { + info!("begin to compact rocksdb"); if self.is_secondary { info!("Cannot compact in secondary instance"); return Ok(()); diff --git a/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/Frontend.java b/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/Frontend.java index f3d6e67be719..9eb12d683761 100644 --- a/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/Frontend.java +++ b/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/Frontend.java @@ -20,7 +20,8 @@ import com.alibaba.graphscope.common.client.channel.ChannelFetcher; import com.alibaba.graphscope.common.client.channel.HostsRpcChannelFetcher; import com.alibaba.graphscope.common.config.Configs; -import com.alibaba.graphscope.common.config.GraphConfig; +import com.alibaba.graphscope.common.ir.meta.fetcher.StaticIrMetaFetcher; +import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.common.manager.IrMetaQueryCallback; import com.alibaba.graphscope.gremlin.integration.result.TestGraphFactory; @@ -45,12 +46,18 @@ public Frontend(Configs configs) { public void start() throws Exception { ChannelFetcher channelFetcher = new HostsRpcChannelFetcher(configs); - String vineyardSchemaPath = GraphConfig.GRAPH_SCHEMA.get(configs); + GraphRelOptimizer optimizer = new GraphRelOptimizer(configs); IrMetaQueryCallback queryCallback = - new IrMetaQueryCallback(new VineyardMetaFetcher(vineyardSchemaPath)); + new IrMetaQueryCallback( + new StaticIrMetaFetcher( + new VineyardIrMetaReader(configs), optimizer.getGlogueHolder())); this.graphServer = new GraphServer( - this.configs, channelFetcher, queryCallback, TestGraphFactory.VINEYARD); + this.configs, + channelFetcher, + queryCallback, + TestGraphFactory.VINEYARD, + optimizer); this.graphServer.start(); } diff --git a/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/JsonFileSchemaFetcher.java b/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/JsonFileSchemaFetcher.java deleted file mode 100644 index d1bc0e9e4a55..000000000000 --- a/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/JsonFileSchemaFetcher.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ -package com.alibaba.graphscope.frontend; - -import com.alibaba.graphscope.groot.common.schema.api.GraphSchema; -import com.alibaba.graphscope.groot.common.schema.api.SchemaFetcher; -import com.alibaba.graphscope.groot.common.schema.impl.DefaultGraphSchema; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Map; - -public class JsonFileSchemaFetcher implements SchemaFetcher { - private long snapshot; - private GraphSchema graphSchema; - - public JsonFileSchemaFetcher(String filePath) { - try { - String schemaString = new String(Files.readAllBytes(Paths.get(filePath))); - this.graphSchema = DefaultGraphSchema.buildSchemaFromJson(schemaString); - this.snapshot = Integer.MAX_VALUE - 1; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public Map getSchemaSnapshotPair() { - return Map.of(snapshot, graphSchema); - } - - @Override - public int getPartitionNum() { - return -1; - } - - @Override - public int getVersion() { - return -1; - } -} diff --git a/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/VineyardIrMetaReader.java b/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/VineyardIrMetaReader.java new file mode 100644 index 000000000000..012b373f4c83 --- /dev/null +++ b/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/VineyardIrMetaReader.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Alibaba Group Holding Limited. + * + * 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. + */ + +package com.alibaba.graphscope.frontend; + +import com.alibaba.graphscope.common.config.Configs; +import com.alibaba.graphscope.common.config.GraphConfig; +import com.alibaba.graphscope.common.ir.meta.GraphId; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.reader.IrMetaReader; +import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; +import com.alibaba.graphscope.groot.common.schema.api.GraphSchema; +import com.alibaba.graphscope.groot.common.schema.api.GraphStatistics; +import com.alibaba.graphscope.groot.common.schema.impl.DefaultGraphSchema; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.NotImplementedException; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +public class VineyardIrMetaReader implements IrMetaReader { + private final Configs configs; + + public VineyardIrMetaReader(Configs configs) { + this.configs = configs; + } + + @Override + public IrMeta readMeta() throws IOException { + String schemaString = + FileUtils.readFileToString( + new File(GraphConfig.GRAPH_SCHEMA.get(configs)), StandardCharsets.UTF_8); + GraphSchema graphSchema = DefaultGraphSchema.buildSchemaFromJson(schemaString); + return new IrMeta(new IrGraphSchema(graphSchema, true)); + } + + @Override + public GraphStatistics readStats(GraphId graphId) throws IOException { + // TODO: support statistics, otherwise, the CBO will not work + throw new NotImplementedException( + "reading graph statistics in vineyard is unimplemented yet"); + } +} diff --git a/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/VineyardMetaFetcher.java b/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/VineyardMetaFetcher.java deleted file mode 100644 index 5626887359d1..000000000000 --- a/interactive_engine/frontend/src/main/java/com/alibaba/graphscope/frontend/VineyardMetaFetcher.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2020 Alibaba Group Holding Limited. - * - * 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. - */ - -package com.alibaba.graphscope.frontend; - -import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; -import com.alibaba.graphscope.common.store.IrMeta; -import com.alibaba.graphscope.common.store.IrMetaFetcher; -import com.alibaba.graphscope.groot.common.schema.api.GraphSchema; -import com.alibaba.graphscope.groot.common.util.IrSchemaParser; - -import java.io.IOException; -import java.util.Optional; - -public class VineyardMetaFetcher implements IrMetaFetcher { - private final IrMeta irMeta; - - public VineyardMetaFetcher(String schemaPath) { - IrSchemaParser parser = IrSchemaParser.getInstance(); - JsonFileSchemaFetcher fetcher = new JsonFileSchemaFetcher(schemaPath); - GraphSchema graphSchema = fetcher.getSchemaSnapshotPair().values().iterator().next(); - try { - // TODO: support statistics, otherwise, the CBO will not work - this.irMeta = new IrMeta(new IrGraphSchema(graphSchema, true)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public Optional fetch() { - return Optional.of(irMeta); - } -} diff --git a/interactive_engine/groot-client/src/main/java/com/alibaba/graphscope/groot/sdk/schema/Schema.java b/interactive_engine/groot-client/src/main/java/com/alibaba/graphscope/groot/sdk/schema/Schema.java index d68402f0bb0b..c5d5aa61a3d4 100644 --- a/interactive_engine/groot-client/src/main/java/com/alibaba/graphscope/groot/sdk/schema/Schema.java +++ b/interactive_engine/groot-client/src/main/java/com/alibaba/graphscope/groot/sdk/schema/Schema.java @@ -12,15 +12,22 @@ public class Schema { List vertexLabelsToDrop; List edgeLabelsToDrop; + List vertexLabelsToAddProperties; + List edgeLabelsToAddProperties; + public Schema( List vertexLabels, List edgeLabels, List vertexLabelsToDrop, - List edgeLabelsToDrop) { + List edgeLabelsToDrop, + List vertexLabelsToAddProperties, + List edgeLabelsToAddProperties) { this.vertexLabels = vertexLabels; this.edgeLabels = edgeLabels; this.vertexLabelsToDrop = vertexLabelsToDrop; this.edgeLabelsToDrop = edgeLabelsToDrop; + this.vertexLabelsToAddProperties = vertexLabelsToAddProperties; + this.edgeLabelsToAddProperties = edgeLabelsToAddProperties; } public Schema() {} @@ -117,6 +124,14 @@ public BatchSubmitRequest toProto() { DDLRequest.newBuilder().setDropVertexTypeRequest(typeBuilder); builder.addValue(ddlRequestBuilder); } + for (VertexLabel label : vertexLabelsToAddProperties) { + AddVertexTypePropertiesRequest.Builder typeBuilder = + AddVertexTypePropertiesRequest.newBuilder(); + typeBuilder.setTypeDef(label.toProto()); + DDLRequest.Builder ddlRequestBuilder = + DDLRequest.newBuilder().setAddVertexTypePropertiesRequest(typeBuilder); + builder.addValue(ddlRequestBuilder); + } for (EdgeLabel label : edgeLabels) { CreateEdgeTypeRequest.Builder typeBuilder = CreateEdgeTypeRequest.newBuilder(); typeBuilder.setTypeDef(label.toProto()); @@ -132,6 +147,14 @@ public BatchSubmitRequest toProto() { builder.addValue(DDLRequest.newBuilder().setAddEdgeKindRequest(kindBuilder)); } } + for (EdgeLabel label : edgeLabelsToAddProperties) { + AddEdgeTypePropertiesRequest.Builder typeBuilder = + AddEdgeTypePropertiesRequest.newBuilder(); + typeBuilder.setTypeDef(label.toProto()); + DDLRequest.Builder ddlRequestBuilder = + DDLRequest.newBuilder().setAddEdgeTypePropertiesRequest(typeBuilder); + builder.addValue(ddlRequestBuilder); + } for (EdgeLabel label : edgeLabelsToDrop) { for (EdgeLabel.EdgeRelation relation : label.getRelations()) { RemoveEdgeKindRequest.Builder kindBuilder = RemoveEdgeKindRequest.newBuilder(); @@ -159,11 +182,16 @@ public static class Builder { List vertexLabelsToDrop; List edgeLabelsToDrop; + List vertexLabelsToAddProperties; + List edgeLabelsToAddProperties; + public Builder() { vertexLabels = new ArrayList<>(); edgeLabels = new ArrayList<>(); vertexLabelsToDrop = new ArrayList<>(); edgeLabelsToDrop = new ArrayList<>(); + vertexLabelsToAddProperties = new ArrayList<>(); + edgeLabelsToAddProperties = new ArrayList<>(); } public Builder addVertexLabel(VertexLabel label) { @@ -171,11 +199,35 @@ public Builder addVertexLabel(VertexLabel label) { return this; } + public Builder addVertexLabelProperties(VertexLabel label) { + if (vertexLabelsToAddProperties.stream() + .anyMatch(item -> item.getLabel().equals(label.getLabel()))) { + throw new IllegalArgumentException( + label.getLabel() + + " duplicated label in submission queue. " + + "merge all properties if they belong to same label."); + } + vertexLabelsToAddProperties.add(label); + return this; + } + public Builder addEdgeLabel(EdgeLabel label) { edgeLabels.add(label); return this; } + public Builder addEdgeLabelProperties(EdgeLabel label) { + if (edgeLabelsToAddProperties.stream() + .anyMatch(item -> item.getLabel().equals(label.getLabel()))) { + throw new IllegalArgumentException( + label.getLabel() + + " duplicated label in submission queue. " + + "merge all properties if they belong to same label."); + } + edgeLabelsToAddProperties.add(label); + return this; + } + public Builder dropVertexLabel(VertexLabel label) { vertexLabelsToDrop.add(label); return this; @@ -196,10 +248,18 @@ public Builder addVertexLabel(VertexLabel.Builder label) { return addVertexLabel(label.build()); } + public Builder addVertexLabelProperties(VertexLabel.Builder label) { + return addVertexLabelProperties(label.build()); + } + public Builder addEdgeLabel(EdgeLabel.Builder label) { return addEdgeLabel(label.build()); } + public Builder addEdgeLabelProperties(EdgeLabel.Builder label) { + return addEdgeLabelProperties(label.build()); + } + public Builder dropVertexLabel(VertexLabel.Builder label) { return dropVertexLabel(label.build()); } @@ -215,7 +275,13 @@ public Builder dropEdgeLabelOrKind(EdgeLabel.Builder label) { } public Schema build() { - return new Schema(vertexLabels, edgeLabels, vertexLabelsToDrop, edgeLabelsToDrop); + return new Schema( + vertexLabels, + edgeLabels, + vertexLabelsToDrop, + edgeLabelsToDrop, + vertexLabelsToAddProperties, + edgeLabelsToAddProperties); } } } diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/coordinator/SchemaManager.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/coordinator/SchemaManager.java index aae7c6344c76..6586beaaa338 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/coordinator/SchemaManager.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/coordinator/SchemaManager.java @@ -95,7 +95,7 @@ private void recover() { } catch (InterruptedException interruptedException) { // Ignore } - this.singleThreadExecutor.execute(() -> recover()); + this.singleThreadExecutor.execute(this::recover); } } @@ -107,7 +107,7 @@ private void recoverInternal() throws IOException, ExecutionException, Interrupt GraphDef graphDef = this.graphDefFetcher.fetchGraphDef(); this.graphDefRef.set(graphDef); this.ready = true; - // logger.info("SchemaManager recovered. version [" + graphDef.getVersion() + "]"); + logger.debug("SchemaManager recovered. version [" + graphDef.getVersion() + "]"); } public void stop() { diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/frontend/GrootDdlService.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/frontend/GrootDdlService.java index 865199281796..73c08a928c74 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/frontend/GrootDdlService.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/frontend/GrootDdlService.java @@ -68,6 +68,14 @@ public void batchSubmit( .CreateVertexTypeRequest( parseTypeDefPb(cvtReq.getTypeDef()))); break; + case ADD_VERTEX_TYPE_PROPERTIES_REQUEST: + AddVertexTypePropertiesRequest avtpReq = + ddlRequest.getAddVertexTypePropertiesRequest(); + builder.addDdlRequest( + new com.alibaba.graphscope.groot.schema.request + .AddVertexTypePropertiesRequest( + parseTypeDefPb(avtpReq.getTypeDef()))); + break; case CREATE_EDGE_TYPE_REQUEST: CreateEdgeTypeRequest cetReq = ddlRequest.getCreateEdgeTypeRequest(); builder.addDdlRequest( @@ -75,6 +83,14 @@ public void batchSubmit( .CreateEdgeTypeRequest( parseTypeDefPb(cetReq.getTypeDef()))); break; + case ADD_EDGE_TYPE_PROPERTIES_REQUEST: + AddEdgeTypePropertiesRequest aetpReq = + ddlRequest.getAddEdgeTypePropertiesRequest(); + builder.addDdlRequest( + new com.alibaba.graphscope.groot.schema.request + .AddEdgeTypePropertiesRequest( + parseTypeDefPb(aetpReq.getTypeDef()))); + break; case ADD_EDGE_KIND_REQUEST: AddEdgeKindRequest addEdgeKindRequest = ddlRequest.getAddEdgeKindRequest(); builder.addDdlRequest( @@ -156,7 +172,8 @@ private GraphDefPb toGraphDefPb(GraphDef graphDef) { for (EdgeKind edgeKind : edgeKinds) { EdgeKindPb edgeKindPb = EdgeKindPb.newBuilder() - .setEdgeLabel(edgeKind.getEdgeLabel()) + .setEdgeLabel( + graphDef.getTypeDef(edgeKind.getEdgeLabelId()).getLabel()) .setEdgeLabelId( LabelIdPb.newBuilder() .setId(edgeKind.getEdgeLabelId().getId())) diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/frontend/write/KafkaAppender.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/frontend/write/KafkaAppender.java index c79a4f85fe5a..adc98d787134 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/frontend/write/KafkaAppender.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/frontend/write/KafkaAppender.java @@ -231,7 +231,8 @@ public List replayDMLRecordsFrom(long offset, long timestamp) throws IOExc types.add(OperationType.DELETE_EDGE); types.add(OperationType.CLEAR_VERTEX_PROPERTIES); types.add(OperationType.CLEAR_EDGE_PROPERTIES); - + types.add(OperationType.ADD_VERTEX_TYPE_PROPERTIES); + types.add(OperationType.ADD_EDGE_TYPE_PROPERTIES); logger.info("replay DML records of from offset [{}], ts [{}]", offset, timestamp); long batchSnapshotId = 0; diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/OperationType.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/OperationType.java index 2630737beb8e..ae16576a0b0b 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/OperationType.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/OperationType.java @@ -38,7 +38,10 @@ public enum OperationType { CLEAR_VERTEX_PROPERTIES(15), - CLEAR_EDGE_PROPERTIES(16); + CLEAR_EDGE_PROPERTIES(16), + + ADD_VERTEX_TYPE_PROPERTIES(17), + ADD_EDGE_TYPE_PROPERTIES(18); private final byte b; diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/ddl/AddEdgeTypePropertiesOperation.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/ddl/AddEdgeTypePropertiesOperation.java new file mode 100644 index 000000000000..a5adbf2a6a8a --- /dev/null +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/ddl/AddEdgeTypePropertiesOperation.java @@ -0,0 +1,35 @@ +package com.alibaba.graphscope.groot.operation.ddl; + +import com.alibaba.graphscope.groot.common.schema.wrapper.TypeDef; +import com.alibaba.graphscope.groot.operation.Operation; +import com.alibaba.graphscope.groot.operation.OperationType; +import com.alibaba.graphscope.proto.groot.DdlOperationPb; +import com.google.protobuf.ByteString; + +public class AddEdgeTypePropertiesOperation extends Operation { + + private final int partitionId; + private final long schemaVersion; + private final TypeDef typeDef; + + public AddEdgeTypePropertiesOperation(int partitionId, long schemaVersion, TypeDef typeDef) { + super(OperationType.ADD_EDGE_TYPE_PROPERTIES); + this.partitionId = partitionId; + this.schemaVersion = schemaVersion; + this.typeDef = typeDef; + } + + @Override + protected long getPartitionKey() { + return partitionId; + } + + @Override + protected ByteString getBytes() { + return DdlOperationPb.newBuilder() + .setSchemaVersion(schemaVersion) + .setDdlBlob(typeDef.toProto().toByteString()) + .build() + .toByteString(); + } +} diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/ddl/AddVertexTypePropertiesOperation.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/ddl/AddVertexTypePropertiesOperation.java new file mode 100644 index 000000000000..ff0be13ffa1b --- /dev/null +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/operation/ddl/AddVertexTypePropertiesOperation.java @@ -0,0 +1,52 @@ +package com.alibaba.graphscope.groot.operation.ddl; + +import com.alibaba.graphscope.groot.common.schema.wrapper.TypeDef; +import com.alibaba.graphscope.groot.operation.Operation; +import com.alibaba.graphscope.groot.operation.OperationType; +import com.alibaba.graphscope.proto.groot.AddVertexTypePropertiesPb; +import com.alibaba.graphscope.proto.groot.DdlOperationPb; +import com.google.protobuf.ByteString; + +public class AddVertexTypePropertiesOperation extends Operation { + + private final int partitionId; + private final long schemaVersion; + private final TypeDef typeDef; + private final long tableIdx; + + public AddVertexTypePropertiesOperation( + int partitionId, long schemaVersion, TypeDef typeDef, long tableIdx) { + super(OperationType.ADD_VERTEX_TYPE_PROPERTIES); + this.partitionId = partitionId; + this.schemaVersion = schemaVersion; + this.typeDef = typeDef; + this.tableIdx = tableIdx; + } + + public int getPartitionId() { + return partitionId; + } + + public TypeDef getTypeDef() { + return typeDef; + } + + @Override + protected long getPartitionKey() { + return partitionId; + } + + @Override + protected ByteString getBytes() { + return DdlOperationPb.newBuilder() + .setSchemaVersion(schemaVersion) + .setDdlBlob( + AddVertexTypePropertiesPb.newBuilder() + .setTypeDef(typeDef.toProto()) + .setTableIdx(tableIdx) + .build() + .toByteString()) + .build() + .toByteString(); + } +} diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractAddTypePropertiesExecutor.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractAddTypePropertiesExecutor.java new file mode 100644 index 000000000000..9c23cf27f271 --- /dev/null +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractAddTypePropertiesExecutor.java @@ -0,0 +1,153 @@ +package com.alibaba.graphscope.groot.schema.ddl; + +import com.alibaba.graphscope.groot.common.schema.wrapper.*; +import com.alibaba.graphscope.groot.common.util.JSON; +import com.alibaba.graphscope.groot.operation.Operation; +import com.alibaba.graphscope.groot.schema.request.DdlException; +import com.alibaba.graphscope.proto.groot.TypeDefPb; +import com.google.protobuf.ByteString; +import com.google.protobuf.InvalidProtocolBufferException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.*; + +public abstract class AbstractAddTypePropertiesExecutor extends AbstractDdlExecutor { + + private static final Logger logger = + LoggerFactory.getLogger(AbstractAddTypePropertiesExecutor.class); + + private static final String NAME_REGEX = "^\\w{1,128}$"; + + @Override + public DdlResult execute(ByteString ddlBlob, GraphDef graphDef, int partitionCount) + throws InvalidProtocolBufferException { + TypeDefPb typeDefPb = TypeDefPb.parseFrom(ddlBlob); + TypeDef incomingTypeDef = TypeDef.parseProto(typeDefPb); + long version = graphDef.getSchemaVersion(); + String label = incomingTypeDef.getLabel(); + + TypeDef previousTypeDef = graphDef.getTypeDef(label); + if (previousTypeDef == null) { + throw new DdlException( + "LabelName [" + label + "] cannot found exists label in Graph Def."); + } + if (previousTypeDef.getTypeEnum() != incomingTypeDef.getTypeEnum()) { + throw new DdlException( + "LabelName [" + + label + + "] type enum has been change. origin type [" + + previousTypeDef.getTypeEnum() + + "]."); + } + + LabelId labelId = new LabelId(previousTypeDef.getLabelId()); + version++; + if (!label.matches(NAME_REGEX)) { + throw new DdlException("illegal label name [" + label + "]"); + } + + if (!graphDef.hasLabel(label)) { + throw new DdlException( + "label [" + label + "] not found, schema version [" + version + "]"); + } + + if (incomingTypeDef.getTypeEnum() == TypeEnum.VERTEX) { + if (this instanceof AddEdgeTypePropertiesExecutor) { + throw new DdlException("Expect edge type but got vertex type"); + } + if (incomingTypeDef.getPkIdxs().size() > 0) { + throw new DdlException( + "Can not add primary key properties in exists Vertex type. label [" + + label + + "]"); + } + } else { + if (this instanceof AddVertexTypePropertiesExecutor) { + throw new DdlException("Expect vertex type but got edge type"); + } + if (incomingTypeDef.getPkIdxs().size() > 0) { + throw new DdlException( + "Can not add primary key properties in exists Edge type. label [" + + label + + "]"); + } + } + + GraphDef.Builder graphDefBuilder = GraphDef.newBuilder(graphDef); + graphDefBuilder.setVersion(version); + TypeDef.Builder typeDefBuilder = TypeDef.newBuilder(incomingTypeDef); + typeDefBuilder.setVersionId((int) version); + typeDefBuilder.setLabelId(labelId); + + int propertyIdx = graphDef.getPropertyIdx(); + Map propertyNameToId = graphDef.getPropertyNameToId(); + List incomingProperties = incomingTypeDef.getProperties(); + checkDuplicatedPropertiesExists(incomingProperties); + List previousProperties = previousTypeDef.getProperties(); + List allProperties = + new ArrayList<>(previousProperties.size() + incomingProperties.size()); + List newIncomingProperties = new ArrayList<>(incomingProperties.size()); + allProperties.addAll(previousProperties); + for (PropertyDef property : incomingProperties) { + checkPropertiesExists(label, property, previousProperties); + String propertyName = property.getName(); + if (!propertyName.matches(NAME_REGEX)) { + throw new DdlException("illegal property name [" + propertyName + "]"); + } + Integer propertyId = propertyNameToId.get(propertyName); + if (propertyId == null) { + propertyIdx++; + propertyId = propertyIdx; + graphDefBuilder.putPropertyNameToId(propertyName, propertyId); + graphDefBuilder.setPropertyIdx(propertyIdx); + } + PropertyDef propertyDef = + PropertyDef.newBuilder(property) + .setId(propertyId) + .setInnerId(propertyId) + .build(); + allProperties.add(propertyDef); + newIncomingProperties.add(propertyDef); + } + typeDefBuilder.setPropertyDefs(allProperties); + graphDefBuilder.addTypeDef(typeDefBuilder.build()); + GraphDef newGraphDef = graphDefBuilder.build(); + + typeDefBuilder.setPropertyDefs(newIncomingProperties); + TypeDef newIncomingTypeDef = typeDefBuilder.build(); + + List operations = new ArrayList<>(partitionCount); + for (int i = 0; i < partitionCount; i++) { + Operation operation = makeOperation(i, version, newIncomingTypeDef, newGraphDef); + operations.add(operation); + } + logger.info("new incoming type def is {}", JSON.toJson(newIncomingTypeDef)); + return new DdlResult(newGraphDef, operations); + } + + private void checkPropertiesExists( + String label, PropertyDef property, List propertyDefs) { + Integer propertyId = property.getId(); + String propertyName = property.getName(); + for (PropertyDef existsProperty : propertyDefs) { + Integer curId = existsProperty.getId(); + String curName = existsProperty.getName(); + if (propertyName.equals(curName) || propertyId.equals(curId)) { + throw new DdlException( + "propertyName [" + + propertyName + + "], propertyId [" + + propertyId + + "]" + + "already exists in Label [" + + label + + "]."); + } + } + } + + protected abstract Operation makeOperation( + int partition, long version, TypeDef typeDef, GraphDef graphDef); +} diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractCreateTypeExecutor.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractCreateTypeExecutor.java index ec36ba2423a8..a371392b87e3 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractCreateTypeExecutor.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractCreateTypeExecutor.java @@ -60,6 +60,7 @@ public DdlResult execute(ByteString ddlBlob, GraphDef graphDef, int partitionCou } else if (this instanceof CreateVertexTypeExecutor) { throw new DdlException("Expect vertex type but got edge type"); } + version++; GraphDef.Builder graphDefBuilder = GraphDef.newBuilder(graphDef); TypeDef.Builder typeDefBuilder = TypeDef.newBuilder(typeDef); @@ -67,6 +68,7 @@ public DdlResult execute(ByteString ddlBlob, GraphDef graphDef, int partitionCou int propertyIdx = graphDef.getPropertyIdx(); Map propertyNameToId = graphDef.getPropertyNameToId(); List inputPropertiesInfo = typeDef.getProperties(); + checkDuplicatedPropertiesExists(inputPropertiesInfo); List propertyDefs = new ArrayList<>(inputPropertiesInfo.size()); for (PropertyDef property : inputPropertiesInfo) { String propertyName = property.getName(); @@ -90,9 +92,9 @@ public DdlResult execute(ByteString ddlBlob, GraphDef graphDef, int partitionCou int labelIdx = graphDef.getLabelIdx() + 1; LabelId labelId = new LabelId(labelIdx); typeDefBuilder.setLabelId(labelId); + typeDefBuilder.setVersionId((int) version); TypeDef newTypeDef = typeDefBuilder.build(); - version++; graphDefBuilder.setVersion(version); graphDefBuilder.addTypeDef(newTypeDef); graphDefBuilder.setLabelIdx(labelIdx); diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractDdlExecutor.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractDdlExecutor.java index 3b34fd738e4d..b3fd7f8ac809 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractDdlExecutor.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AbstractDdlExecutor.java @@ -14,11 +14,29 @@ package com.alibaba.graphscope.groot.schema.ddl; import com.alibaba.graphscope.groot.common.schema.wrapper.GraphDef; +import com.alibaba.graphscope.groot.common.schema.wrapper.PropertyDef; +import com.alibaba.graphscope.groot.schema.request.DdlException; import com.google.protobuf.ByteString; import com.google.protobuf.InvalidProtocolBufferException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + public abstract class AbstractDdlExecutor { public abstract DdlResult execute(ByteString ddlBlob, GraphDef graphDef, int partitionCount) throws InvalidProtocolBufferException; + + protected void checkDuplicatedPropertiesExists(List propertyDefs) { + Set propertyNameSet = new HashSet<>(); + for (PropertyDef property : propertyDefs) { + String propertyName = property.getName(); + if (propertyNameSet.contains(propertyName)) { + throw new DdlException( + "incoming propertyName [" + propertyName + "] has duplicated"); + } + propertyNameSet.add(propertyName); + } + } } diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AddEdgeTypePropertiesExecutor.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AddEdgeTypePropertiesExecutor.java new file mode 100644 index 000000000000..b19eedcc50b1 --- /dev/null +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AddEdgeTypePropertiesExecutor.java @@ -0,0 +1,15 @@ +package com.alibaba.graphscope.groot.schema.ddl; + +import com.alibaba.graphscope.groot.common.schema.wrapper.GraphDef; +import com.alibaba.graphscope.groot.common.schema.wrapper.TypeDef; +import com.alibaba.graphscope.groot.operation.Operation; +import com.alibaba.graphscope.groot.operation.ddl.AddEdgeTypePropertiesOperation; + +public class AddEdgeTypePropertiesExecutor extends AbstractAddTypePropertiesExecutor { + + @Override + protected Operation makeOperation( + int partition, long version, TypeDef typeDef, GraphDef newGraphDef) { + return new AddEdgeTypePropertiesOperation(partition, version, typeDef); + } +} diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AddVertexTypePropertiesExecutor.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AddVertexTypePropertiesExecutor.java new file mode 100644 index 000000000000..fbcf34fa3a61 --- /dev/null +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/AddVertexTypePropertiesExecutor.java @@ -0,0 +1,20 @@ +package com.alibaba.graphscope.groot.schema.ddl; + +import com.alibaba.graphscope.groot.common.schema.wrapper.GraphDef; +import com.alibaba.graphscope.groot.common.schema.wrapper.LabelId; +import com.alibaba.graphscope.groot.common.schema.wrapper.TypeDef; +import com.alibaba.graphscope.groot.operation.Operation; +import com.alibaba.graphscope.groot.operation.ddl.AddVertexTypePropertiesOperation; + +import java.util.Map; + +public class AddVertexTypePropertiesExecutor extends AbstractAddTypePropertiesExecutor { + + @Override + protected Operation makeOperation( + int partition, long version, TypeDef typeDef, GraphDef newGraphDef) { + Map vertexTableIdMap = newGraphDef.getVertexTableIds(); + Long tableId = vertexTableIdMap.get(typeDef.getTypeLabelId()); + return new AddVertexTypePropertiesOperation(partition, version, typeDef, tableId); + } +} diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/DdlExecutors.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/DdlExecutors.java index 9f8ede0e745f..77d59c12bfe8 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/DdlExecutors.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/ddl/DdlExecutors.java @@ -33,7 +33,11 @@ public class DdlExecutors { public DdlExecutors() { this.ddlExecutors = new HashMap<>(); ddlExecutors.put(OperationType.CREATE_VERTEX_TYPE, new CreateVertexTypeExecutor()); + ddlExecutors.put( + OperationType.ADD_VERTEX_TYPE_PROPERTIES, new AddVertexTypePropertiesExecutor()); ddlExecutors.put(OperationType.CREATE_EDGE_TYPE, new CreateEdgeTypeExecutor()); + ddlExecutors.put( + OperationType.ADD_EDGE_TYPE_PROPERTIES, new AddEdgeTypePropertiesExecutor()); ddlExecutors.put(OperationType.DROP_VERTEX_TYPE, new DropVertexTypeExecutor()); ddlExecutors.put(OperationType.DROP_EDGE_TYPE, new DropEdgeTypeExecutor()); ddlExecutors.put(OperationType.ADD_EDGE_KIND, new AddEdgeKindExecutor()); diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/request/AddEdgeTypePropertiesRequest.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/request/AddEdgeTypePropertiesRequest.java new file mode 100644 index 000000000000..62a8595b7463 --- /dev/null +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/request/AddEdgeTypePropertiesRequest.java @@ -0,0 +1,20 @@ +package com.alibaba.graphscope.groot.schema.request; + +import com.alibaba.graphscope.groot.common.schema.wrapper.TypeDef; +import com.alibaba.graphscope.groot.operation.OperationType; +import com.google.protobuf.ByteString; + +public class AddEdgeTypePropertiesRequest extends AbstractDdlRequest { + + private TypeDef typeDef; + + public AddEdgeTypePropertiesRequest(TypeDef typeDef) { + super(OperationType.ADD_EDGE_TYPE_PROPERTIES); + this.typeDef = typeDef; + } + + @Override + protected ByteString getBytes() { + return typeDef.toDdlProto().toByteString(); + } +} diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/request/AddVertexTypePropertiesRequest.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/request/AddVertexTypePropertiesRequest.java new file mode 100644 index 000000000000..e8a0cd1fbb00 --- /dev/null +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/schema/request/AddVertexTypePropertiesRequest.java @@ -0,0 +1,20 @@ +package com.alibaba.graphscope.groot.schema.request; + +import com.alibaba.graphscope.groot.common.schema.wrapper.TypeDef; +import com.alibaba.graphscope.groot.operation.OperationType; +import com.google.protobuf.ByteString; + +public class AddVertexTypePropertiesRequest extends AbstractDdlRequest { + + private TypeDef typeDef; + + public AddVertexTypePropertiesRequest(TypeDef typeDef) { + super(OperationType.ADD_VERTEX_TYPE_PROPERTIES); + this.typeDef = typeDef; + } + + @Override + protected ByteString getBytes() { + return typeDef.toDdlProto().toByteString(); + } +} diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/store/KafkaProcessor.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/store/KafkaProcessor.java index 1c6cb6af8131..0ee4c1dd7f59 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/store/KafkaProcessor.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/store/KafkaProcessor.java @@ -278,6 +278,8 @@ private List prepareDDLTypes() { types.add(OperationType.REMOVE_EDGE_KIND); types.add(OperationType.PREPARE_DATA_LOAD); types.add(OperationType.COMMIT_DATA_LOAD); + types.add(OperationType.ADD_VERTEX_TYPE_PROPERTIES); + types.add(OperationType.ADD_EDGE_TYPE_PROPERTIES); types.add(OperationType.MARKER); // For advance ID return types; } diff --git a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/store/StoreService.java b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/store/StoreService.java index 27b4a2e78f6b..5a55fbc2832b 100644 --- a/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/store/StoreService.java +++ b/interactive_engine/groot-module/src/main/java/com/alibaba/graphscope/groot/store/StoreService.java @@ -120,18 +120,13 @@ public void start() throws IOException { new LinkedBlockingQueue<>(1), ThreadFactoryUtils.daemonThreadFactoryWithLogExceptionHandler( "store-ingest", logger)); - int partitionCount = partitionIds.size(); - int compactQueueLength = - partitionCount - this.compactThreadCount <= 0 - ? 1 - : partitionCount - this.compactThreadCount; this.compactExecutor = new ThreadPoolExecutor( 1, this.compactThreadCount, 60L, TimeUnit.SECONDS, - new LinkedBlockingQueue<>(compactQueueLength), + new LinkedBlockingQueue<>(partitionIds.size()), ThreadFactoryUtils.daemonThreadFactoryWithLogExceptionHandler( "store-compact", logger)); this.garbageCollectExecutor = @@ -309,7 +304,7 @@ public void ingestData( downloadPath = Paths.get(dataRoot, "download").toString(); } String[] items = path.split("/"); - // Get the unique path (uuid) + // Get the unique path (uuid) String unique_path = items[items.length - 1]; Path uniquePath = Paths.get(downloadPath, unique_path); if (!Files.isDirectory(uniquePath)) { @@ -425,13 +420,14 @@ public void compactDB(CompletionCallback callback) { int partitionCount = this.idToPartition.values().size(); CountDownLatch compactCountDownLatch = new CountDownLatch(partitionCount); AtomicInteger successCompactJobCount = new AtomicInteger(partitionCount); - logger.info("compact DB"); + logger.info("compaction of all DB started"); for (GraphPartition partition : this.idToPartition.values()) { this.compactExecutor.execute( () -> { try { + logger.info("Compaction of {} partition started", partition.getId()); partition.compact(); - logger.info("Compaction {} partition finished", partition.getId()); + logger.info("Compaction of {} partition finished", partition.getId()); successCompactJobCount.decrementAndGet(); } catch (Exception e) { logger.error("compact DB failed", e); @@ -448,7 +444,9 @@ public void compactDB(CompletionCallback callback) { } if (successCompactJobCount.get() > 0) { - callback.onError(new Exception("not all partition compact success. please check log.")); + String msg = "not all partition compact success. please check log."; + logger.error(msg); + callback.onError(new Exception(msg)); } else { callback.onCompleted(null); } diff --git a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/FrontendQueryManager.java b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/FrontendQueryManager.java index 9f467a4c5a9d..0330544d8c39 100644 --- a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/FrontendQueryManager.java +++ b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/FrontendQueryManager.java @@ -16,9 +16,9 @@ package com.alibaba.graphscope.groot.servers.ir; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.fetcher.IrMetaFetcher; import com.alibaba.graphscope.common.manager.IrMetaQueryCallback; -import com.alibaba.graphscope.common.store.IrMeta; -import com.alibaba.graphscope.common.store.IrMetaFetcher; import com.alibaba.graphscope.groot.frontend.SnapshotUpdateClient; import com.alibaba.graphscope.groot.rpc.RoleClients; import com.google.common.util.concurrent.ThreadFactoryBuilder; diff --git a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/GrootIrMetaReader.java b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/GrootIrMetaReader.java new file mode 100644 index 000000000000..a1a7d5f3ded7 --- /dev/null +++ b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/GrootIrMetaReader.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Alibaba Group Holding Limited. + * + * 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. + */ + +package com.alibaba.graphscope.groot.servers.ir; + +import com.alibaba.graphscope.common.ir.meta.GraphId; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.SnapshotId; +import com.alibaba.graphscope.common.ir.meta.reader.IrMetaReader; +import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; +import com.alibaba.graphscope.groot.common.schema.api.GraphSchema; +import com.alibaba.graphscope.groot.common.schema.api.GraphStatistics; +import com.alibaba.graphscope.groot.common.schema.api.SchemaFetcher; +import com.google.common.base.Preconditions; + +import org.apache.commons.lang3.NotImplementedException; + +import java.io.IOException; +import java.util.*; + +public class GrootIrMetaReader implements IrMetaReader { + private final SchemaFetcher schemaFetcher; + + public GrootIrMetaReader(SchemaFetcher schemaFetcher) { + this.schemaFetcher = schemaFetcher; + } + + @Override + public IrMeta readMeta() throws IOException { + Map pair = this.schemaFetcher.getSchemaSnapshotPair(); + Preconditions.checkArgument(!pair.isEmpty(), "fetch schema snapshot pair failed in groot"); + Map.Entry entry = pair.entrySet().iterator().next(); + Long snapshotId = entry.getKey(); + GraphSchema schema = entry.getValue(); + return new IrMeta(new SnapshotId(true, snapshotId), new IrGraphSchema(schema, true)); + } + + @Override + public GraphStatistics readStats(GraphId graphId) throws IOException { + // TODO: add statistics, otherwise, the CBO will not work + throw new NotImplementedException("reading graph statistics in groot is unimplemented yet"); + } +} diff --git a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/GrootMetaFetcher.java b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/GrootMetaFetcher.java index 4fbbf90353bc..027c488bc762 100644 --- a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/GrootMetaFetcher.java +++ b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/GrootMetaFetcher.java @@ -16,41 +16,29 @@ package com.alibaba.graphscope.groot.servers.ir; -import com.alibaba.graphscope.common.ir.meta.schema.IrGraphSchema; -import com.alibaba.graphscope.common.store.IrMeta; -import com.alibaba.graphscope.common.store.IrMetaFetcher; -import com.alibaba.graphscope.common.store.SnapshotId; -import com.alibaba.graphscope.groot.common.schema.api.GraphSchema; -import com.alibaba.graphscope.groot.common.schema.api.SchemaFetcher; +import com.alibaba.graphscope.common.ir.meta.IrMeta; +import com.alibaba.graphscope.common.ir.meta.IrMetaTracker; +import com.alibaba.graphscope.common.ir.meta.fetcher.IrMetaFetcher; +import com.alibaba.graphscope.common.ir.meta.reader.IrMetaReader; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.io.IOException; import java.util.*; -public class GrootMetaFetcher implements IrMetaFetcher { - private final SchemaFetcher schemaFetcher; +public class GrootMetaFetcher extends IrMetaFetcher { + private static final Logger logger = LoggerFactory.getLogger(GrootMetaFetcher.class); - public GrootMetaFetcher(SchemaFetcher schemaFetcher) { - this.schemaFetcher = schemaFetcher; + public GrootMetaFetcher(IrMetaReader reader, IrMetaTracker tracker) { + super(reader, tracker); } @Override public Optional fetch() { - Map pair = this.schemaFetcher.getSchemaSnapshotPair(); - - if (!pair.isEmpty()) { - Map.Entry entry = pair.entrySet().iterator().next(); - Long snapshotId = entry.getKey(); - GraphSchema schema = entry.getValue(); - - try { - // TODO: add statistics, otherwise, the CBO will not work - return Optional.of( - new IrMeta( - new SnapshotId(true, snapshotId), new IrGraphSchema(schema, true))); - } catch (IOException e) { - throw new RuntimeException(e); - } - } else { + try { + return Optional.of(reader.readMeta()); + } catch (Exception e) { + logger.warn("fetch ir meta from groot failed: {}", e); return Optional.empty(); } } diff --git a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/IrServiceProducer.java b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/IrServiceProducer.java index fc39e1d5ff69..d6a39f6aa4d4 100644 --- a/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/IrServiceProducer.java +++ b/interactive_engine/groot-server/src/main/java/com/alibaba/graphscope/groot/servers/ir/IrServiceProducer.java @@ -21,7 +21,9 @@ import com.alibaba.graphscope.common.config.AuthConfig; import com.alibaba.graphscope.common.config.FrontendConfig; import com.alibaba.graphscope.common.config.PegasusConfig; -import com.alibaba.graphscope.common.store.IrMetaFetcher; +import com.alibaba.graphscope.common.config.PlannerConfig; +import com.alibaba.graphscope.common.ir.meta.fetcher.IrMetaFetcher; +import com.alibaba.graphscope.common.ir.planner.GraphRelOptimizer; import com.alibaba.graphscope.gremlin.integration.result.TestGraphFactory; import com.alibaba.graphscope.groot.common.RoleType; import com.alibaba.graphscope.groot.common.config.CommonConfig; @@ -56,7 +58,10 @@ public AbstractService makeGraphService( new RpcChannelManagerFetcher(channelManager, executorCount, RoleType.GAIA_RPC); com.alibaba.graphscope.common.config.Configs irConfigs = getConfigs(); logger.info("IR configs: {}", irConfigs); - IrMetaFetcher irMetaFetcher = new GrootMetaFetcher(schemaFetcher); + GraphRelOptimizer optimizer = new GraphRelOptimizer(irConfigs); + IrMetaFetcher irMetaFetcher = + new GrootMetaFetcher( + new GrootIrMetaReader(schemaFetcher), optimizer.getGlogueHolder()); RoleClients updateCommitter = new RoleClients<>(channelManager, RoleType.COORDINATOR, SnapshotUpdateClient::new); int frontendId = CommonConfig.NODE_IDX.get(configs); @@ -66,7 +71,11 @@ public AbstractService makeGraphService( return new AbstractService() { private final GraphServer graphServer = new GraphServer( - irConfigs, channelFetcher, queryManager, TestGraphFactory.GROOT); + irConfigs, + channelFetcher, + queryManager, + TestGraphFactory.GROOT, + optimizer); @Override public void start() { @@ -121,6 +130,10 @@ private com.alibaba.graphscope.common.config.Configs getConfigs() { addToConfigMapIfExist(FrontendConfig.FRONTEND_SERVER_NUM.getKey(), configMap); // add frontend qps limit addToConfigMapIfExist(FrontendConfig.QUERY_PER_SECOND_LIMIT.getKey(), configMap); + // add graph planner configs + addToConfigMapIfExist(PlannerConfig.GRAPH_PLANNER_IS_ON.getKey(), configMap); + addToConfigMapIfExist(PlannerConfig.GRAPH_PLANNER_OPT.getKey(), configMap); + addToConfigMapIfExist(PlannerConfig.GRAPH_PLANNER_RULES.getKey(), configMap); return new com.alibaba.graphscope.common.config.Configs(configMap); } diff --git a/k8s/dockerfiles/analytical.Dockerfile b/k8s/dockerfiles/analytical.Dockerfile index 5a9cc1e794fe..9cc0614861aa 100644 --- a/k8s/dockerfiles/analytical.Dockerfile +++ b/k8s/dockerfiles/analytical.Dockerfile @@ -73,7 +73,7 @@ RUN cd /home/graphscope/GraphScope/ && \ strip ${INSTALL_DIR}/bin/grape_engine; \ strip ${INSTALL_DIR}/lib/*.so; \ sudo cp -rs ${INSTALL_DIR}/* ${GRAPHSCOPE_HOME}/; \ - python3 ./k8s/utils/precompile.py --graph --output_dir ${INSTALL_DIR}/builtin; \ + python3 ./k8s/utils/precompile.py --graph --output_dir ${INSTALL_DIR}/builtin --enable_java_sdk ON; \ strip ${INSTALL_DIR}/builtin/*/*.so || true; \ fi diff --git a/k8s/utils/precompile.py b/k8s/utils/precompile.py index 4def24e505e9..21818ff33631 100755 --- a/k8s/utils/precompile.py +++ b/k8s/utils/precompile.py @@ -41,6 +41,7 @@ def compute_sig(s): else "/opt/graphscope" ) + def cmake_and_make(cmake_commands): try: cmake_process = subprocess.run( @@ -92,7 +93,12 @@ def cmake_graph(graph_class): ) with open(cmakelists_file, mode="w") as f: f.write(content) - cmake_commands = ["cmake", ".", "-DNETWORKX=" + NETWORKX] + cmake_commands = [ + "cmake", + ".", + "-DNETWORKX=" + NETWORKX, + "-DENABLE_JAVA_SDK=" + ENABLE_JAVA_SDK, + ] if "ArrowFragment" in graph_class: cmake_commands.append("-DPROPERTY_GRAPH_FRAME=True") else: @@ -453,6 +459,12 @@ def parse_sys_args(): default=WORKSPACE, help="Output directory." ) + parser.add_argument( + "--enable_java_sdk", + type=str, + default="OFF", + help="Enable Java SDK support or not", + ) return parser.parse_args() WORKSPACE = Path(os.path.join("/", tempfile.gettempprefix(), "gs", "builtin")).resolve() @@ -462,6 +474,7 @@ def parse_sys_args(): print("Launching with args", args) WORKSPACE = args.output_dir WORKSPACE = Path(WORKSPACE).resolve() + ENABLE_JAVA_SDK = args.enable_java_sdk print("Will output libraries to", WORKSPACE) os.makedirs(WORKSPACE, exist_ok=True) if args.graph: diff --git a/proto/ddl_service.proto b/proto/ddl_service.proto index ddb51da7fd7e..3fcb5a421b86 100644 --- a/proto/ddl_service.proto +++ b/proto/ddl_service.proto @@ -37,6 +37,8 @@ message BatchSubmitRequest { RemoveEdgeKindRequest remove_edge_kind_request = 4; DropVertexTypeRequest drop_vertex_type_request = 5; DropEdgeTypeRequest drop_edge_type_request = 6; + AddVertexTypePropertiesRequest add_vertex_type_properties_request = 7; + AddEdgeTypePropertiesRequest add_edge_type_properties_request = 8; } } repeated DDLRequest value = 3; @@ -53,10 +55,18 @@ message CreateVertexTypeRequest { gs.rpc.graph.TypeDefPb type_def = 1; } +message AddVertexTypePropertiesRequest { + gs.rpc.graph.TypeDefPb type_def = 1; +} + message CreateEdgeTypeRequest { gs.rpc.graph.TypeDefPb type_def = 1; } +message AddEdgeTypePropertiesRequest { + gs.rpc.graph.TypeDefPb type_def = 1; +} + message AddEdgeKindRequest { string edge_label = 1; string src_vertex_label = 2; diff --git a/proto/groot/sdk/model.proto b/proto/groot/sdk/model.proto index 98ce53be4904..aea7eba8d32a 100644 --- a/proto/groot/sdk/model.proto +++ b/proto/groot/sdk/model.proto @@ -61,6 +61,9 @@ enum OpTypePb { CLEAR_VERTEX_PROPERTIES = 15; CLEAR_EDGE_PROPERTIES = 16; + + ADD_VERTEX_TYPE_PROPERTIES = 17; + ADD_EDGE_TYPE_PROPERTIES = 18; } message VertexIdPb { @@ -111,12 +114,16 @@ message CreateVertexTypePb { int64 tableIdx = 2; } +message AddVertexTypePropertiesPb { + gs.rpc.graph.TypeDefPb typeDef = 1; + int64 tableIdx = 2; +} + message AddEdgeKindPb { gs.rpc.graph.EdgeKindPb edgeKind = 1; int64 tableIdx = 2; } - message EdgeTableIdEntry { gs.rpc.graph.EdgeKindPb edgeKind = 1; int64 tableId = 2; diff --git a/python/graphscope/config.py b/python/graphscope/config.py index 8aabe53d14b6..909cb872f360 100644 --- a/python/graphscope/config.py +++ b/python/graphscope/config.py @@ -235,6 +235,8 @@ class CoordinatorConfig: """ service_port: int = 63800 # Coordinator service port that will be listening on. + http_port: int = 8080 # Coordinator HTTP service port + monitor: bool = False # Enable or disable prometheus exporter. monitor_port: int = 9090 # Coordinator prometheus exporter service port. diff --git a/python/graphscope/flex/rest/__init__.py b/python/graphscope/flex/rest/__init__.py index 7b1b19539217..813c91ee1e10 100644 --- a/python/graphscope/flex/rest/__init__.py +++ b/python/graphscope/flex/rest/__init__.py @@ -7,7 +7,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,14 +19,12 @@ # import apis into sdk package from graphscope.flex.rest.api.alert_api import AlertApi -from graphscope.flex.rest.api.connection_api import ConnectionApi -from graphscope.flex.rest.api.datasource_api import DatasourceApi +from graphscope.flex.rest.api.data_source_api import DataSourceApi from graphscope.flex.rest.api.deployment_api import DeploymentApi from graphscope.flex.rest.api.graph_api import GraphApi from graphscope.flex.rest.api.job_api import JobApi -from graphscope.flex.rest.api.legacy_api import LegacyApi -from graphscope.flex.rest.api.procedure_api import ProcedureApi from graphscope.flex.rest.api.service_api import ServiceApi +from graphscope.flex.rest.api.stored_procedure_api import StoredProcedureApi from graphscope.flex.rest.api.utils_api import UtilsApi # import ApiClient @@ -41,51 +39,59 @@ from graphscope.flex.rest.exceptions import ApiException # import models into sdk package -from graphscope.flex.rest.models.alert_message import AlertMessage -from graphscope.flex.rest.models.alert_receiver import AlertReceiver -from graphscope.flex.rest.models.alert_rule import AlertRule +from graphscope.flex.rest.models.base_edge_type import BaseEdgeType +from graphscope.flex.rest.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner +from graphscope.flex.rest.models.base_edge_type_vertex_type_pair_relations_inner_x_csr_params import BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams +from graphscope.flex.rest.models.base_property_meta import BasePropertyMeta +from graphscope.flex.rest.models.base_vertex_type import BaseVertexType +from graphscope.flex.rest.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams from graphscope.flex.rest.models.column_mapping import ColumnMapping -from graphscope.flex.rest.models.connection import Connection -from graphscope.flex.rest.models.connection_status import ConnectionStatus -from graphscope.flex.rest.models.data_source import DataSource -from graphscope.flex.rest.models.deployment_info import DeploymentInfo -from graphscope.flex.rest.models.deployment_info_graphs_info_value import DeploymentInfoGraphsInfoValue -from graphscope.flex.rest.models.deployment_status import DeploymentStatus -from graphscope.flex.rest.models.edge_data_source import EdgeDataSource +from graphscope.flex.rest.models.column_mapping_column import ColumnMappingColumn +from graphscope.flex.rest.models.create_alert_receiver_request import CreateAlertReceiverRequest +from graphscope.flex.rest.models.create_alert_rule_request import CreateAlertRuleRequest +from graphscope.flex.rest.models.create_dataloading_job_response import CreateDataloadingJobResponse +from graphscope.flex.rest.models.create_edge_type import CreateEdgeType +from graphscope.flex.rest.models.create_graph_request import CreateGraphRequest +from graphscope.flex.rest.models.create_graph_response import CreateGraphResponse +from graphscope.flex.rest.models.create_graph_schema_request import CreateGraphSchemaRequest +from graphscope.flex.rest.models.create_property_meta import CreatePropertyMeta +from graphscope.flex.rest.models.create_stored_proc_request import CreateStoredProcRequest +from graphscope.flex.rest.models.create_stored_proc_response import CreateStoredProcResponse +from graphscope.flex.rest.models.create_vertex_type import CreateVertexType +from graphscope.flex.rest.models.dataloading_job_config import DataloadingJobConfig +from graphscope.flex.rest.models.dataloading_job_config_edges_inner import DataloadingJobConfigEdgesInner +from graphscope.flex.rest.models.dataloading_job_config_loading_config import DataloadingJobConfigLoadingConfig +from graphscope.flex.rest.models.dataloading_job_config_loading_config_format import DataloadingJobConfigLoadingConfigFormat +from graphscope.flex.rest.models.dataloading_job_config_vertices_inner import DataloadingJobConfigVerticesInner from graphscope.flex.rest.models.edge_mapping import EdgeMapping -from graphscope.flex.rest.models.edge_mapping_destination_vertex_mappings_inner import EdgeMappingDestinationVertexMappingsInner -from graphscope.flex.rest.models.edge_mapping_source_vertex_mappings_inner import EdgeMappingSourceVertexMappingsInner -from graphscope.flex.rest.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn from graphscope.flex.rest.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet -from graphscope.flex.rest.models.edge_type import EdgeType -from graphscope.flex.rest.models.edge_type_vertex_type_pair_relations_inner import EdgeTypeVertexTypePairRelationsInner -from graphscope.flex.rest.models.edge_type_vertex_type_pair_relations_inner_x_csr_params import EdgeTypeVertexTypePairRelationsInnerXCsrParams -from graphscope.flex.rest.models.graph import Graph -from graphscope.flex.rest.models.graph_stored_procedures import GraphStoredProcedures -from graphscope.flex.rest.models.groot_dataloading_job_config import GrootDataloadingJobConfig -from graphscope.flex.rest.models.groot_dataloading_job_config_edges_inner import GrootDataloadingJobConfigEdgesInner -from graphscope.flex.rest.models.groot_edge_type import GrootEdgeType -from graphscope.flex.rest.models.groot_edge_type_relations_inner import GrootEdgeTypeRelationsInner -from graphscope.flex.rest.models.groot_graph import GrootGraph -from graphscope.flex.rest.models.groot_graph_gremlin_interface import GrootGraphGremlinInterface -from graphscope.flex.rest.models.groot_property import GrootProperty -from graphscope.flex.rest.models.groot_schema import GrootSchema -from graphscope.flex.rest.models.groot_vertex_type import GrootVertexType +from graphscope.flex.rest.models.error import Error +from graphscope.flex.rest.models.gs_data_type import GSDataType +from graphscope.flex.rest.models.get_alert_message_response import GetAlertMessageResponse +from graphscope.flex.rest.models.get_alert_receiver_response import GetAlertReceiverResponse +from graphscope.flex.rest.models.get_alert_rule_response import GetAlertRuleResponse +from graphscope.flex.rest.models.get_edge_type import GetEdgeType +from graphscope.flex.rest.models.get_graph_response import GetGraphResponse +from graphscope.flex.rest.models.get_graph_schema_response import GetGraphSchemaResponse +from graphscope.flex.rest.models.get_property_meta import GetPropertyMeta +from graphscope.flex.rest.models.get_stored_proc_response import GetStoredProcResponse +from graphscope.flex.rest.models.get_vertex_type import GetVertexType from graphscope.flex.rest.models.job_status import JobStatus -from graphscope.flex.rest.models.model_property import ModelProperty -from graphscope.flex.rest.models.model_schema import ModelSchema +from graphscope.flex.rest.models.long_text import LongText from graphscope.flex.rest.models.node_status import NodeStatus -from graphscope.flex.rest.models.procedure import Procedure -from graphscope.flex.rest.models.procedure_params_inner import ProcedureParamsInner -from graphscope.flex.rest.models.property_property_type import PropertyPropertyType +from graphscope.flex.rest.models.parameter import Parameter +from graphscope.flex.rest.models.primitive_type import PrimitiveType +from graphscope.flex.rest.models.running_deployment_info import RunningDeploymentInfo +from graphscope.flex.rest.models.running_deployment_status import RunningDeploymentStatus +from graphscope.flex.rest.models.running_deployment_status_nodes_inner import RunningDeploymentStatusNodesInner from graphscope.flex.rest.models.schema_mapping import SchemaMapping -from graphscope.flex.rest.models.schema_mapping_loading_config import SchemaMappingLoadingConfig -from graphscope.flex.rest.models.schema_mapping_loading_config_data_source import SchemaMappingLoadingConfigDataSource -from graphscope.flex.rest.models.schema_mapping_loading_config_format import SchemaMappingLoadingConfigFormat from graphscope.flex.rest.models.service_status import ServiceStatus from graphscope.flex.rest.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints from graphscope.flex.rest.models.start_service_request import StartServiceRequest -from graphscope.flex.rest.models.update_alert_messages_request import UpdateAlertMessagesRequest -from graphscope.flex.rest.models.vertex_data_source import VertexDataSource +from graphscope.flex.rest.models.stored_procedure_meta import StoredProcedureMeta +from graphscope.flex.rest.models.string_type import StringType +from graphscope.flex.rest.models.string_type_string import StringTypeString +from graphscope.flex.rest.models.update_alert_message_status_request import UpdateAlertMessageStatusRequest +from graphscope.flex.rest.models.update_stored_proc_request import UpdateStoredProcRequest +from graphscope.flex.rest.models.upload_file_response import UploadFileResponse from graphscope.flex.rest.models.vertex_mapping import VertexMapping -from graphscope.flex.rest.models.vertex_type import VertexType diff --git a/python/graphscope/flex/rest/api/__init__.py b/python/graphscope/flex/rest/api/__init__.py index 1394a483cf37..9d14882d4185 100644 --- a/python/graphscope/flex/rest/api/__init__.py +++ b/python/graphscope/flex/rest/api/__init__.py @@ -2,13 +2,11 @@ # import apis into api package from graphscope.flex.rest.api.alert_api import AlertApi -from graphscope.flex.rest.api.connection_api import ConnectionApi -from graphscope.flex.rest.api.datasource_api import DatasourceApi +from graphscope.flex.rest.api.data_source_api import DataSourceApi from graphscope.flex.rest.api.deployment_api import DeploymentApi from graphscope.flex.rest.api.graph_api import GraphApi from graphscope.flex.rest.api.job_api import JobApi -from graphscope.flex.rest.api.legacy_api import LegacyApi -from graphscope.flex.rest.api.procedure_api import ProcedureApi from graphscope.flex.rest.api.service_api import ServiceApi +from graphscope.flex.rest.api.stored_procedure_api import StoredProcedureApi from graphscope.flex.rest.api.utils_api import UtilsApi diff --git a/python/graphscope/flex/rest/api/alert_api.py b/python/graphscope/flex/rest/api/alert_api.py index 7fb1c8546b66..060a10909a23 100644 --- a/python/graphscope/flex/rest/api/alert_api.py +++ b/python/graphscope/flex/rest/api/alert_api.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -17,13 +17,15 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, field_validator +from pydantic import Field, StrictInt, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated -from graphscope.flex.rest.models.alert_message import AlertMessage -from graphscope.flex.rest.models.alert_receiver import AlertReceiver -from graphscope.flex.rest.models.alert_rule import AlertRule -from graphscope.flex.rest.models.update_alert_messages_request import UpdateAlertMessagesRequest +from graphscope.flex.rest.models.create_alert_receiver_request import CreateAlertReceiverRequest +from graphscope.flex.rest.models.create_alert_rule_request import CreateAlertRuleRequest +from graphscope.flex.rest.models.get_alert_message_response import GetAlertMessageResponse +from graphscope.flex.rest.models.get_alert_receiver_response import GetAlertReceiverResponse +from graphscope.flex.rest.models.get_alert_rule_response import GetAlertRuleResponse +from graphscope.flex.rest.models.update_alert_message_status_request import UpdateAlertMessageStatusRequest from graphscope.flex.rest.api_client import ApiClient, RequestSerialized from graphscope.flex.rest.api_response import ApiResponse @@ -44,9 +46,9 @@ def __init__(self, api_client=None) -> None: @validate_call - def delete_alert_rule_by_name( + def create_alert_receiver( self, - rule_name: StrictStr, + create_alert_receiver_request: CreateAlertReceiverRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -60,11 +62,12 @@ def delete_alert_rule_by_name( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """delete_alert_rule_by_name + """create_alert_receiver + Create a new alert receiver - :param rule_name: (required) - :type rule_name: str + :param create_alert_receiver_request: (required) + :type create_alert_receiver_request: CreateAlertReceiverRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -87,8 +90,8 @@ def delete_alert_rule_by_name( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_alert_rule_by_name_serialize( - rule_name=rule_name, + _param = self._create_alert_receiver_serialize( + create_alert_receiver_request=create_alert_receiver_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -97,6 +100,7 @@ def delete_alert_rule_by_name( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -110,9 +114,9 @@ def delete_alert_rule_by_name( @validate_call - def delete_alert_rule_by_name_with_http_info( + def create_alert_receiver_with_http_info( self, - rule_name: StrictStr, + create_alert_receiver_request: CreateAlertReceiverRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -126,11 +130,12 @@ def delete_alert_rule_by_name_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """delete_alert_rule_by_name + """create_alert_receiver + Create a new alert receiver - :param rule_name: (required) - :type rule_name: str + :param create_alert_receiver_request: (required) + :type create_alert_receiver_request: CreateAlertReceiverRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -153,8 +158,8 @@ def delete_alert_rule_by_name_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_alert_rule_by_name_serialize( - rule_name=rule_name, + _param = self._create_alert_receiver_serialize( + create_alert_receiver_request=create_alert_receiver_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -163,6 +168,7 @@ def delete_alert_rule_by_name_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -176,9 +182,9 @@ def delete_alert_rule_by_name_with_http_info( @validate_call - def delete_alert_rule_by_name_without_preload_content( + def create_alert_receiver_without_preload_content( self, - rule_name: StrictStr, + create_alert_receiver_request: CreateAlertReceiverRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -192,11 +198,12 @@ def delete_alert_rule_by_name_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """delete_alert_rule_by_name + """create_alert_receiver + Create a new alert receiver - :param rule_name: (required) - :type rule_name: str + :param create_alert_receiver_request: (required) + :type create_alert_receiver_request: CreateAlertReceiverRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -219,8 +226,8 @@ def delete_alert_rule_by_name_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_alert_rule_by_name_serialize( - rule_name=rule_name, + _param = self._create_alert_receiver_serialize( + create_alert_receiver_request=create_alert_receiver_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -229,6 +236,7 @@ def delete_alert_rule_by_name_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -237,9 +245,9 @@ def delete_alert_rule_by_name_without_preload_content( return response_data.response - def _delete_alert_rule_by_name_serialize( + def _create_alert_receiver_serialize( self, - rule_name, + create_alert_receiver_request, _request_auth, _content_type, _headers, @@ -259,12 +267,287 @@ def _delete_alert_rule_by_name_serialize( _body_params: Optional[bytes] = None # process the path parameters - if rule_name is not None: - _path_params['rule_name'] = rule_name # process the query parameters # process the header parameters # process the form parameters # process the body parameter + if create_alert_receiver_request is not None: + _body_params = create_alert_receiver_request + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/alert/receiver', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_alert_message_in_batch( + self, + message_ids: Annotated[StrictStr, Field(description="A list of message id separated by comma, e.g. id1,id2,id3")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> str: + """delete_alert_message_in_batch + + Delete alert message in batch + + :param message_ids: A list of message id separated by comma, e.g. id1,id2,id3 (required) + :type message_ids: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_alert_message_in_batch_serialize( + message_ids=message_ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_alert_message_in_batch_with_http_info( + self, + message_ids: Annotated[StrictStr, Field(description="A list of message id separated by comma, e.g. id1,id2,id3")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[str]: + """delete_alert_message_in_batch + + Delete alert message in batch + + :param message_ids: A list of message id separated by comma, e.g. id1,id2,id3 (required) + :type message_ids: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_alert_message_in_batch_serialize( + message_ids=message_ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_alert_message_in_batch_without_preload_content( + self, + message_ids: Annotated[StrictStr, Field(description="A list of message id separated by comma, e.g. id1,id2,id3")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """delete_alert_message_in_batch + + Delete alert message in batch + + :param message_ids: A list of message id separated by comma, e.g. id1,id2,id3 (required) + :type message_ids: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_alert_message_in_batch_serialize( + message_ids=message_ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_alert_message_in_batch_serialize( + self, + message_ids, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if message_ids is not None: + + _query_params.append(('message_ids', message_ids)) + + # process the header parameters + # process the form parameters + # process the body parameter # set the HTTP header `Accept` @@ -281,7 +564,7 @@ def _delete_alert_rule_by_name_serialize( return self.api_client.param_serialize( method='DELETE', - resource_path='/api/v1/alert/rule/{rule_name}', + resource_path='/api/v1/alert/message-collection', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -298,7 +581,7 @@ def _delete_alert_rule_by_name_serialize( @validate_call - def delete_receiver_by_id( + def delete_alert_receiver_by_id( self, receiver_id: StrictStr, _request_timeout: Union[ @@ -314,8 +597,9 @@ def delete_receiver_by_id( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """delete_receiver_by_id + """delete_alert_receiver_by_id + Delete the alert receiver by ID :param receiver_id: (required) :type receiver_id: str @@ -341,7 +625,7 @@ def delete_receiver_by_id( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_receiver_by_id_serialize( + _param = self._delete_alert_receiver_by_id_serialize( receiver_id=receiver_id, _request_auth=_request_auth, _content_type=_content_type, @@ -351,7 +635,7 @@ def delete_receiver_by_id( _response_types_map: Dict[str, Optional[str]] = { '200': "str", - '404': None, + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -365,7 +649,7 @@ def delete_receiver_by_id( @validate_call - def delete_receiver_by_id_with_http_info( + def delete_alert_receiver_by_id_with_http_info( self, receiver_id: StrictStr, _request_timeout: Union[ @@ -381,8 +665,9 @@ def delete_receiver_by_id_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """delete_receiver_by_id + """delete_alert_receiver_by_id + Delete the alert receiver by ID :param receiver_id: (required) :type receiver_id: str @@ -408,7 +693,7 @@ def delete_receiver_by_id_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_receiver_by_id_serialize( + _param = self._delete_alert_receiver_by_id_serialize( receiver_id=receiver_id, _request_auth=_request_auth, _content_type=_content_type, @@ -418,7 +703,7 @@ def delete_receiver_by_id_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", - '404': None, + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -432,7 +717,7 @@ def delete_receiver_by_id_with_http_info( @validate_call - def delete_receiver_by_id_without_preload_content( + def delete_alert_receiver_by_id_without_preload_content( self, receiver_id: StrictStr, _request_timeout: Union[ @@ -448,8 +733,9 @@ def delete_receiver_by_id_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """delete_receiver_by_id + """delete_alert_receiver_by_id + Delete the alert receiver by ID :param receiver_id: (required) :type receiver_id: str @@ -475,7 +761,7 @@ def delete_receiver_by_id_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_receiver_by_id_serialize( + _param = self._delete_alert_receiver_by_id_serialize( receiver_id=receiver_id, _request_auth=_request_auth, _content_type=_content_type, @@ -485,7 +771,7 @@ def delete_receiver_by_id_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", - '404': None, + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -494,7 +780,7 @@ def delete_receiver_by_id_without_preload_content( return response_data.response - def _delete_receiver_by_id_serialize( + def _delete_alert_receiver_by_id_serialize( self, receiver_id, _request_auth, @@ -555,13 +841,9 @@ def _delete_receiver_by_id_serialize( @validate_call - def list_alert_messages( + def delete_alert_rule_by_id( self, - alert_type: Optional[StrictStr] = None, - status: Optional[StrictStr] = None, - severity: Optional[StrictStr] = None, - start_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, - end_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, + rule_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -574,20 +856,12 @@ def list_alert_messages( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[AlertMessage]: - """list_alert_messages + ) -> str: + """delete_alert_rule_by_id - :param alert_type: - :type alert_type: str - :param status: - :type status: str - :param severity: - :type severity: str - :param start_time: format with \"2023-02-21-11-56-30\" - :type start_time: str - :param end_time: format with \"2023-02-21-11-56-30\" - :type end_time: str + :param rule_id: (required) + :type rule_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -607,15 +881,11 @@ def list_alert_messages( request; this effectively ignores the host_index in the spec for a single request. :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_alert_messages_serialize( - alert_type=alert_type, - status=status, - severity=severity, - start_time=start_time, - end_time=end_time, + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_alert_rule_by_id_serialize( + rule_id=rule_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -623,7 +893,8 @@ def list_alert_messages( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[AlertMessage]", + '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -637,13 +908,9 @@ def list_alert_messages( @validate_call - def list_alert_messages_with_http_info( + def delete_alert_rule_by_id_with_http_info( self, - alert_type: Optional[StrictStr] = None, - status: Optional[StrictStr] = None, - severity: Optional[StrictStr] = None, - start_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, - end_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, + rule_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -656,20 +923,12 @@ def list_alert_messages_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[AlertMessage]]: - """list_alert_messages + ) -> ApiResponse[str]: + """delete_alert_rule_by_id - :param alert_type: - :type alert_type: str - :param status: - :type status: str - :param severity: - :type severity: str - :param start_time: format with \"2023-02-21-11-56-30\" - :type start_time: str - :param end_time: format with \"2023-02-21-11-56-30\" - :type end_time: str + :param rule_id: (required) + :type rule_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -692,12 +951,8 @@ def list_alert_messages_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_alert_messages_serialize( - alert_type=alert_type, - status=status, - severity=severity, - start_time=start_time, - end_time=end_time, + _param = self._delete_alert_rule_by_id_serialize( + rule_id=rule_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -705,7 +960,8 @@ def list_alert_messages_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[AlertMessage]", + '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -719,13 +975,9 @@ def list_alert_messages_with_http_info( @validate_call - def list_alert_messages_without_preload_content( + def delete_alert_rule_by_id_without_preload_content( self, - alert_type: Optional[StrictStr] = None, - status: Optional[StrictStr] = None, - severity: Optional[StrictStr] = None, - start_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, - end_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, + rule_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -739,19 +991,11 @@ def list_alert_messages_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """list_alert_messages + """delete_alert_rule_by_id - :param alert_type: - :type alert_type: str - :param status: - :type status: str - :param severity: - :type severity: str - :param start_time: format with \"2023-02-21-11-56-30\" - :type start_time: str - :param end_time: format with \"2023-02-21-11-56-30\" - :type end_time: str + :param rule_id: (required) + :type rule_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -774,12 +1018,8 @@ def list_alert_messages_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_alert_messages_serialize( - alert_type=alert_type, - status=status, - severity=severity, - start_time=start_time, - end_time=end_time, + _param = self._delete_alert_rule_by_id_serialize( + rule_id=rule_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -787,7 +1027,8 @@ def list_alert_messages_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[AlertMessage]", + '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -796,13 +1037,9 @@ def list_alert_messages_without_preload_content( return response_data.response - def _list_alert_messages_serialize( + def _delete_alert_rule_by_id_serialize( self, - alert_type, - status, - severity, - start_time, - end_time, + rule_id, _request_auth, _content_type, _headers, @@ -822,27 +1059,9 @@ def _list_alert_messages_serialize( _body_params: Optional[bytes] = None # process the path parameters + if rule_id is not None: + _path_params['rule_id'] = rule_id # process the query parameters - if alert_type is not None: - - _query_params.append(('alert_type', alert_type)) - - if status is not None: - - _query_params.append(('status', status)) - - if severity is not None: - - _query_params.append(('severity', severity)) - - if start_time is not None: - - _query_params.append(('start_time', start_time)) - - if end_time is not None: - - _query_params.append(('end_time', end_time)) - # process the header parameters # process the form parameters # process the body parameter @@ -861,8 +1080,8 @@ def _list_alert_messages_serialize( ] return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/alert/message', + method='DELETE', + resource_path='/api/v1/alert/rule/{rule_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -879,8 +1098,14 @@ def _list_alert_messages_serialize( @validate_call - def list_alert_rules( + def list_alert_messages( self, + alert_type: Optional[StrictStr] = None, + status: Optional[StrictStr] = None, + severity: Optional[StrictStr] = None, + start_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, + end_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, + limit: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -893,10 +1118,23 @@ def list_alert_rules( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[AlertRule]: - """list_alert_rules + ) -> List[GetAlertMessageResponse]: + """list_alert_messages + List all alert messages + :param alert_type: + :type alert_type: str + :param status: + :type status: str + :param severity: + :type severity: str + :param start_time: format with \"2023-02-21-11-56-30\" + :type start_time: str + :param end_time: format with \"2023-02-21-11-56-30\" + :type end_time: str + :param limit: + :type limit: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -919,7 +1157,13 @@ def list_alert_rules( :return: Returns the result object. """ # noqa: E501 - _param = self._list_alert_rules_serialize( + _param = self._list_alert_messages_serialize( + alert_type=alert_type, + status=status, + severity=severity, + start_time=start_time, + end_time=end_time, + limit=limit, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -927,7 +1171,8 @@ def list_alert_rules( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[AlertRule]", + '200': "List[GetAlertMessageResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -941,8 +1186,14 @@ def list_alert_rules( @validate_call - def list_alert_rules_with_http_info( + def list_alert_messages_with_http_info( self, + alert_type: Optional[StrictStr] = None, + status: Optional[StrictStr] = None, + severity: Optional[StrictStr] = None, + start_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, + end_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, + limit: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -955,10 +1206,23 @@ def list_alert_rules_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[AlertRule]]: - """list_alert_rules + ) -> ApiResponse[List[GetAlertMessageResponse]]: + """list_alert_messages + List all alert messages + :param alert_type: + :type alert_type: str + :param status: + :type status: str + :param severity: + :type severity: str + :param start_time: format with \"2023-02-21-11-56-30\" + :type start_time: str + :param end_time: format with \"2023-02-21-11-56-30\" + :type end_time: str + :param limit: + :type limit: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -981,7 +1245,13 @@ def list_alert_rules_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_alert_rules_serialize( + _param = self._list_alert_messages_serialize( + alert_type=alert_type, + status=status, + severity=severity, + start_time=start_time, + end_time=end_time, + limit=limit, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -989,7 +1259,8 @@ def list_alert_rules_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[AlertRule]", + '200': "List[GetAlertMessageResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1003,8 +1274,14 @@ def list_alert_rules_with_http_info( @validate_call - def list_alert_rules_without_preload_content( + def list_alert_messages_without_preload_content( self, + alert_type: Optional[StrictStr] = None, + status: Optional[StrictStr] = None, + severity: Optional[StrictStr] = None, + start_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, + end_time: Annotated[Optional[StrictStr], Field(description="format with \"2023-02-21-11-56-30\"")] = None, + limit: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1018,9 +1295,22 @@ def list_alert_rules_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """list_alert_rules + """list_alert_messages + List all alert messages + :param alert_type: + :type alert_type: str + :param status: + :type status: str + :param severity: + :type severity: str + :param start_time: format with \"2023-02-21-11-56-30\" + :type start_time: str + :param end_time: format with \"2023-02-21-11-56-30\" + :type end_time: str + :param limit: + :type limit: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1043,7 +1333,13 @@ def list_alert_rules_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_alert_rules_serialize( + _param = self._list_alert_messages_serialize( + alert_type=alert_type, + status=status, + severity=severity, + start_time=start_time, + end_time=end_time, + limit=limit, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1051,7 +1347,8 @@ def list_alert_rules_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[AlertRule]", + '200': "List[GetAlertMessageResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1060,8 +1357,14 @@ def list_alert_rules_without_preload_content( return response_data.response - def _list_alert_rules_serialize( + def _list_alert_messages_serialize( self, + alert_type, + status, + severity, + start_time, + end_time, + limit, _request_auth, _content_type, _headers, @@ -1082,6 +1385,30 @@ def _list_alert_rules_serialize( # process the path parameters # process the query parameters + if alert_type is not None: + + _query_params.append(('alert_type', alert_type)) + + if status is not None: + + _query_params.append(('status', status)) + + if severity is not None: + + _query_params.append(('severity', severity)) + + if start_time is not None: + + _query_params.append(('start_time', start_time)) + + if end_time is not None: + + _query_params.append(('end_time', end_time)) + + if limit is not None: + + _query_params.append(('limit', limit)) + # process the header parameters # process the form parameters # process the body parameter @@ -1101,7 +1428,7 @@ def _list_alert_rules_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/alert/rule', + resource_path='/api/v1/alert/message', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1118,7 +1445,7 @@ def _list_alert_rules_serialize( @validate_call - def list_receivers( + def list_alert_receivers( self, _request_timeout: Union[ None, @@ -1132,9 +1459,10 @@ def list_receivers( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[AlertReceiver]: - """list_receivers + ) -> List[GetAlertReceiverResponse]: + """list_alert_receivers + List all alert receivers :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -1158,7 +1486,7 @@ def list_receivers( :return: Returns the result object. """ # noqa: E501 - _param = self._list_receivers_serialize( + _param = self._list_alert_receivers_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1166,7 +1494,8 @@ def list_receivers( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[AlertReceiver]", + '200': "List[GetAlertReceiverResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1180,7 +1509,7 @@ def list_receivers( @validate_call - def list_receivers_with_http_info( + def list_alert_receivers_with_http_info( self, _request_timeout: Union[ None, @@ -1194,9 +1523,10 @@ def list_receivers_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[AlertReceiver]]: - """list_receivers + ) -> ApiResponse[List[GetAlertReceiverResponse]]: + """list_alert_receivers + List all alert receivers :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -1220,7 +1550,7 @@ def list_receivers_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_receivers_serialize( + _param = self._list_alert_receivers_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1228,7 +1558,8 @@ def list_receivers_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[AlertReceiver]", + '200': "List[GetAlertReceiverResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1242,7 +1573,7 @@ def list_receivers_with_http_info( @validate_call - def list_receivers_without_preload_content( + def list_alert_receivers_without_preload_content( self, _request_timeout: Union[ None, @@ -1257,8 +1588,9 @@ def list_receivers_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """list_receivers + """list_alert_receivers + List all alert receivers :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -1282,7 +1614,7 @@ def list_receivers_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_receivers_serialize( + _param = self._list_alert_receivers_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1290,7 +1622,8 @@ def list_receivers_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[AlertReceiver]", + '200': "List[GetAlertReceiverResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1299,7 +1632,7 @@ def list_receivers_without_preload_content( return response_data.response - def _list_receivers_serialize( + def _list_alert_receivers_serialize( self, _request_auth, _content_type, @@ -1357,9 +1690,8 @@ def _list_receivers_serialize( @validate_call - def register_receiver( + def list_alert_rules( self, - alert_receiver: AlertReceiver, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1372,12 +1704,11 @@ def register_receiver( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """register_receiver + ) -> List[GetAlertRuleResponse]: + """list_alert_rules + List all alert rules - :param alert_receiver: (required) - :type alert_receiver: AlertReceiver :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1400,8 +1731,7 @@ def register_receiver( :return: Returns the result object. """ # noqa: E501 - _param = self._register_receiver_serialize( - alert_receiver=alert_receiver, + _param = self._list_alert_rules_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1409,7 +1739,8 @@ def register_receiver( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "List[GetAlertRuleResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1423,9 +1754,8 @@ def register_receiver( @validate_call - def register_receiver_with_http_info( + def list_alert_rules_with_http_info( self, - alert_receiver: AlertReceiver, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1438,12 +1768,11 @@ def register_receiver_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """register_receiver + ) -> ApiResponse[List[GetAlertRuleResponse]]: + """list_alert_rules + List all alert rules - :param alert_receiver: (required) - :type alert_receiver: AlertReceiver :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1466,8 +1795,7 @@ def register_receiver_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._register_receiver_serialize( - alert_receiver=alert_receiver, + _param = self._list_alert_rules_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1475,7 +1803,8 @@ def register_receiver_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "List[GetAlertRuleResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1489,9 +1818,8 @@ def register_receiver_with_http_info( @validate_call - def register_receiver_without_preload_content( + def list_alert_rules_without_preload_content( self, - alert_receiver: AlertReceiver, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1505,11 +1833,10 @@ def register_receiver_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """register_receiver + """list_alert_rules + List all alert rules - :param alert_receiver: (required) - :type alert_receiver: AlertReceiver :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1532,8 +1859,7 @@ def register_receiver_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._register_receiver_serialize( - alert_receiver=alert_receiver, + _param = self._list_alert_rules_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1541,7 +1867,8 @@ def register_receiver_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "List[GetAlertRuleResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1550,9 +1877,8 @@ def register_receiver_without_preload_content( return response_data.response - def _register_receiver_serialize( + def _list_alert_rules_serialize( self, - alert_receiver, _request_auth, _content_type, _headers, @@ -1576,8 +1902,6 @@ def _register_receiver_serialize( # process the header parameters # process the form parameters # process the body parameter - if alert_receiver is not None: - _body_params = alert_receiver # set the HTTP header `Accept` @@ -1587,27 +1911,14 @@ def _register_receiver_serialize( ] ) - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/alert/receiver', + method='GET', + resource_path='/api/v1/alert/rule', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1624,9 +1935,9 @@ def _register_receiver_serialize( @validate_call - def update_alert_messages( + def update_alert_message_in_batch( self, - update_alert_messages_request: Optional[UpdateAlertMessagesRequest] = None, + update_alert_message_status_request: Optional[UpdateAlertMessageStatusRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1640,12 +1951,12 @@ def update_alert_messages( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """update_alert_messages + """update_alert_message_in_batch - Update alert messages in batch + Update the message status in batch - :param update_alert_messages_request: - :type update_alert_messages_request: UpdateAlertMessagesRequest + :param update_alert_message_status_request: + :type update_alert_message_status_request: UpdateAlertMessageStatusRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1668,8 +1979,8 @@ def update_alert_messages( :return: Returns the result object. """ # noqa: E501 - _param = self._update_alert_messages_serialize( - update_alert_messages_request=update_alert_messages_request, + _param = self._update_alert_message_in_batch_serialize( + update_alert_message_status_request=update_alert_message_status_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1678,7 +1989,7 @@ def update_alert_messages( _response_types_map: Dict[str, Optional[str]] = { '200': "str", - '404': None, + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1692,9 +2003,9 @@ def update_alert_messages( @validate_call - def update_alert_messages_with_http_info( + def update_alert_message_in_batch_with_http_info( self, - update_alert_messages_request: Optional[UpdateAlertMessagesRequest] = None, + update_alert_message_status_request: Optional[UpdateAlertMessageStatusRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1708,12 +2019,12 @@ def update_alert_messages_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """update_alert_messages + """update_alert_message_in_batch - Update alert messages in batch + Update the message status in batch - :param update_alert_messages_request: - :type update_alert_messages_request: UpdateAlertMessagesRequest + :param update_alert_message_status_request: + :type update_alert_message_status_request: UpdateAlertMessageStatusRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1736,8 +2047,8 @@ def update_alert_messages_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._update_alert_messages_serialize( - update_alert_messages_request=update_alert_messages_request, + _param = self._update_alert_message_in_batch_serialize( + update_alert_message_status_request=update_alert_message_status_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1746,7 +2057,7 @@ def update_alert_messages_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", - '404': None, + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1760,9 +2071,9 @@ def update_alert_messages_with_http_info( @validate_call - def update_alert_messages_without_preload_content( + def update_alert_message_in_batch_without_preload_content( self, - update_alert_messages_request: Optional[UpdateAlertMessagesRequest] = None, + update_alert_message_status_request: Optional[UpdateAlertMessageStatusRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1776,12 +2087,12 @@ def update_alert_messages_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """update_alert_messages + """update_alert_message_in_batch - Update alert messages in batch + Update the message status in batch - :param update_alert_messages_request: - :type update_alert_messages_request: UpdateAlertMessagesRequest + :param update_alert_message_status_request: + :type update_alert_message_status_request: UpdateAlertMessageStatusRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1804,8 +2115,8 @@ def update_alert_messages_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_alert_messages_serialize( - update_alert_messages_request=update_alert_messages_request, + _param = self._update_alert_message_in_batch_serialize( + update_alert_message_status_request=update_alert_message_status_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1814,7 +2125,7 @@ def update_alert_messages_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", - '404': None, + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1823,9 +2134,9 @@ def update_alert_messages_without_preload_content( return response_data.response - def _update_alert_messages_serialize( + def _update_alert_message_in_batch_serialize( self, - update_alert_messages_request, + update_alert_message_status_request, _request_auth, _content_type, _headers, @@ -1849,8 +2160,8 @@ def _update_alert_messages_serialize( # process the header parameters # process the form parameters # process the body parameter - if update_alert_messages_request is not None: - _body_params = update_alert_messages_request + if update_alert_message_status_request is not None: + _body_params = update_alert_message_status_request # set the HTTP header `Accept` @@ -1880,7 +2191,7 @@ def _update_alert_messages_serialize( return self.api_client.param_serialize( method='PUT', - resource_path='/api/v1/alert/message', + resource_path='/api/v1/alert/message-collection/status', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1897,10 +2208,10 @@ def _update_alert_messages_serialize( @validate_call - def update_alert_rule_by_name( + def update_alert_receiver_by_id( self, - rule_name: StrictStr, - alert_rule: Optional[AlertRule] = None, + receiver_id: StrictStr, + create_alert_receiver_request: Optional[CreateAlertReceiverRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1914,13 +2225,14 @@ def update_alert_rule_by_name( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """update_alert_rule_by_name + """update_alert_receiver_by_id + Update alert receiver by ID - :param rule_name: (required) - :type rule_name: str - :param alert_rule: - :type alert_rule: AlertRule + :param receiver_id: (required) + :type receiver_id: str + :param create_alert_receiver_request: + :type create_alert_receiver_request: CreateAlertReceiverRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1943,9 +2255,9 @@ def update_alert_rule_by_name( :return: Returns the result object. """ # noqa: E501 - _param = self._update_alert_rule_by_name_serialize( - rule_name=rule_name, - alert_rule=alert_rule, + _param = self._update_alert_receiver_by_id_serialize( + receiver_id=receiver_id, + create_alert_receiver_request=create_alert_receiver_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1954,6 +2266,7 @@ def update_alert_rule_by_name( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1967,10 +2280,10 @@ def update_alert_rule_by_name( @validate_call - def update_alert_rule_by_name_with_http_info( + def update_alert_receiver_by_id_with_http_info( self, - rule_name: StrictStr, - alert_rule: Optional[AlertRule] = None, + receiver_id: StrictStr, + create_alert_receiver_request: Optional[CreateAlertReceiverRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1984,13 +2297,14 @@ def update_alert_rule_by_name_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """update_alert_rule_by_name + """update_alert_receiver_by_id + Update alert receiver by ID - :param rule_name: (required) - :type rule_name: str - :param alert_rule: - :type alert_rule: AlertRule + :param receiver_id: (required) + :type receiver_id: str + :param create_alert_receiver_request: + :type create_alert_receiver_request: CreateAlertReceiverRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2013,9 +2327,9 @@ def update_alert_rule_by_name_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._update_alert_rule_by_name_serialize( - rule_name=rule_name, - alert_rule=alert_rule, + _param = self._update_alert_receiver_by_id_serialize( + receiver_id=receiver_id, + create_alert_receiver_request=create_alert_receiver_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2024,6 +2338,7 @@ def update_alert_rule_by_name_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -2037,10 +2352,10 @@ def update_alert_rule_by_name_with_http_info( @validate_call - def update_alert_rule_by_name_without_preload_content( + def update_alert_receiver_by_id_without_preload_content( self, - rule_name: StrictStr, - alert_rule: Optional[AlertRule] = None, + receiver_id: StrictStr, + create_alert_receiver_request: Optional[CreateAlertReceiverRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2054,13 +2369,14 @@ def update_alert_rule_by_name_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """update_alert_rule_by_name + """update_alert_receiver_by_id + Update alert receiver by ID - :param rule_name: (required) - :type rule_name: str - :param alert_rule: - :type alert_rule: AlertRule + :param receiver_id: (required) + :type receiver_id: str + :param create_alert_receiver_request: + :type create_alert_receiver_request: CreateAlertReceiverRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2083,9 +2399,9 @@ def update_alert_rule_by_name_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_alert_rule_by_name_serialize( - rule_name=rule_name, - alert_rule=alert_rule, + _param = self._update_alert_receiver_by_id_serialize( + receiver_id=receiver_id, + create_alert_receiver_request=create_alert_receiver_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2094,6 +2410,7 @@ def update_alert_rule_by_name_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -2102,10 +2419,10 @@ def update_alert_rule_by_name_without_preload_content( return response_data.response - def _update_alert_rule_by_name_serialize( + def _update_alert_receiver_by_id_serialize( self, - rule_name, - alert_rule, + receiver_id, + create_alert_receiver_request, _request_auth, _content_type, _headers, @@ -2125,14 +2442,14 @@ def _update_alert_rule_by_name_serialize( _body_params: Optional[bytes] = None # process the path parameters - if rule_name is not None: - _path_params['rule_name'] = rule_name + if receiver_id is not None: + _path_params['receiver_id'] = receiver_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter - if alert_rule is not None: - _body_params = alert_rule + if create_alert_receiver_request is not None: + _body_params = create_alert_receiver_request # set the HTTP header `Accept` @@ -2162,7 +2479,7 @@ def _update_alert_rule_by_name_serialize( return self.api_client.param_serialize( method='PUT', - resource_path='/api/v1/alert/rule/{rule_name}', + resource_path='/api/v1/alert/receiver/{receiver_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2179,10 +2496,10 @@ def _update_alert_rule_by_name_serialize( @validate_call - def update_receiver_by_id( + def update_alert_rule_by_id( self, - receiver_id: StrictStr, - alert_receiver: Optional[AlertReceiver] = None, + rule_id: StrictStr, + create_alert_rule_request: Optional[CreateAlertRuleRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2196,13 +2513,13 @@ def update_receiver_by_id( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """update_receiver_by_id + """update_alert_rule_by_id - :param receiver_id: (required) - :type receiver_id: str - :param alert_receiver: - :type alert_receiver: AlertReceiver + :param rule_id: (required) + :type rule_id: str + :param create_alert_rule_request: + :type create_alert_rule_request: CreateAlertRuleRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2225,9 +2542,9 @@ def update_receiver_by_id( :return: Returns the result object. """ # noqa: E501 - _param = self._update_receiver_by_id_serialize( - receiver_id=receiver_id, - alert_receiver=alert_receiver, + _param = self._update_alert_rule_by_id_serialize( + rule_id=rule_id, + create_alert_rule_request=create_alert_rule_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2236,7 +2553,7 @@ def update_receiver_by_id( _response_types_map: Dict[str, Optional[str]] = { '200': "str", - '404': None, + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -2250,10 +2567,10 @@ def update_receiver_by_id( @validate_call - def update_receiver_by_id_with_http_info( + def update_alert_rule_by_id_with_http_info( self, - receiver_id: StrictStr, - alert_receiver: Optional[AlertReceiver] = None, + rule_id: StrictStr, + create_alert_rule_request: Optional[CreateAlertRuleRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2267,13 +2584,13 @@ def update_receiver_by_id_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """update_receiver_by_id + """update_alert_rule_by_id - :param receiver_id: (required) - :type receiver_id: str - :param alert_receiver: - :type alert_receiver: AlertReceiver + :param rule_id: (required) + :type rule_id: str + :param create_alert_rule_request: + :type create_alert_rule_request: CreateAlertRuleRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2296,9 +2613,9 @@ def update_receiver_by_id_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._update_receiver_by_id_serialize( - receiver_id=receiver_id, - alert_receiver=alert_receiver, + _param = self._update_alert_rule_by_id_serialize( + rule_id=rule_id, + create_alert_rule_request=create_alert_rule_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2307,7 +2624,7 @@ def update_receiver_by_id_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", - '404': None, + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -2321,10 +2638,10 @@ def update_receiver_by_id_with_http_info( @validate_call - def update_receiver_by_id_without_preload_content( + def update_alert_rule_by_id_without_preload_content( self, - receiver_id: StrictStr, - alert_receiver: Optional[AlertReceiver] = None, + rule_id: StrictStr, + create_alert_rule_request: Optional[CreateAlertRuleRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2338,13 +2655,13 @@ def update_receiver_by_id_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """update_receiver_by_id + """update_alert_rule_by_id - :param receiver_id: (required) - :type receiver_id: str - :param alert_receiver: - :type alert_receiver: AlertReceiver + :param rule_id: (required) + :type rule_id: str + :param create_alert_rule_request: + :type create_alert_rule_request: CreateAlertRuleRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2367,9 +2684,9 @@ def update_receiver_by_id_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_receiver_by_id_serialize( - receiver_id=receiver_id, - alert_receiver=alert_receiver, + _param = self._update_alert_rule_by_id_serialize( + rule_id=rule_id, + create_alert_rule_request=create_alert_rule_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2378,7 +2695,7 @@ def update_receiver_by_id_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", - '404': None, + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -2387,10 +2704,10 @@ def update_receiver_by_id_without_preload_content( return response_data.response - def _update_receiver_by_id_serialize( + def _update_alert_rule_by_id_serialize( self, - receiver_id, - alert_receiver, + rule_id, + create_alert_rule_request, _request_auth, _content_type, _headers, @@ -2410,14 +2727,14 @@ def _update_receiver_by_id_serialize( _body_params: Optional[bytes] = None # process the path parameters - if receiver_id is not None: - _path_params['receiver_id'] = receiver_id + if rule_id is not None: + _path_params['rule_id'] = rule_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter - if alert_receiver is not None: - _body_params = alert_receiver + if create_alert_rule_request is not None: + _body_params = create_alert_rule_request # set the HTTP header `Accept` @@ -2447,7 +2764,7 @@ def _update_receiver_by_id_serialize( return self.api_client.param_serialize( method='PUT', - resource_path='/api/v1/alert/receiver/{receiver_id}', + resource_path='/api/v1/alert/rule/{rule_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/python/graphscope/flex/rest/api/connection_api.py b/python/graphscope/flex/rest/api/connection_api.py deleted file mode 100644 index f1a5322c8656..000000000000 --- a/python/graphscope/flex/rest/api/connection_api.py +++ /dev/null @@ -1,550 +0,0 @@ -# coding: utf-8 - -""" - GraphScope FLEX HTTP SERVICE API - - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - -import warnings -from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Any, Dict, List, Optional, Tuple, Union -from typing_extensions import Annotated - -from graphscope.flex.rest.models.connection import Connection -from graphscope.flex.rest.models.connection_status import ConnectionStatus - -from graphscope.flex.rest.api_client import ApiClient, RequestSerialized -from graphscope.flex.rest.api_response import ApiResponse -from graphscope.flex.rest.rest import RESTResponseType - - -class ConnectionApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - - @validate_call - def close( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """close - - Close the connection with coordinator - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._close_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def close_with_http_info( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """close - - Close the connection with coordinator - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._close_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def close_without_preload_content( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """close - - Close the connection with coordinator - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._close_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _close_serialize( - self, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='DELETE', - resource_path='/api/v1/connection', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def connect( - self, - connection: Connection, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ConnectionStatus: - """connect - - Connect to coordinator service - - :param connection: (required) - :type connection: Connection - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._connect_serialize( - connection=connection, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ConnectionStatus", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def connect_with_http_info( - self, - connection: Connection, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ConnectionStatus]: - """connect - - Connect to coordinator service - - :param connection: (required) - :type connection: Connection - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._connect_serialize( - connection=connection, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ConnectionStatus", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def connect_without_preload_content( - self, - connection: Connection, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """connect - - Connect to coordinator service - - :param connection: (required) - :type connection: Connection - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._connect_serialize( - connection=connection, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "ConnectionStatus", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _connect_serialize( - self, - connection, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if connection is not None: - _body_params = connection - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/connection', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - diff --git a/python/graphscope/flex/rest/api/legacy_api.py b/python/graphscope/flex/rest/api/data_source_api.py similarity index 80% rename from python/graphscope/flex/rest/api/legacy_api.py rename to python/graphscope/flex/rest/api/data_source_api.py index b1f32984004e..13b53166d849 100644 --- a/python/graphscope/flex/rest/api/legacy_api.py +++ b/python/graphscope/flex/rest/api/data_source_api.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,16 +18,14 @@ from typing_extensions import Annotated from pydantic import StrictStr -from graphscope.flex.rest.models.groot_dataloading_job_config import GrootDataloadingJobConfig -from graphscope.flex.rest.models.groot_graph import GrootGraph -from graphscope.flex.rest.models.groot_schema import GrootSchema +from graphscope.flex.rest.models.schema_mapping import SchemaMapping from graphscope.flex.rest.api_client import ApiClient, RequestSerialized from graphscope.flex.rest.api_response import ApiResponse from graphscope.flex.rest.rest import RESTResponseType -class LegacyApi: +class DataSourceApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech @@ -41,10 +39,10 @@ def __init__(self, api_client=None) -> None: @validate_call - def create_groot_dataloading_job( + def bind_datasource_in_batch( self, - graph_name: StrictStr, - groot_dataloading_job_config: GrootDataloadingJobConfig, + graph_id: StrictStr, + schema_mapping: SchemaMapping, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -58,13 +56,14 @@ def create_groot_dataloading_job( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """create_groot_dataloading_job + """bind_datasource_in_batch + Bind data sources in batches - :param graph_name: (required) - :type graph_name: str - :param groot_dataloading_job_config: (required) - :type groot_dataloading_job_config: GrootDataloadingJobConfig + :param graph_id: (required) + :type graph_id: str + :param schema_mapping: (required) + :type schema_mapping: SchemaMapping :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -87,9 +86,9 @@ def create_groot_dataloading_job( :return: Returns the result object. """ # noqa: E501 - _param = self._create_groot_dataloading_job_serialize( - graph_name=graph_name, - groot_dataloading_job_config=groot_dataloading_job_config, + _param = self._bind_datasource_in_batch_serialize( + graph_id=graph_id, + schema_mapping=schema_mapping, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -98,6 +97,8 @@ def create_groot_dataloading_job( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -111,10 +112,10 @@ def create_groot_dataloading_job( @validate_call - def create_groot_dataloading_job_with_http_info( + def bind_datasource_in_batch_with_http_info( self, - graph_name: StrictStr, - groot_dataloading_job_config: GrootDataloadingJobConfig, + graph_id: StrictStr, + schema_mapping: SchemaMapping, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -128,13 +129,14 @@ def create_groot_dataloading_job_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """create_groot_dataloading_job + """bind_datasource_in_batch + Bind data sources in batches - :param graph_name: (required) - :type graph_name: str - :param groot_dataloading_job_config: (required) - :type groot_dataloading_job_config: GrootDataloadingJobConfig + :param graph_id: (required) + :type graph_id: str + :param schema_mapping: (required) + :type schema_mapping: SchemaMapping :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -157,9 +159,9 @@ def create_groot_dataloading_job_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._create_groot_dataloading_job_serialize( - graph_name=graph_name, - groot_dataloading_job_config=groot_dataloading_job_config, + _param = self._bind_datasource_in_batch_serialize( + graph_id=graph_id, + schema_mapping=schema_mapping, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -168,6 +170,8 @@ def create_groot_dataloading_job_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -181,10 +185,10 @@ def create_groot_dataloading_job_with_http_info( @validate_call - def create_groot_dataloading_job_without_preload_content( + def bind_datasource_in_batch_without_preload_content( self, - graph_name: StrictStr, - groot_dataloading_job_config: GrootDataloadingJobConfig, + graph_id: StrictStr, + schema_mapping: SchemaMapping, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -198,13 +202,14 @@ def create_groot_dataloading_job_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """create_groot_dataloading_job + """bind_datasource_in_batch + Bind data sources in batches - :param graph_name: (required) - :type graph_name: str - :param groot_dataloading_job_config: (required) - :type groot_dataloading_job_config: GrootDataloadingJobConfig + :param graph_id: (required) + :type graph_id: str + :param schema_mapping: (required) + :type schema_mapping: SchemaMapping :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -227,9 +232,9 @@ def create_groot_dataloading_job_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._create_groot_dataloading_job_serialize( - graph_name=graph_name, - groot_dataloading_job_config=groot_dataloading_job_config, + _param = self._bind_datasource_in_batch_serialize( + graph_id=graph_id, + schema_mapping=schema_mapping, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -238,6 +243,8 @@ def create_groot_dataloading_job_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -246,10 +253,10 @@ def create_groot_dataloading_job_without_preload_content( return response_data.response - def _create_groot_dataloading_job_serialize( + def _bind_datasource_in_batch_serialize( self, - graph_name, - groot_dataloading_job_config, + graph_id, + schema_mapping, _request_auth, _content_type, _headers, @@ -269,14 +276,14 @@ def _create_groot_dataloading_job_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter - if groot_dataloading_job_config is not None: - _body_params = groot_dataloading_job_config + if schema_mapping is not None: + _body_params = schema_mapping # set the HTTP header `Accept` @@ -306,7 +313,7 @@ def _create_groot_dataloading_job_serialize( return self.api_client.param_serialize( method='POST', - resource_path='/api/v1/groot/graph/{graph_name}/dataloading', + resource_path='/api/v1/graph/{graph_id}/datasource', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -323,9 +330,9 @@ def _create_groot_dataloading_job_serialize( @validate_call - def get_groot_schema( + def get_datasource_by_id( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -338,13 +345,13 @@ def get_groot_schema( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> GrootSchema: - """get_groot_schema + ) -> SchemaMapping: + """get_datasource_by_id - Get graph schema by name + Get data source by ID - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -367,8 +374,8 @@ def get_groot_schema( :return: Returns the result object. """ # noqa: E501 - _param = self._get_groot_schema_serialize( - graph_name=graph_name, + _param = self._get_datasource_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -376,7 +383,8 @@ def get_groot_schema( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GrootSchema", + '200': "SchemaMapping", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -390,9 +398,9 @@ def get_groot_schema( @validate_call - def get_groot_schema_with_http_info( + def get_datasource_by_id_with_http_info( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -405,13 +413,13 @@ def get_groot_schema_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[GrootSchema]: - """get_groot_schema + ) -> ApiResponse[SchemaMapping]: + """get_datasource_by_id - Get graph schema by name + Get data source by ID - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -434,8 +442,8 @@ def get_groot_schema_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_groot_schema_serialize( - graph_name=graph_name, + _param = self._get_datasource_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -443,7 +451,8 @@ def get_groot_schema_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GrootSchema", + '200': "SchemaMapping", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -457,9 +466,9 @@ def get_groot_schema_with_http_info( @validate_call - def get_groot_schema_without_preload_content( + def get_datasource_by_id_without_preload_content( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -473,12 +482,12 @@ def get_groot_schema_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """get_groot_schema + """get_datasource_by_id - Get graph schema by name + Get data source by ID - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -501,8 +510,8 @@ def get_groot_schema_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_groot_schema_serialize( - graph_name=graph_name, + _param = self._get_datasource_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -510,7 +519,8 @@ def get_groot_schema_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GrootSchema", + '200': "SchemaMapping", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -519,9 +529,9 @@ def get_groot_schema_without_preload_content( return response_data.response - def _get_groot_schema_serialize( + def _get_datasource_by_id_serialize( self, - graph_name, + graph_id, _request_auth, _content_type, _headers, @@ -541,8 +551,8 @@ def _get_groot_schema_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters @@ -563,7 +573,7 @@ def _get_groot_schema_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/groot/graph/{graph_name}/schema', + resource_path='/api/v1/graph/{graph_id}/datasource', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -580,10 +590,12 @@ def _get_groot_schema_serialize( @validate_call - def import_groot_schema( + def unbind_edge_datasource( self, - graph_name: StrictStr, - groot_schema: GrootSchema, + graph_id: StrictStr, + type_name: StrictStr, + source_vertex_type: StrictStr, + destination_vertex_type: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -597,14 +609,18 @@ def import_groot_schema( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """import_groot_schema - - Import schema to groot graph - - :param graph_name: (required) - :type graph_name: str - :param groot_schema: (required) - :type groot_schema: GrootSchema + """unbind_edge_datasource + + Unbind datas ource on an edge type + + :param graph_id: (required) + :type graph_id: str + :param type_name: (required) + :type type_name: str + :param source_vertex_type: (required) + :type source_vertex_type: str + :param destination_vertex_type: (required) + :type destination_vertex_type: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -627,9 +643,11 @@ def import_groot_schema( :return: Returns the result object. """ # noqa: E501 - _param = self._import_groot_schema_serialize( - graph_name=graph_name, - groot_schema=groot_schema, + _param = self._unbind_edge_datasource_serialize( + graph_id=graph_id, + type_name=type_name, + source_vertex_type=source_vertex_type, + destination_vertex_type=destination_vertex_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -638,6 +656,7 @@ def import_groot_schema( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -651,10 +670,12 @@ def import_groot_schema( @validate_call - def import_groot_schema_with_http_info( + def unbind_edge_datasource_with_http_info( self, - graph_name: StrictStr, - groot_schema: GrootSchema, + graph_id: StrictStr, + type_name: StrictStr, + source_vertex_type: StrictStr, + destination_vertex_type: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -668,14 +689,18 @@ def import_groot_schema_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """import_groot_schema - - Import schema to groot graph - - :param graph_name: (required) - :type graph_name: str - :param groot_schema: (required) - :type groot_schema: GrootSchema + """unbind_edge_datasource + + Unbind datas ource on an edge type + + :param graph_id: (required) + :type graph_id: str + :param type_name: (required) + :type type_name: str + :param source_vertex_type: (required) + :type source_vertex_type: str + :param destination_vertex_type: (required) + :type destination_vertex_type: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -698,9 +723,11 @@ def import_groot_schema_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._import_groot_schema_serialize( - graph_name=graph_name, - groot_schema=groot_schema, + _param = self._unbind_edge_datasource_serialize( + graph_id=graph_id, + type_name=type_name, + source_vertex_type=source_vertex_type, + destination_vertex_type=destination_vertex_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -709,6 +736,7 @@ def import_groot_schema_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -722,10 +750,12 @@ def import_groot_schema_with_http_info( @validate_call - def import_groot_schema_without_preload_content( + def unbind_edge_datasource_without_preload_content( self, - graph_name: StrictStr, - groot_schema: GrootSchema, + graph_id: StrictStr, + type_name: StrictStr, + source_vertex_type: StrictStr, + destination_vertex_type: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -739,14 +769,18 @@ def import_groot_schema_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """import_groot_schema - - Import schema to groot graph - - :param graph_name: (required) - :type graph_name: str - :param groot_schema: (required) - :type groot_schema: GrootSchema + """unbind_edge_datasource + + Unbind datas ource on an edge type + + :param graph_id: (required) + :type graph_id: str + :param type_name: (required) + :type type_name: str + :param source_vertex_type: (required) + :type source_vertex_type: str + :param destination_vertex_type: (required) + :type destination_vertex_type: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -769,9 +803,11 @@ def import_groot_schema_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._import_groot_schema_serialize( - graph_name=graph_name, - groot_schema=groot_schema, + _param = self._unbind_edge_datasource_serialize( + graph_id=graph_id, + type_name=type_name, + source_vertex_type=source_vertex_type, + destination_vertex_type=destination_vertex_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -780,6 +816,7 @@ def import_groot_schema_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -788,10 +825,12 @@ def import_groot_schema_without_preload_content( return response_data.response - def _import_groot_schema_serialize( + def _unbind_edge_datasource_serialize( self, - graph_name, - groot_schema, + graph_id, + type_name, + source_vertex_type, + destination_vertex_type, _request_auth, _content_type, _headers, @@ -811,14 +850,22 @@ def _import_groot_schema_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id + if type_name is not None: + _path_params['type_name'] = type_name # process the query parameters + if source_vertex_type is not None: + + _query_params.append(('source_vertex_type', source_vertex_type)) + + if destination_vertex_type is not None: + + _query_params.append(('destination_vertex_type', destination_vertex_type)) + # process the header parameters # process the form parameters # process the body parameter - if groot_schema is not None: - _body_params = groot_schema # set the HTTP header `Accept` @@ -828,27 +875,14 @@ def _import_groot_schema_serialize( ] ) - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/groot/graph/{graph_name}/schema', + method='DELETE', + resource_path='/api/v1/graph/{graph_id}/datasource/edge/{type_name}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -865,8 +899,10 @@ def _import_groot_schema_serialize( @validate_call - def list_groot_graph( + def unbind_vertex_datasource( self, + graph_id: StrictStr, + type_name: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -879,11 +915,15 @@ def list_groot_graph( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[GrootGraph]: - """list_groot_graph + ) -> str: + """unbind_vertex_datasource - list groot graph + Unbind data source on a vertex type + :param graph_id: (required) + :type graph_id: str + :param type_name: (required) + :type type_name: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -906,7 +946,9 @@ def list_groot_graph( :return: Returns the result object. """ # noqa: E501 - _param = self._list_groot_graph_serialize( + _param = self._unbind_vertex_datasource_serialize( + graph_id=graph_id, + type_name=type_name, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -914,7 +956,8 @@ def list_groot_graph( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[GrootGraph]", + '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -928,8 +971,10 @@ def list_groot_graph( @validate_call - def list_groot_graph_with_http_info( + def unbind_vertex_datasource_with_http_info( self, + graph_id: StrictStr, + type_name: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -942,11 +987,15 @@ def list_groot_graph_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[GrootGraph]]: - """list_groot_graph + ) -> ApiResponse[str]: + """unbind_vertex_datasource - list groot graph + Unbind data source on a vertex type + :param graph_id: (required) + :type graph_id: str + :param type_name: (required) + :type type_name: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -969,7 +1018,9 @@ def list_groot_graph_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_groot_graph_serialize( + _param = self._unbind_vertex_datasource_serialize( + graph_id=graph_id, + type_name=type_name, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -977,7 +1028,8 @@ def list_groot_graph_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[GrootGraph]", + '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -991,8 +1043,10 @@ def list_groot_graph_with_http_info( @validate_call - def list_groot_graph_without_preload_content( + def unbind_vertex_datasource_without_preload_content( self, + graph_id: StrictStr, + type_name: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1006,10 +1060,14 @@ def list_groot_graph_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """list_groot_graph + """unbind_vertex_datasource - list groot graph + Unbind data source on a vertex type + :param graph_id: (required) + :type graph_id: str + :param type_name: (required) + :type type_name: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1032,7 +1090,9 @@ def list_groot_graph_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_groot_graph_serialize( + _param = self._unbind_vertex_datasource_serialize( + graph_id=graph_id, + type_name=type_name, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1040,7 +1100,8 @@ def list_groot_graph_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[GrootGraph]", + '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1049,8 +1110,10 @@ def list_groot_graph_without_preload_content( return response_data.response - def _list_groot_graph_serialize( + def _unbind_vertex_datasource_serialize( self, + graph_id, + type_name, _request_auth, _content_type, _headers, @@ -1070,6 +1133,10 @@ def _list_groot_graph_serialize( _body_params: Optional[bytes] = None # process the path parameters + if graph_id is not None: + _path_params['graph_id'] = graph_id + if type_name is not None: + _path_params['type_name'] = type_name # process the query parameters # process the header parameters # process the form parameters @@ -1089,8 +1156,8 @@ def _list_groot_graph_serialize( ] return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/groot/graph', + method='DELETE', + resource_path='/api/v1/graph/{graph_id}/datasource/vertex/{type_name}', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/python/graphscope/flex/rest/api/datasource_api.py b/python/graphscope/flex/rest/api/datasource_api.py deleted file mode 100644 index e38b6c6d78a5..000000000000 --- a/python/graphscope/flex/rest/api/datasource_api.py +++ /dev/null @@ -1,2308 +0,0 @@ -# coding: utf-8 - -""" - GraphScope FLEX HTTP SERVICE API - - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - -import warnings -from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Any, Dict, List, Optional, Tuple, Union -from typing_extensions import Annotated - -from pydantic import StrictStr -from graphscope.flex.rest.models.data_source import DataSource -from graphscope.flex.rest.models.edge_data_source import EdgeDataSource -from graphscope.flex.rest.models.vertex_data_source import VertexDataSource - -from graphscope.flex.rest.api_client import ApiClient, RequestSerialized -from graphscope.flex.rest.api_response import ApiResponse -from graphscope.flex.rest.rest import RESTResponseType - - -class DatasourceApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - - @validate_call - def bind_edge_datasource( - self, - graph_name: StrictStr, - edge_data_source: EdgeDataSource, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """bind_edge_datasource - - Bind data source on edge type - - :param graph_name: (required) - :type graph_name: str - :param edge_data_source: (required) - :type edge_data_source: EdgeDataSource - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._bind_edge_datasource_serialize( - graph_name=graph_name, - edge_data_source=edge_data_source, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def bind_edge_datasource_with_http_info( - self, - graph_name: StrictStr, - edge_data_source: EdgeDataSource, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """bind_edge_datasource - - Bind data source on edge type - - :param graph_name: (required) - :type graph_name: str - :param edge_data_source: (required) - :type edge_data_source: EdgeDataSource - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._bind_edge_datasource_serialize( - graph_name=graph_name, - edge_data_source=edge_data_source, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def bind_edge_datasource_without_preload_content( - self, - graph_name: StrictStr, - edge_data_source: EdgeDataSource, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """bind_edge_datasource - - Bind data source on edge type - - :param graph_name: (required) - :type graph_name: str - :param edge_data_source: (required) - :type edge_data_source: EdgeDataSource - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._bind_edge_datasource_serialize( - graph_name=graph_name, - edge_data_source=edge_data_source, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _bind_edge_datasource_serialize( - self, - graph_name, - edge_data_source, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if edge_data_source is not None: - _body_params = edge_data_source - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/graph/{graph_name}/datasource/edge_datasource', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def bind_vertex_datasource( - self, - graph_name: StrictStr, - vertex_data_source: VertexDataSource, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """bind_vertex_datasource - - Bind data source on vertex type - - :param graph_name: (required) - :type graph_name: str - :param vertex_data_source: (required) - :type vertex_data_source: VertexDataSource - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._bind_vertex_datasource_serialize( - graph_name=graph_name, - vertex_data_source=vertex_data_source, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def bind_vertex_datasource_with_http_info( - self, - graph_name: StrictStr, - vertex_data_source: VertexDataSource, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """bind_vertex_datasource - - Bind data source on vertex type - - :param graph_name: (required) - :type graph_name: str - :param vertex_data_source: (required) - :type vertex_data_source: VertexDataSource - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._bind_vertex_datasource_serialize( - graph_name=graph_name, - vertex_data_source=vertex_data_source, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def bind_vertex_datasource_without_preload_content( - self, - graph_name: StrictStr, - vertex_data_source: VertexDataSource, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """bind_vertex_datasource - - Bind data source on vertex type - - :param graph_name: (required) - :type graph_name: str - :param vertex_data_source: (required) - :type vertex_data_source: VertexDataSource - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._bind_vertex_datasource_serialize( - graph_name=graph_name, - vertex_data_source=vertex_data_source, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _bind_vertex_datasource_serialize( - self, - graph_name, - vertex_data_source, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if vertex_data_source is not None: - _body_params = vertex_data_source - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/graph/{graph_name}/datasource/vertex_datasource', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def get_datasource( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> DataSource: - """get_datasource - - List data source on graph - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_datasource_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "DataSource", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def get_datasource_with_http_info( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[DataSource]: - """get_datasource - - List data source on graph - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_datasource_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "DataSource", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def get_datasource_without_preload_content( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """get_datasource - - List data source on graph - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_datasource_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "DataSource", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_datasource_serialize( - self, - graph_name, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/graph/{graph_name}/datasource', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def get_edge_datasource( - self, - graph_name: StrictStr, - type_name: StrictStr, - source_vertex_type: StrictStr, - destination_vertex_type: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> EdgeDataSource: - """get_edge_datasource - - Get edge data source - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param source_vertex_type: (required) - :type source_vertex_type: str - :param destination_vertex_type: (required) - :type destination_vertex_type: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_edge_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - source_vertex_type=source_vertex_type, - destination_vertex_type=destination_vertex_type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EdgeDataSource", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def get_edge_datasource_with_http_info( - self, - graph_name: StrictStr, - type_name: StrictStr, - source_vertex_type: StrictStr, - destination_vertex_type: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[EdgeDataSource]: - """get_edge_datasource - - Get edge data source - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param source_vertex_type: (required) - :type source_vertex_type: str - :param destination_vertex_type: (required) - :type destination_vertex_type: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_edge_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - source_vertex_type=source_vertex_type, - destination_vertex_type=destination_vertex_type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EdgeDataSource", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def get_edge_datasource_without_preload_content( - self, - graph_name: StrictStr, - type_name: StrictStr, - source_vertex_type: StrictStr, - destination_vertex_type: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """get_edge_datasource - - Get edge data source - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param source_vertex_type: (required) - :type source_vertex_type: str - :param destination_vertex_type: (required) - :type destination_vertex_type: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_edge_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - source_vertex_type=source_vertex_type, - destination_vertex_type=destination_vertex_type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "EdgeDataSource", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_edge_datasource_serialize( - self, - graph_name, - type_name, - source_vertex_type, - destination_vertex_type, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if type_name is not None: - _path_params['type_name'] = type_name - # process the query parameters - if source_vertex_type is not None: - - _query_params.append(('source_vertex_type', source_vertex_type)) - - if destination_vertex_type is not None: - - _query_params.append(('destination_vertex_type', destination_vertex_type)) - - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/graph/{graph_name}/datasource/edge_datasource/{type_name}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def get_vertex_datasource( - self, - graph_name: StrictStr, - type_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> VertexDataSource: - """get_vertex_datasource - - Get vertex data source - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_vertex_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "VertexDataSource", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def get_vertex_datasource_with_http_info( - self, - graph_name: StrictStr, - type_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[VertexDataSource]: - """get_vertex_datasource - - Get vertex data source - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_vertex_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "VertexDataSource", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def get_vertex_datasource_without_preload_content( - self, - graph_name: StrictStr, - type_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """get_vertex_datasource - - Get vertex data source - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_vertex_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "VertexDataSource", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_vertex_datasource_serialize( - self, - graph_name, - type_name, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if type_name is not None: - _path_params['type_name'] = type_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/graph/{graph_name}/datasource/vertex_datasource/{type_name}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def import_datasource( - self, - graph_name: StrictStr, - data_source: DataSource, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """import_datasource - - Import data source in batch - - :param graph_name: (required) - :type graph_name: str - :param data_source: (required) - :type data_source: DataSource - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._import_datasource_serialize( - graph_name=graph_name, - data_source=data_source, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def import_datasource_with_http_info( - self, - graph_name: StrictStr, - data_source: DataSource, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """import_datasource - - Import data source in batch - - :param graph_name: (required) - :type graph_name: str - :param data_source: (required) - :type data_source: DataSource - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._import_datasource_serialize( - graph_name=graph_name, - data_source=data_source, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def import_datasource_without_preload_content( - self, - graph_name: StrictStr, - data_source: DataSource, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """import_datasource - - Import data source in batch - - :param graph_name: (required) - :type graph_name: str - :param data_source: (required) - :type data_source: DataSource - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._import_datasource_serialize( - graph_name=graph_name, - data_source=data_source, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _import_datasource_serialize( - self, - graph_name, - data_source, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if data_source is not None: - _body_params = data_source - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/graph/{graph_name}/datasource', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def unbind_edge_datasource( - self, - graph_name: StrictStr, - type_name: StrictStr, - source_vertex_type: StrictStr, - destination_vertex_type: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """unbind_edge_datasource - - Unbind datasource on an edge type - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param source_vertex_type: (required) - :type source_vertex_type: str - :param destination_vertex_type: (required) - :type destination_vertex_type: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._unbind_edge_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - source_vertex_type=source_vertex_type, - destination_vertex_type=destination_vertex_type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def unbind_edge_datasource_with_http_info( - self, - graph_name: StrictStr, - type_name: StrictStr, - source_vertex_type: StrictStr, - destination_vertex_type: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """unbind_edge_datasource - - Unbind datasource on an edge type - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param source_vertex_type: (required) - :type source_vertex_type: str - :param destination_vertex_type: (required) - :type destination_vertex_type: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._unbind_edge_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - source_vertex_type=source_vertex_type, - destination_vertex_type=destination_vertex_type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def unbind_edge_datasource_without_preload_content( - self, - graph_name: StrictStr, - type_name: StrictStr, - source_vertex_type: StrictStr, - destination_vertex_type: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """unbind_edge_datasource - - Unbind datasource on an edge type - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param source_vertex_type: (required) - :type source_vertex_type: str - :param destination_vertex_type: (required) - :type destination_vertex_type: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._unbind_edge_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - source_vertex_type=source_vertex_type, - destination_vertex_type=destination_vertex_type, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _unbind_edge_datasource_serialize( - self, - graph_name, - type_name, - source_vertex_type, - destination_vertex_type, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if type_name is not None: - _path_params['type_name'] = type_name - # process the query parameters - if source_vertex_type is not None: - - _query_params.append(('source_vertex_type', source_vertex_type)) - - if destination_vertex_type is not None: - - _query_params.append(('destination_vertex_type', destination_vertex_type)) - - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='DELETE', - resource_path='/api/v1/graph/{graph_name}/datasource/edge_datasource/{type_name}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def unbind_vertex_datasource( - self, - graph_name: StrictStr, - type_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """unbind_vertex_datasource - - Unbind datasource on a vertex type - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._unbind_vertex_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def unbind_vertex_datasource_with_http_info( - self, - graph_name: StrictStr, - type_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """unbind_vertex_datasource - - Unbind datasource on a vertex type - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._unbind_vertex_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def unbind_vertex_datasource_without_preload_content( - self, - graph_name: StrictStr, - type_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """unbind_vertex_datasource - - Unbind datasource on a vertex type - - :param graph_name: (required) - :type graph_name: str - :param type_name: (required) - :type type_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._unbind_vertex_datasource_serialize( - graph_name=graph_name, - type_name=type_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _unbind_vertex_datasource_serialize( - self, - graph_name, - type_name, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if type_name is not None: - _path_params['type_name'] = type_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='DELETE', - resource_path='/api/v1/graph/{graph_name}/datasource/vertex_datasource/{type_name}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - diff --git a/python/graphscope/flex/rest/api/deployment_api.py b/python/graphscope/flex/rest/api/deployment_api.py index 4b7b1e24822d..ff24027e9d4d 100644 --- a/python/graphscope/flex/rest/api/deployment_api.py +++ b/python/graphscope/flex/rest/api/deployment_api.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -17,10 +17,8 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import StrictInt, StrictStr -from graphscope.flex.rest.models.deployment_info import DeploymentInfo -from graphscope.flex.rest.models.deployment_status import DeploymentStatus -from graphscope.flex.rest.models.node_status import NodeStatus +from graphscope.flex.rest.models.running_deployment_info import RunningDeploymentInfo +from graphscope.flex.rest.models.running_deployment_status import RunningDeploymentStatus from graphscope.flex.rest.api_client import ApiClient, RequestSerialized from graphscope.flex.rest.api_response import ApiResponse @@ -40,313 +38,6 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client - @validate_call - def fetch_log( - self, - component: StrictStr, - pod_name: StrictStr, - container_name: StrictStr, - since_seconds: StrictInt, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[DeploymentStatus]: - """fetch_log - - - :param component: (required) - :type component: str - :param pod_name: (required) - :type pod_name: str - :param container_name: (required) - :type container_name: str - :param since_seconds: (required) - :type since_seconds: int - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._fetch_log_serialize( - component=component, - pod_name=pod_name, - container_name=container_name, - since_seconds=since_seconds, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[DeploymentStatus]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def fetch_log_with_http_info( - self, - component: StrictStr, - pod_name: StrictStr, - container_name: StrictStr, - since_seconds: StrictInt, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[DeploymentStatus]]: - """fetch_log - - - :param component: (required) - :type component: str - :param pod_name: (required) - :type pod_name: str - :param container_name: (required) - :type container_name: str - :param since_seconds: (required) - :type since_seconds: int - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._fetch_log_serialize( - component=component, - pod_name=pod_name, - container_name=container_name, - since_seconds=since_seconds, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[DeploymentStatus]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def fetch_log_without_preload_content( - self, - component: StrictStr, - pod_name: StrictStr, - container_name: StrictStr, - since_seconds: StrictInt, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """fetch_log - - - :param component: (required) - :type component: str - :param pod_name: (required) - :type pod_name: str - :param container_name: (required) - :type container_name: str - :param since_seconds: (required) - :type since_seconds: int - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._fetch_log_serialize( - component=component, - pod_name=pod_name, - container_name=container_name, - since_seconds=since_seconds, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[DeploymentStatus]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _fetch_log_serialize( - self, - component, - pod_name, - container_name, - since_seconds, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - if component is not None: - - _query_params.append(('component', component)) - - if pod_name is not None: - - _query_params.append(('pod_name', pod_name)) - - if container_name is not None: - - _query_params.append(('container_name', container_name)) - - if since_seconds is not None: - - _query_params.append(('since_seconds', since_seconds)) - - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/deployment/log', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - @validate_call def get_deployment_info( self, @@ -362,10 +53,10 @@ def get_deployment_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> DeploymentInfo: + ) -> RunningDeploymentInfo: """get_deployment_info - Get deployment's meta info + Deployment information :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -397,7 +88,8 @@ def get_deployment_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "DeploymentInfo", + '200': "RunningDeploymentInfo", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -425,10 +117,10 @@ def get_deployment_info_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[DeploymentInfo]: + ) -> ApiResponse[RunningDeploymentInfo]: """get_deployment_info - Get deployment's meta info + Deployment information :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -460,7 +152,8 @@ def get_deployment_info_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "DeploymentInfo", + '200': "RunningDeploymentInfo", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -491,7 +184,7 @@ def get_deployment_info_without_preload_content( ) -> RESTResponseType: """get_deployment_info - Get deployment's meta info + Deployment information :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -523,7 +216,8 @@ def get_deployment_info_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "DeploymentInfo", + '200': "RunningDeploymentInfo", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -573,7 +267,7 @@ def _get_deployment_info_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/deployment/info', + resource_path='/api/v1/deployment', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -604,10 +298,10 @@ def get_deployment_status( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[DeploymentStatus]: + ) -> RunningDeploymentStatus: """get_deployment_status - Get deployment's status (k8s only) + Deployment status :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -639,7 +333,8 @@ def get_deployment_status( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[DeploymentStatus]", + '200': "RunningDeploymentStatus", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -667,10 +362,10 @@ def get_deployment_status_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[DeploymentStatus]]: + ) -> ApiResponse[RunningDeploymentStatus]: """get_deployment_status - Get deployment's status (k8s only) + Deployment status :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -702,7 +397,8 @@ def get_deployment_status_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[DeploymentStatus]", + '200': "RunningDeploymentStatus", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -733,7 +429,7 @@ def get_deployment_status_without_preload_content( ) -> RESTResponseType: """get_deployment_status - Get deployment's status (k8s only) + Deployment status :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -765,7 +461,8 @@ def get_deployment_status_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[DeploymentStatus]", + '200': "RunningDeploymentStatus", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -829,245 +526,3 @@ def _get_deployment_status_serialize( ) - - - @validate_call - def get_node_status( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[NodeStatus]: - """get_node_status - - Get node status (cpu/memory/disk, local only) - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_node_status_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[NodeStatus]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def get_node_status_with_http_info( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[NodeStatus]]: - """get_node_status - - Get node status (cpu/memory/disk, local only) - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_node_status_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[NodeStatus]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def get_node_status_without_preload_content( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """get_node_status - - Get node status (cpu/memory/disk, local only) - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_node_status_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[NodeStatus]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_node_status_serialize( - self, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/node/status', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - diff --git a/python/graphscope/flex/rest/api/graph_api.py b/python/graphscope/flex/rest/api/graph_api.py index ce0aa1782961..bc2f2fcdd2a7 100644 --- a/python/graphscope/flex/rest/api/graph_api.py +++ b/python/graphscope/flex/rest/api/graph_api.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,10 +18,14 @@ from typing_extensions import Annotated from pydantic import StrictStr -from graphscope.flex.rest.models.edge_type import EdgeType -from graphscope.flex.rest.models.graph import Graph -from graphscope.flex.rest.models.model_schema import ModelSchema -from graphscope.flex.rest.models.vertex_type import VertexType +from typing import Optional +from graphscope.flex.rest.models.create_edge_type import CreateEdgeType +from graphscope.flex.rest.models.create_graph_request import CreateGraphRequest +from graphscope.flex.rest.models.create_graph_response import CreateGraphResponse +from graphscope.flex.rest.models.create_graph_schema_request import CreateGraphSchemaRequest +from graphscope.flex.rest.models.create_vertex_type import CreateVertexType +from graphscope.flex.rest.models.get_graph_response import GetGraphResponse +from graphscope.flex.rest.models.get_graph_schema_response import GetGraphSchemaResponse from graphscope.flex.rest.api_client import ApiClient, RequestSerialized from graphscope.flex.rest.api_response import ApiResponse @@ -44,8 +48,8 @@ def __init__(self, api_client=None) -> None: @validate_call def create_edge_type( self, - graph_name: StrictStr, - edge_type: EdgeType, + graph_id: StrictStr, + create_edge_type: Optional[CreateEdgeType] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -63,10 +67,10 @@ def create_edge_type( Create a edge type - :param graph_name: (required) - :type graph_name: str - :param edge_type: (required) - :type edge_type: EdgeType + :param graph_id: (required) + :type graph_id: str + :param create_edge_type: + :type create_edge_type: CreateEdgeType :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -90,8 +94,8 @@ def create_edge_type( """ # noqa: E501 _param = self._create_edge_type_serialize( - graph_name=graph_name, - edge_type=edge_type, + graph_id=graph_id, + create_edge_type=create_edge_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -100,6 +104,8 @@ def create_edge_type( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -115,8 +121,8 @@ def create_edge_type( @validate_call def create_edge_type_with_http_info( self, - graph_name: StrictStr, - edge_type: EdgeType, + graph_id: StrictStr, + create_edge_type: Optional[CreateEdgeType] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -134,10 +140,10 @@ def create_edge_type_with_http_info( Create a edge type - :param graph_name: (required) - :type graph_name: str - :param edge_type: (required) - :type edge_type: EdgeType + :param graph_id: (required) + :type graph_id: str + :param create_edge_type: + :type create_edge_type: CreateEdgeType :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -161,8 +167,8 @@ def create_edge_type_with_http_info( """ # noqa: E501 _param = self._create_edge_type_serialize( - graph_name=graph_name, - edge_type=edge_type, + graph_id=graph_id, + create_edge_type=create_edge_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -171,6 +177,8 @@ def create_edge_type_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -186,8 +194,8 @@ def create_edge_type_with_http_info( @validate_call def create_edge_type_without_preload_content( self, - graph_name: StrictStr, - edge_type: EdgeType, + graph_id: StrictStr, + create_edge_type: Optional[CreateEdgeType] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -205,10 +213,10 @@ def create_edge_type_without_preload_content( Create a edge type - :param graph_name: (required) - :type graph_name: str - :param edge_type: (required) - :type edge_type: EdgeType + :param graph_id: (required) + :type graph_id: str + :param create_edge_type: + :type create_edge_type: CreateEdgeType :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -232,8 +240,8 @@ def create_edge_type_without_preload_content( """ # noqa: E501 _param = self._create_edge_type_serialize( - graph_name=graph_name, - edge_type=edge_type, + graph_id=graph_id, + create_edge_type=create_edge_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -242,6 +250,8 @@ def create_edge_type_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -252,8 +262,8 @@ def create_edge_type_without_preload_content( def _create_edge_type_serialize( self, - graph_name, - edge_type, + graph_id, + create_edge_type, _request_auth, _content_type, _headers, @@ -273,14 +283,14 @@ def _create_edge_type_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter - if edge_type is not None: - _body_params = edge_type + if create_edge_type is not None: + _body_params = create_edge_type # set the HTTP header `Accept` @@ -310,7 +320,7 @@ def _create_edge_type_serialize( return self.api_client.param_serialize( method='POST', - resource_path='/api/v1/graph/{graph_name}/schema/edge_type', + resource_path='/api/v1/graph/{graph_id}/schema/edge', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -329,7 +339,7 @@ def _create_edge_type_serialize( @validate_call def create_graph( self, - graph: Graph, + create_graph_request: CreateGraphRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -342,13 +352,13 @@ def create_graph( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: + ) -> CreateGraphResponse: """create_graph Create a new graph - :param graph: (required) - :type graph: Graph + :param create_graph_request: (required) + :type create_graph_request: CreateGraphRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -372,7 +382,7 @@ def create_graph( """ # noqa: E501 _param = self._create_graph_serialize( - graph=graph, + create_graph_request=create_graph_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -380,7 +390,9 @@ def create_graph( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "CreateGraphResponse", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -396,7 +408,7 @@ def create_graph( @validate_call def create_graph_with_http_info( self, - graph: Graph, + create_graph_request: CreateGraphRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -409,13 +421,13 @@ def create_graph_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> ApiResponse[CreateGraphResponse]: """create_graph Create a new graph - :param graph: (required) - :type graph: Graph + :param create_graph_request: (required) + :type create_graph_request: CreateGraphRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -439,7 +451,7 @@ def create_graph_with_http_info( """ # noqa: E501 _param = self._create_graph_serialize( - graph=graph, + create_graph_request=create_graph_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -447,7 +459,9 @@ def create_graph_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "CreateGraphResponse", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -463,7 +477,7 @@ def create_graph_with_http_info( @validate_call def create_graph_without_preload_content( self, - graph: Graph, + create_graph_request: CreateGraphRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -481,8 +495,8 @@ def create_graph_without_preload_content( Create a new graph - :param graph: (required) - :type graph: Graph + :param create_graph_request: (required) + :type create_graph_request: CreateGraphRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -506,7 +520,7 @@ def create_graph_without_preload_content( """ # noqa: E501 _param = self._create_graph_serialize( - graph=graph, + create_graph_request=create_graph_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -514,7 +528,9 @@ def create_graph_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "CreateGraphResponse", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -525,7 +541,7 @@ def create_graph_without_preload_content( def _create_graph_serialize( self, - graph, + create_graph_request, _request_auth, _content_type, _headers, @@ -549,8 +565,8 @@ def _create_graph_serialize( # process the header parameters # process the form parameters # process the body parameter - if graph is not None: - _body_params = graph + if create_graph_request is not None: + _body_params = create_graph_request # set the HTTP header `Accept` @@ -599,8 +615,8 @@ def _create_graph_serialize( @validate_call def create_vertex_type( self, - graph_name: StrictStr, - vertex_type: VertexType, + graph_id: StrictStr, + create_vertex_type: CreateVertexType, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -618,10 +634,10 @@ def create_vertex_type( Create a vertex type - :param graph_name: (required) - :type graph_name: str - :param vertex_type: (required) - :type vertex_type: VertexType + :param graph_id: (required) + :type graph_id: str + :param create_vertex_type: (required) + :type create_vertex_type: CreateVertexType :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -645,8 +661,8 @@ def create_vertex_type( """ # noqa: E501 _param = self._create_vertex_type_serialize( - graph_name=graph_name, - vertex_type=vertex_type, + graph_id=graph_id, + create_vertex_type=create_vertex_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -655,6 +671,8 @@ def create_vertex_type( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -670,8 +688,8 @@ def create_vertex_type( @validate_call def create_vertex_type_with_http_info( self, - graph_name: StrictStr, - vertex_type: VertexType, + graph_id: StrictStr, + create_vertex_type: CreateVertexType, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -689,10 +707,10 @@ def create_vertex_type_with_http_info( Create a vertex type - :param graph_name: (required) - :type graph_name: str - :param vertex_type: (required) - :type vertex_type: VertexType + :param graph_id: (required) + :type graph_id: str + :param create_vertex_type: (required) + :type create_vertex_type: CreateVertexType :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -716,8 +734,8 @@ def create_vertex_type_with_http_info( """ # noqa: E501 _param = self._create_vertex_type_serialize( - graph_name=graph_name, - vertex_type=vertex_type, + graph_id=graph_id, + create_vertex_type=create_vertex_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -726,6 +744,8 @@ def create_vertex_type_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -741,8 +761,8 @@ def create_vertex_type_with_http_info( @validate_call def create_vertex_type_without_preload_content( self, - graph_name: StrictStr, - vertex_type: VertexType, + graph_id: StrictStr, + create_vertex_type: CreateVertexType, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -760,10 +780,10 @@ def create_vertex_type_without_preload_content( Create a vertex type - :param graph_name: (required) - :type graph_name: str - :param vertex_type: (required) - :type vertex_type: VertexType + :param graph_id: (required) + :type graph_id: str + :param create_vertex_type: (required) + :type create_vertex_type: CreateVertexType :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -787,8 +807,8 @@ def create_vertex_type_without_preload_content( """ # noqa: E501 _param = self._create_vertex_type_serialize( - graph_name=graph_name, - vertex_type=vertex_type, + graph_id=graph_id, + create_vertex_type=create_vertex_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -797,6 +817,8 @@ def create_vertex_type_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -807,8 +829,8 @@ def create_vertex_type_without_preload_content( def _create_vertex_type_serialize( self, - graph_name, - vertex_type, + graph_id, + create_vertex_type, _request_auth, _content_type, _headers, @@ -828,14 +850,14 @@ def _create_vertex_type_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter - if vertex_type is not None: - _body_params = vertex_type + if create_vertex_type is not None: + _body_params = create_vertex_type # set the HTTP header `Accept` @@ -865,7 +887,7 @@ def _create_vertex_type_serialize( return self.api_client.param_serialize( method='POST', - resource_path='/api/v1/graph/{graph_name}/schema/vertex_type', + resource_path='/api/v1/graph/{graph_id}/schema/vertex', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -882,9 +904,9 @@ def _create_vertex_type_serialize( @validate_call - def delete_edge_type( + def delete_edge_type_by_name( self, - graph_name: StrictStr, + graph_id: StrictStr, type_name: StrictStr, source_vertex_type: StrictStr, destination_vertex_type: StrictStr, @@ -901,12 +923,12 @@ def delete_edge_type( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """delete_edge_type + """delete_edge_type_by_name - Delete a edge type by name + Delete edge type by name - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param type_name: (required) :type type_name: str :param source_vertex_type: (required) @@ -935,8 +957,8 @@ def delete_edge_type( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_edge_type_serialize( - graph_name=graph_name, + _param = self._delete_edge_type_by_name_serialize( + graph_id=graph_id, type_name=type_name, source_vertex_type=source_vertex_type, destination_vertex_type=destination_vertex_type, @@ -948,6 +970,7 @@ def delete_edge_type( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -961,9 +984,9 @@ def delete_edge_type( @validate_call - def delete_edge_type_with_http_info( + def delete_edge_type_by_name_with_http_info( self, - graph_name: StrictStr, + graph_id: StrictStr, type_name: StrictStr, source_vertex_type: StrictStr, destination_vertex_type: StrictStr, @@ -980,12 +1003,12 @@ def delete_edge_type_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """delete_edge_type + """delete_edge_type_by_name - Delete a edge type by name + Delete edge type by name - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param type_name: (required) :type type_name: str :param source_vertex_type: (required) @@ -1014,8 +1037,8 @@ def delete_edge_type_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_edge_type_serialize( - graph_name=graph_name, + _param = self._delete_edge_type_by_name_serialize( + graph_id=graph_id, type_name=type_name, source_vertex_type=source_vertex_type, destination_vertex_type=destination_vertex_type, @@ -1027,6 +1050,7 @@ def delete_edge_type_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1040,9 +1064,9 @@ def delete_edge_type_with_http_info( @validate_call - def delete_edge_type_without_preload_content( + def delete_edge_type_by_name_without_preload_content( self, - graph_name: StrictStr, + graph_id: StrictStr, type_name: StrictStr, source_vertex_type: StrictStr, destination_vertex_type: StrictStr, @@ -1059,12 +1083,12 @@ def delete_edge_type_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """delete_edge_type + """delete_edge_type_by_name - Delete a edge type by name + Delete edge type by name - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param type_name: (required) :type type_name: str :param source_vertex_type: (required) @@ -1093,8 +1117,8 @@ def delete_edge_type_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_edge_type_serialize( - graph_name=graph_name, + _param = self._delete_edge_type_by_name_serialize( + graph_id=graph_id, type_name=type_name, source_vertex_type=source_vertex_type, destination_vertex_type=destination_vertex_type, @@ -1106,6 +1130,7 @@ def delete_edge_type_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1114,9 +1139,9 @@ def delete_edge_type_without_preload_content( return response_data.response - def _delete_edge_type_serialize( + def _delete_edge_type_by_name_serialize( self, - graph_name, + graph_id, type_name, source_vertex_type, destination_vertex_type, @@ -1139,8 +1164,8 @@ def _delete_edge_type_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id if type_name is not None: _path_params['type_name'] = type_name # process the query parameters @@ -1171,7 +1196,7 @@ def _delete_edge_type_serialize( return self.api_client.param_serialize( method='DELETE', - resource_path='/api/v1/graph/{graph_name}/schema/edge_edge/{type_name}', + resource_path='/api/v1/graph/{graph_id}/schema/edge/{type_name}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1188,9 +1213,9 @@ def _delete_edge_type_serialize( @validate_call - def delete_graph( + def delete_graph_by_id( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1204,12 +1229,12 @@ def delete_graph( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """delete_graph + """delete_graph_by_id - Delete a graph by name + Delete graph by ID - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1232,8 +1257,8 @@ def delete_graph( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_graph_serialize( - graph_name=graph_name, + _param = self._delete_graph_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1242,6 +1267,7 @@ def delete_graph( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1255,9 +1281,9 @@ def delete_graph( @validate_call - def delete_graph_with_http_info( + def delete_graph_by_id_with_http_info( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1271,12 +1297,12 @@ def delete_graph_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """delete_graph + """delete_graph_by_id - Delete a graph by name + Delete graph by ID - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1299,8 +1325,8 @@ def delete_graph_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_graph_serialize( - graph_name=graph_name, + _param = self._delete_graph_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1309,6 +1335,7 @@ def delete_graph_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1322,9 +1349,9 @@ def delete_graph_with_http_info( @validate_call - def delete_graph_without_preload_content( + def delete_graph_by_id_without_preload_content( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1338,12 +1365,12 @@ def delete_graph_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """delete_graph + """delete_graph_by_id - Delete a graph by name + Delete graph by ID - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1366,8 +1393,8 @@ def delete_graph_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_graph_serialize( - graph_name=graph_name, + _param = self._delete_graph_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1376,6 +1403,7 @@ def delete_graph_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1384,9 +1412,9 @@ def delete_graph_without_preload_content( return response_data.response - def _delete_graph_serialize( + def _delete_graph_by_id_serialize( self, - graph_name, + graph_id, _request_auth, _content_type, _headers, @@ -1406,8 +1434,8 @@ def _delete_graph_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters @@ -1428,7 +1456,7 @@ def _delete_graph_serialize( return self.api_client.param_serialize( method='DELETE', - resource_path='/api/v1/graph/{graph_name}', + resource_path='/api/v1/graph/{graph_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1445,9 +1473,9 @@ def _delete_graph_serialize( @validate_call - def delete_vertex_type( + def delete_vertex_type_by_name( self, - graph_name: StrictStr, + graph_id: StrictStr, type_name: StrictStr, _request_timeout: Union[ None, @@ -1462,12 +1490,12 @@ def delete_vertex_type( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """delete_vertex_type + """delete_vertex_type_by_name - Delete a vertex type by name + Delete vertex type by name - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param type_name: (required) :type type_name: str :param _request_timeout: timeout setting for this request. If one @@ -1492,8 +1520,8 @@ def delete_vertex_type( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_vertex_type_serialize( - graph_name=graph_name, + _param = self._delete_vertex_type_by_name_serialize( + graph_id=graph_id, type_name=type_name, _request_auth=_request_auth, _content_type=_content_type, @@ -1503,6 +1531,7 @@ def delete_vertex_type( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1516,9 +1545,9 @@ def delete_vertex_type( @validate_call - def delete_vertex_type_with_http_info( + def delete_vertex_type_by_name_with_http_info( self, - graph_name: StrictStr, + graph_id: StrictStr, type_name: StrictStr, _request_timeout: Union[ None, @@ -1533,12 +1562,12 @@ def delete_vertex_type_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """delete_vertex_type + """delete_vertex_type_by_name - Delete a vertex type by name + Delete vertex type by name - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param type_name: (required) :type type_name: str :param _request_timeout: timeout setting for this request. If one @@ -1563,8 +1592,8 @@ def delete_vertex_type_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_vertex_type_serialize( - graph_name=graph_name, + _param = self._delete_vertex_type_by_name_serialize( + graph_id=graph_id, type_name=type_name, _request_auth=_request_auth, _content_type=_content_type, @@ -1574,6 +1603,7 @@ def delete_vertex_type_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1587,9 +1617,9 @@ def delete_vertex_type_with_http_info( @validate_call - def delete_vertex_type_without_preload_content( + def delete_vertex_type_by_name_without_preload_content( self, - graph_name: StrictStr, + graph_id: StrictStr, type_name: StrictStr, _request_timeout: Union[ None, @@ -1604,12 +1634,12 @@ def delete_vertex_type_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """delete_vertex_type + """delete_vertex_type_by_name - Delete a vertex type by name + Delete vertex type by name - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param type_name: (required) :type type_name: str :param _request_timeout: timeout setting for this request. If one @@ -1634,8 +1664,8 @@ def delete_vertex_type_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_vertex_type_serialize( - graph_name=graph_name, + _param = self._delete_vertex_type_by_name_serialize( + graph_id=graph_id, type_name=type_name, _request_auth=_request_auth, _content_type=_content_type, @@ -1645,6 +1675,7 @@ def delete_vertex_type_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1653,9 +1684,9 @@ def delete_vertex_type_without_preload_content( return response_data.response - def _delete_vertex_type_serialize( + def _delete_vertex_type_by_name_serialize( self, - graph_name, + graph_id, type_name, _request_auth, _content_type, @@ -1676,8 +1707,8 @@ def _delete_vertex_type_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id if type_name is not None: _path_params['type_name'] = type_name # process the query parameters @@ -1700,7 +1731,7 @@ def _delete_vertex_type_serialize( return self.api_client.param_serialize( method='DELETE', - resource_path='/api/v1/graph/{graph_name}/schema/vertex_type/{type_name}', + resource_path='/api/v1/graph/{graph_id}/schema/vertex/{type_name}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1717,9 +1748,9 @@ def _delete_vertex_type_serialize( @validate_call - def get_schema( + def get_graph_by_id( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1732,13 +1763,13 @@ def get_schema( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ModelSchema: - """get_schema + ) -> GetGraphResponse: + """get_graph_by_id - Get graph schema by name + Get graph by ID - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1761,8 +1792,8 @@ def get_schema( :return: Returns the result object. """ # noqa: E501 - _param = self._get_schema_serialize( - graph_name=graph_name, + _param = self._get_graph_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1770,7 +1801,8 @@ def get_schema( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ModelSchema", + '200': "GetGraphResponse", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1784,9 +1816,9 @@ def get_schema( @validate_call - def get_schema_with_http_info( + def get_graph_by_id_with_http_info( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1799,13 +1831,13 @@ def get_schema_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ModelSchema]: - """get_schema + ) -> ApiResponse[GetGraphResponse]: + """get_graph_by_id - Get graph schema by name + Get graph by ID - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1828,8 +1860,8 @@ def get_schema_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_schema_serialize( - graph_name=graph_name, + _param = self._get_graph_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1837,7 +1869,8 @@ def get_schema_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ModelSchema", + '200': "GetGraphResponse", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1851,9 +1884,9 @@ def get_schema_with_http_info( @validate_call - def get_schema_without_preload_content( + def get_graph_by_id_without_preload_content( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1867,12 +1900,12 @@ def get_schema_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """get_schema + """get_graph_by_id - Get graph schema by name + Get graph by ID - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1895,8 +1928,8 @@ def get_schema_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_schema_serialize( - graph_name=graph_name, + _param = self._get_graph_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1904,7 +1937,8 @@ def get_schema_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ModelSchema", + '200': "GetGraphResponse", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1913,9 +1947,9 @@ def get_schema_without_preload_content( return response_data.response - def _get_schema_serialize( + def _get_graph_by_id_serialize( self, - graph_name, + graph_id, _request_auth, _content_type, _headers, @@ -1935,8 +1969,8 @@ def _get_schema_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters @@ -1957,7 +1991,558 @@ def _get_schema_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/graph/{graph_name}/schema', + resource_path='/api/v1/graph/{graph_id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_schema_by_id( + self, + graph_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetGraphSchemaResponse: + """get_schema_by_id + + Get graph schema by ID + + :param graph_id: (required) + :type graph_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_schema_by_id_serialize( + graph_id=graph_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetGraphSchemaResponse", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_schema_by_id_with_http_info( + self, + graph_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetGraphSchemaResponse]: + """get_schema_by_id + + Get graph schema by ID + + :param graph_id: (required) + :type graph_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_schema_by_id_serialize( + graph_id=graph_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetGraphSchemaResponse", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_schema_by_id_without_preload_content( + self, + graph_id: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_schema_by_id + + Get graph schema by ID + + :param graph_id: (required) + :type graph_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_schema_by_id_serialize( + graph_id=graph_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetGraphSchemaResponse", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_schema_by_id_serialize( + self, + graph_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if graph_id is not None: + _path_params['graph_id'] = graph_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/graph/{graph_id}/schema', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def import_schema_by_id( + self, + graph_id: StrictStr, + create_graph_schema_request: CreateGraphSchemaRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> str: + """import_schema_by_id + + Import graph schema + + :param graph_id: (required) + :type graph_id: str + :param create_graph_schema_request: (required) + :type create_graph_schema_request: CreateGraphSchemaRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_schema_by_id_serialize( + graph_id=graph_id, + create_graph_schema_request=create_graph_schema_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + '400': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def import_schema_by_id_with_http_info( + self, + graph_id: StrictStr, + create_graph_schema_request: CreateGraphSchemaRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[str]: + """import_schema_by_id + + Import graph schema + + :param graph_id: (required) + :type graph_id: str + :param create_graph_schema_request: (required) + :type create_graph_schema_request: CreateGraphSchemaRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_schema_by_id_serialize( + graph_id=graph_id, + create_graph_schema_request=create_graph_schema_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + '400': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def import_schema_by_id_without_preload_content( + self, + graph_id: StrictStr, + create_graph_schema_request: CreateGraphSchemaRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """import_schema_by_id + + Import graph schema + + :param graph_id: (required) + :type graph_id: str + :param create_graph_schema_request: (required) + :type create_graph_schema_request: CreateGraphSchemaRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._import_schema_by_id_serialize( + graph_id=graph_id, + create_graph_schema_request=create_graph_schema_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "str", + '400': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _import_schema_by_id_serialize( + self, + graph_id, + create_graph_schema_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if graph_id is not None: + _path_params['graph_id'] = graph_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_graph_schema_request is not None: + _body_params = create_graph_schema_request + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/graph/{graph_id}/schema', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1988,7 +2573,7 @@ def list_graphs( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[Graph]: + ) -> List[GetGraphResponse]: """list_graphs List all graphs @@ -2023,7 +2608,8 @@ def list_graphs( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Graph]", + '200': "List[GetGraphResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -2051,7 +2637,7 @@ def list_graphs_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[Graph]]: + ) -> ApiResponse[List[GetGraphResponse]]: """list_graphs List all graphs @@ -2086,7 +2672,8 @@ def list_graphs_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Graph]", + '200': "List[GetGraphResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -2149,7 +2736,8 @@ def list_graphs_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Graph]", + '200': "List[GetGraphResponse]", + '500': "Error", } response_data = self.api_client.call_api( *_param, diff --git a/python/graphscope/flex/rest/api/job_api.py b/python/graphscope/flex/rest/api/job_api.py index 211269140468..a124ab8c98bb 100644 --- a/python/graphscope/flex/rest/api/job_api.py +++ b/python/graphscope/flex/rest/api/job_api.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,8 +18,9 @@ from typing_extensions import Annotated from pydantic import StrictStr +from graphscope.flex.rest.models.create_dataloading_job_response import CreateDataloadingJobResponse +from graphscope.flex.rest.models.dataloading_job_config import DataloadingJobConfig from graphscope.flex.rest.models.job_status import JobStatus -from graphscope.flex.rest.models.schema_mapping import SchemaMapping from graphscope.flex.rest.api_client import ApiClient, RequestSerialized from graphscope.flex.rest.api_response import ApiResponse @@ -40,10 +41,9 @@ def __init__(self, api_client=None) -> None: @validate_call - def create_dataloading_job( + def delete_job_by_id( self, - graph_name: StrictStr, - schema_mapping: SchemaMapping, + job_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -57,13 +57,12 @@ def create_dataloading_job( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """create_dataloading_job + """delete_job_by_id + Delete job by ID - :param graph_name: (required) - :type graph_name: str - :param schema_mapping: (required) - :type schema_mapping: SchemaMapping + :param job_id: (required) + :type job_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -86,9 +85,8 @@ def create_dataloading_job( :return: Returns the result object. """ # noqa: E501 - _param = self._create_dataloading_job_serialize( - graph_name=graph_name, - schema_mapping=schema_mapping, + _param = self._delete_job_by_id_serialize( + job_id=job_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -97,6 +95,7 @@ def create_dataloading_job( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -110,10 +109,9 @@ def create_dataloading_job( @validate_call - def create_dataloading_job_with_http_info( + def delete_job_by_id_with_http_info( self, - graph_name: StrictStr, - schema_mapping: SchemaMapping, + job_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -127,13 +125,12 @@ def create_dataloading_job_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """create_dataloading_job + """delete_job_by_id + Delete job by ID - :param graph_name: (required) - :type graph_name: str - :param schema_mapping: (required) - :type schema_mapping: SchemaMapping + :param job_id: (required) + :type job_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -156,9 +153,8 @@ def create_dataloading_job_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._create_dataloading_job_serialize( - graph_name=graph_name, - schema_mapping=schema_mapping, + _param = self._delete_job_by_id_serialize( + job_id=job_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -167,6 +163,7 @@ def create_dataloading_job_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -180,10 +177,9 @@ def create_dataloading_job_with_http_info( @validate_call - def create_dataloading_job_without_preload_content( + def delete_job_by_id_without_preload_content( self, - graph_name: StrictStr, - schema_mapping: SchemaMapping, + job_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -197,13 +193,12 @@ def create_dataloading_job_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """create_dataloading_job + """delete_job_by_id + Delete job by ID - :param graph_name: (required) - :type graph_name: str - :param schema_mapping: (required) - :type schema_mapping: SchemaMapping + :param job_id: (required) + :type job_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -226,9 +221,8 @@ def create_dataloading_job_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._create_dataloading_job_serialize( - graph_name=graph_name, - schema_mapping=schema_mapping, + _param = self._delete_job_by_id_serialize( + job_id=job_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -237,6 +231,7 @@ def create_dataloading_job_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -245,10 +240,9 @@ def create_dataloading_job_without_preload_content( return response_data.response - def _create_dataloading_job_serialize( + def _delete_job_by_id_serialize( self, - graph_name, - schema_mapping, + job_id, _request_auth, _content_type, _headers, @@ -268,14 +262,12 @@ def _create_dataloading_job_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if job_id is not None: + _path_params['job_id'] = job_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter - if schema_mapping is not None: - _body_params = schema_mapping # set the HTTP header `Accept` @@ -285,27 +277,14 @@ def _create_dataloading_job_serialize( ] ) - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/graph/{graph_name}/dataloading', + method='DELETE', + resource_path='/api/v1/job/{job_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -322,9 +301,9 @@ def _create_dataloading_job_serialize( @validate_call - def delete_job_by_id( + def get_dataloading_job_config( self, - job_id: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -337,12 +316,13 @@ def delete_job_by_id( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """delete_job_by_id + ) -> DataloadingJobConfig: + """get_dataloading_job_config + Get the data loading configuration - :param job_id: (required) - :type job_id: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -365,8 +345,8 @@ def delete_job_by_id( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_job_by_id_serialize( - job_id=job_id, + _param = self._get_dataloading_job_config_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -374,7 +354,8 @@ def delete_job_by_id( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "DataloadingJobConfig", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -388,9 +369,9 @@ def delete_job_by_id( @validate_call - def delete_job_by_id_with_http_info( + def get_dataloading_job_config_with_http_info( self, - job_id: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -403,12 +384,13 @@ def delete_job_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """delete_job_by_id + ) -> ApiResponse[DataloadingJobConfig]: + """get_dataloading_job_config + Get the data loading configuration - :param job_id: (required) - :type job_id: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -431,8 +413,8 @@ def delete_job_by_id_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_job_by_id_serialize( - job_id=job_id, + _param = self._get_dataloading_job_config_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -440,7 +422,8 @@ def delete_job_by_id_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "DataloadingJobConfig", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -454,9 +437,9 @@ def delete_job_by_id_with_http_info( @validate_call - def delete_job_by_id_without_preload_content( + def get_dataloading_job_config_without_preload_content( self, - job_id: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -470,11 +453,12 @@ def delete_job_by_id_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """delete_job_by_id + """get_dataloading_job_config + Get the data loading configuration - :param job_id: (required) - :type job_id: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -497,8 +481,8 @@ def delete_job_by_id_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_job_by_id_serialize( - job_id=job_id, + _param = self._get_dataloading_job_config_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -506,7 +490,8 @@ def delete_job_by_id_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "DataloadingJobConfig", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -515,9 +500,9 @@ def delete_job_by_id_without_preload_content( return response_data.response - def _delete_job_by_id_serialize( + def _get_dataloading_job_config_serialize( self, - job_id, + graph_id, _request_auth, _content_type, _headers, @@ -537,8 +522,8 @@ def _delete_job_by_id_serialize( _body_params: Optional[bytes] = None # process the path parameters - if job_id is not None: - _path_params['job_id'] = job_id + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters @@ -558,8 +543,8 @@ def _delete_job_by_id_serialize( ] return self.api_client.param_serialize( - method='DELETE', - resource_path='/api/v1/job/{job_id}', + method='GET', + resource_path='/api/v1/graph/{graph_id}/dataloading/config', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -576,9 +561,9 @@ def _delete_job_by_id_serialize( @validate_call - def get_dataloading_config( + def get_job_by_id( self, - graph_name: StrictStr, + job_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -591,13 +576,13 @@ def get_dataloading_config( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> SchemaMapping: - """get_dataloading_config + ) -> JobStatus: + """get_job_by_id - get dataloading configuration + Get job status by ID - :param graph_name: (required) - :type graph_name: str + :param job_id: (required) + :type job_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -620,8 +605,8 @@ def get_dataloading_config( :return: Returns the result object. """ # noqa: E501 - _param = self._get_dataloading_config_serialize( - graph_name=graph_name, + _param = self._get_job_by_id_serialize( + job_id=job_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -629,7 +614,8 @@ def get_dataloading_config( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "SchemaMapping", + '200': "JobStatus", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -643,9 +629,9 @@ def get_dataloading_config( @validate_call - def get_dataloading_config_with_http_info( + def get_job_by_id_with_http_info( self, - graph_name: StrictStr, + job_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -658,13 +644,13 @@ def get_dataloading_config_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[SchemaMapping]: - """get_dataloading_config + ) -> ApiResponse[JobStatus]: + """get_job_by_id - get dataloading configuration + Get job status by ID - :param graph_name: (required) - :type graph_name: str + :param job_id: (required) + :type job_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -687,8 +673,8 @@ def get_dataloading_config_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_dataloading_config_serialize( - graph_name=graph_name, + _param = self._get_job_by_id_serialize( + job_id=job_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -696,7 +682,8 @@ def get_dataloading_config_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "SchemaMapping", + '200': "JobStatus", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -710,9 +697,9 @@ def get_dataloading_config_with_http_info( @validate_call - def get_dataloading_config_without_preload_content( + def get_job_by_id_without_preload_content( self, - graph_name: StrictStr, + job_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -726,12 +713,12 @@ def get_dataloading_config_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """get_dataloading_config + """get_job_by_id - get dataloading configuration + Get job status by ID - :param graph_name: (required) - :type graph_name: str + :param job_id: (required) + :type job_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -754,8 +741,8 @@ def get_dataloading_config_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_dataloading_config_serialize( - graph_name=graph_name, + _param = self._get_job_by_id_serialize( + job_id=job_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -763,7 +750,8 @@ def get_dataloading_config_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "SchemaMapping", + '200': "JobStatus", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -772,9 +760,9 @@ def get_dataloading_config_without_preload_content( return response_data.response - def _get_dataloading_config_serialize( + def _get_job_by_id_serialize( self, - graph_name, + job_id, _request_auth, _content_type, _headers, @@ -794,8 +782,8 @@ def _get_dataloading_config_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if job_id is not None: + _path_params['job_id'] = job_id # process the query parameters # process the header parameters # process the form parameters @@ -816,7 +804,7 @@ def _get_dataloading_config_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/graph/{graph_name}/dataloading/config', + resource_path='/api/v1/job/{job_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -833,9 +821,8 @@ def _get_dataloading_config_serialize( @validate_call - def get_job_by_id( + def list_jobs( self, - job_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -848,12 +835,11 @@ def get_job_by_id( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> JobStatus: - """get_job_by_id + ) -> List[JobStatus]: + """list_jobs + List all jobs - :param job_id: (required) - :type job_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -876,8 +862,7 @@ def get_job_by_id( :return: Returns the result object. """ # noqa: E501 - _param = self._get_job_by_id_serialize( - job_id=job_id, + _param = self._list_jobs_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -885,7 +870,8 @@ def get_job_by_id( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "JobStatus", + '200': "List[JobStatus]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -899,9 +885,8 @@ def get_job_by_id( @validate_call - def get_job_by_id_with_http_info( + def list_jobs_with_http_info( self, - job_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -914,12 +899,11 @@ def get_job_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[JobStatus]: - """get_job_by_id + ) -> ApiResponse[List[JobStatus]]: + """list_jobs + List all jobs - :param job_id: (required) - :type job_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -942,8 +926,7 @@ def get_job_by_id_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_job_by_id_serialize( - job_id=job_id, + _param = self._list_jobs_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -951,7 +934,8 @@ def get_job_by_id_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "JobStatus", + '200': "List[JobStatus]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -965,9 +949,8 @@ def get_job_by_id_with_http_info( @validate_call - def get_job_by_id_without_preload_content( + def list_jobs_without_preload_content( self, - job_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -981,11 +964,10 @@ def get_job_by_id_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """get_job_by_id + """list_jobs + List all jobs - :param job_id: (required) - :type job_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1008,8 +990,7 @@ def get_job_by_id_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_job_by_id_serialize( - job_id=job_id, + _param = self._list_jobs_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1017,7 +998,8 @@ def get_job_by_id_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "JobStatus", + '200': "List[JobStatus]", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1026,9 +1008,8 @@ def get_job_by_id_without_preload_content( return response_data.response - def _get_job_by_id_serialize( + def _list_jobs_serialize( self, - job_id, _request_auth, _content_type, _headers, @@ -1048,8 +1029,6 @@ def _get_job_by_id_serialize( _body_params: Optional[bytes] = None # process the path parameters - if job_id is not None: - _path_params['job_id'] = job_id # process the query parameters # process the header parameters # process the form parameters @@ -1070,7 +1049,7 @@ def _get_job_by_id_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/job/{job_id}', + resource_path='/api/v1/job', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1087,8 +1066,10 @@ def _get_job_by_id_serialize( @validate_call - def list_jobs( + def submit_dataloading_job( self, + graph_id: StrictStr, + dataloading_job_config: DataloadingJobConfig, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1101,10 +1082,15 @@ def list_jobs( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[JobStatus]: - """list_jobs + ) -> CreateDataloadingJobResponse: + """submit_dataloading_job + Submit a dataloading job + :param graph_id: (required) + :type graph_id: str + :param dataloading_job_config: (required) + :type dataloading_job_config: DataloadingJobConfig :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1127,7 +1113,9 @@ def list_jobs( :return: Returns the result object. """ # noqa: E501 - _param = self._list_jobs_serialize( + _param = self._submit_dataloading_job_serialize( + graph_id=graph_id, + dataloading_job_config=dataloading_job_config, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1135,7 +1123,9 @@ def list_jobs( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[JobStatus]", + '200': "CreateDataloadingJobResponse", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1149,8 +1139,10 @@ def list_jobs( @validate_call - def list_jobs_with_http_info( + def submit_dataloading_job_with_http_info( self, + graph_id: StrictStr, + dataloading_job_config: DataloadingJobConfig, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1163,10 +1155,15 @@ def list_jobs_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[JobStatus]]: - """list_jobs + ) -> ApiResponse[CreateDataloadingJobResponse]: + """submit_dataloading_job + Submit a dataloading job + :param graph_id: (required) + :type graph_id: str + :param dataloading_job_config: (required) + :type dataloading_job_config: DataloadingJobConfig :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1189,7 +1186,9 @@ def list_jobs_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_jobs_serialize( + _param = self._submit_dataloading_job_serialize( + graph_id=graph_id, + dataloading_job_config=dataloading_job_config, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1197,7 +1196,9 @@ def list_jobs_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[JobStatus]", + '200': "CreateDataloadingJobResponse", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1211,8 +1212,10 @@ def list_jobs_with_http_info( @validate_call - def list_jobs_without_preload_content( + def submit_dataloading_job_without_preload_content( self, + graph_id: StrictStr, + dataloading_job_config: DataloadingJobConfig, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1226,9 +1229,14 @@ def list_jobs_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """list_jobs + """submit_dataloading_job + Submit a dataloading job + :param graph_id: (required) + :type graph_id: str + :param dataloading_job_config: (required) + :type dataloading_job_config: DataloadingJobConfig :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1251,7 +1259,9 @@ def list_jobs_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_jobs_serialize( + _param = self._submit_dataloading_job_serialize( + graph_id=graph_id, + dataloading_job_config=dataloading_job_config, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1259,7 +1269,9 @@ def list_jobs_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[JobStatus]", + '200': "CreateDataloadingJobResponse", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1268,8 +1280,10 @@ def list_jobs_without_preload_content( return response_data.response - def _list_jobs_serialize( + def _submit_dataloading_job_serialize( self, + graph_id, + dataloading_job_config, _request_auth, _content_type, _headers, @@ -1289,10 +1303,14 @@ def _list_jobs_serialize( _body_params: Optional[bytes] = None # process the path parameters + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter + if dataloading_job_config is not None: + _body_params = dataloading_job_config # set the HTTP header `Accept` @@ -1302,14 +1320,27 @@ def _list_jobs_serialize( ] ) + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/job', + method='POST', + resource_path='/api/v1/graph/{graph_id}/dataloading', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/python/graphscope/flex/rest/api/procedure_api.py b/python/graphscope/flex/rest/api/procedure_api.py deleted file mode 100644 index ae8366e39457..000000000000 --- a/python/graphscope/flex/rest/api/procedure_api.py +++ /dev/null @@ -1,1667 +0,0 @@ -# coding: utf-8 - -""" - GraphScope FLEX HTTP SERVICE API - - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - -import warnings -from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Any, Dict, List, Optional, Tuple, Union -from typing_extensions import Annotated - -from pydantic import StrictStr -from typing import Optional -from graphscope.flex.rest.models.procedure import Procedure - -from graphscope.flex.rest.api_client import ApiClient, RequestSerialized -from graphscope.flex.rest.api_response import ApiResponse -from graphscope.flex.rest.rest import RESTResponseType - - -class ProcedureApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - - @validate_call - def create_procedure( - self, - graph_name: StrictStr, - procedure: Procedure, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """create_procedure - - Create a new stored procedure on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param procedure: (required) - :type procedure: Procedure - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._create_procedure_serialize( - graph_name=graph_name, - procedure=procedure, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def create_procedure_with_http_info( - self, - graph_name: StrictStr, - procedure: Procedure, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """create_procedure - - Create a new stored procedure on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param procedure: (required) - :type procedure: Procedure - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._create_procedure_serialize( - graph_name=graph_name, - procedure=procedure, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def create_procedure_without_preload_content( - self, - graph_name: StrictStr, - procedure: Procedure, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """create_procedure - - Create a new stored procedure on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param procedure: (required) - :type procedure: Procedure - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._create_procedure_serialize( - graph_name=graph_name, - procedure=procedure, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _create_procedure_serialize( - self, - graph_name, - procedure, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if procedure is not None: - _body_params = procedure - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/graph/{graph_name}/procedure', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def delete_procedure( - self, - graph_name: StrictStr, - procedure_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """delete_procedure - - Delete a stored procedure on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._delete_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def delete_procedure_with_http_info( - self, - graph_name: StrictStr, - procedure_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """delete_procedure - - Delete a stored procedure on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._delete_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def delete_procedure_without_preload_content( - self, - graph_name: StrictStr, - procedure_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """delete_procedure - - Delete a stored procedure on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._delete_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _delete_procedure_serialize( - self, - graph_name, - procedure_name, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if procedure_name is not None: - _path_params['procedure_name'] = procedure_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='DELETE', - resource_path='/api/v1/graph/{graph_name}/procedure/{procedure_name}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def get_procedure( - self, - graph_name: StrictStr, - procedure_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> Procedure: - """get_procedure - - Get a procedure by name - - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "Procedure", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def get_procedure_with_http_info( - self, - graph_name: StrictStr, - procedure_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Procedure]: - """get_procedure - - Get a procedure by name - - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "Procedure", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def get_procedure_without_preload_content( - self, - graph_name: StrictStr, - procedure_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """get_procedure - - Get a procedure by name - - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._get_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "Procedure", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _get_procedure_serialize( - self, - graph_name, - procedure_name, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if procedure_name is not None: - _path_params['procedure_name'] = procedure_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/graph/{graph_name}/procedure/{procedure_name}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def list_procedures( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[Procedure]: - """list_procedures - - List all the stored procedures - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_procedures_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Procedure]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def list_procedures_with_http_info( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[Procedure]]: - """list_procedures - - List all the stored procedures - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_procedures_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Procedure]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def list_procedures_without_preload_content( - self, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """list_procedures - - List all the stored procedures - - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_procedures_serialize( - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Procedure]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _list_procedures_serialize( - self, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/procedure', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def list_procedures_by_graph( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[Procedure]: - """list_procedures_by_graph - - List stored procedures on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_procedures_by_graph_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Procedure]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def list_procedures_by_graph_with_http_info( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[Procedure]]: - """list_procedures_by_graph - - List stored procedures on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_procedures_by_graph_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Procedure]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def list_procedures_by_graph_without_preload_content( - self, - graph_name: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """list_procedures_by_graph - - List stored procedures on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._list_procedures_by_graph_serialize( - graph_name=graph_name, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Procedure]", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _list_procedures_by_graph_serialize( - self, - graph_name, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/graph/{graph_name}/procedure', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - - @validate_call - def update_procedure( - self, - graph_name: StrictStr, - procedure_name: StrictStr, - procedure: Optional[Procedure] = None, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """update_procedure - - Update stored procedure on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param procedure: - :type procedure: Procedure - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._update_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - procedure=procedure, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def update_procedure_with_http_info( - self, - graph_name: StrictStr, - procedure_name: StrictStr, - procedure: Optional[Procedure] = None, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """update_procedure - - Update stored procedure on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param procedure: - :type procedure: Procedure - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._update_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - procedure=procedure, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def update_procedure_without_preload_content( - self, - graph_name: StrictStr, - procedure_name: StrictStr, - procedure: Optional[Procedure] = None, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """update_procedure - - Update stored procedure on a certain graph - - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param procedure: - :type procedure: Procedure - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._update_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - procedure=procedure, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "str", - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _update_procedure_serialize( - self, - graph_name, - procedure_name, - procedure, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, str] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if procedure_name is not None: - _path_params['procedure_name'] = procedure_name - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if procedure is not None: - _body_params = procedure - - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='PUT', - resource_path='/api/v1/graph/{graph_name}/procedure/{procedure_name}', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - diff --git a/python/graphscope/flex/rest/api/service_api.py b/python/graphscope/flex/rest/api/service_api.py index ad3e66205fe9..391fd274038b 100644 --- a/python/graphscope/flex/rest/api/service_api.py +++ b/python/graphscope/flex/rest/api/service_api.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -17,6 +17,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from pydantic import StrictStr from typing import Optional from graphscope.flex.rest.models.service_status import ServiceStatus from graphscope.flex.rest.models.start_service_request import StartServiceRequest @@ -40,8 +41,9 @@ def __init__(self, api_client=None) -> None: @validate_call - def get_service_status( + def get_service_status_by_id( self, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -55,10 +57,12 @@ def get_service_status( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ServiceStatus: - """get_service_status + """get_service_status_by_id - Get service status + Get service status by graph ID + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -81,7 +85,8 @@ def get_service_status( :return: Returns the result object. """ # noqa: E501 - _param = self._get_service_status_serialize( + _param = self._get_service_status_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -90,6 +95,7 @@ def get_service_status( _response_types_map: Dict[str, Optional[str]] = { '200': "ServiceStatus", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -103,8 +109,9 @@ def get_service_status( @validate_call - def get_service_status_with_http_info( + def get_service_status_by_id_with_http_info( self, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -118,10 +125,12 @@ def get_service_status_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[ServiceStatus]: - """get_service_status + """get_service_status_by_id - Get service status + Get service status by graph ID + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -144,7 +153,8 @@ def get_service_status_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_service_status_serialize( + _param = self._get_service_status_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -153,6 +163,7 @@ def get_service_status_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "ServiceStatus", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -166,8 +177,9 @@ def get_service_status_with_http_info( @validate_call - def get_service_status_without_preload_content( + def get_service_status_by_id_without_preload_content( self, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -181,10 +193,12 @@ def get_service_status_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """get_service_status + """get_service_status_by_id - Get service status + Get service status by graph ID + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -207,7 +221,8 @@ def get_service_status_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_service_status_serialize( + _param = self._get_service_status_by_id_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -216,6 +231,7 @@ def get_service_status_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "ServiceStatus", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -224,8 +240,9 @@ def get_service_status_without_preload_content( return response_data.response - def _get_service_status_serialize( + def _get_service_status_by_id_serialize( self, + graph_id, _request_auth, _content_type, _headers, @@ -245,6 +262,8 @@ def _get_service_status_serialize( _body_params: Optional[bytes] = None # process the path parameters + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters @@ -265,7 +284,252 @@ def _get_service_status_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/service/status', + resource_path='/api/v1/graph/{graph_id}/service', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_service_status( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ServiceStatus]: + """list_service_status + + List all service status + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_service_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ServiceStatus]", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_service_status_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ServiceStatus]]: + """list_service_status + + List all service status + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_service_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ServiceStatus]", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_service_status_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """list_service_status + + List all service status + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_service_status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ServiceStatus]", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_service_status_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/service', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -332,6 +596,7 @@ def restart_service( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -395,6 +660,7 @@ def restart_service_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -458,6 +724,7 @@ def restart_service_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -578,6 +845,8 @@ def start_service( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -645,6 +914,8 @@ def start_service_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -712,6 +983,8 @@ def start_service_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -844,6 +1117,7 @@ def stop_service( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -907,6 +1181,7 @@ def stop_service_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -970,6 +1245,7 @@ def stop_service_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, diff --git a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/procedure_api.py b/python/graphscope/flex/rest/api/stored_procedure_api.py similarity index 78% rename from flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/procedure_api.py rename to python/graphscope/flex/rest/api/stored_procedure_api.py index 0f7a10e006e9..3d2decbb1821 100644 --- a/flex/coordinator/gs_flex_coordinator/core/interactive/hqps_client/api/procedure_api.py +++ b/python/graphscope/flex/rest/api/stored_procedure_api.py @@ -1,41 +1,35 @@ # coding: utf-8 """ - GraphScope Interactive API + GraphScope FLEX HTTP SERVICE API - This is a specification for GraphScope Interactive based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](#) + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. """ # noqa: E501 - -import io import warnings - from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import StrictStr +from typing import Optional +from graphscope.flex.rest.models.create_stored_proc_request import CreateStoredProcRequest +from graphscope.flex.rest.models.create_stored_proc_response import CreateStoredProcResponse +from graphscope.flex.rest.models.get_stored_proc_response import GetStoredProcResponse +from graphscope.flex.rest.models.update_stored_proc_request import UpdateStoredProcRequest -from typing import List, Optional - -from hqps_client.models.procedure import Procedure - -from hqps_client.api_client import ApiClient -from hqps_client.api_response import ApiResponse -from hqps_client.rest import RESTResponseType +from graphscope.flex.rest.api_client import ApiClient, RequestSerialized +from graphscope.flex.rest.api_response import ApiResponse +from graphscope.flex.rest.rest import RESTResponseType -class ProcedureApi: +class StoredProcedureApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech @@ -49,10 +43,10 @@ def __init__(self, api_client=None) -> None: @validate_call - def create_procedure( + def create_stored_procedure( self, - graph_name: StrictStr, - procedure: Procedure, + graph_id: StrictStr, + create_stored_proc_request: CreateStoredProcRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -65,15 +59,15 @@ def create_procedure( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: - """create_procedure + ) -> CreateStoredProcResponse: + """create_stored_procedure - Create a new procedure on a graph + Create a new stored procedure on a certain graph - :param graph_name: (required) - :type graph_name: str - :param procedure: (required) - :type procedure: Procedure + :param graph_id: (required) + :type graph_id: str + :param create_stored_proc_request: (required) + :type create_stored_proc_request: CreateStoredProcRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -96,9 +90,9 @@ def create_procedure( :return: Returns the result object. """ # noqa: E501 - _param = self._create_procedure_serialize( - graph_name=graph_name, - procedure=procedure, + _param = self._create_stored_procedure_serialize( + graph_id=graph_id, + create_stored_proc_request=create_stored_proc_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -106,7 +100,9 @@ def create_procedure( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "CreateStoredProcResponse", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -120,10 +116,10 @@ def create_procedure( @validate_call - def create_procedure_with_http_info( + def create_stored_procedure_with_http_info( self, - graph_name: StrictStr, - procedure: Procedure, + graph_id: StrictStr, + create_stored_proc_request: CreateStoredProcRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -136,15 +132,15 @@ def create_procedure_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: - """create_procedure + ) -> ApiResponse[CreateStoredProcResponse]: + """create_stored_procedure - Create a new procedure on a graph + Create a new stored procedure on a certain graph - :param graph_name: (required) - :type graph_name: str - :param procedure: (required) - :type procedure: Procedure + :param graph_id: (required) + :type graph_id: str + :param create_stored_proc_request: (required) + :type create_stored_proc_request: CreateStoredProcRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -167,9 +163,9 @@ def create_procedure_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._create_procedure_serialize( - graph_name=graph_name, - procedure=procedure, + _param = self._create_stored_procedure_serialize( + graph_id=graph_id, + create_stored_proc_request=create_stored_proc_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -177,7 +173,9 @@ def create_procedure_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "CreateStoredProcResponse", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -191,10 +189,10 @@ def create_procedure_with_http_info( @validate_call - def create_procedure_without_preload_content( + def create_stored_procedure_without_preload_content( self, - graph_name: StrictStr, - procedure: Procedure, + graph_id: StrictStr, + create_stored_proc_request: CreateStoredProcRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -208,14 +206,14 @@ def create_procedure_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """create_procedure + """create_stored_procedure - Create a new procedure on a graph + Create a new stored procedure on a certain graph - :param graph_name: (required) - :type graph_name: str - :param procedure: (required) - :type procedure: Procedure + :param graph_id: (required) + :type graph_id: str + :param create_stored_proc_request: (required) + :type create_stored_proc_request: CreateStoredProcRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -238,9 +236,9 @@ def create_procedure_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._create_procedure_serialize( - graph_name=graph_name, - procedure=procedure, + _param = self._create_stored_procedure_serialize( + graph_id=graph_id, + create_stored_proc_request=create_stored_proc_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -248,7 +246,9 @@ def create_procedure_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "CreateStoredProcResponse", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -257,15 +257,15 @@ def create_procedure_without_preload_content( return response_data.response - def _create_procedure_serialize( + def _create_stored_procedure_serialize( self, - graph_name, - procedure, + graph_id, + create_stored_proc_request, _request_auth, _content_type, _headers, _host_index, - ) -> Tuple: + ) -> RequestSerialized: _host = None @@ -280,14 +280,14 @@ def _create_procedure_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter - if procedure is not None: - _body_params = procedure + if create_stored_proc_request is not None: + _body_params = create_stored_proc_request # set the HTTP header `Accept` @@ -317,7 +317,7 @@ def _create_procedure_serialize( return self.api_client.param_serialize( method='POST', - resource_path='/v1/graph/{graph_name}/procedure', + resource_path='/api/v1/graph/{graph_id}/storedproc', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -334,10 +334,10 @@ def _create_procedure_serialize( @validate_call - def delete_procedure( + def delete_stored_procedure_by_id( self, - graph_name: StrictStr, - procedure_name: StrictStr, + graph_id: StrictStr, + stored_procedure_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -351,14 +351,14 @@ def delete_procedure( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """delete_procedure + """delete_stored_procedure_by_id - Delete a procedure on a graph by name + Delete a stored procedure by ID - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str + :param graph_id: (required) + :type graph_id: str + :param stored_procedure_id: (required) + :type stored_procedure_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -381,9 +381,9 @@ def delete_procedure( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, + _param = self._delete_stored_procedure_by_id_serialize( + graph_id=graph_id, + stored_procedure_id=stored_procedure_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -392,6 +392,7 @@ def delete_procedure( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -405,10 +406,10 @@ def delete_procedure( @validate_call - def delete_procedure_with_http_info( + def delete_stored_procedure_by_id_with_http_info( self, - graph_name: StrictStr, - procedure_name: StrictStr, + graph_id: StrictStr, + stored_procedure_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -422,14 +423,14 @@ def delete_procedure_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """delete_procedure + """delete_stored_procedure_by_id - Delete a procedure on a graph by name + Delete a stored procedure by ID - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str + :param graph_id: (required) + :type graph_id: str + :param stored_procedure_id: (required) + :type stored_procedure_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -452,9 +453,9 @@ def delete_procedure_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, + _param = self._delete_stored_procedure_by_id_serialize( + graph_id=graph_id, + stored_procedure_id=stored_procedure_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -463,6 +464,7 @@ def delete_procedure_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -476,10 +478,10 @@ def delete_procedure_with_http_info( @validate_call - def delete_procedure_without_preload_content( + def delete_stored_procedure_by_id_without_preload_content( self, - graph_name: StrictStr, - procedure_name: StrictStr, + graph_id: StrictStr, + stored_procedure_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -493,14 +495,14 @@ def delete_procedure_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """delete_procedure + """delete_stored_procedure_by_id - Delete a procedure on a graph by name + Delete a stored procedure by ID - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str + :param graph_id: (required) + :type graph_id: str + :param stored_procedure_id: (required) + :type stored_procedure_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -523,9 +525,9 @@ def delete_procedure_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, + _param = self._delete_stored_procedure_by_id_serialize( + graph_id=graph_id, + stored_procedure_id=stored_procedure_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -534,6 +536,7 @@ def delete_procedure_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -542,15 +545,15 @@ def delete_procedure_without_preload_content( return response_data.response - def _delete_procedure_serialize( + def _delete_stored_procedure_by_id_serialize( self, - graph_name, - procedure_name, + graph_id, + stored_procedure_id, _request_auth, _content_type, _headers, _host_index, - ) -> Tuple: + ) -> RequestSerialized: _host = None @@ -565,10 +568,10 @@ def _delete_procedure_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if procedure_name is not None: - _path_params['procedure_name'] = procedure_name + if graph_id is not None: + _path_params['graph_id'] = graph_id + if stored_procedure_id is not None: + _path_params['stored_procedure_id'] = stored_procedure_id # process the query parameters # process the header parameters # process the form parameters @@ -589,7 +592,7 @@ def _delete_procedure_serialize( return self.api_client.param_serialize( method='DELETE', - resource_path='/v1/graph/{graph_name}/procedure/{procedure_name}', + resource_path='/api/v1/graph/{graph_id}/storedproc/{stored_procedure_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -606,10 +609,10 @@ def _delete_procedure_serialize( @validate_call - def get_procedure( + def get_stored_procedure_by_id( self, - graph_name: StrictStr, - procedure_name: StrictStr, + graph_id: StrictStr, + stored_procedure_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -622,15 +625,15 @@ def get_procedure( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> Procedure: - """get_procedure + ) -> GetStoredProcResponse: + """get_stored_procedure_by_id - Get a procedure by name + Get a stored procedure by ID - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str + :param graph_id: (required) + :type graph_id: str + :param stored_procedure_id: (required) + :type stored_procedure_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -653,9 +656,9 @@ def get_procedure( :return: Returns the result object. """ # noqa: E501 - _param = self._get_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, + _param = self._get_stored_procedure_by_id_serialize( + graph_id=graph_id, + stored_procedure_id=stored_procedure_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -663,7 +666,8 @@ def get_procedure( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "Procedure", + '200': "GetStoredProcResponse", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -677,10 +681,10 @@ def get_procedure( @validate_call - def get_procedure_with_http_info( + def get_stored_procedure_by_id_with_http_info( self, - graph_name: StrictStr, - procedure_name: StrictStr, + graph_id: StrictStr, + stored_procedure_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -693,15 +697,15 @@ def get_procedure_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Procedure]: - """get_procedure + ) -> ApiResponse[GetStoredProcResponse]: + """get_stored_procedure_by_id - Get a procedure by name + Get a stored procedure by ID - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str + :param graph_id: (required) + :type graph_id: str + :param stored_procedure_id: (required) + :type stored_procedure_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -724,9 +728,9 @@ def get_procedure_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, + _param = self._get_stored_procedure_by_id_serialize( + graph_id=graph_id, + stored_procedure_id=stored_procedure_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -734,7 +738,8 @@ def get_procedure_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "Procedure", + '200': "GetStoredProcResponse", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -748,10 +753,10 @@ def get_procedure_with_http_info( @validate_call - def get_procedure_without_preload_content( + def get_stored_procedure_by_id_without_preload_content( self, - graph_name: StrictStr, - procedure_name: StrictStr, + graph_id: StrictStr, + stored_procedure_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -765,14 +770,14 @@ def get_procedure_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """get_procedure + """get_stored_procedure_by_id - Get a procedure by name + Get a stored procedure by ID - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str + :param graph_id: (required) + :type graph_id: str + :param stored_procedure_id: (required) + :type stored_procedure_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -795,9 +800,9 @@ def get_procedure_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, + _param = self._get_stored_procedure_by_id_serialize( + graph_id=graph_id, + stored_procedure_id=stored_procedure_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -805,7 +810,8 @@ def get_procedure_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "Procedure", + '200': "GetStoredProcResponse", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -814,15 +820,15 @@ def get_procedure_without_preload_content( return response_data.response - def _get_procedure_serialize( + def _get_stored_procedure_by_id_serialize( self, - graph_name, - procedure_name, + graph_id, + stored_procedure_id, _request_auth, _content_type, _headers, _host_index, - ) -> Tuple: + ) -> RequestSerialized: _host = None @@ -837,10 +843,10 @@ def _get_procedure_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if procedure_name is not None: - _path_params['procedure_name'] = procedure_name + if graph_id is not None: + _path_params['graph_id'] = graph_id + if stored_procedure_id is not None: + _path_params['stored_procedure_id'] = stored_procedure_id # process the query parameters # process the header parameters # process the form parameters @@ -861,7 +867,7 @@ def _get_procedure_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/v1/graph/{graph_name}/procedure/{procedure_name}', + resource_path='/api/v1/graph/{graph_id}/storedproc/{stored_procedure_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -878,9 +884,9 @@ def _get_procedure_serialize( @validate_call - def list_procedures( + def list_stored_procedures( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -893,13 +899,13 @@ def list_procedures( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> List[Procedure]: - """list_procedures + ) -> List[GetStoredProcResponse]: + """list_stored_procedures - List all procedures + List all stored procedures on a certain graph - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -922,8 +928,8 @@ def list_procedures( :return: Returns the result object. """ # noqa: E501 - _param = self._list_procedures_serialize( - graph_name=graph_name, + _param = self._list_stored_procedures_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -931,7 +937,9 @@ def list_procedures( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Procedure]", + '200': "List[GetStoredProcResponse]", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -945,9 +953,9 @@ def list_procedures( @validate_call - def list_procedures_with_http_info( + def list_stored_procedures_with_http_info( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -960,13 +968,13 @@ def list_procedures_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[Procedure]]: - """list_procedures + ) -> ApiResponse[List[GetStoredProcResponse]]: + """list_stored_procedures - List all procedures + List all stored procedures on a certain graph - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -989,8 +997,8 @@ def list_procedures_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_procedures_serialize( - graph_name=graph_name, + _param = self._list_stored_procedures_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -998,7 +1006,9 @@ def list_procedures_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Procedure]", + '200': "List[GetStoredProcResponse]", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1012,9 +1022,9 @@ def list_procedures_with_http_info( @validate_call - def list_procedures_without_preload_content( + def list_stored_procedures_without_preload_content( self, - graph_name: StrictStr, + graph_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1028,12 +1038,12 @@ def list_procedures_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """list_procedures + """list_stored_procedures - List all procedures + List all stored procedures on a certain graph - :param graph_name: (required) - :type graph_name: str + :param graph_id: (required) + :type graph_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1056,8 +1066,8 @@ def list_procedures_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_procedures_serialize( - graph_name=graph_name, + _param = self._list_stored_procedures_serialize( + graph_id=graph_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1065,7 +1075,9 @@ def list_procedures_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "List[Procedure]", + '200': "List[GetStoredProcResponse]", + '400': "Error", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1074,14 +1086,14 @@ def list_procedures_without_preload_content( return response_data.response - def _list_procedures_serialize( + def _list_stored_procedures_serialize( self, - graph_name, + graph_id, _request_auth, _content_type, _headers, _host_index, - ) -> Tuple: + ) -> RequestSerialized: _host = None @@ -1096,8 +1108,8 @@ def _list_procedures_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name + if graph_id is not None: + _path_params['graph_id'] = graph_id # process the query parameters # process the header parameters # process the form parameters @@ -1118,7 +1130,7 @@ def _list_procedures_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/v1/graph/{graph_name}/procedure', + resource_path='/api/v1/graph/{graph_id}/storedproc', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1135,11 +1147,11 @@ def _list_procedures_serialize( @validate_call - def update_procedure( + def update_stored_procedure_by_id( self, - graph_name: StrictStr, - procedure_name: StrictStr, - procedure: Optional[Procedure] = None, + graph_id: StrictStr, + stored_procedure_id: StrictStr, + update_stored_proc_request: Optional[UpdateStoredProcRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1153,16 +1165,16 @@ def update_procedure( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> str: - """update_procedure + """update_stored_procedure_by_id - Update procedure on a graph by name + Update a stored procedure by ID - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param procedure: - :type procedure: Procedure + :param graph_id: (required) + :type graph_id: str + :param stored_procedure_id: (required) + :type stored_procedure_id: str + :param update_stored_proc_request: + :type update_stored_proc_request: UpdateStoredProcRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1185,10 +1197,10 @@ def update_procedure( :return: Returns the result object. """ # noqa: E501 - _param = self._update_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - procedure=procedure, + _param = self._update_stored_procedure_by_id_serialize( + graph_id=graph_id, + stored_procedure_id=stored_procedure_id, + update_stored_proc_request=update_stored_proc_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1197,6 +1209,7 @@ def update_procedure( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1210,11 +1223,11 @@ def update_procedure( @validate_call - def update_procedure_with_http_info( + def update_stored_procedure_by_id_with_http_info( self, - graph_name: StrictStr, - procedure_name: StrictStr, - procedure: Optional[Procedure] = None, + graph_id: StrictStr, + stored_procedure_id: StrictStr, + update_stored_proc_request: Optional[UpdateStoredProcRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1228,16 +1241,16 @@ def update_procedure_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[str]: - """update_procedure + """update_stored_procedure_by_id - Update procedure on a graph by name + Update a stored procedure by ID - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param procedure: - :type procedure: Procedure + :param graph_id: (required) + :type graph_id: str + :param stored_procedure_id: (required) + :type stored_procedure_id: str + :param update_stored_proc_request: + :type update_stored_proc_request: UpdateStoredProcRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1260,10 +1273,10 @@ def update_procedure_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._update_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - procedure=procedure, + _param = self._update_stored_procedure_by_id_serialize( + graph_id=graph_id, + stored_procedure_id=stored_procedure_id, + update_stored_proc_request=update_stored_proc_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1272,6 +1285,7 @@ def update_procedure_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1285,11 +1299,11 @@ def update_procedure_with_http_info( @validate_call - def update_procedure_without_preload_content( + def update_stored_procedure_by_id_without_preload_content( self, - graph_name: StrictStr, - procedure_name: StrictStr, - procedure: Optional[Procedure] = None, + graph_id: StrictStr, + stored_procedure_id: StrictStr, + update_stored_proc_request: Optional[UpdateStoredProcRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1303,16 +1317,16 @@ def update_procedure_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """update_procedure + """update_stored_procedure_by_id - Update procedure on a graph by name + Update a stored procedure by ID - :param graph_name: (required) - :type graph_name: str - :param procedure_name: (required) - :type procedure_name: str - :param procedure: - :type procedure: Procedure + :param graph_id: (required) + :type graph_id: str + :param stored_procedure_id: (required) + :type stored_procedure_id: str + :param update_stored_proc_request: + :type update_stored_proc_request: UpdateStoredProcRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1335,10 +1349,10 @@ def update_procedure_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_procedure_serialize( - graph_name=graph_name, - procedure_name=procedure_name, - procedure=procedure, + _param = self._update_stored_procedure_by_id_serialize( + graph_id=graph_id, + stored_procedure_id=stored_procedure_id, + update_stored_proc_request=update_stored_proc_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1347,6 +1361,7 @@ def update_procedure_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "str", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -1355,16 +1370,16 @@ def update_procedure_without_preload_content( return response_data.response - def _update_procedure_serialize( + def _update_stored_procedure_by_id_serialize( self, - graph_name, - procedure_name, - procedure, + graph_id, + stored_procedure_id, + update_stored_proc_request, _request_auth, _content_type, _headers, _host_index, - ) -> Tuple: + ) -> RequestSerialized: _host = None @@ -1379,16 +1394,16 @@ def _update_procedure_serialize( _body_params: Optional[bytes] = None # process the path parameters - if graph_name is not None: - _path_params['graph_name'] = graph_name - if procedure_name is not None: - _path_params['procedure_name'] = procedure_name + if graph_id is not None: + _path_params['graph_id'] = graph_id + if stored_procedure_id is not None: + _path_params['stored_procedure_id'] = stored_procedure_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter - if procedure is not None: - _body_params = procedure + if update_stored_proc_request is not None: + _body_params = update_stored_proc_request # set the HTTP header `Accept` @@ -1418,7 +1433,7 @@ def _update_procedure_serialize( return self.api_client.param_serialize( method='PUT', - resource_path='/v1/graph/{graph_name}/procedure/{procedure_name}', + resource_path='/api/v1/graph/{graph_id}/storedproc/{stored_procedure_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/python/graphscope/flex/rest/api/utils_api.py b/python/graphscope/flex/rest/api/utils_api.py index f8b936fe09b8..a6bccd89ee85 100644 --- a/python/graphscope/flex/rest/api/utils_api.py +++ b/python/graphscope/flex/rest/api/utils_api.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,6 +19,7 @@ from pydantic import StrictBytes, StrictStr from typing import Optional, Union +from graphscope.flex.rest.models.upload_file_response import UploadFileResponse from graphscope.flex.rest.api_client import ApiClient, RequestSerialized from graphscope.flex.rest.api_response import ApiResponse @@ -54,7 +55,7 @@ def upload_file( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> str: + ) -> UploadFileResponse: """upload_file @@ -91,7 +92,8 @@ def upload_file( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "UploadFileResponse", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -120,7 +122,7 @@ def upload_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> ApiResponse[UploadFileResponse]: """upload_file @@ -157,7 +159,8 @@ def upload_file_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "UploadFileResponse", + '500': "Error", } response_data = self.api_client.call_api( *_param, @@ -223,7 +226,8 @@ def upload_file_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "str", + '200': "UploadFileResponse", + '500': "Error", } response_data = self.api_client.call_api( *_param, diff --git a/python/graphscope/flex/rest/api_client.py b/python/graphscope/flex/rest/api_client.py index 48481fcb6366..005ffc21b993 100644 --- a/python/graphscope/flex/rest/api_client.py +++ b/python/graphscope/flex/rest/api_client.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/python/graphscope/flex/rest/configuration.py b/python/graphscope/flex/rest/configuration.py index 110cf31214c7..a49843aeb7c7 100644 --- a/python/graphscope/flex/rest/configuration.py +++ b/python/graphscope/flex/rest/configuration.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -370,7 +370,7 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 0.9.1\n"\ + "Version of the API: 1.0.0\n"\ "SDK Package Version: 1.0.0".\ format(env=sys.platform, pyversion=sys.version) diff --git a/python/graphscope/flex/rest/exceptions.py b/python/graphscope/flex/rest/exceptions.py index 8a1582bd9395..c2b39a21c846 100644 --- a/python/graphscope/flex/rest/exceptions.py +++ b/python/graphscope/flex/rest/exceptions.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/python/graphscope/flex/rest/models/__init__.py b/python/graphscope/flex/rest/models/__init__.py index ec359f781ce1..30275356d1b8 100644 --- a/python/graphscope/flex/rest/models/__init__.py +++ b/python/graphscope/flex/rest/models/__init__.py @@ -6,7 +6,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -15,51 +15,59 @@ # import models into model package -from graphscope.flex.rest.models.alert_message import AlertMessage -from graphscope.flex.rest.models.alert_receiver import AlertReceiver -from graphscope.flex.rest.models.alert_rule import AlertRule +from graphscope.flex.rest.models.base_edge_type import BaseEdgeType +from graphscope.flex.rest.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner +from graphscope.flex.rest.models.base_edge_type_vertex_type_pair_relations_inner_x_csr_params import BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams +from graphscope.flex.rest.models.base_property_meta import BasePropertyMeta +from graphscope.flex.rest.models.base_vertex_type import BaseVertexType +from graphscope.flex.rest.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams from graphscope.flex.rest.models.column_mapping import ColumnMapping -from graphscope.flex.rest.models.connection import Connection -from graphscope.flex.rest.models.connection_status import ConnectionStatus -from graphscope.flex.rest.models.data_source import DataSource -from graphscope.flex.rest.models.deployment_info import DeploymentInfo -from graphscope.flex.rest.models.deployment_info_graphs_info_value import DeploymentInfoGraphsInfoValue -from graphscope.flex.rest.models.deployment_status import DeploymentStatus -from graphscope.flex.rest.models.edge_data_source import EdgeDataSource +from graphscope.flex.rest.models.column_mapping_column import ColumnMappingColumn +from graphscope.flex.rest.models.create_alert_receiver_request import CreateAlertReceiverRequest +from graphscope.flex.rest.models.create_alert_rule_request import CreateAlertRuleRequest +from graphscope.flex.rest.models.create_dataloading_job_response import CreateDataloadingJobResponse +from graphscope.flex.rest.models.create_edge_type import CreateEdgeType +from graphscope.flex.rest.models.create_graph_request import CreateGraphRequest +from graphscope.flex.rest.models.create_graph_response import CreateGraphResponse +from graphscope.flex.rest.models.create_graph_schema_request import CreateGraphSchemaRequest +from graphscope.flex.rest.models.create_property_meta import CreatePropertyMeta +from graphscope.flex.rest.models.create_stored_proc_request import CreateStoredProcRequest +from graphscope.flex.rest.models.create_stored_proc_response import CreateStoredProcResponse +from graphscope.flex.rest.models.create_vertex_type import CreateVertexType +from graphscope.flex.rest.models.dataloading_job_config import DataloadingJobConfig +from graphscope.flex.rest.models.dataloading_job_config_edges_inner import DataloadingJobConfigEdgesInner +from graphscope.flex.rest.models.dataloading_job_config_loading_config import DataloadingJobConfigLoadingConfig +from graphscope.flex.rest.models.dataloading_job_config_loading_config_format import DataloadingJobConfigLoadingConfigFormat +from graphscope.flex.rest.models.dataloading_job_config_vertices_inner import DataloadingJobConfigVerticesInner from graphscope.flex.rest.models.edge_mapping import EdgeMapping -from graphscope.flex.rest.models.edge_mapping_destination_vertex_mappings_inner import EdgeMappingDestinationVertexMappingsInner -from graphscope.flex.rest.models.edge_mapping_source_vertex_mappings_inner import EdgeMappingSourceVertexMappingsInner -from graphscope.flex.rest.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn from graphscope.flex.rest.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet -from graphscope.flex.rest.models.edge_type import EdgeType -from graphscope.flex.rest.models.edge_type_vertex_type_pair_relations_inner import EdgeTypeVertexTypePairRelationsInner -from graphscope.flex.rest.models.edge_type_vertex_type_pair_relations_inner_x_csr_params import EdgeTypeVertexTypePairRelationsInnerXCsrParams -from graphscope.flex.rest.models.graph import Graph -from graphscope.flex.rest.models.graph_stored_procedures import GraphStoredProcedures -from graphscope.flex.rest.models.groot_dataloading_job_config import GrootDataloadingJobConfig -from graphscope.flex.rest.models.groot_dataloading_job_config_edges_inner import GrootDataloadingJobConfigEdgesInner -from graphscope.flex.rest.models.groot_edge_type import GrootEdgeType -from graphscope.flex.rest.models.groot_edge_type_relations_inner import GrootEdgeTypeRelationsInner -from graphscope.flex.rest.models.groot_graph import GrootGraph -from graphscope.flex.rest.models.groot_graph_gremlin_interface import GrootGraphGremlinInterface -from graphscope.flex.rest.models.groot_property import GrootProperty -from graphscope.flex.rest.models.groot_schema import GrootSchema -from graphscope.flex.rest.models.groot_vertex_type import GrootVertexType +from graphscope.flex.rest.models.error import Error +from graphscope.flex.rest.models.gs_data_type import GSDataType +from graphscope.flex.rest.models.get_alert_message_response import GetAlertMessageResponse +from graphscope.flex.rest.models.get_alert_receiver_response import GetAlertReceiverResponse +from graphscope.flex.rest.models.get_alert_rule_response import GetAlertRuleResponse +from graphscope.flex.rest.models.get_edge_type import GetEdgeType +from graphscope.flex.rest.models.get_graph_response import GetGraphResponse +from graphscope.flex.rest.models.get_graph_schema_response import GetGraphSchemaResponse +from graphscope.flex.rest.models.get_property_meta import GetPropertyMeta +from graphscope.flex.rest.models.get_stored_proc_response import GetStoredProcResponse +from graphscope.flex.rest.models.get_vertex_type import GetVertexType from graphscope.flex.rest.models.job_status import JobStatus -from graphscope.flex.rest.models.model_property import ModelProperty -from graphscope.flex.rest.models.model_schema import ModelSchema +from graphscope.flex.rest.models.long_text import LongText from graphscope.flex.rest.models.node_status import NodeStatus -from graphscope.flex.rest.models.procedure import Procedure -from graphscope.flex.rest.models.procedure_params_inner import ProcedureParamsInner -from graphscope.flex.rest.models.property_property_type import PropertyPropertyType +from graphscope.flex.rest.models.parameter import Parameter +from graphscope.flex.rest.models.primitive_type import PrimitiveType +from graphscope.flex.rest.models.running_deployment_info import RunningDeploymentInfo +from graphscope.flex.rest.models.running_deployment_status import RunningDeploymentStatus +from graphscope.flex.rest.models.running_deployment_status_nodes_inner import RunningDeploymentStatusNodesInner from graphscope.flex.rest.models.schema_mapping import SchemaMapping -from graphscope.flex.rest.models.schema_mapping_loading_config import SchemaMappingLoadingConfig -from graphscope.flex.rest.models.schema_mapping_loading_config_data_source import SchemaMappingLoadingConfigDataSource -from graphscope.flex.rest.models.schema_mapping_loading_config_format import SchemaMappingLoadingConfigFormat from graphscope.flex.rest.models.service_status import ServiceStatus from graphscope.flex.rest.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints from graphscope.flex.rest.models.start_service_request import StartServiceRequest -from graphscope.flex.rest.models.update_alert_messages_request import UpdateAlertMessagesRequest -from graphscope.flex.rest.models.vertex_data_source import VertexDataSource +from graphscope.flex.rest.models.stored_procedure_meta import StoredProcedureMeta +from graphscope.flex.rest.models.string_type import StringType +from graphscope.flex.rest.models.string_type_string import StringTypeString +from graphscope.flex.rest.models.update_alert_message_status_request import UpdateAlertMessageStatusRequest +from graphscope.flex.rest.models.update_stored_proc_request import UpdateStoredProcRequest +from graphscope.flex.rest.models.upload_file_response import UploadFileResponse from graphscope.flex.rest.models.vertex_mapping import VertexMapping -from graphscope.flex.rest.models.vertex_type import VertexType diff --git a/python/graphscope/flex/rest/models/vertex_type.py b/python/graphscope/flex/rest/models/base_edge_type.py similarity index 70% rename from python/graphscope/flex/rest/models/vertex_type.py rename to python/graphscope/flex/rest/models/base_edge_type.py index f5dbfb4e1a7e..93e9b1bb75d5 100644 --- a/python/graphscope/flex/rest/models/vertex_type.py +++ b/python/graphscope/flex/rest/models/base_edge_type.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,21 +18,21 @@ import re # noqa: F401 import json -from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import BaseModel, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.model_property import ModelProperty +from graphscope.flex.rest.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner from typing import Optional, Set from typing_extensions import Self -class VertexType(BaseModel): +class BaseEdgeType(BaseModel): """ - VertexType + BaseEdgeType """ # noqa: E501 - type_id: Optional[StrictInt] = None - type_name: Optional[StrictStr] = None - properties: Optional[List[ModelProperty]] = None + type_name: StrictStr + vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner] + directed: Optional[StrictBool] = None primary_keys: Optional[List[StrictStr]] = None - __properties: ClassVar[List[str]] = ["type_id", "type_name", "properties", "primary_keys"] + __properties: ClassVar[List[str]] = ["type_name", "vertex_type_pair_relations", "directed", "primary_keys"] model_config = { "populate_by_name": True, @@ -52,7 +52,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of VertexType from a JSON string""" + """Create an instance of BaseEdgeType from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,18 +73,18 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in properties (list) + # override the default output from pydantic by calling `to_dict()` of each item in vertex_type_pair_relations (list) _items = [] - if self.properties: - for _item in self.properties: + if self.vertex_type_pair_relations: + for _item in self.vertex_type_pair_relations: if _item: _items.append(_item.to_dict()) - _dict['properties'] = _items + _dict['vertex_type_pair_relations'] = _items return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of VertexType from a dict""" + """Create an instance of BaseEdgeType from a dict""" if obj is None: return None @@ -92,9 +92,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "type_id": obj.get("type_id"), "type_name": obj.get("type_name"), - "properties": [ModelProperty.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None, + "vertex_type_pair_relations": [BaseEdgeTypeVertexTypePairRelationsInner.from_dict(_item) for _item in obj["vertex_type_pair_relations"]] if obj.get("vertex_type_pair_relations") is not None else None, + "directed": obj.get("directed"), "primary_keys": obj.get("primary_keys") }) return _obj diff --git a/python/graphscope/flex/rest/models/edge_type_vertex_type_pair_relations_inner.py b/python/graphscope/flex/rest/models/base_edge_type_vertex_type_pair_relations_inner.py similarity index 78% rename from python/graphscope/flex/rest/models/edge_type_vertex_type_pair_relations_inner.py rename to python/graphscope/flex/rest/models/base_edge_type_vertex_type_pair_relations_inner.py index b667f8faa10e..93d1a9e5d50b 100644 --- a/python/graphscope/flex/rest/models/edge_type_vertex_type_pair_relations_inner.py +++ b/python/graphscope/flex/rest/models/base_edge_type_vertex_type_pair_relations_inner.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -20,26 +20,23 @@ from pydantic import BaseModel, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.edge_type_vertex_type_pair_relations_inner_x_csr_params import EdgeTypeVertexTypePairRelationsInnerXCsrParams +from graphscope.flex.rest.models.base_edge_type_vertex_type_pair_relations_inner_x_csr_params import BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams from typing import Optional, Set from typing_extensions import Self -class EdgeTypeVertexTypePairRelationsInner(BaseModel): +class BaseEdgeTypeVertexTypePairRelationsInner(BaseModel): """ - EdgeTypeVertexTypePairRelationsInner + BaseEdgeTypeVertexTypePairRelationsInner """ # noqa: E501 - source_vertex: Optional[StrictStr] = None - destination_vertex: Optional[StrictStr] = None - relation: Optional[StrictStr] = None - x_csr_params: Optional[EdgeTypeVertexTypePairRelationsInnerXCsrParams] = None + source_vertex: StrictStr + destination_vertex: StrictStr + relation: StrictStr + x_csr_params: Optional[BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams] = None __properties: ClassVar[List[str]] = ["source_vertex", "destination_vertex", "relation", "x_csr_params"] @field_validator('relation') def relation_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['MANY_TO_MANY', 'ONE_TO_MANY', 'MANY_TO_ONE', 'ONE_TO_ONE']): raise ValueError("must be one of enum values ('MANY_TO_MANY', 'ONE_TO_MANY', 'MANY_TO_ONE', 'ONE_TO_ONE')") return value @@ -62,7 +59,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EdgeTypeVertexTypePairRelationsInner from a JSON string""" + """Create an instance of BaseEdgeTypeVertexTypePairRelationsInner from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -90,7 +87,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EdgeTypeVertexTypePairRelationsInner from a dict""" + """Create an instance of BaseEdgeTypeVertexTypePairRelationsInner from a dict""" if obj is None: return None @@ -101,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "source_vertex": obj.get("source_vertex"), "destination_vertex": obj.get("destination_vertex"), "relation": obj.get("relation"), - "x_csr_params": EdgeTypeVertexTypePairRelationsInnerXCsrParams.from_dict(obj["x_csr_params"]) if obj.get("x_csr_params") is not None else None + "x_csr_params": BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams.from_dict(obj["x_csr_params"]) if obj.get("x_csr_params") is not None else None }) return _obj diff --git a/python/graphscope/flex/rest/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py b/python/graphscope/flex/rest/models/base_edge_type_vertex_type_pair_relations_inner_x_csr_params.py similarity index 90% rename from python/graphscope/flex/rest/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py rename to python/graphscope/flex/rest/models/base_edge_type_vertex_type_pair_relations_inner_x_csr_params.py index 2aa9c37a1568..9c95c2700a57 100644 --- a/python/graphscope/flex/rest/models/edge_type_vertex_type_pair_relations_inner_x_csr_params.py +++ b/python/graphscope/flex/rest/models/base_edge_type_vertex_type_pair_relations_inner_x_csr_params.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -23,7 +23,7 @@ from typing import Optional, Set from typing_extensions import Self -class EdgeTypeVertexTypePairRelationsInnerXCsrParams(BaseModel): +class BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams(BaseModel): """ Used for storage optimization """ # noqa: E501 @@ -58,7 +58,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EdgeTypeVertexTypePairRelationsInnerXCsrParams from a JSON string""" + """Create an instance of BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -83,7 +83,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EdgeTypeVertexTypePairRelationsInnerXCsrParams from a dict""" + """Create an instance of BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams from a dict""" if obj is None: return None diff --git a/python/graphscope/flex/rest/models/edge_mapping_destination_vertex_mappings_inner.py b/python/graphscope/flex/rest/models/base_property_meta.py similarity index 65% rename from python/graphscope/flex/rest/models/edge_mapping_destination_vertex_mappings_inner.py rename to python/graphscope/flex/rest/models/base_property_meta.py index d512f31ea980..7d8c53985255 100644 --- a/python/graphscope/flex/rest/models/edge_mapping_destination_vertex_mappings_inner.py +++ b/python/graphscope/flex/rest/models/base_property_meta.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,18 +18,22 @@ import re # noqa: F401 import json -from pydantic import BaseModel +from pydantic import BaseModel, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn +from graphscope.flex.rest.models.gs_data_type import GSDataType from typing import Optional, Set from typing_extensions import Self -class EdgeMappingDestinationVertexMappingsInner(BaseModel): +class BasePropertyMeta(BaseModel): """ - Mapping column index to the primary key of destination vertex + BasePropertyMeta """ # noqa: E501 - column: Optional[EdgeMappingSourceVertexMappingsInnerColumn] = None - __properties: ClassVar[List[str]] = ["column"] + property_name: StrictStr + property_type: GSDataType + nullable: Optional[StrictBool] = None + default_value: Optional[Any] = None + description: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["property_name", "property_type", "nullable", "default_value", "description"] model_config = { "populate_by_name": True, @@ -49,7 +53,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EdgeMappingDestinationVertexMappingsInner from a JSON string""" + """Create an instance of BasePropertyMeta from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -70,14 +74,19 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of column - if self.column: - _dict['column'] = self.column.to_dict() + # override the default output from pydantic by calling `to_dict()` of property_type + if self.property_type: + _dict['property_type'] = self.property_type.to_dict() + # set to None if default_value (nullable) is None + # and model_fields_set contains the field + if self.default_value is None and "default_value" in self.model_fields_set: + _dict['default_value'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EdgeMappingDestinationVertexMappingsInner from a dict""" + """Create an instance of BasePropertyMeta from a dict""" if obj is None: return None @@ -85,7 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "column": EdgeMappingSourceVertexMappingsInnerColumn.from_dict(obj["column"]) if obj.get("column") is not None else None + "property_name": obj.get("property_name"), + "property_type": GSDataType.from_dict(obj["property_type"]) if obj.get("property_type") is not None else None, + "nullable": obj.get("nullable"), + "default_value": obj.get("default_value"), + "description": obj.get("description") }) return _obj diff --git a/python/graphscope/flex/rest/models/groot_vertex_type.py b/python/graphscope/flex/rest/models/base_vertex_type.py similarity index 74% rename from python/graphscope/flex/rest/models/groot_vertex_type.py rename to python/graphscope/flex/rest/models/base_vertex_type.py index 230ce50707eb..2cd893cb24aa 100644 --- a/python/graphscope/flex/rest/models/groot_vertex_type.py +++ b/python/graphscope/flex/rest/models/base_vertex_type.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -20,17 +20,18 @@ from pydantic import BaseModel, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.groot_property import GrootProperty +from graphscope.flex.rest.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams from typing import Optional, Set from typing_extensions import Self -class GrootVertexType(BaseModel): +class BaseVertexType(BaseModel): """ - GrootVertexType + BaseVertexType """ # noqa: E501 - label: Optional[StrictStr] = None - properties: Optional[List[GrootProperty]] = None - __properties: ClassVar[List[str]] = ["label", "properties"] + type_name: StrictStr + primary_keys: List[StrictStr] + x_csr_params: Optional[BaseVertexTypeXCsrParams] = None + __properties: ClassVar[List[str]] = ["type_name", "primary_keys", "x_csr_params"] model_config = { "populate_by_name": True, @@ -50,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GrootVertexType from a JSON string""" + """Create an instance of BaseVertexType from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -71,18 +72,14 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in properties (list) - _items = [] - if self.properties: - for _item in self.properties: - if _item: - _items.append(_item.to_dict()) - _dict['properties'] = _items + # override the default output from pydantic by calling `to_dict()` of x_csr_params + if self.x_csr_params: + _dict['x_csr_params'] = self.x_csr_params.to_dict() return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GrootVertexType from a dict""" + """Create an instance of BaseVertexType from a dict""" if obj is None: return None @@ -90,8 +87,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "label": obj.get("label"), - "properties": [GrootProperty.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None + "type_name": obj.get("type_name"), + "primary_keys": obj.get("primary_keys"), + "x_csr_params": BaseVertexTypeXCsrParams.from_dict(obj["x_csr_params"]) if obj.get("x_csr_params") is not None else None }) return _obj diff --git a/python/graphscope/flex/rest/models/procedure_params_inner.py b/python/graphscope/flex/rest/models/base_vertex_type_x_csr_params.py similarity index 82% rename from python/graphscope/flex/rest/models/procedure_params_inner.py rename to python/graphscope/flex/rest/models/base_vertex_type_x_csr_params.py index 4559b124c271..df95a1512052 100644 --- a/python/graphscope/flex/rest/models/procedure_params_inner.py +++ b/python/graphscope/flex/rest/models/base_vertex_type_x_csr_params.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,18 +18,17 @@ import re # noqa: F401 import json -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, StrictInt from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self -class ProcedureParamsInner(BaseModel): +class BaseVertexTypeXCsrParams(BaseModel): """ - ProcedureParamsInner + Used for storage optimization """ # noqa: E501 - name: Optional[StrictStr] = None - type: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["name", "type"] + max_vertex_num: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["max_vertex_num"] model_config = { "populate_by_name": True, @@ -49,7 +48,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ProcedureParamsInner from a JSON string""" + """Create an instance of BaseVertexTypeXCsrParams from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -74,7 +73,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ProcedureParamsInner from a dict""" + """Create an instance of BaseVertexTypeXCsrParams from a dict""" if obj is None: return None @@ -82,8 +81,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "name": obj.get("name"), - "type": obj.get("type") + "max_vertex_num": obj.get("max_vertex_num") }) return _obj diff --git a/python/graphscope/flex/rest/models/column_mapping.py b/python/graphscope/flex/rest/models/column_mapping.py index 13535a072bcc..9101d053a72a 100644 --- a/python/graphscope/flex/rest/models/column_mapping.py +++ b/python/graphscope/flex/rest/models/column_mapping.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,8 +19,8 @@ import json from pydantic import BaseModel, Field, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn +from typing import Any, ClassVar, Dict, List +from graphscope.flex.rest.models.column_mapping_column import ColumnMappingColumn from typing import Optional, Set from typing_extensions import Self @@ -28,8 +28,8 @@ class ColumnMapping(BaseModel): """ ColumnMapping """ # noqa: E501 - column: Optional[EdgeMappingSourceVertexMappingsInnerColumn] = None - var_property: Optional[StrictStr] = Field(default=None, description="must align with the schema", alias="property") + column: ColumnMappingColumn + var_property: StrictStr = Field(description="must align with the schema", alias="property") __properties: ClassVar[List[str]] = ["column", "property"] model_config = { @@ -86,7 +86,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "column": EdgeMappingSourceVertexMappingsInnerColumn.from_dict(obj["column"]) if obj.get("column") is not None else None, + "column": ColumnMappingColumn.from_dict(obj["column"]) if obj.get("column") is not None else None, "property": obj.get("property") }) return _obj diff --git a/python/graphscope/flex/rest/models/edge_mapping_source_vertex_mappings_inner_column.py b/python/graphscope/flex/rest/models/column_mapping_column.py similarity index 88% rename from python/graphscope/flex/rest/models/edge_mapping_source_vertex_mappings_inner_column.py rename to python/graphscope/flex/rest/models/column_mapping_column.py index 7165366b2006..5e44ab40785a 100644 --- a/python/graphscope/flex/rest/models/edge_mapping_source_vertex_mappings_inner_column.py +++ b/python/graphscope/flex/rest/models/column_mapping_column.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class EdgeMappingSourceVertexMappingsInnerColumn(BaseModel): +class ColumnMappingColumn(BaseModel): """ - EdgeMappingSourceVertexMappingsInnerColumn + ColumnMappingColumn """ # noqa: E501 index: Optional[StrictInt] = None name: Optional[StrictStr] = None @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EdgeMappingSourceVertexMappingsInnerColumn from a JSON string""" + """Create an instance of ColumnMappingColumn from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -74,7 +74,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EdgeMappingSourceVertexMappingsInnerColumn from a dict""" + """Create an instance of ColumnMappingColumn from a dict""" if obj is None: return None diff --git a/python/graphscope/flex/rest/models/groot_property.py b/python/graphscope/flex/rest/models/create_alert_receiver_request.py similarity index 72% rename from python/graphscope/flex/rest/models/groot_property.py rename to python/graphscope/flex/rest/models/create_alert_receiver_request.py index 458688acb38f..41e80497b726 100644 --- a/python/graphscope/flex/rest/models/groot_property.py +++ b/python/graphscope/flex/rest/models/create_alert_receiver_request.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,29 +18,27 @@ import re # noqa: F401 import json -from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self -class GrootProperty(BaseModel): +class CreateAlertReceiverRequest(BaseModel): """ - GrootProperty + CreateAlertReceiverRequest """ # noqa: E501 - id: Optional[StrictInt] = None - name: Optional[StrictStr] = None - type: Optional[StrictStr] = None - is_primary_key: Optional[StrictBool] = None - __properties: ClassVar[List[str]] = ["id", "name", "type", "is_primary_key"] + type: StrictStr + webhook_url: StrictStr + at_user_ids: List[StrictStr] + is_at_all: StrictBool + enable: StrictBool + __properties: ClassVar[List[str]] = ["type", "webhook_url", "at_user_ids", "is_at_all", "enable"] @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - - if value not in set(['DT_STRING', 'DT_SIGNED_INT64', 'DT_DOUBLE']): - raise ValueError("must be one of enum values ('DT_STRING', 'DT_SIGNED_INT64', 'DT_DOUBLE')") + if value not in set(['webhook']): + raise ValueError("must be one of enum values ('webhook')") return value model_config = { @@ -61,7 +59,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GrootProperty from a JSON string""" + """Create an instance of CreateAlertReceiverRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -86,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GrootProperty from a dict""" + """Create an instance of CreateAlertReceiverRequest from a dict""" if obj is None: return None @@ -94,10 +92,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "id": obj.get("id"), - "name": obj.get("name"), "type": obj.get("type"), - "is_primary_key": obj.get("is_primary_key") + "webhook_url": obj.get("webhook_url"), + "at_user_ids": obj.get("at_user_ids"), + "is_at_all": obj.get("is_at_all"), + "enable": obj.get("enable") }) return _obj diff --git a/python/graphscope/flex/rest/models/alert_rule.py b/python/graphscope/flex/rest/models/create_alert_rule_request.py similarity index 83% rename from python/graphscope/flex/rest/models/alert_rule.py rename to python/graphscope/flex/rest/models/create_alert_rule_request.py index d80650145601..9cdd85175274 100644 --- a/python/graphscope/flex/rest/models/alert_rule.py +++ b/python/graphscope/flex/rest/models/create_alert_rule_request.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,28 +19,25 @@ import json from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self -class AlertRule(BaseModel): +class CreateAlertRuleRequest(BaseModel): """ - AlertRule + CreateAlertRuleRequest """ # noqa: E501 - name: Optional[StrictStr] = None - severity: Optional[StrictStr] = None - metric_type: Optional[StrictStr] = None - conditions_description: Optional[StrictStr] = None - frequency: Optional[StrictInt] = Field(default=None, description="(mins)") - enable: Optional[StrictBool] = None + name: StrictStr + severity: StrictStr + metric_type: StrictStr + conditions_description: StrictStr + frequency: StrictInt = Field(description="(mins)") + enable: StrictBool __properties: ClassVar[List[str]] = ["name", "severity", "metric_type", "conditions_description", "frequency", "enable"] @field_validator('severity') def severity_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['warning', 'emergency']): raise ValueError("must be one of enum values ('warning', 'emergency')") return value @@ -48,9 +45,6 @@ def severity_validate_enum(cls, value): @field_validator('metric_type') def metric_type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['node', 'service']): raise ValueError("must be one of enum values ('node', 'service')") return value @@ -73,7 +67,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of AlertRule from a JSON string""" + """Create an instance of CreateAlertRuleRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -98,7 +92,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of AlertRule from a dict""" + """Create an instance of CreateAlertRuleRequest from a dict""" if obj is None: return None diff --git a/python/graphscope/flex/rest/models/create_dataloading_job_response.py b/python/graphscope/flex/rest/models/create_dataloading_job_response.py new file mode 100644 index 000000000000..0047a5d8c756 --- /dev/null +++ b/python/graphscope/flex/rest/models/create_dataloading_job_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class CreateDataloadingJobResponse(BaseModel): + """ + CreateDataloadingJobResponse + """ # noqa: E501 + job_id: StrictStr + __properties: ClassVar[List[str]] = ["job_id"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateDataloadingJobResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateDataloadingJobResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "job_id": obj.get("job_id") + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/edge_type.py b/python/graphscope/flex/rest/models/create_edge_type.py similarity index 69% rename from python/graphscope/flex/rest/models/edge_type.py rename to python/graphscope/flex/rest/models/create_edge_type.py index 902ab1b59fb0..d2e421eef43c 100644 --- a/python/graphscope/flex/rest/models/edge_type.py +++ b/python/graphscope/flex/rest/models/create_edge_type.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,22 +18,24 @@ import re # noqa: F401 import json -from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import BaseModel, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.edge_type_vertex_type_pair_relations_inner import EdgeTypeVertexTypePairRelationsInner -from graphscope.flex.rest.models.model_property import ModelProperty +from graphscope.flex.rest.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner +from graphscope.flex.rest.models.create_property_meta import CreatePropertyMeta from typing import Optional, Set from typing_extensions import Self -class EdgeType(BaseModel): +class CreateEdgeType(BaseModel): """ - EdgeType + CreateEdgeType """ # noqa: E501 - type_id: Optional[StrictInt] = None - type_name: Optional[StrictStr] = None - vertex_type_pair_relations: Optional[List[EdgeTypeVertexTypePairRelationsInner]] = None - properties: Optional[List[ModelProperty]] = None - __properties: ClassVar[List[str]] = ["type_id", "type_name", "vertex_type_pair_relations", "properties"] + type_name: StrictStr + vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner] + directed: Optional[StrictBool] = None + primary_keys: Optional[List[StrictStr]] = None + properties: List[CreatePropertyMeta] + description: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type_name", "vertex_type_pair_relations", "directed", "primary_keys", "properties", "description"] model_config = { "populate_by_name": True, @@ -53,7 +55,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EdgeType from a JSON string""" + """Create an instance of CreateEdgeType from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -92,7 +94,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EdgeType from a dict""" + """Create an instance of CreateEdgeType from a dict""" if obj is None: return None @@ -100,10 +102,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "type_id": obj.get("type_id"), "type_name": obj.get("type_name"), - "vertex_type_pair_relations": [EdgeTypeVertexTypePairRelationsInner.from_dict(_item) for _item in obj["vertex_type_pair_relations"]] if obj.get("vertex_type_pair_relations") is not None else None, - "properties": [ModelProperty.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None + "vertex_type_pair_relations": [BaseEdgeTypeVertexTypePairRelationsInner.from_dict(_item) for _item in obj["vertex_type_pair_relations"]] if obj.get("vertex_type_pair_relations") is not None else None, + "directed": obj.get("directed"), + "primary_keys": obj.get("primary_keys"), + "properties": [CreatePropertyMeta.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None, + "description": obj.get("description") }) return _obj diff --git a/python/graphscope/flex/rest/models/graph.py b/python/graphscope/flex/rest/models/create_graph_request.py similarity index 66% rename from python/graphscope/flex/rest/models/graph.py rename to python/graphscope/flex/rest/models/create_graph_request.py index 5e7c6d5f1f29..47f080eb34e9 100644 --- a/python/graphscope/flex/rest/models/graph.py +++ b/python/graphscope/flex/rest/models/create_graph_request.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,32 +18,22 @@ import re # noqa: F401 import json -from pydantic import BaseModel, Field, StrictStr, field_validator +from pydantic import BaseModel, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.graph_stored_procedures import GraphStoredProcedures -from graphscope.flex.rest.models.model_schema import ModelSchema +from graphscope.flex.rest.models.create_graph_schema_request import CreateGraphSchemaRequest +from graphscope.flex.rest.models.create_stored_proc_request import CreateStoredProcRequest from typing import Optional, Set from typing_extensions import Self -class Graph(BaseModel): +class CreateGraphRequest(BaseModel): """ - Graph + CreateGraphRequest """ # noqa: E501 name: Optional[StrictStr] = None - store_type: Optional[StrictStr] = None - stored_procedures: Optional[GraphStoredProcedures] = None - var_schema: Optional[ModelSchema] = Field(default=None, alias="schema") - __properties: ClassVar[List[str]] = ["name", "store_type", "stored_procedures", "schema"] - - @field_validator('store_type') - def store_type_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set(['mutable_csr']): - raise ValueError("must be one of enum values ('mutable_csr')") - return value + description: Optional[StrictStr] = None + stored_procedures: Optional[List[CreateStoredProcRequest]] = None + var_schema: Optional[CreateGraphSchemaRequest] = Field(default=None, alias="schema") + __properties: ClassVar[List[str]] = ["name", "description", "stored_procedures", "schema"] model_config = { "populate_by_name": True, @@ -63,7 +53,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of Graph from a JSON string""" + """Create an instance of CreateGraphRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -84,9 +74,13 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of stored_procedures + # override the default output from pydantic by calling `to_dict()` of each item in stored_procedures (list) + _items = [] if self.stored_procedures: - _dict['stored_procedures'] = self.stored_procedures.to_dict() + for _item in self.stored_procedures: + if _item: + _items.append(_item.to_dict()) + _dict['stored_procedures'] = _items # override the default output from pydantic by calling `to_dict()` of var_schema if self.var_schema: _dict['schema'] = self.var_schema.to_dict() @@ -94,7 +88,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of Graph from a dict""" + """Create an instance of CreateGraphRequest from a dict""" if obj is None: return None @@ -103,9 +97,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "name": obj.get("name"), - "store_type": obj.get("store_type"), - "stored_procedures": GraphStoredProcedures.from_dict(obj["stored_procedures"]) if obj.get("stored_procedures") is not None else None, - "schema": ModelSchema.from_dict(obj["schema"]) if obj.get("schema") is not None else None + "description": obj.get("description"), + "stored_procedures": [CreateStoredProcRequest.from_dict(_item) for _item in obj["stored_procedures"]] if obj.get("stored_procedures") is not None else None, + "schema": CreateGraphSchemaRequest.from_dict(obj["schema"]) if obj.get("schema") is not None else None }) return _obj diff --git a/python/graphscope/flex/rest/models/create_graph_response.py b/python/graphscope/flex/rest/models/create_graph_response.py new file mode 100644 index 000000000000..8460f0c4d494 --- /dev/null +++ b/python/graphscope/flex/rest/models/create_graph_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class CreateGraphResponse(BaseModel): + """ + CreateGraphResponse + """ # noqa: E501 + graph_id: StrictStr + __properties: ClassVar[List[str]] = ["graph_id"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateGraphResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateGraphResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "graph_id": obj.get("graph_id") + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/groot_schema.py b/python/graphscope/flex/rest/models/create_graph_schema_request.py similarity index 69% rename from python/graphscope/flex/rest/models/groot_schema.py rename to python/graphscope/flex/rest/models/create_graph_schema_request.py index 455f519ee02c..16c02e9e1497 100644 --- a/python/graphscope/flex/rest/models/groot_schema.py +++ b/python/graphscope/flex/rest/models/create_graph_schema_request.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,19 +19,19 @@ import json from pydantic import BaseModel -from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.groot_edge_type import GrootEdgeType -from graphscope.flex.rest.models.groot_vertex_type import GrootVertexType +from typing import Any, ClassVar, Dict, List +from graphscope.flex.rest.models.create_edge_type import CreateEdgeType +from graphscope.flex.rest.models.create_vertex_type import CreateVertexType from typing import Optional, Set from typing_extensions import Self -class GrootSchema(BaseModel): +class CreateGraphSchemaRequest(BaseModel): """ - GrootSchema + CreateGraphSchemaRequest """ # noqa: E501 - vertices: Optional[List[GrootVertexType]] = None - edges: Optional[List[GrootEdgeType]] = None - __properties: ClassVar[List[str]] = ["vertices", "edges"] + vertex_types: List[CreateVertexType] + edge_types: List[CreateEdgeType] + __properties: ClassVar[List[str]] = ["vertex_types", "edge_types"] model_config = { "populate_by_name": True, @@ -51,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GrootSchema from a JSON string""" + """Create an instance of CreateGraphSchemaRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -72,25 +72,25 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in vertices (list) + # override the default output from pydantic by calling `to_dict()` of each item in vertex_types (list) _items = [] - if self.vertices: - for _item in self.vertices: + if self.vertex_types: + for _item in self.vertex_types: if _item: _items.append(_item.to_dict()) - _dict['vertices'] = _items - # override the default output from pydantic by calling `to_dict()` of each item in edges (list) + _dict['vertex_types'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in edge_types (list) _items = [] - if self.edges: - for _item in self.edges: + if self.edge_types: + for _item in self.edge_types: if _item: _items.append(_item.to_dict()) - _dict['edges'] = _items + _dict['edge_types'] = _items return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GrootSchema from a dict""" + """Create an instance of CreateGraphSchemaRequest from a dict""" if obj is None: return None @@ -98,8 +98,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "vertices": [GrootVertexType.from_dict(_item) for _item in obj["vertices"]] if obj.get("vertices") is not None else None, - "edges": [GrootEdgeType.from_dict(_item) for _item in obj["edges"]] if obj.get("edges") is not None else None + "vertex_types": [CreateVertexType.from_dict(_item) for _item in obj["vertex_types"]] if obj.get("vertex_types") is not None else None, + "edge_types": [CreateEdgeType.from_dict(_item) for _item in obj["edge_types"]] if obj.get("edge_types") is not None else None }) return _obj diff --git a/python/graphscope/flex/rest/models/model_property.py b/python/graphscope/flex/rest/models/create_property_meta.py similarity index 73% rename from python/graphscope/flex/rest/models/model_property.py rename to python/graphscope/flex/rest/models/create_property_meta.py index d8b32e230af3..21f5dc94d620 100644 --- a/python/graphscope/flex/rest/models/model_property.py +++ b/python/graphscope/flex/rest/models/create_property_meta.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,20 +18,22 @@ import re # noqa: F401 import json -from pydantic import BaseModel, StrictInt, StrictStr +from pydantic import BaseModel, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.property_property_type import PropertyPropertyType +from graphscope.flex.rest.models.gs_data_type import GSDataType from typing import Optional, Set from typing_extensions import Self -class ModelProperty(BaseModel): +class CreatePropertyMeta(BaseModel): """ - ModelProperty + CreatePropertyMeta """ # noqa: E501 - property_id: Optional[StrictInt] = None - property_name: Optional[StrictStr] = None - property_type: Optional[PropertyPropertyType] = None - __properties: ClassVar[List[str]] = ["property_id", "property_name", "property_type"] + property_name: StrictStr + property_type: GSDataType + nullable: Optional[StrictBool] = None + default_value: Optional[Dict[str, Any]] = None + description: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["property_name", "property_type", "nullable", "default_value", "description"] model_config = { "populate_by_name": True, @@ -51,7 +53,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ModelProperty from a JSON string""" + """Create an instance of CreatePropertyMeta from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -79,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ModelProperty from a dict""" + """Create an instance of CreatePropertyMeta from a dict""" if obj is None: return None @@ -87,9 +89,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "property_id": obj.get("property_id"), "property_name": obj.get("property_name"), - "property_type": PropertyPropertyType.from_dict(obj["property_type"]) if obj.get("property_type") is not None else None + "property_type": GSDataType.from_dict(obj["property_type"]) if obj.get("property_type") is not None else None, + "nullable": obj.get("nullable"), + "default_value": obj.get("default_value"), + "description": obj.get("description") }) return _obj diff --git a/python/graphscope/flex/rest/models/graph_stored_procedures.py b/python/graphscope/flex/rest/models/create_stored_proc_request.py similarity index 75% rename from python/graphscope/flex/rest/models/graph_stored_procedures.py rename to python/graphscope/flex/rest/models/create_stored_proc_request.py index 8bb62181e02c..aef3fe16492f 100644 --- a/python/graphscope/flex/rest/models/graph_stored_procedures.py +++ b/python/graphscope/flex/rest/models/create_stored_proc_request.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -23,21 +23,21 @@ from typing import Optional, Set from typing_extensions import Self -class GraphStoredProcedures(BaseModel): +class CreateStoredProcRequest(BaseModel): """ - GraphStoredProcedures + CreateStoredProcRequest """ # noqa: E501 - directory: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["directory"] - - @field_validator('directory') - def directory_validate_enum(cls, value): + name: StrictStr + description: Optional[StrictStr] = None + type: StrictStr + query: StrictStr + __properties: ClassVar[List[str]] = ["name", "description", "type", "query"] + + @field_validator('type') + def type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - - if value not in set(['plugins']): - raise ValueError("must be one of enum values ('plugins')") + if value not in set(['cpp', 'cypher']): + raise ValueError("must be one of enum values ('cpp', 'cypher')") return value model_config = { @@ -58,7 +58,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GraphStoredProcedures from a JSON string""" + """Create an instance of CreateStoredProcRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -83,7 +83,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GraphStoredProcedures from a dict""" + """Create an instance of CreateStoredProcRequest from a dict""" if obj is None: return None @@ -91,7 +91,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "directory": obj.get("directory") + "name": obj.get("name"), + "description": obj.get("description"), + "type": obj.get("type"), + "query": obj.get("query") }) return _obj diff --git a/python/graphscope/flex/rest/models/create_stored_proc_response.py b/python/graphscope/flex/rest/models/create_stored_proc_response.py new file mode 100644 index 000000000000..af05050c1503 --- /dev/null +++ b/python/graphscope/flex/rest/models/create_stored_proc_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class CreateStoredProcResponse(BaseModel): + """ + CreateStoredProcResponse + """ # noqa: E501 + stored_procedure_id: StrictStr + __properties: ClassVar[List[str]] = ["stored_procedure_id"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateStoredProcResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateStoredProcResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "stored_procedure_id": obj.get("stored_procedure_id") + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/groot_edge_type.py b/python/graphscope/flex/rest/models/create_vertex_type.py similarity index 69% rename from python/graphscope/flex/rest/models/groot_edge_type.py rename to python/graphscope/flex/rest/models/create_vertex_type.py index ddabe2ac0b87..e5322ba4680f 100644 --- a/python/graphscope/flex/rest/models/groot_edge_type.py +++ b/python/graphscope/flex/rest/models/create_vertex_type.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -20,19 +20,21 @@ from pydantic import BaseModel, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.groot_edge_type_relations_inner import GrootEdgeTypeRelationsInner -from graphscope.flex.rest.models.groot_property import GrootProperty +from graphscope.flex.rest.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams +from graphscope.flex.rest.models.create_property_meta import CreatePropertyMeta from typing import Optional, Set from typing_extensions import Self -class GrootEdgeType(BaseModel): +class CreateVertexType(BaseModel): """ - GrootEdgeType + CreateVertexType """ # noqa: E501 - label: Optional[StrictStr] = None - relations: Optional[List[GrootEdgeTypeRelationsInner]] = None - properties: Optional[List[GrootProperty]] = None - __properties: ClassVar[List[str]] = ["label", "relations", "properties"] + type_name: StrictStr + primary_keys: List[StrictStr] + x_csr_params: Optional[BaseVertexTypeXCsrParams] = None + properties: List[CreatePropertyMeta] + description: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type_name", "primary_keys", "x_csr_params", "properties", "description"] model_config = { "populate_by_name": True, @@ -52,7 +54,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GrootEdgeType from a JSON string""" + """Create an instance of CreateVertexType from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,13 +75,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in relations (list) - _items = [] - if self.relations: - for _item in self.relations: - if _item: - _items.append(_item.to_dict()) - _dict['relations'] = _items + # override the default output from pydantic by calling `to_dict()` of x_csr_params + if self.x_csr_params: + _dict['x_csr_params'] = self.x_csr_params.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in properties (list) _items = [] if self.properties: @@ -91,7 +89,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GrootEdgeType from a dict""" + """Create an instance of CreateVertexType from a dict""" if obj is None: return None @@ -99,9 +97,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "label": obj.get("label"), - "relations": [GrootEdgeTypeRelationsInner.from_dict(_item) for _item in obj["relations"]] if obj.get("relations") is not None else None, - "properties": [GrootProperty.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None + "type_name": obj.get("type_name"), + "primary_keys": obj.get("primary_keys"), + "x_csr_params": BaseVertexTypeXCsrParams.from_dict(obj["x_csr_params"]) if obj.get("x_csr_params") is not None else None, + "properties": [CreatePropertyMeta.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None, + "description": obj.get("description") }) return _obj diff --git a/python/graphscope/flex/rest/models/data_source.py b/python/graphscope/flex/rest/models/data_source.py deleted file mode 100644 index 205e431024ef..000000000000 --- a/python/graphscope/flex/rest/models/data_source.py +++ /dev/null @@ -1,106 +0,0 @@ -# coding: utf-8 - -""" - GraphScope FLEX HTTP SERVICE API - - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel -from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.edge_data_source import EdgeDataSource -from graphscope.flex.rest.models.vertex_data_source import VertexDataSource -from typing import Optional, Set -from typing_extensions import Self - -class DataSource(BaseModel): - """ - DataSource - """ # noqa: E501 - vertices_datasource: Optional[List[VertexDataSource]] = None - edges_datasource: Optional[List[EdgeDataSource]] = None - __properties: ClassVar[List[str]] = ["vertices_datasource", "edges_datasource"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of DataSource from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each item in vertices_datasource (list) - _items = [] - if self.vertices_datasource: - for _item in self.vertices_datasource: - if _item: - _items.append(_item.to_dict()) - _dict['vertices_datasource'] = _items - # override the default output from pydantic by calling `to_dict()` of each item in edges_datasource (list) - _items = [] - if self.edges_datasource: - for _item in self.edges_datasource: - if _item: - _items.append(_item.to_dict()) - _dict['edges_datasource'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of DataSource from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "vertices_datasource": [VertexDataSource.from_dict(_item) for _item in obj["vertices_datasource"]] if obj.get("vertices_datasource") is not None else None, - "edges_datasource": [EdgeDataSource.from_dict(_item) for _item in obj["edges_datasource"]] if obj.get("edges_datasource") is not None else None - }) - return _obj - - diff --git a/python/graphscope/flex/rest/models/groot_dataloading_job_config.py b/python/graphscope/flex/rest/models/dataloading_job_config.py similarity index 60% rename from python/graphscope/flex/rest/models/groot_dataloading_job_config.py rename to python/graphscope/flex/rest/models/dataloading_job_config.py index 797680a17994..45c5070a5822 100644 --- a/python/graphscope/flex/rest/models/groot_dataloading_job_config.py +++ b/python/graphscope/flex/rest/models/dataloading_job_config.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -20,19 +20,22 @@ from pydantic import BaseModel, Field, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.groot_dataloading_job_config_edges_inner import GrootDataloadingJobConfigEdgesInner +from graphscope.flex.rest.models.dataloading_job_config_edges_inner import DataloadingJobConfigEdgesInner +from graphscope.flex.rest.models.dataloading_job_config_loading_config import DataloadingJobConfigLoadingConfig +from graphscope.flex.rest.models.dataloading_job_config_vertices_inner import DataloadingJobConfigVerticesInner from typing import Optional, Set from typing_extensions import Self -class GrootDataloadingJobConfig(BaseModel): +class DataloadingJobConfig(BaseModel): """ - GrootDataloadingJobConfig + DataloadingJobConfig """ # noqa: E501 - vertices: Optional[List[StrictStr]] = None - edges: Optional[List[GrootDataloadingJobConfigEdgesInner]] = None + loading_config: DataloadingJobConfigLoadingConfig + vertices: List[DataloadingJobConfigVerticesInner] + edges: List[DataloadingJobConfigEdgesInner] schedule: Optional[StrictStr] = Field(default=None, description="format with '2023-02-21 11:56:30'") repeat: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["vertices", "edges", "schedule", "repeat"] + __properties: ClassVar[List[str]] = ["loading_config", "vertices", "edges", "schedule", "repeat"] @field_validator('repeat') def repeat_validate_enum(cls, value): @@ -62,7 +65,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GrootDataloadingJobConfig from a JSON string""" + """Create an instance of DataloadingJobConfig from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -83,6 +86,16 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of loading_config + if self.loading_config: + _dict['loading_config'] = self.loading_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in vertices (list) + _items = [] + if self.vertices: + for _item in self.vertices: + if _item: + _items.append(_item.to_dict()) + _dict['vertices'] = _items # override the default output from pydantic by calling `to_dict()` of each item in edges (list) _items = [] if self.edges: @@ -90,11 +103,21 @@ def to_dict(self) -> Dict[str, Any]: if _item: _items.append(_item.to_dict()) _dict['edges'] = _items + # set to None if schedule (nullable) is None + # and model_fields_set contains the field + if self.schedule is None and "schedule" in self.model_fields_set: + _dict['schedule'] = None + + # set to None if repeat (nullable) is None + # and model_fields_set contains the field + if self.repeat is None and "repeat" in self.model_fields_set: + _dict['repeat'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GrootDataloadingJobConfig from a dict""" + """Create an instance of DataloadingJobConfig from a dict""" if obj is None: return None @@ -102,8 +125,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "vertices": obj.get("vertices"), - "edges": [GrootDataloadingJobConfigEdgesInner.from_dict(_item) for _item in obj["edges"]] if obj.get("edges") is not None else None, + "loading_config": DataloadingJobConfigLoadingConfig.from_dict(obj["loading_config"]) if obj.get("loading_config") is not None else None, + "vertices": [DataloadingJobConfigVerticesInner.from_dict(_item) for _item in obj["vertices"]] if obj.get("vertices") is not None else None, + "edges": [DataloadingJobConfigEdgesInner.from_dict(_item) for _item in obj["edges"]] if obj.get("edges") is not None else None, "schedule": obj.get("schedule"), "repeat": obj.get("repeat") }) diff --git a/python/graphscope/flex/rest/models/groot_dataloading_job_config_edges_inner.py b/python/graphscope/flex/rest/models/dataloading_job_config_edges_inner.py similarity index 90% rename from python/graphscope/flex/rest/models/groot_dataloading_job_config_edges_inner.py rename to python/graphscope/flex/rest/models/dataloading_job_config_edges_inner.py index 290867957708..485c97a4dc98 100644 --- a/python/graphscope/flex/rest/models/groot_dataloading_job_config_edges_inner.py +++ b/python/graphscope/flex/rest/models/dataloading_job_config_edges_inner.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class GrootDataloadingJobConfigEdgesInner(BaseModel): +class DataloadingJobConfigEdgesInner(BaseModel): """ - GrootDataloadingJobConfigEdgesInner + DataloadingJobConfigEdgesInner """ # noqa: E501 type_name: Optional[StrictStr] = None source_vertex: Optional[StrictStr] = None @@ -50,7 +50,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GrootDataloadingJobConfigEdgesInner from a JSON string""" + """Create an instance of DataloadingJobConfigEdgesInner from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -75,7 +75,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GrootDataloadingJobConfigEdgesInner from a dict""" + """Create an instance of DataloadingJobConfigEdgesInner from a dict""" if obj is None: return None diff --git a/python/graphscope/flex/rest/models/schema_mapping_loading_config.py b/python/graphscope/flex/rest/models/dataloading_job_config_loading_config.py similarity index 72% rename from python/graphscope/flex/rest/models/schema_mapping_loading_config.py rename to python/graphscope/flex/rest/models/dataloading_job_config_loading_config.py index efad1d4b01f8..8c9d944feca2 100644 --- a/python/graphscope/flex/rest/models/schema_mapping_loading_config.py +++ b/python/graphscope/flex/rest/models/dataloading_job_config_loading_config.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -20,19 +20,17 @@ from pydantic import BaseModel, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.schema_mapping_loading_config_data_source import SchemaMappingLoadingConfigDataSource -from graphscope.flex.rest.models.schema_mapping_loading_config_format import SchemaMappingLoadingConfigFormat +from graphscope.flex.rest.models.dataloading_job_config_loading_config_format import DataloadingJobConfigLoadingConfigFormat from typing import Optional, Set from typing_extensions import Self -class SchemaMappingLoadingConfig(BaseModel): +class DataloadingJobConfigLoadingConfig(BaseModel): """ - SchemaMappingLoadingConfig + DataloadingJobConfigLoadingConfig """ # noqa: E501 - data_source: Optional[SchemaMappingLoadingConfigDataSource] = None import_option: Optional[StrictStr] = None - format: Optional[SchemaMappingLoadingConfigFormat] = None - __properties: ClassVar[List[str]] = ["data_source", "import_option", "format"] + format: Optional[DataloadingJobConfigLoadingConfigFormat] = None + __properties: ClassVar[List[str]] = ["import_option", "format"] @field_validator('import_option') def import_option_validate_enum(cls, value): @@ -62,7 +60,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of SchemaMappingLoadingConfig from a JSON string""" + """Create an instance of DataloadingJobConfigLoadingConfig from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -83,9 +81,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of data_source - if self.data_source: - _dict['data_source'] = self.data_source.to_dict() # override the default output from pydantic by calling `to_dict()` of format if self.format: _dict['format'] = self.format.to_dict() @@ -93,7 +88,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of SchemaMappingLoadingConfig from a dict""" + """Create an instance of DataloadingJobConfigLoadingConfig from a dict""" if obj is None: return None @@ -101,9 +96,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "data_source": SchemaMappingLoadingConfigDataSource.from_dict(obj["data_source"]) if obj.get("data_source") is not None else None, "import_option": obj.get("import_option"), - "format": SchemaMappingLoadingConfigFormat.from_dict(obj["format"]) if obj.get("format") is not None else None + "format": DataloadingJobConfigLoadingConfigFormat.from_dict(obj["format"]) if obj.get("format") is not None else None }) return _obj diff --git a/python/graphscope/flex/rest/models/schema_mapping_loading_config_format.py b/python/graphscope/flex/rest/models/dataloading_job_config_loading_config_format.py similarity index 89% rename from python/graphscope/flex/rest/models/schema_mapping_loading_config_format.py rename to python/graphscope/flex/rest/models/dataloading_job_config_loading_config_format.py index 0dfa09824412..af13cffba0b5 100644 --- a/python/graphscope/flex/rest/models/schema_mapping_loading_config_format.py +++ b/python/graphscope/flex/rest/models/dataloading_job_config_loading_config_format.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class SchemaMappingLoadingConfigFormat(BaseModel): +class DataloadingJobConfigLoadingConfigFormat(BaseModel): """ - SchemaMappingLoadingConfigFormat + DataloadingJobConfigLoadingConfigFormat """ # noqa: E501 type: Optional[StrictStr] = None metadata: Optional[Dict[str, Any]] = None @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of SchemaMappingLoadingConfigFormat from a JSON string""" + """Create an instance of DataloadingJobConfigLoadingConfigFormat from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -74,7 +74,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of SchemaMappingLoadingConfigFormat from a dict""" + """Create an instance of DataloadingJobConfigLoadingConfigFormat from a dict""" if obj is None: return None diff --git a/python/graphscope/flex/rest/models/connection.py b/python/graphscope/flex/rest/models/dataloading_job_config_vertices_inner.py similarity index 84% rename from python/graphscope/flex/rest/models/connection.py rename to python/graphscope/flex/rest/models/dataloading_job_config_vertices_inner.py index c0ec9fac7e00..0e8ad5b83127 100644 --- a/python/graphscope/flex/rest/models/connection.py +++ b/python/graphscope/flex/rest/models/dataloading_job_config_vertices_inner.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -23,12 +23,12 @@ from typing import Optional, Set from typing_extensions import Self -class Connection(BaseModel): +class DataloadingJobConfigVerticesInner(BaseModel): """ - Connection + DataloadingJobConfigVerticesInner """ # noqa: E501 - coordinator_endpoint: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["coordinator_endpoint"] + type_name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type_name"] model_config = { "populate_by_name": True, @@ -48,7 +48,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of Connection from a JSON string""" + """Create an instance of DataloadingJobConfigVerticesInner from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,7 +73,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of Connection from a dict""" + """Create an instance of DataloadingJobConfigVerticesInner from a dict""" if obj is None: return None @@ -81,7 +81,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "coordinator_endpoint": obj.get("coordinator_endpoint") + "type_name": obj.get("type_name") }) return _obj diff --git a/python/graphscope/flex/rest/models/deployment_info_graphs_info_value.py b/python/graphscope/flex/rest/models/deployment_info_graphs_info_value.py deleted file mode 100644 index 5c925517d3dd..000000000000 --- a/python/graphscope/flex/rest/models/deployment_info_graphs_info_value.py +++ /dev/null @@ -1,94 +0,0 @@ -# coding: utf-8 - -""" - GraphScope FLEX HTTP SERVICE API - - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class DeploymentInfoGraphsInfoValue(BaseModel): - """ - DeploymentInfoGraphsInfoValue - """ # noqa: E501 - name: Optional[StrictStr] = None - creation_time: Optional[StrictStr] = None - update_time: Optional[StrictStr] = None - last_dataloading_time: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["name", "creation_time", "update_time", "last_dataloading_time"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of DeploymentInfoGraphsInfoValue from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of DeploymentInfoGraphsInfoValue from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "name": obj.get("name"), - "creation_time": obj.get("creation_time"), - "update_time": obj.get("update_time"), - "last_dataloading_time": obj.get("last_dataloading_time") - }) - return _obj - - diff --git a/python/graphscope/flex/rest/models/deployment_status.py b/python/graphscope/flex/rest/models/deployment_status.py deleted file mode 100644 index 7285851c4830..000000000000 --- a/python/graphscope/flex/rest/models/deployment_status.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding: utf-8 - -""" - GraphScope FLEX HTTP SERVICE API - - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, Field, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class DeploymentStatus(BaseModel): - """ - K8s only - """ # noqa: E501 - name: Optional[StrictStr] = None - container: Optional[List[StrictStr]] = None - image: Optional[List[StrictStr]] = None - labels: Optional[List[StrictStr]] = None - node: Optional[StrictStr] = None - status: Optional[StrictStr] = None - restart_count: Optional[StrictInt] = None - cpu_value: Optional[StrictInt] = Field(default=None, description="cpu value in millicore") - memory_value: Optional[StrictInt] = Field(default=None, description="memory value in megabytes") - timestamp: Optional[StrictStr] = None - creation_time: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["name", "container", "image", "labels", "node", "status", "restart_count", "cpu_value", "memory_value", "timestamp", "creation_time"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of DeploymentStatus from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of DeploymentStatus from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "name": obj.get("name"), - "container": obj.get("container"), - "image": obj.get("image"), - "labels": obj.get("labels"), - "node": obj.get("node"), - "status": obj.get("status"), - "restart_count": obj.get("restart_count"), - "cpu_value": obj.get("cpu_value"), - "memory_value": obj.get("memory_value"), - "timestamp": obj.get("timestamp"), - "creation_time": obj.get("creation_time") - }) - return _obj - - diff --git a/python/graphscope/flex/rest/models/edge_data_source.py b/python/graphscope/flex/rest/models/edge_data_source.py deleted file mode 100644 index 2dff3c7acde0..000000000000 --- a/python/graphscope/flex/rest/models/edge_data_source.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding: utf-8 - -""" - GraphScope FLEX HTTP SERVICE API - - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class EdgeDataSource(BaseModel): - """ - EdgeDataSource - """ # noqa: E501 - data_source: Optional[StrictStr] = None - type_name: Optional[StrictStr] = None - source_vertex: Optional[StrictStr] = None - destination_vertex: Optional[StrictStr] = None - location: Optional[StrictStr] = None - source_pk_column_map: Optional[Dict[str, Any]] = None - destination_pk_column_map: Optional[Dict[str, Any]] = None - property_mapping: Optional[Dict[str, Any]] = None - __properties: ClassVar[List[str]] = ["data_source", "type_name", "source_vertex", "destination_vertex", "location", "source_pk_column_map", "destination_pk_column_map", "property_mapping"] - - @field_validator('data_source') - def data_source_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set(['ODPS', 'FILE']): - raise ValueError("must be one of enum values ('ODPS', 'FILE')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EdgeDataSource from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EdgeDataSource from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "data_source": obj.get("data_source"), - "type_name": obj.get("type_name"), - "source_vertex": obj.get("source_vertex"), - "destination_vertex": obj.get("destination_vertex"), - "location": obj.get("location"), - "source_pk_column_map": obj.get("source_pk_column_map"), - "destination_pk_column_map": obj.get("destination_pk_column_map"), - "property_mapping": obj.get("property_mapping") - }) - return _obj - - diff --git a/python/graphscope/flex/rest/models/edge_mapping.py b/python/graphscope/flex/rest/models/edge_mapping.py index 1ad3eef41cf1..3d73295a8be4 100644 --- a/python/graphscope/flex/rest/models/edge_mapping.py +++ b/python/graphscope/flex/rest/models/edge_mapping.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -21,8 +21,6 @@ from pydantic import BaseModel, StrictStr from typing import Any, ClassVar, Dict, List, Optional from graphscope.flex.rest.models.column_mapping import ColumnMapping -from graphscope.flex.rest.models.edge_mapping_destination_vertex_mappings_inner import EdgeMappingDestinationVertexMappingsInner -from graphscope.flex.rest.models.edge_mapping_source_vertex_mappings_inner import EdgeMappingSourceVertexMappingsInner from graphscope.flex.rest.models.edge_mapping_type_triplet import EdgeMappingTypeTriplet from typing import Optional, Set from typing_extensions import Self @@ -31,10 +29,10 @@ class EdgeMapping(BaseModel): """ EdgeMapping """ # noqa: E501 - type_triplet: Optional[EdgeMappingTypeTriplet] = None - inputs: Optional[List[StrictStr]] = None - source_vertex_mappings: Optional[List[EdgeMappingSourceVertexMappingsInner]] = None - destination_vertex_mappings: Optional[List[EdgeMappingDestinationVertexMappingsInner]] = None + type_triplet: EdgeMappingTypeTriplet + inputs: List[StrictStr] + source_vertex_mappings: List[ColumnMapping] + destination_vertex_mappings: List[ColumnMapping] column_mappings: Optional[List[ColumnMapping]] = None __properties: ClassVar[List[str]] = ["type_triplet", "inputs", "source_vertex_mappings", "destination_vertex_mappings", "column_mappings"] @@ -115,8 +113,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "type_triplet": EdgeMappingTypeTriplet.from_dict(obj["type_triplet"]) if obj.get("type_triplet") is not None else None, "inputs": obj.get("inputs"), - "source_vertex_mappings": [EdgeMappingSourceVertexMappingsInner.from_dict(_item) for _item in obj["source_vertex_mappings"]] if obj.get("source_vertex_mappings") is not None else None, - "destination_vertex_mappings": [EdgeMappingDestinationVertexMappingsInner.from_dict(_item) for _item in obj["destination_vertex_mappings"]] if obj.get("destination_vertex_mappings") is not None else None, + "source_vertex_mappings": [ColumnMapping.from_dict(_item) for _item in obj["source_vertex_mappings"]] if obj.get("source_vertex_mappings") is not None else None, + "destination_vertex_mappings": [ColumnMapping.from_dict(_item) for _item in obj["destination_vertex_mappings"]] if obj.get("destination_vertex_mappings") is not None else None, "column_mappings": [ColumnMapping.from_dict(_item) for _item in obj["column_mappings"]] if obj.get("column_mappings") is not None else None }) return _obj diff --git a/python/graphscope/flex/rest/models/edge_mapping_type_triplet.py b/python/graphscope/flex/rest/models/edge_mapping_type_triplet.py index 17908439cd58..40f47de5667f 100644 --- a/python/graphscope/flex/rest/models/edge_mapping_type_triplet.py +++ b/python/graphscope/flex/rest/models/edge_mapping_type_triplet.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,7 +19,7 @@ import json from pydantic import BaseModel, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self @@ -27,9 +27,9 @@ class EdgeMappingTypeTriplet(BaseModel): """ source label -> [edge label] -> destination label """ # noqa: E501 - edge: Optional[StrictStr] = None - source_vertex: Optional[StrictStr] = None - destination_vertex: Optional[StrictStr] = None + edge: StrictStr + source_vertex: StrictStr + destination_vertex: StrictStr __properties: ClassVar[List[str]] = ["edge", "source_vertex", "destination_vertex"] model_config = { diff --git a/python/graphscope/flex/rest/models/error.py b/python/graphscope/flex/rest/models/error.py new file mode 100644 index 000000000000..d157ebab4210 --- /dev/null +++ b/python/graphscope/flex/rest/models/error.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class Error(BaseModel): + """ + Error + """ # noqa: E501 + code: StrictInt = Field(description="Error code") + message: StrictStr = Field(description="Error message") + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/alert_message.py b/python/graphscope/flex/rest/models/get_alert_message_response.py similarity index 77% rename from python/graphscope/flex/rest/models/alert_message.py rename to python/graphscope/flex/rest/models/get_alert_message_response.py index 283b36ff7c5b..69e3962ad0f0 100644 --- a/python/graphscope/flex/rest/models/alert_message.py +++ b/python/graphscope/flex/rest/models/get_alert_message_response.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,30 +19,27 @@ import json from pydantic import BaseModel, Field, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self -class AlertMessage(BaseModel): +class GetAlertMessageResponse(BaseModel): """ - AlertMessage + GetAlertMessageResponse """ # noqa: E501 - message_id: Optional[StrictStr] = Field(default=None, description="Generated in server side") - alert_name: Optional[StrictStr] = None - severity: Optional[StrictStr] = None - metric_type: Optional[StrictStr] = None - target: Optional[List[StrictStr]] = None - trigger_time: Optional[StrictStr] = None - status: Optional[StrictStr] = None - message: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["message_id", "alert_name", "severity", "metric_type", "target", "trigger_time", "status", "message"] + id: StrictStr = Field(description="Generated in server side") + alert_name: StrictStr + severity: StrictStr + metric_type: StrictStr + target: List[StrictStr] + trigger_time: StrictStr + status: StrictStr + message: StrictStr + __properties: ClassVar[List[str]] = ["id", "alert_name", "severity", "metric_type", "target", "trigger_time", "status", "message"] @field_validator('severity') def severity_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['warning', 'emergency']): raise ValueError("must be one of enum values ('warning', 'emergency')") return value @@ -50,9 +47,6 @@ def severity_validate_enum(cls, value): @field_validator('metric_type') def metric_type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['node', 'service']): raise ValueError("must be one of enum values ('node', 'service')") return value @@ -60,9 +54,6 @@ def metric_type_validate_enum(cls, value): @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['unsolved', 'solved', 'dealing']): raise ValueError("must be one of enum values ('unsolved', 'solved', 'dealing')") return value @@ -85,7 +76,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of AlertMessage from a JSON string""" + """Create an instance of GetAlertMessageResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -110,7 +101,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of AlertMessage from a dict""" + """Create an instance of GetAlertMessageResponse from a dict""" if obj is None: return None @@ -118,7 +109,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "message_id": obj.get("message_id"), + "id": obj.get("id"), "alert_name": obj.get("alert_name"), "severity": obj.get("severity"), "metric_type": obj.get("metric_type"), diff --git a/python/graphscope/flex/rest/models/alert_receiver.py b/python/graphscope/flex/rest/models/get_alert_receiver_response.py similarity index 76% rename from python/graphscope/flex/rest/models/alert_receiver.py rename to python/graphscope/flex/rest/models/get_alert_receiver_response.py index ddb507eaae3a..922c423a9fad 100644 --- a/python/graphscope/flex/rest/models/alert_receiver.py +++ b/python/graphscope/flex/rest/models/get_alert_receiver_response.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,29 +19,26 @@ import json from pydantic import BaseModel, Field, StrictBool, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self -class AlertReceiver(BaseModel): +class GetAlertReceiverResponse(BaseModel): """ - AlertReceiver + GetAlertReceiverResponse """ # noqa: E501 - type: Optional[StrictStr] = None - receiver_id: Optional[StrictStr] = Field(default=None, description="Generated in server side") - webhook_url: Optional[StrictStr] = None - at_user_ids: Optional[List[StrictStr]] = None - is_at_all: Optional[StrictBool] = None - enable: Optional[StrictBool] = None - message: Optional[StrictStr] = Field(default=None, description="error message generated in server side") - __properties: ClassVar[List[str]] = ["type", "receiver_id", "webhook_url", "at_user_ids", "is_at_all", "enable", "message"] + type: StrictStr + webhook_url: StrictStr + at_user_ids: List[StrictStr] + is_at_all: StrictBool + enable: StrictBool + id: StrictStr + message: StrictStr = Field(description="Error message generated in server side") + __properties: ClassVar[List[str]] = ["type", "webhook_url", "at_user_ids", "is_at_all", "enable", "id", "message"] @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['webhook']): raise ValueError("must be one of enum values ('webhook')") return value @@ -64,7 +61,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of AlertReceiver from a JSON string""" + """Create an instance of GetAlertReceiverResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -89,7 +86,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of AlertReceiver from a dict""" + """Create an instance of GetAlertReceiverResponse from a dict""" if obj is None: return None @@ -98,11 +95,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "type": obj.get("type"), - "receiver_id": obj.get("receiver_id"), "webhook_url": obj.get("webhook_url"), "at_user_ids": obj.get("at_user_ids"), "is_at_all": obj.get("is_at_all"), "enable": obj.get("enable"), + "id": obj.get("id"), "message": obj.get("message") }) return _obj diff --git a/python/graphscope/flex/rest/models/connection_status.py b/python/graphscope/flex/rest/models/get_alert_rule_response.py similarity index 62% rename from python/graphscope/flex/rest/models/connection_status.py rename to python/graphscope/flex/rest/models/get_alert_rule_response.py index 206f02bb24d5..cc8623bc32dd 100644 --- a/python/graphscope/flex/rest/models/connection_status.py +++ b/python/graphscope/flex/rest/models/get_alert_rule_response.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,37 +18,36 @@ import re # noqa: F401 import json -from pydantic import BaseModel, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self -class ConnectionStatus(BaseModel): +class GetAlertRuleResponse(BaseModel): """ - ConnectionStatus + GetAlertRuleResponse """ # noqa: E501 - status: Optional[StrictStr] = None - solution: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["status", "solution"] - - @field_validator('status') - def status_validate_enum(cls, value): + name: StrictStr + severity: StrictStr + metric_type: StrictStr + conditions_description: StrictStr + frequency: StrictInt = Field(description="(mins)") + enable: StrictBool + id: StrictStr + __properties: ClassVar[List[str]] = ["name", "severity", "metric_type", "conditions_description", "frequency", "enable", "id"] + + @field_validator('severity') + def severity_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - - if value not in set(['CONNECTED']): - raise ValueError("must be one of enum values ('CONNECTED')") + if value not in set(['warning', 'emergency']): + raise ValueError("must be one of enum values ('warning', 'emergency')") return value - @field_validator('solution') - def solution_validate_enum(cls, value): + @field_validator('metric_type') + def metric_type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - - if value not in set(['INTERACTIVE', 'GRAPHSCOPE_INSIGHT']): - raise ValueError("must be one of enum values ('INTERACTIVE', 'GRAPHSCOPE_INSIGHT')") + if value not in set(['node', 'service']): + raise ValueError("must be one of enum values ('node', 'service')") return value model_config = { @@ -69,7 +68,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ConnectionStatus from a JSON string""" + """Create an instance of GetAlertRuleResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -94,7 +93,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ConnectionStatus from a dict""" + """Create an instance of GetAlertRuleResponse from a dict""" if obj is None: return None @@ -102,8 +101,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "status": obj.get("status"), - "solution": obj.get("solution") + "name": obj.get("name"), + "severity": obj.get("severity"), + "metric_type": obj.get("metric_type"), + "conditions_description": obj.get("conditions_description"), + "frequency": obj.get("frequency"), + "enable": obj.get("enable"), + "id": obj.get("id") }) return _obj diff --git a/python/graphscope/flex/rest/models/get_edge_type.py b/python/graphscope/flex/rest/models/get_edge_type.py new file mode 100644 index 000000000000..f7ec28a51a02 --- /dev/null +++ b/python/graphscope/flex/rest/models/get_edge_type.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from graphscope.flex.rest.models.base_edge_type_vertex_type_pair_relations_inner import BaseEdgeTypeVertexTypePairRelationsInner +from graphscope.flex.rest.models.get_property_meta import GetPropertyMeta +from typing import Optional, Set +from typing_extensions import Self + +class GetEdgeType(BaseModel): + """ + GetEdgeType + """ # noqa: E501 + type_name: StrictStr + vertex_type_pair_relations: List[BaseEdgeTypeVertexTypePairRelationsInner] + directed: Optional[StrictBool] = None + primary_keys: Optional[List[StrictStr]] = None + type_id: StrictInt + properties: Optional[List[GetPropertyMeta]] = None + description: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type_name", "vertex_type_pair_relations", "directed", "primary_keys", "type_id", "properties", "description"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetEdgeType from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in vertex_type_pair_relations (list) + _items = [] + if self.vertex_type_pair_relations: + for _item in self.vertex_type_pair_relations: + if _item: + _items.append(_item.to_dict()) + _dict['vertex_type_pair_relations'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in properties (list) + _items = [] + if self.properties: + for _item in self.properties: + if _item: + _items.append(_item.to_dict()) + _dict['properties'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetEdgeType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type_name": obj.get("type_name"), + "vertex_type_pair_relations": [BaseEdgeTypeVertexTypePairRelationsInner.from_dict(_item) for _item in obj["vertex_type_pair_relations"]] if obj.get("vertex_type_pair_relations") is not None else None, + "directed": obj.get("directed"), + "primary_keys": obj.get("primary_keys"), + "type_id": obj.get("type_id"), + "properties": [GetPropertyMeta.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None, + "description": obj.get("description") + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/get_graph_response.py b/python/graphscope/flex/rest/models/get_graph_response.py new file mode 100644 index 000000000000..b85a36c906d9 --- /dev/null +++ b/python/graphscope/flex/rest/models/get_graph_response.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from graphscope.flex.rest.models.get_graph_schema_response import GetGraphSchemaResponse +from graphscope.flex.rest.models.get_stored_proc_response import GetStoredProcResponse +from typing import Optional, Set +from typing_extensions import Self + +class GetGraphResponse(BaseModel): + """ + GetGraphResponse + """ # noqa: E501 + id: StrictStr + name: StrictStr + description: Optional[StrictStr] = None + store_type: Optional[StrictStr] = None + creation_time: StrictStr + data_update_time: StrictStr + schema_update_time: StrictStr + stored_procedures: Optional[List[GetStoredProcResponse]] = None + var_schema: GetGraphSchemaResponse = Field(alias="schema") + __properties: ClassVar[List[str]] = ["id", "name", "description", "store_type", "creation_time", "data_update_time", "schema_update_time", "stored_procedures", "schema"] + + @field_validator('store_type') + def store_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['mutable_csr']): + raise ValueError("must be one of enum values ('mutable_csr')") + return value + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetGraphResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in stored_procedures (list) + _items = [] + if self.stored_procedures: + for _item in self.stored_procedures: + if _item: + _items.append(_item.to_dict()) + _dict['stored_procedures'] = _items + # override the default output from pydantic by calling `to_dict()` of var_schema + if self.var_schema: + _dict['schema'] = self.var_schema.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetGraphResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "description": obj.get("description"), + "store_type": obj.get("store_type"), + "creation_time": obj.get("creation_time"), + "data_update_time": obj.get("data_update_time"), + "schema_update_time": obj.get("schema_update_time"), + "stored_procedures": [GetStoredProcResponse.from_dict(_item) for _item in obj["stored_procedures"]] if obj.get("stored_procedures") is not None else None, + "schema": GetGraphSchemaResponse.from_dict(obj["schema"]) if obj.get("schema") is not None else None + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/model_schema.py b/python/graphscope/flex/rest/models/get_graph_schema_response.py similarity index 79% rename from python/graphscope/flex/rest/models/model_schema.py rename to python/graphscope/flex/rest/models/get_graph_schema_response.py index 83e09f2532c2..b77a86650d58 100644 --- a/python/graphscope/flex/rest/models/model_schema.py +++ b/python/graphscope/flex/rest/models/get_graph_schema_response.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,18 +19,18 @@ import json from pydantic import BaseModel -from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.edge_type import EdgeType -from graphscope.flex.rest.models.vertex_type import VertexType +from typing import Any, ClassVar, Dict, List +from graphscope.flex.rest.models.get_edge_type import GetEdgeType +from graphscope.flex.rest.models.get_vertex_type import GetVertexType from typing import Optional, Set from typing_extensions import Self -class ModelSchema(BaseModel): +class GetGraphSchemaResponse(BaseModel): """ - ModelSchema + GetGraphSchemaResponse """ # noqa: E501 - vertex_types: Optional[List[VertexType]] = None - edge_types: Optional[List[EdgeType]] = None + vertex_types: List[GetVertexType] + edge_types: List[GetEdgeType] __properties: ClassVar[List[str]] = ["vertex_types", "edge_types"] model_config = { @@ -51,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ModelSchema from a JSON string""" + """Create an instance of GetGraphSchemaResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -90,7 +90,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ModelSchema from a dict""" + """Create an instance of GetGraphSchemaResponse from a dict""" if obj is None: return None @@ -98,8 +98,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "vertex_types": [VertexType.from_dict(_item) for _item in obj["vertex_types"]] if obj.get("vertex_types") is not None else None, - "edge_types": [EdgeType.from_dict(_item) for _item in obj["edge_types"]] if obj.get("edge_types") is not None else None + "vertex_types": [GetVertexType.from_dict(_item) for _item in obj["vertex_types"]] if obj.get("vertex_types") is not None else None, + "edge_types": [GetEdgeType.from_dict(_item) for _item in obj["edge_types"]] if obj.get("edge_types") is not None else None }) return _obj diff --git a/python/graphscope/flex/rest/models/edge_mapping_source_vertex_mappings_inner.py b/python/graphscope/flex/rest/models/get_property_meta.py similarity index 67% rename from python/graphscope/flex/rest/models/edge_mapping_source_vertex_mappings_inner.py rename to python/graphscope/flex/rest/models/get_property_meta.py index 267c95d887bf..f1e4c5269056 100644 --- a/python/graphscope/flex/rest/models/edge_mapping_source_vertex_mappings_inner.py +++ b/python/graphscope/flex/rest/models/get_property_meta.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,18 +18,23 @@ import re # noqa: F401 import json -from pydantic import BaseModel +from pydantic import BaseModel, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.edge_mapping_source_vertex_mappings_inner_column import EdgeMappingSourceVertexMappingsInnerColumn +from graphscope.flex.rest.models.gs_data_type import GSDataType from typing import Optional, Set from typing_extensions import Self -class EdgeMappingSourceVertexMappingsInner(BaseModel): +class GetPropertyMeta(BaseModel): """ - Mapping column index to the primary key of source vertex + GetPropertyMeta """ # noqa: E501 - column: Optional[EdgeMappingSourceVertexMappingsInnerColumn] = None - __properties: ClassVar[List[str]] = ["column"] + property_name: StrictStr + property_type: GSDataType + nullable: Optional[StrictBool] = None + default_value: Optional[Dict[str, Any]] = None + description: Optional[StrictStr] = None + property_id: StrictInt + __properties: ClassVar[List[str]] = ["property_name", "property_type", "nullable", "default_value", "description", "property_id"] model_config = { "populate_by_name": True, @@ -49,7 +54,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of EdgeMappingSourceVertexMappingsInner from a JSON string""" + """Create an instance of GetPropertyMeta from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -70,14 +75,14 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of column - if self.column: - _dict['column'] = self.column.to_dict() + # override the default output from pydantic by calling `to_dict()` of property_type + if self.property_type: + _dict['property_type'] = self.property_type.to_dict() return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of EdgeMappingSourceVertexMappingsInner from a dict""" + """Create an instance of GetPropertyMeta from a dict""" if obj is None: return None @@ -85,7 +90,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "column": EdgeMappingSourceVertexMappingsInnerColumn.from_dict(obj["column"]) if obj.get("column") is not None else None + "property_name": obj.get("property_name"), + "property_type": GSDataType.from_dict(obj["property_type"]) if obj.get("property_type") is not None else None, + "nullable": obj.get("nullable"), + "default_value": obj.get("default_value"), + "description": obj.get("description"), + "property_id": obj.get("property_id") }) return _obj diff --git a/python/graphscope/flex/rest/models/procedure.py b/python/graphscope/flex/rest/models/get_stored_proc_response.py similarity index 75% rename from python/graphscope/flex/rest/models/procedure.py rename to python/graphscope/flex/rest/models/get_stored_proc_response.py index 4f69cdc229b8..cf483135b0c6 100644 --- a/python/graphscope/flex/rest/models/procedure.py +++ b/python/graphscope/flex/rest/models/get_stored_proc_response.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -20,31 +20,29 @@ from pydantic import BaseModel, StrictBool, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.procedure_params_inner import ProcedureParamsInner +from graphscope.flex.rest.models.parameter import Parameter from typing import Optional, Set from typing_extensions import Self -class Procedure(BaseModel): +class GetStoredProcResponse(BaseModel): """ - Procedure + GetStoredProcResponse """ # noqa: E501 - name: Optional[StrictStr] = None - bound_graph: Optional[StrictStr] = None + name: StrictStr description: Optional[StrictStr] = None - type: Optional[StrictStr] = None - query: Optional[StrictStr] = None - enable: Optional[StrictBool] = None - runnable: Optional[StrictBool] = None - params: Optional[List[ProcedureParamsInner]] = None - returns: Optional[List[ProcedureParamsInner]] = None - __properties: ClassVar[List[str]] = ["name", "bound_graph", "description", "type", "query", "enable", "runnable", "params", "returns"] + type: StrictStr + query: StrictStr + id: StrictStr + library: StrictStr + params: List[Parameter] + returns: List[Parameter] + bound_graph: StrictStr + runnable: StrictBool + __properties: ClassVar[List[str]] = ["name", "description", "type", "query", "id", "library", "params", "returns", "bound_graph", "runnable"] @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['cpp', 'cypher']): raise ValueError("must be one of enum values ('cpp', 'cypher')") return value @@ -67,7 +65,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of Procedure from a JSON string""" + """Create an instance of GetStoredProcResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -106,7 +104,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of Procedure from a dict""" + """Create an instance of GetStoredProcResponse from a dict""" if obj is None: return None @@ -115,14 +113,15 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "name": obj.get("name"), - "bound_graph": obj.get("bound_graph"), "description": obj.get("description"), "type": obj.get("type"), "query": obj.get("query"), - "enable": obj.get("enable"), - "runnable": obj.get("runnable"), - "params": [ProcedureParamsInner.from_dict(_item) for _item in obj["params"]] if obj.get("params") is not None else None, - "returns": [ProcedureParamsInner.from_dict(_item) for _item in obj["returns"]] if obj.get("returns") is not None else None + "id": obj.get("id"), + "library": obj.get("library"), + "params": [Parameter.from_dict(_item) for _item in obj["params"]] if obj.get("params") is not None else None, + "returns": [Parameter.from_dict(_item) for _item in obj["returns"]] if obj.get("returns") is not None else None, + "bound_graph": obj.get("bound_graph"), + "runnable": obj.get("runnable") }) return _obj diff --git a/python/graphscope/flex/rest/models/get_vertex_type.py b/python/graphscope/flex/rest/models/get_vertex_type.py new file mode 100644 index 000000000000..3dd188016371 --- /dev/null +++ b/python/graphscope/flex/rest/models/get_vertex_type.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from graphscope.flex.rest.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams +from graphscope.flex.rest.models.get_property_meta import GetPropertyMeta +from typing import Optional, Set +from typing_extensions import Self + +class GetVertexType(BaseModel): + """ + GetVertexType + """ # noqa: E501 + type_name: StrictStr + primary_keys: List[StrictStr] + x_csr_params: Optional[BaseVertexTypeXCsrParams] = None + type_id: StrictInt + properties: List[GetPropertyMeta] + description: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type_name", "primary_keys", "x_csr_params", "type_id", "properties", "description"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetVertexType from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of x_csr_params + if self.x_csr_params: + _dict['x_csr_params'] = self.x_csr_params.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in properties (list) + _items = [] + if self.properties: + for _item in self.properties: + if _item: + _items.append(_item.to_dict()) + _dict['properties'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetVertexType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type_name": obj.get("type_name"), + "primary_keys": obj.get("primary_keys"), + "x_csr_params": BaseVertexTypeXCsrParams.from_dict(obj["x_csr_params"]) if obj.get("x_csr_params") is not None else None, + "type_id": obj.get("type_id"), + "properties": [GetPropertyMeta.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None, + "description": obj.get("description") + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/groot_graph_gremlin_interface.py b/python/graphscope/flex/rest/models/groot_graph_gremlin_interface.py deleted file mode 100644 index 05cbf433bd31..000000000000 --- a/python/graphscope/flex/rest/models/groot_graph_gremlin_interface.py +++ /dev/null @@ -1,94 +0,0 @@ -# coding: utf-8 - -""" - GraphScope FLEX HTTP SERVICE API - - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class GrootGraphGremlinInterface(BaseModel): - """ - GrootGraphGremlinInterface - """ # noqa: E501 - gremlin_endpoint: Optional[StrictStr] = None - grpc_endpoint: Optional[StrictStr] = None - username: Optional[StrictStr] = None - password: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["gremlin_endpoint", "grpc_endpoint", "username", "password"] - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GrootGraphGremlinInterface from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GrootGraphGremlinInterface from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "gremlin_endpoint": obj.get("gremlin_endpoint"), - "grpc_endpoint": obj.get("grpc_endpoint"), - "username": obj.get("username"), - "password": obj.get("password") - }) - return _obj - - diff --git a/python/graphscope/flex/rest/models/gs_data_type.py b/python/graphscope/flex/rest/models/gs_data_type.py new file mode 100644 index 000000000000..afb0721dee58 --- /dev/null +++ b/python/graphscope/flex/rest/models/gs_data_type.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from graphscope.flex.rest.models.primitive_type import PrimitiveType +from graphscope.flex.rest.models.string_type import StringType +from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self + +GSDATATYPE_ONE_OF_SCHEMAS = ["PrimitiveType", "StringType"] + +class GSDataType(BaseModel): + """ + GSDataType + """ + # data type: PrimitiveType + oneof_schema_1_validator: Optional[PrimitiveType] = None + # data type: StringType + oneof_schema_2_validator: Optional[StringType] = None + actual_instance: Optional[Union[PrimitiveType, StringType]] = None + one_of_schemas: List[str] = Field(default=Literal["PrimitiveType", "StringType"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = GSDataType.model_construct() + error_messages = [] + match = 0 + # validate data type: PrimitiveType + if not isinstance(v, PrimitiveType): + error_messages.append(f"Error! Input type `{type(v)}` is not `PrimitiveType`") + else: + match += 1 + # validate data type: StringType + if not isinstance(v, StringType): + error_messages.append(f"Error! Input type `{type(v)}` is not `StringType`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in GSDataType with oneOf schemas: PrimitiveType, StringType. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in GSDataType with oneOf schemas: PrimitiveType, StringType. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into PrimitiveType + try: + instance.actual_instance = PrimitiveType.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into StringType + try: + instance.actual_instance = StringType.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into GSDataType with oneOf schemas: PrimitiveType, StringType. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into GSDataType with oneOf schemas: PrimitiveType, StringType. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], PrimitiveType, StringType]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/python/graphscope/flex/rest/models/job_status.py b/python/graphscope/flex/rest/models/job_status.py index 15001b11fc7c..bbdbc98f0bbc 100644 --- a/python/graphscope/flex/rest/models/job_status.py +++ b/python/graphscope/flex/rest/models/job_status.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -27,21 +27,18 @@ class JobStatus(BaseModel): """ JobStatus """ # noqa: E501 - job_id: Optional[StrictStr] = None - type: Optional[StrictStr] = None - status: Optional[StrictStr] = None + id: StrictStr + type: StrictStr + status: StrictStr start_time: Optional[StrictStr] = None end_time: Optional[StrictStr] = None - log: Optional[StrictStr] = Field(default=None, description="URL or log string") + log: Optional[StrictStr] = Field(default=None, description="logview URL or log string") detail: Optional[Dict[str, Any]] = None - __properties: ClassVar[List[str]] = ["job_id", "type", "status", "start_time", "end_time", "log", "detail"] + __properties: ClassVar[List[str]] = ["id", "type", "status", "start_time", "end_time", "log", "detail"] @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['RUNNING', 'SUCCESS', 'FAILED', 'CANCELLED', 'WAITING']): raise ValueError("must be one of enum values ('RUNNING', 'SUCCESS', 'FAILED', 'CANCELLED', 'WAITING')") return value @@ -97,7 +94,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "job_id": obj.get("job_id"), + "id": obj.get("id"), "type": obj.get("type"), "status": obj.get("status"), "start_time": obj.get("start_time"), diff --git a/python/graphscope/flex/rest/models/groot_edge_type_relations_inner.py b/python/graphscope/flex/rest/models/long_text.py similarity index 81% rename from python/graphscope/flex/rest/models/groot_edge_type_relations_inner.py rename to python/graphscope/flex/rest/models/long_text.py index fcdc83aa2235..51d739eab46e 100644 --- a/python/graphscope/flex/rest/models/groot_edge_type_relations_inner.py +++ b/python/graphscope/flex/rest/models/long_text.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -23,13 +23,12 @@ from typing import Optional, Set from typing_extensions import Self -class GrootEdgeTypeRelationsInner(BaseModel): +class LongText(BaseModel): """ - GrootEdgeTypeRelationsInner + LongText """ # noqa: E501 - src_label: Optional[StrictStr] = None - dst_label: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["src_label", "dst_label"] + long_text: Optional[StrictStr] + __properties: ClassVar[List[str]] = ["long_text"] model_config = { "populate_by_name": True, @@ -49,7 +48,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GrootEdgeTypeRelationsInner from a JSON string""" + """Create an instance of LongText from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -70,11 +69,16 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # set to None if long_text (nullable) is None + # and model_fields_set contains the field + if self.long_text is None and "long_text" in self.model_fields_set: + _dict['long_text'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GrootEdgeTypeRelationsInner from a dict""" + """Create an instance of LongText from a dict""" if obj is None: return None @@ -82,8 +86,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "src_label": obj.get("src_label"), - "dst_label": obj.get("dst_label") + "long_text": obj.get("long_text") }) return _obj diff --git a/python/graphscope/flex/rest/models/node_status.py b/python/graphscope/flex/rest/models/node_status.py index b1bb1c6b6634..73170b01af4a 100644 --- a/python/graphscope/flex/rest/models/node_status.py +++ b/python/graphscope/flex/rest/models/node_status.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,7 +19,7 @@ import json from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self @@ -27,11 +27,11 @@ class NodeStatus(BaseModel): """ NodeStatus """ # noqa: E501 - node: Optional[StrictStr] = None - cpu_usage: Optional[Union[StrictFloat, StrictInt]] = None - memory_usage: Optional[Union[StrictFloat, StrictInt]] = None - disk_usage: Optional[Union[StrictFloat, StrictInt]] = None - __properties: ClassVar[List[str]] = ["node", "cpu_usage", "memory_usage", "disk_usage"] + name: StrictStr + cpu_usage: Union[StrictFloat, StrictInt] + memory_usage: Union[StrictFloat, StrictInt] + disk_usage: Union[StrictFloat, StrictInt] + __properties: ClassVar[List[str]] = ["name", "cpu_usage", "memory_usage", "disk_usage"] model_config = { "populate_by_name": True, @@ -84,7 +84,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "node": obj.get("node"), + "name": obj.get("name"), "cpu_usage": obj.get("cpu_usage"), "memory_usage": obj.get("memory_usage"), "disk_usage": obj.get("disk_usage") diff --git a/python/graphscope/flex/rest/models/parameter.py b/python/graphscope/flex/rest/models/parameter.py new file mode 100644 index 000000000000..c8cbd43939e7 --- /dev/null +++ b/python/graphscope/flex/rest/models/parameter.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictStr +from typing import Any, ClassVar, Dict, List +from graphscope.flex.rest.models.gs_data_type import GSDataType +from typing import Optional, Set +from typing_extensions import Self + +class Parameter(BaseModel): + """ + Parameter + """ # noqa: E501 + name: StrictStr + type: GSDataType + __properties: ClassVar[List[str]] = ["name", "type"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Parameter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of type + if self.type: + _dict['type'] = self.type.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Parameter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "type": GSDataType.from_dict(obj["type"]) if obj.get("type") is not None else None + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/property_property_type.py b/python/graphscope/flex/rest/models/primitive_type.py similarity index 80% rename from python/graphscope/flex/rest/models/property_property_type.py rename to python/graphscope/flex/rest/models/primitive_type.py index 72cd19b367e3..e1302b46a94e 100644 --- a/python/graphscope/flex/rest/models/property_property_type.py +++ b/python/graphscope/flex/rest/models/primitive_type.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,25 +19,22 @@ import json from pydantic import BaseModel, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self -class PropertyPropertyType(BaseModel): +class PrimitiveType(BaseModel): """ - PropertyPropertyType + PrimitiveType """ # noqa: E501 - primitive_type: Optional[StrictStr] = None + primitive_type: StrictStr __properties: ClassVar[List[str]] = ["primitive_type"] @field_validator('primitive_type') def primitive_type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - - if value not in set(['DT_DOUBLE', 'DT_STRING', 'DT_SIGNED_INT32', 'DT_SIGNED_INT64', 'DT_DATE32']): - raise ValueError("must be one of enum values ('DT_DOUBLE', 'DT_STRING', 'DT_SIGNED_INT32', 'DT_SIGNED_INT64', 'DT_DATE32')") + if value not in set(['DT_SIGNED_INT32', 'DT_UNSIGNED_INT32', 'DT_SIGNED_INT64', 'DT_UNSIGNED_INT64', 'DT_BOOL', 'DT_FLOAT', 'DT_DOUBLE']): + raise ValueError("must be one of enum values ('DT_SIGNED_INT32', 'DT_UNSIGNED_INT32', 'DT_SIGNED_INT64', 'DT_UNSIGNED_INT64', 'DT_BOOL', 'DT_FLOAT', 'DT_DOUBLE')") return value model_config = { @@ -58,7 +55,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of PropertyPropertyType from a JSON string""" + """Create an instance of PrimitiveType from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -83,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of PropertyPropertyType from a dict""" + """Create an instance of PrimitiveType from a dict""" if obj is None: return None diff --git a/python/graphscope/flex/rest/models/deployment_info.py b/python/graphscope/flex/rest/models/running_deployment_info.py similarity index 61% rename from python/graphscope/flex/rest/models/deployment_info.py rename to python/graphscope/flex/rest/models/running_deployment_info.py index d95b41676d1d..953c59e968f9 100644 --- a/python/graphscope/flex/rest/models/deployment_info.py +++ b/python/graphscope/flex/rest/models/running_deployment_info.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,41 +19,49 @@ import json from pydantic import BaseModel, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.deployment_info_graphs_info_value import DeploymentInfoGraphsInfoValue +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self -class DeploymentInfo(BaseModel): +class RunningDeploymentInfo(BaseModel): """ - DeploymentInfo + RunningDeploymentInfo """ # noqa: E501 - name: Optional[StrictStr] = None - cluster_type: Optional[StrictStr] = None - version: Optional[StrictStr] = None - solution: Optional[StrictStr] = None - creation_time: Optional[StrictStr] = None - graphs_info: Optional[Dict[str, DeploymentInfoGraphsInfoValue]] = None - __properties: ClassVar[List[str]] = ["name", "cluster_type", "version", "solution", "creation_time", "graphs_info"] + instance_name: StrictStr + cluster_type: StrictStr + version: StrictStr + creation_time: StrictStr + frontend: StrictStr + engine: StrictStr + storage: StrictStr + __properties: ClassVar[List[str]] = ["instance_name", "cluster_type", "version", "creation_time", "frontend", "engine", "storage"] @field_validator('cluster_type') def cluster_type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - if value not in set(['HOSTS', 'KUBERNETES']): raise ValueError("must be one of enum values ('HOSTS', 'KUBERNETES')") return value - @field_validator('solution') - def solution_validate_enum(cls, value): + @field_validator('frontend') + def frontend_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Cypher/Gremlin', 'AnalyticalApps']): + raise ValueError("must be one of enum values ('Cypher/Gremlin', 'AnalyticalApps')") + return value + + @field_validator('engine') + def engine_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value + if value not in set(['Hiactor', 'Gaia']): + raise ValueError("must be one of enum values ('Hiactor', 'Gaia')") + return value - if value not in set(['INTERACTIVE', 'GRAPHSCOPE_INSIGHT']): - raise ValueError("must be one of enum values ('INTERACTIVE', 'GRAPHSCOPE_INSIGHT')") + @field_validator('storage') + def storage_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['MutableCSR']): + raise ValueError("must be one of enum values ('MutableCSR')") return value model_config = { @@ -74,7 +82,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of DeploymentInfo from a JSON string""" + """Create an instance of RunningDeploymentInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -95,18 +103,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each value in graphs_info (dict) - _field_dict = {} - if self.graphs_info: - for _key in self.graphs_info: - if self.graphs_info[_key]: - _field_dict[_key] = self.graphs_info[_key].to_dict() - _dict['graphs_info'] = _field_dict return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of DeploymentInfo from a dict""" + """Create an instance of RunningDeploymentInfo from a dict""" if obj is None: return None @@ -114,17 +115,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "name": obj.get("name"), + "instance_name": obj.get("instance_name"), "cluster_type": obj.get("cluster_type"), "version": obj.get("version"), - "solution": obj.get("solution"), "creation_time": obj.get("creation_time"), - "graphs_info": dict( - (_k, DeploymentInfoGraphsInfoValue.from_dict(_v)) - for _k, _v in obj["graphs_info"].items() - ) - if obj.get("graphs_info") is not None - else None + "frontend": obj.get("frontend"), + "engine": obj.get("engine"), + "storage": obj.get("storage") }) return _obj diff --git a/python/graphscope/flex/rest/models/vertex_data_source.py b/python/graphscope/flex/rest/models/running_deployment_status.py similarity index 67% rename from python/graphscope/flex/rest/models/vertex_data_source.py rename to python/graphscope/flex/rest/models/running_deployment_status.py index f938fe876fdc..b6cf0ba69bad 100644 --- a/python/graphscope/flex/rest/models/vertex_data_source.py +++ b/python/graphscope/flex/rest/models/running_deployment_status.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,28 +19,24 @@ import json from pydantic import BaseModel, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List +from graphscope.flex.rest.models.running_deployment_status_nodes_inner import RunningDeploymentStatusNodesInner from typing import Optional, Set from typing_extensions import Self -class VertexDataSource(BaseModel): +class RunningDeploymentStatus(BaseModel): """ - VertexDataSource + RunningDeploymentStatus """ # noqa: E501 - data_source: Optional[StrictStr] = None - type_name: Optional[StrictStr] = None - location: Optional[StrictStr] = None - property_mapping: Optional[Dict[str, Any]] = None - __properties: ClassVar[List[str]] = ["data_source", "type_name", "location", "property_mapping"] - - @field_validator('data_source') - def data_source_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value + cluster_type: StrictStr + nodes: List[RunningDeploymentStatusNodesInner] + __properties: ClassVar[List[str]] = ["cluster_type", "nodes"] - if value not in set(['ODPS', 'FILE']): - raise ValueError("must be one of enum values ('ODPS', 'FILE')") + @field_validator('cluster_type') + def cluster_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['HOSTS', 'KUBERNETES']): + raise ValueError("must be one of enum values ('HOSTS', 'KUBERNETES')") return value model_config = { @@ -61,7 +57,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of VertexDataSource from a JSON string""" + """Create an instance of RunningDeploymentStatus from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -82,11 +78,18 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in nodes (list) + _items = [] + if self.nodes: + for _item in self.nodes: + if _item: + _items.append(_item.to_dict()) + _dict['nodes'] = _items return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of VertexDataSource from a dict""" + """Create an instance of RunningDeploymentStatus from a dict""" if obj is None: return None @@ -94,10 +97,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "data_source": obj.get("data_source"), - "type_name": obj.get("type_name"), - "location": obj.get("location"), - "property_mapping": obj.get("property_mapping") + "cluster_type": obj.get("cluster_type"), + "nodes": [RunningDeploymentStatusNodesInner.from_dict(_item) for _item in obj["nodes"]] if obj.get("nodes") is not None else None }) return _obj diff --git a/python/graphscope/flex/rest/models/running_deployment_status_nodes_inner.py b/python/graphscope/flex/rest/models/running_deployment_status_nodes_inner.py new file mode 100644 index 000000000000..1d5e90e0b995 --- /dev/null +++ b/python/graphscope/flex/rest/models/running_deployment_status_nodes_inner.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from graphscope.flex.rest.models.node_status import NodeStatus +from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self + +RUNNINGDEPLOYMENTSTATUSNODESINNER_ONE_OF_SCHEMAS = ["NodeStatus"] + +class RunningDeploymentStatusNodesInner(BaseModel): + """ + RunningDeploymentStatusNodesInner + """ + # data type: NodeStatus + oneof_schema_1_validator: Optional[NodeStatus] = None + actual_instance: Optional[Union[NodeStatus]] = None + one_of_schemas: List[str] = Field(default=Literal["NodeStatus"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = RunningDeploymentStatusNodesInner.model_construct() + error_messages = [] + match = 0 + # validate data type: NodeStatus + if not isinstance(v, NodeStatus): + error_messages.append(f"Error! Input type `{type(v)}` is not `NodeStatus`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in RunningDeploymentStatusNodesInner with oneOf schemas: NodeStatus. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in RunningDeploymentStatusNodesInner with oneOf schemas: NodeStatus. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into NodeStatus + try: + instance.actual_instance = NodeStatus.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into RunningDeploymentStatusNodesInner with oneOf schemas: NodeStatus. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into RunningDeploymentStatusNodesInner with oneOf schemas: NodeStatus. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], NodeStatus]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/python/graphscope/flex/rest/models/schema_mapping.py b/python/graphscope/flex/rest/models/schema_mapping.py index e84c4fbb047e..48db48043733 100644 --- a/python/graphscope/flex/rest/models/schema_mapping.py +++ b/python/graphscope/flex/rest/models/schema_mapping.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,10 +18,9 @@ import re # noqa: F401 import json -from pydantic import BaseModel, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel +from typing import Any, ClassVar, Dict, List from graphscope.flex.rest.models.edge_mapping import EdgeMapping -from graphscope.flex.rest.models.schema_mapping_loading_config import SchemaMappingLoadingConfig from graphscope.flex.rest.models.vertex_mapping import VertexMapping from typing import Optional, Set from typing_extensions import Self @@ -30,11 +29,9 @@ class SchemaMapping(BaseModel): """ SchemaMapping """ # noqa: E501 - graph: Optional[StrictStr] = None - loading_config: Optional[SchemaMappingLoadingConfig] = None - vertex_mappings: Optional[List[VertexMapping]] = None - edge_mappings: Optional[List[EdgeMapping]] = None - __properties: ClassVar[List[str]] = ["graph", "loading_config", "vertex_mappings", "edge_mappings"] + vertex_mappings: List[VertexMapping] + edge_mappings: List[EdgeMapping] + __properties: ClassVar[List[str]] = ["vertex_mappings", "edge_mappings"] model_config = { "populate_by_name": True, @@ -75,9 +72,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of loading_config - if self.loading_config: - _dict['loading_config'] = self.loading_config.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in vertex_mappings (list) _items = [] if self.vertex_mappings: @@ -104,8 +98,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "graph": obj.get("graph"), - "loading_config": SchemaMappingLoadingConfig.from_dict(obj["loading_config"]) if obj.get("loading_config") is not None else None, "vertex_mappings": [VertexMapping.from_dict(_item) for _item in obj["vertex_mappings"]] if obj.get("vertex_mappings") is not None else None, "edge_mappings": [EdgeMapping.from_dict(_item) for _item in obj["edge_mappings"]] if obj.get("edge_mappings") is not None else None }) diff --git a/python/graphscope/flex/rest/models/service_status.py b/python/graphscope/flex/rest/models/service_status.py index a72e8b08e19e..9f0bc273786c 100644 --- a/python/graphscope/flex/rest/models/service_status.py +++ b/python/graphscope/flex/rest/models/service_status.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from graphscope.flex.rest.models.service_status_sdk_endpoints import ServiceStatusSdkEndpoints from typing import Optional, Set @@ -28,10 +28,18 @@ class ServiceStatus(BaseModel): """ ServiceStatus """ # noqa: E501 - status: Optional[StrictStr] = None - graph_name: Optional[StrictStr] = Field(default=None, description="which graph is serving now") + graph_id: StrictStr + status: StrictStr sdk_endpoints: Optional[ServiceStatusSdkEndpoints] = None - __properties: ClassVar[List[str]] = ["status", "graph_name", "sdk_endpoints"] + start_time: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["graph_id", "status", "sdk_endpoints", "start_time"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Running', 'Stopped']): + raise ValueError("must be one of enum values ('Running', 'Stopped')") + return value model_config = { "populate_by_name": True, @@ -87,9 +95,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "graph_id": obj.get("graph_id"), "status": obj.get("status"), - "graph_name": obj.get("graph_name"), - "sdk_endpoints": ServiceStatusSdkEndpoints.from_dict(obj["sdk_endpoints"]) if obj.get("sdk_endpoints") is not None else None + "sdk_endpoints": ServiceStatusSdkEndpoints.from_dict(obj["sdk_endpoints"]) if obj.get("sdk_endpoints") is not None else None, + "start_time": obj.get("start_time") }) return _obj diff --git a/python/graphscope/flex/rest/models/service_status_sdk_endpoints.py b/python/graphscope/flex/rest/models/service_status_sdk_endpoints.py index a37eb9309564..f811522ca475 100644 --- a/python/graphscope/flex/rest/models/service_status_sdk_endpoints.py +++ b/python/graphscope/flex/rest/models/service_status_sdk_endpoints.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/python/graphscope/flex/rest/models/start_service_request.py b/python/graphscope/flex/rest/models/start_service_request.py index 901009e11692..ad3127b9c09b 100644 --- a/python/graphscope/flex/rest/models/start_service_request.py +++ b/python/graphscope/flex/rest/models/start_service_request.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -27,8 +27,8 @@ class StartServiceRequest(BaseModel): """ StartServiceRequest """ # noqa: E501 - graph_name: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["graph_name"] + graph_id: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["graph_id"] model_config = { "populate_by_name": True, @@ -81,7 +81,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "graph_name": obj.get("graph_name") + "graph_id": obj.get("graph_id") }) return _obj diff --git a/python/graphscope/flex/rest/models/groot_graph.py b/python/graphscope/flex/rest/models/stored_procedure_meta.py similarity index 61% rename from python/graphscope/flex/rest/models/groot_graph.py rename to python/graphscope/flex/rest/models/stored_procedure_meta.py index 890844de4ca9..e847f327a15b 100644 --- a/python/graphscope/flex/rest/models/groot_graph.py +++ b/python/graphscope/flex/rest/models/stored_procedure_meta.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -18,33 +18,31 @@ import re # noqa: F401 import json -from pydantic import BaseModel, Field, StrictBool, StrictStr, field_validator +from pydantic import BaseModel, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.groot_graph_gremlin_interface import GrootGraphGremlinInterface -from graphscope.flex.rest.models.groot_schema import GrootSchema +from graphscope.flex.rest.models.parameter import Parameter from typing import Optional, Set from typing_extensions import Self -class GrootGraph(BaseModel): +class StoredProcedureMeta(BaseModel): """ - GrootGraph + StoredProcedureMeta """ # noqa: E501 - name: Optional[StrictStr] = None - type: Optional[StrictStr] = None - directed: Optional[StrictBool] = None - creation_time: Optional[StrictStr] = None - var_schema: Optional[GrootSchema] = Field(default=None, alias="schema") - gremlin_interface: Optional[GrootGraphGremlinInterface] = None - __properties: ClassVar[List[str]] = ["name", "type", "directed", "creation_time", "schema", "gremlin_interface"] + name: StrictStr + description: Optional[StrictStr] = None + type: StrictStr + query: StrictStr + id: StrictStr + library: StrictStr + params: List[Parameter] + returns: List[Parameter] + __properties: ClassVar[List[str]] = ["name", "description", "type", "query", "id", "library", "params", "returns"] @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - - if value not in set(['GrootGraph']): - raise ValueError("must be one of enum values ('GrootGraph')") + if value not in set(['cpp', 'cypher']): + raise ValueError("must be one of enum values ('cpp', 'cypher')") return value model_config = { @@ -65,7 +63,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of GrootGraph from a JSON string""" + """Create an instance of StoredProcedureMeta from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -86,17 +84,25 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of var_schema - if self.var_schema: - _dict['schema'] = self.var_schema.to_dict() - # override the default output from pydantic by calling `to_dict()` of gremlin_interface - if self.gremlin_interface: - _dict['gremlin_interface'] = self.gremlin_interface.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in params (list) + _items = [] + if self.params: + for _item in self.params: + if _item: + _items.append(_item.to_dict()) + _dict['params'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in returns (list) + _items = [] + if self.returns: + for _item in self.returns: + if _item: + _items.append(_item.to_dict()) + _dict['returns'] = _items return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of GrootGraph from a dict""" + """Create an instance of StoredProcedureMeta from a dict""" if obj is None: return None @@ -105,11 +111,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "name": obj.get("name"), + "description": obj.get("description"), "type": obj.get("type"), - "directed": obj.get("directed"), - "creation_time": obj.get("creation_time"), - "schema": GrootSchema.from_dict(obj["schema"]) if obj.get("schema") is not None else None, - "gremlin_interface": GrootGraphGremlinInterface.from_dict(obj["gremlin_interface"]) if obj.get("gremlin_interface") is not None else None + "query": obj.get("query"), + "id": obj.get("id"), + "library": obj.get("library"), + "params": [Parameter.from_dict(_item) for _item in obj["params"]] if obj.get("params") is not None else None, + "returns": [Parameter.from_dict(_item) for _item in obj["returns"]] if obj.get("returns") is not None else None }) return _obj diff --git a/python/graphscope/flex/rest/models/string_type.py b/python/graphscope/flex/rest/models/string_type.py new file mode 100644 index 000000000000..3c44c4e3cbec --- /dev/null +++ b/python/graphscope/flex/rest/models/string_type.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel +from typing import Any, ClassVar, Dict, List +from graphscope.flex.rest.models.string_type_string import StringTypeString +from typing import Optional, Set +from typing_extensions import Self + +class StringType(BaseModel): + """ + StringType + """ # noqa: E501 + string: StringTypeString + __properties: ClassVar[List[str]] = ["string"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StringType from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of string + if self.string: + _dict['string'] = self.string.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StringType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "string": StringTypeString.from_dict(obj["string"]) if obj.get("string") is not None else None + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/string_type_string.py b/python/graphscope/flex/rest/models/string_type_string.py new file mode 100644 index 000000000000..8ed931db3b49 --- /dev/null +++ b/python/graphscope/flex/rest/models/string_type_string.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from graphscope.flex.rest.models.long_text import LongText +from pydantic import StrictStr, Field +from typing import Union, List, Optional, Dict +from typing_extensions import Literal, Self + +STRINGTYPESTRING_ONE_OF_SCHEMAS = ["LongText"] + +class StringTypeString(BaseModel): + """ + StringTypeString + """ + # data type: LongText + oneof_schema_1_validator: Optional[LongText] = None + actual_instance: Optional[Union[LongText]] = None + one_of_schemas: List[str] = Field(default=Literal["LongText"]) + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = StringTypeString.model_construct() + error_messages = [] + match = 0 + # validate data type: LongText + if not isinstance(v, LongText): + error_messages.append(f"Error! Input type `{type(v)}` is not `LongText`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in StringTypeString with oneOf schemas: LongText. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in StringTypeString with oneOf schemas: LongText. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into LongText + try: + instance.actual_instance = LongText.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into StringTypeString with oneOf schemas: LongText. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into StringTypeString with oneOf schemas: LongText. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], LongText]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/python/graphscope/flex/rest/models/schema_mapping_loading_config_data_source.py b/python/graphscope/flex/rest/models/update_alert_message_status_request.py similarity index 76% rename from python/graphscope/flex/rest/models/schema_mapping_loading_config_data_source.py rename to python/graphscope/flex/rest/models/update_alert_message_status_request.py index d792e3eb5409..56dd5eef2682 100644 --- a/python/graphscope/flex/rest/models/schema_mapping_loading_config_data_source.py +++ b/python/graphscope/flex/rest/models/update_alert_message_status_request.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,25 +19,23 @@ import json from pydantic import BaseModel, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self -class SchemaMappingLoadingConfigDataSource(BaseModel): +class UpdateAlertMessageStatusRequest(BaseModel): """ - SchemaMappingLoadingConfigDataSource + UpdateAlertMessageStatusRequest """ # noqa: E501 - scheme: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["scheme"] + message_ids: List[StrictStr] + status: StrictStr + __properties: ClassVar[List[str]] = ["message_ids", "status"] - @field_validator('scheme') - def scheme_validate_enum(cls, value): + @field_validator('status') + def status_validate_enum(cls, value): """Validates the enum""" - if value is None: - return value - - if value not in set(['file']): - raise ValueError("must be one of enum values ('file')") + if value not in set(['unsolved', 'solved', 'dealing']): + raise ValueError("must be one of enum values ('unsolved', 'solved', 'dealing')") return value model_config = { @@ -58,7 +56,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of SchemaMappingLoadingConfigDataSource from a JSON string""" + """Create an instance of UpdateAlertMessageStatusRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -83,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of SchemaMappingLoadingConfigDataSource from a dict""" + """Create an instance of UpdateAlertMessageStatusRequest from a dict""" if obj is None: return None @@ -91,7 +89,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "scheme": obj.get("scheme") + "message_ids": obj.get("message_ids"), + "status": obj.get("status") }) return _obj diff --git a/python/graphscope/flex/rest/models/update_alert_messages_request.py b/python/graphscope/flex/rest/models/update_alert_messages_request.py deleted file mode 100644 index b7c3b38ecf9a..000000000000 --- a/python/graphscope/flex/rest/models/update_alert_messages_request.py +++ /dev/null @@ -1,110 +0,0 @@ -# coding: utf-8 - -""" - GraphScope FLEX HTTP SERVICE API - - This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - - The version of the OpenAPI document: 0.9.1 - Contact: graphscope@alibaba-inc.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, Field, StrictBool, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional -from graphscope.flex.rest.models.alert_message import AlertMessage -from typing import Optional, Set -from typing_extensions import Self - -class UpdateAlertMessagesRequest(BaseModel): - """ - UpdateAlertMessagesRequest - """ # noqa: E501 - messages: Optional[List[AlertMessage]] = None - batch_status: Optional[StrictStr] = Field(default=None, description="Override the status of each message") - batch_delete: Optional[StrictBool] = Field(default=False, description="True will delete all the messages in request body") - __properties: ClassVar[List[str]] = ["messages", "batch_status", "batch_delete"] - - @field_validator('batch_status') - def batch_status_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set(['solved', 'unsolved', 'dealing']): - raise ValueError("must be one of enum values ('solved', 'unsolved', 'dealing')") - return value - - model_config = { - "populate_by_name": True, - "validate_assignment": True, - "protected_namespaces": (), - } - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of UpdateAlertMessagesRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each item in messages (list) - _items = [] - if self.messages: - for _item in self.messages: - if _item: - _items.append(_item.to_dict()) - _dict['messages'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of UpdateAlertMessagesRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "messages": [AlertMessage.from_dict(_item) for _item in obj["messages"]] if obj.get("messages") is not None else None, - "batch_status": obj.get("batch_status"), - "batch_delete": obj.get("batch_delete") if obj.get("batch_delete") is not None else False - }) - return _obj - - diff --git a/python/graphscope/flex/rest/models/update_stored_proc_request.py b/python/graphscope/flex/rest/models/update_stored_proc_request.py new file mode 100644 index 000000000000..f69de27952f5 --- /dev/null +++ b/python/graphscope/flex/rest/models/update_stored_proc_request.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class UpdateStoredProcRequest(BaseModel): + """ + UpdateStoredProcRequest + """ # noqa: E501 + description: StrictStr + __properties: ClassVar[List[str]] = ["description"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateStoredProcRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateStoredProcRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "description": obj.get("description") + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/upload_file_response.py b/python/graphscope/flex/rest/models/upload_file_response.py new file mode 100644 index 000000000000..5d90a08bef55 --- /dev/null +++ b/python/graphscope/flex/rest/models/upload_file_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + GraphScope FLEX HTTP SERVICE API + + This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) + + The version of the OpenAPI document: 1.0.0 + Contact: graphscope@alibaba-inc.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class UploadFileResponse(BaseModel): + """ + UploadFileResponse + """ # noqa: E501 + file_path: StrictStr + __properties: ClassVar[List[str]] = ["file_path"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True, + "protected_namespaces": (), + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UploadFileResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UploadFileResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "file_path": obj.get("file_path") + }) + return _obj + + diff --git a/python/graphscope/flex/rest/models/vertex_mapping.py b/python/graphscope/flex/rest/models/vertex_mapping.py index 7dc951a6813f..1bd01e7ed882 100644 --- a/python/graphscope/flex/rest/models/vertex_mapping.py +++ b/python/graphscope/flex/rest/models/vertex_mapping.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) @@ -19,7 +19,7 @@ import json from pydantic import BaseModel, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from graphscope.flex.rest.models.column_mapping import ColumnMapping from typing import Optional, Set from typing_extensions import Self @@ -28,9 +28,9 @@ class VertexMapping(BaseModel): """ VertexMapping """ # noqa: E501 - type_name: Optional[StrictStr] = None - inputs: Optional[List[StrictStr]] = None - column_mappings: Optional[List[ColumnMapping]] = None + type_name: StrictStr + inputs: List[StrictStr] + column_mappings: List[ColumnMapping] __properties: ClassVar[List[str]] = ["type_name", "inputs", "column_mappings"] model_config = { diff --git a/python/graphscope/flex/rest/rest.py b/python/graphscope/flex/rest/rest.py index ecb9dc1eb11e..25ab1380fdf0 100644 --- a/python/graphscope/flex/rest/rest.py +++ b/python/graphscope/flex/rest/rest.py @@ -5,7 +5,7 @@ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/). Some useful links: - [GraphScope Repository](https://github.com/alibaba/GraphScope) - [The Source API definition for GraphScope Interactive](https://github.com/GraphScope/portal/tree/main/httpservice) - The version of the OpenAPI document: 0.9.1 + The version of the OpenAPI document: 1.0.0 Contact: graphscope@alibaba-inc.com Generated by OpenAPI Generator (https://openapi-generator.tech) diff --git a/python/graphscope/framework/graph_schema.py b/python/graphscope/framework/graph_schema.py index 7d89fe779b58..127db4e05e59 100644 --- a/python/graphscope/framework/graph_schema.py +++ b/python/graphscope/framework/graph_schema.py @@ -276,6 +276,8 @@ def __init__(self): self._edge_labels_to_add: List[EdgeLabel] = [] self._vertex_labels_to_drop: List[VertexLabel] = [] self._edge_labels_to_drop: List[EdgeLabel] = [] + self._vertex_labels_to_add_property: List[VertexLabel] = [] + self._edge_labels_to_add_property: List[VertexLabel] = [] # 1 indicate valid, 0 indicate invalid. self._valid_vertices = [] self._valid_edges = [] @@ -565,6 +567,8 @@ def clear(self): self._vertex_labels_to_drop.clear() self._edge_labels_to_add.clear() self._edge_labels_to_drop.clear() + self._vertex_labels_to_add_property.clear() + self._edge_labels_to_add_property.clear() self._valid_vertices.clear() self._valid_edges.clear() self._v_label_index.clear() @@ -599,6 +603,22 @@ def add_edge_label( self._edge_labels_to_add.append(item) return self._edge_labels_to_add[-1] + def add_vertex_properties(self, label, properties=None): + item = VertexLabel(label) + if properties is not None: + for prop in properties: + item = item.add_property(*prop) + self._vertex_labels_to_add_property.append(item) + return self._vertex_labels_to_add_property[-1] + + def add_edge_properties(self, label, properties=None): + item = EdgeLabel(label) + if properties is not None: + for prop in properties: + item = item.add_property(*prop) + self._edge_labels_to_add_property.append(item) + return self._edge_labels_to_add_property[-1] + def drop(self, label, src_label=None, dst_label=None): for item in self._vertex_labels: if label == item.label: @@ -653,6 +673,16 @@ def _prepare_batch_rpc(self): requests.value.add().remove_edge_kind_request.CopyFrom(request) else: requests.value.add().drop_edge_type_request.label = item.label + for item in self._vertex_labels_to_add_property: + type_pb = item.as_type_def() + requests.value.add().add_vertex_type_properties_request.type_def.CopyFrom( + type_pb + ) + for item in self._edge_labels_to_add_property: + type_pb = item.as_type_def() + requests.value.add().add_edge_type_properties_request.type_def.CopyFrom( + type_pb + ) for item in self._vertex_labels_to_drop: requests.value.add().drop_vertex_type_request.label = item.label return requests @@ -663,6 +693,8 @@ def update(self): self._edge_labels_to_add.clear() self._vertex_labels_to_drop.clear() self._edge_labels_to_drop.clear() + self._vertex_labels_to_add_property.clear() + self._edge_labels_to_add_property.clear() response = self._conn.submit(requests) self.from_graph_def(response.graph_def) return self diff --git a/python/graphscope/gsctl/__init__.py b/python/graphscope/gsctl/__init__.py index 895287b8d746..92788493ca65 100644 --- a/python/graphscope/gsctl/__init__.py +++ b/python/graphscope/gsctl/__init__.py @@ -15,3 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +import warnings + +# Disable warnings +warnings.filterwarnings("ignore", category=Warning) diff --git a/python/graphscope/gsctl/commands/__init__.py b/python/graphscope/gsctl/commands/__init__.py index 7d5ab360d901..5998bb958dd7 100644 --- a/python/graphscope/gsctl/commands/__init__.py +++ b/python/graphscope/gsctl/commands/__init__.py @@ -22,7 +22,8 @@ from graphscope.gsctl.commands.common import cli as common from graphscope.gsctl.commands.dev import cli as dev -from graphscope.gsctl.commands.insight.graph import cli as insight_graph + +# from graphscope.gsctl.commands.insight.graph import cli as insight_graph from graphscope.gsctl.commands.interactive.glob import cli as interactive from graphscope.gsctl.commands.interactive.graph import cli as interactive_graph from graphscope.gsctl.config import Context @@ -33,6 +34,22 @@ from graphscope.gsctl.utils import info +def is_interactive_mode(flex): + return ( + flex["engine"] == "Hiactor" + and flex["storage"] == "MutableCSR" + and flex["frontend"] == "Cypher/Gremlin" + ) + + +def is_insight_mode(flex): + return ( + flex["engine"] == "Gaia" + and flex["storage"] == "MutableCSR" + and flex["frontend"] == "Cypher/Gremlin" + ) + + def get_command_collection(context: Context): # default commands commands = click.CommandCollection(sources=[common, dev]) @@ -56,7 +73,11 @@ def get_command_collection(context: Context): try: # connect to coordinator and reset the timestamp response = connect_coordinator(context.coordinator_endpoint) - solution = response.solution + flex = { + "engine": response.engine, + "storage": response.storage, + "frontend": response.frontend, + } except Exception as e: err( "Failed to connect to coordinator at {0}: {1}".format( @@ -69,15 +90,15 @@ def get_command_collection(context: Context): return commands else: # check consistency - if solution != context.flex: + if flex != context.flex: raise RuntimeError( - f"Instance changed: {context.flex} -> {solution}, please close and reconnect to the coordinator" + f"Instance changed: {context.flex} -> {flex}, please close and reconnect to the coordinator" ) context.reset_timestamp() config = load_gs_config() config.update_and_write(context) - if context.flex == "INTERACTIVE": + if is_interactive_mode(context.flex): if context.context == "global": if len(sys.argv) < 2 or sys.argv[1] != "use": info("Using GLOBAL.", fg="green", bold=True) @@ -90,7 +111,8 @@ def get_command_collection(context: Context): info(f"Using GRAPH {context.context}.", fg="green", bold=True) info("Run `gsctl use GLOBAL` to switch back to GLOBAL context.\n") commands = click.CommandCollection(sources=[common, interactive_graph]) - elif context.flex == "GRAPHSCOPE_INSIGHT": - commands = click.CommandCollection(sources=[common, insight_graph]) + elif is_insight_mode(context.flex): + commands = click.CommandCollection(sources=[common]) + # commands = click.CommandCollection(sources=[common, insight_graph]) return commands diff --git a/python/graphscope/gsctl/commands/common.py b/python/graphscope/gsctl/commands/common.py index 7d94a2aad577..37b43d0a7b67 100644 --- a/python/graphscope/gsctl/commands/common.py +++ b/python/graphscope/gsctl/commands/common.py @@ -62,8 +62,11 @@ def connect(coordinator_endpoint): except Exception as e: err(f"Unable to connect to server: {str(e)}") else: + serving_mode = "frontend: {0}, engine: {1}, storage: {2}".format( + resp.frontend, resp.engine, resp.storage + ) succ( - f"Connected to {coordinator_endpoint}, coordinator is serving with {resp.solution} mode.\n" + f"Connected to {coordinator_endpoint}, coordinator is serving with {serving_mode} mode.\n" ) info("Try 'gsctl --help' for help.") diff --git a/python/graphscope/gsctl/commands/insight/graph.py b/python/graphscope/gsctl/commands/insight/graph.py deleted file mode 100644 index 81e7aaf12115..000000000000 --- a/python/graphscope/gsctl/commands/insight/graph.py +++ /dev/null @@ -1,307 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. All Rights Reserved. -# -# 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. -# - -import click -import yaml - -from graphscope.gsctl.impl import create_edge_type -from graphscope.gsctl.impl import create_groot_dataloading_job -from graphscope.gsctl.impl import create_vertex_type -from graphscope.gsctl.impl import delete_edge_type -from graphscope.gsctl.impl import delete_job_by_id -from graphscope.gsctl.impl import delete_vertex_type -from graphscope.gsctl.impl import get_datasource -from graphscope.gsctl.impl import get_job_by_id -from graphscope.gsctl.impl import import_datasource -from graphscope.gsctl.impl import import_groot_schema -from graphscope.gsctl.impl import list_groot_graph -from graphscope.gsctl.impl import list_jobs -from graphscope.gsctl.impl import unbind_edge_datasource -from graphscope.gsctl.impl import unbind_vertex_datasource -from graphscope.gsctl.utils import TreeDisplay -from graphscope.gsctl.utils import err -from graphscope.gsctl.utils import info -from graphscope.gsctl.utils import is_valid_file_path -from graphscope.gsctl.utils import read_yaml_file -from graphscope.gsctl.utils import succ -from graphscope.gsctl.utils import terminal_display - - -@click.group() -def cli(): - pass - - -@cli.group() -def create(): - """Create vertex/edge type, data source, loader job from file""" - pass - - -@cli.group() -def delete(): - """Delete vertex/edge type, data source, loader job by identifier""" - pass - - -@cli.group() -def desc(): - """Show details of job status by identifier""" - pass - - -@cli.command() -def ls(): # noqa: F811 - """Display schema, stored procedure, and job information""" - tree = TreeDisplay() - try: - graphs = list_groot_graph() - using_graph = graphs[0] - # schema - tree.create_graph_node_for_groot(using_graph) - # data source - datasource = get_datasource("placeholder") - tree.create_datasource_node(using_graph, datasource) - # stored procedure - tree.create_procedure_node(using_graph, []) - # job - jobs = list_jobs() - tree.create_job_node(using_graph, jobs) - except Exception as e: - err(f"Failed to display graph information: {str(e)}") - else: - tree.show(using_graph.name) - - -@create.command -@click.option( - "-f", - "--filename", - required=True, - help="Path of yaml file", -) -def schema(filename): # noqa: F811 - """Import the schema from file""" - if not is_valid_file_path(filename): - err(f"Invalid file: {filename}") - return - try: - schema = read_yaml_file(filename) - # only one graph supported int groot - import_groot_schema("placeholder", schema) - except Exception as e: - err(f"Failed to import schema: {str(e)}") - else: - succ("Import schema successfully.") - - -@create.command(name="vertex_type") -@click.option( - "-f", - "--filename", - required=True, - help="Path of yaml file", -) -def vertex_type(filename): # noqa: F811 - """Create a vertex type from file""" - if not is_valid_file_path(filename): - err(f"Invalid file: {filename}") - return - try: - vtype = read_yaml_file(filename) - # only one graph supported in groot - create_vertex_type("placeholder", vtype) - except Exception as e: - err(f"Failed to create vertex type: {str(e)}") - else: - succ(f"Create vertex type {vtype['type_name']} successfully.") - - -@delete.command(name="vertex_type") -@click.argument("vertex_type", required=True) -def vertex_type(vertex_type): # noqa: F811 - """Delete a vertex type, see identifier with `ls` command""" - try: - delete_vertex_type("placeholder", vertex_type) - except Exception as e: - err(f"Failed to delete vertex type {vertex_type}: {str(e)}") - else: - succ(f"Delete vertex type {vertex_type} successfully.") - - -@create.command(name="edge_type") -@click.option( - "-f", - "--filename", - required=True, - help="Path of yaml file", -) -def edge_type(filename): # noqa: F811 - """Create an edge type from file""" - if not is_valid_file_path(filename): - err(f"Invalid file: {filename}") - return - try: - etype = read_yaml_file(filename) - # only one graph supported in groot - create_edge_type("placeholder", etype) - except Exception as e: - err(f"Failed to create edge type: {str(e)}") - else: - succ(f"Create edge type {etype['type_name']} successfully.") - - -@delete.command(name="edge_type") -@click.argument("edge_type", required=True) -@click.option( - "-s", - "--source_vertex_type", - required=True, - help="Source vertex type of the edge", -) -@click.option( - "-d", - "--destination_vertex_type", - required=True, - help="Destination vertex type of the edge", -) -def etype(edge_type, source_vertex_type, destination_vertex_type): # noqa: F811 - """Delete an edge type, see identifier with `ls` command""" - try: - etype_full_name = ( - f"({source_vertex_type})-[{edge_type}]->({destination_vertex_type})" - ) - delete_edge_type( - "placeholder", edge_type, source_vertex_type, destination_vertex_type - ) - except Exception as e: - err(f"Failed to delete edge type {etype_full_name}: {str(e)}") - else: - succ(f"Delete edge type {etype_full_name} successfully.") - - -@create.command -@click.option( - "-f", - "--filename", - required=True, - help="Path of yaml file.", -) -def datasource(filename): # noqa: F811 - """Bind data source from file""" - if not is_valid_file_path(filename): - err(f"Invalid file: {filename}") - return - try: - datasource = read_yaml_file(filename) - # only one graph supported int groot - import_datasource("placeholder", datasource) - except Exception as e: - err(f"Failed to import data source: {str(e)}") - else: - succ("Bind data source successfully.") - - -@delete.command(name="vertex_source") -@click.argument("vertex_type", required=True) -def vertex_source(vertex_type): # noqa: F811 - """Unbind the data source on vertex type""" - try: - unbind_vertex_datasource("placeholder", vertex_type) - except Exception as e: - err(f"Failed to unbind data source on {vertex_type}: {str(e)}") - else: - succ(f"Unbind data source on {vertex_type} successfully.") - - -@delete.command(name="edge_source") -@click.argument("edge_type", required=True) -@click.option( - "-s", - "--source_vertex_type", - required=True, - help="Source vertex type of the edge", -) -@click.option( - "-d", - "--destination_vertex_type", - required=True, - help="Destination vertex type of the edge", -) -def edge_source(edge_type, source_vertex_type, destination_vertex_type): # noqa: F811 - """Unbind the data source on edge type""" - try: - etype_full_name = ( - f"({source_vertex_type})-[{edge_type}]->({destination_vertex_type})" - ) - unbind_edge_datasource( - "placeholder", edge_type, source_vertex_type, destination_vertex_type - ) - except Exception as e: - err(f"Failed to unbind data source on {etype_full_name}: {str(e)}") - else: - succ(f"Unbind data source on {etype_full_name} successfully.") - - -@create.command() -@click.option( - "-f", - "--filename", - required=True, - help="Path of yaml file", -) -def loaderjob(filename): # noqa: F811 - """Create a dataloading job from file""" - if not is_valid_file_path(filename): - err(f"Invalid file: {filename}") - return - try: - config = read_yaml_file(filename) - jobid = create_groot_dataloading_job("placeholder", config) - except Exception as e: - err(f"Failed to create a job: {str(e)}") - else: - succ(f"Create job {jobid} successfully.") - - -@desc.command() -@click.argument("identifier", required=True) -def job(identifier): # noqa: F811 - """Show details of job, see identifier with `ls` command""" - try: - job = get_job_by_id(identifier) - except Exception as e: - err(f"Failed to get job: {str(e)}") - else: - info(yaml.dump(job.to_dict())) - - -@delete.command() -@click.argument("identifier", required=True) -def job(identifier): # noqa: F811 - """Cancel a job, see identifier with `ls` command""" - try: - delete_job_by_id(identifier) - except Exception as e: - err(f"Failed to cancel job {identifier}: {str(e)}") - else: - succ(f"Cancel job {identifier} successfully.") - - -if __name__ == "__main__": - cli() diff --git a/python/graphscope/gsctl/commands/interactive/glob.py b/python/graphscope/gsctl/commands/interactive/glob.py index 8da1cbc8eab1..4167d7277188 100644 --- a/python/graphscope/gsctl/commands/interactive/glob.py +++ b/python/graphscope/gsctl/commands/interactive/glob.py @@ -20,12 +20,13 @@ import yaml from graphscope.gsctl.impl import create_graph -from graphscope.gsctl.impl import delete_graph_by_name -from graphscope.gsctl.impl import get_dataloading_config -from graphscope.gsctl.impl import get_service_status +from graphscope.gsctl.impl import delete_graph_by_id +from graphscope.gsctl.impl import get_datasource_by_id +from graphscope.gsctl.impl import get_graph_id_by_name from graphscope.gsctl.impl import list_graphs from graphscope.gsctl.impl import list_jobs -from graphscope.gsctl.impl import list_procedures +from graphscope.gsctl.impl import list_service_status +from graphscope.gsctl.impl import list_stored_procedures from graphscope.gsctl.impl import restart_service from graphscope.gsctl.impl import start_service from graphscope.gsctl.impl import stop_service @@ -70,17 +71,7 @@ def service(): def use(context, graph_identifier): """Switch to GRAPH context, see identifier with `ls` command""" try: - graphs = list_graphs() - graph_exist = False - for g in graphs: - if graph_identifier == g.name: - graph_exist = True - break - if not graph_exist: - raise RuntimeError( - f"Graph '{graph_identifier}' not exists, see graph identifier with `ls` command." - ) - switch_context(graph_identifier) + switch_context(get_graph_id_by_name(graph_identifier)) except Exception as e: err(f"Failed to switch context: {str(e)}") else: @@ -98,12 +89,12 @@ def ls(l): # noqa: F811, E741 # schema tree.create_graph_node(g, recursive=l) if l: - # get data source from job configuration - job_config = get_dataloading_config(g.name) - tree.create_datasource_node_for_interactive(g, job_config) + # data source mappin + datasource_mapping = get_datasource_by_id(g.id) + tree.create_datasource_mapping_node(g, datasource_mapping) # stored procedure - procedures = list_procedures(g.name) - tree.create_procedure_node(g, procedures) + stored_procedures = list_stored_procedures(g.id) + tree.create_stored_procedure_node(g, stored_procedures) # job jobs = list_jobs() tree.create_job_node(g, jobs) @@ -141,7 +132,7 @@ def graph(filename): # noqa: F811 def graph(graph_identifier): # noqa: F811 """Delete a graph, see graph identifier with `ls` command""" try: - delete_graph_by_name(graph_identifier) + delete_graph_by_id(get_graph_id_by_name(graph_identifier)) except Exception as e: err(f"Failed to delete graph {graph_identifier}: {str(e)}") else: @@ -169,7 +160,7 @@ def stop(): # noqa: F811 def start(graph_identifier): # noqa: F811 """Start database service on a certain graph""" try: - start_service(graph_identifier) + start_service(get_graph_id_by_name(graph_identifier)) except Exception as e: err(f"Failed to start service on graph {graph_identifier}: {str(e)}") else: @@ -192,22 +183,33 @@ def ls(): # noqa: F811 """Display current service status""" def _construct_and_display_data(status): - head = ["STATUS", "SERVING_GRAPH", "CYPHER_ENDPOINT", "HQPS_ENDPOINT"] + head = [ + "STATUS", + "SERVING_GRAPH(IDENTIFIER)", + "CYPHER_ENDPOINT", + "HQPS_ENDPOINT", + "GREMLIN_ENDPOINT", + ] data = [head] - data.append( - [ - status.status, - status.graph_name, - status.sdk_endpoints.cypher, - status.sdk_endpoints.hqps, - ] - ) + for s in status: + if s.status == "Stopped": + data.append([s.status, s.graph_id, "-", "-", "-"]) + else: + data.append( + [ + s.status, + s.graph_id, + s.sdk_endpoints.cypher, + s.sdk_endpoints.hqps, + s.sdk_endpoints.gremlin, + ] + ) terminal_display(data) try: - status = get_service_status() + status = list_service_status() except Exception as e: - err(f"Failed to get service status: {str(e)}") + err(f"Failed to list service status: {str(e)}") else: _construct_and_display_data(status) diff --git a/python/graphscope/gsctl/commands/interactive/graph.py b/python/graphscope/gsctl/commands/interactive/graph.py index d728bb38b2df..942972f3db1e 100644 --- a/python/graphscope/gsctl/commands/interactive/graph.py +++ b/python/graphscope/gsctl/commands/interactive/graph.py @@ -20,17 +20,20 @@ import yaml from graphscope.gsctl.config import get_current_context -from graphscope.gsctl.impl import create_dataloading_job -from graphscope.gsctl.impl import create_procedure +from graphscope.gsctl.impl import bind_datasource_in_batch +from graphscope.gsctl.impl import create_stored_procedure from graphscope.gsctl.impl import delete_job_by_id -from graphscope.gsctl.impl import delete_procedure_by_name -from graphscope.gsctl.impl import get_dataloading_config +from graphscope.gsctl.impl import delete_stored_procedure_by_id +from graphscope.gsctl.impl import get_datasource_by_id +from graphscope.gsctl.impl import get_graph_id_by_name from graphscope.gsctl.impl import get_job_by_id from graphscope.gsctl.impl import list_graphs from graphscope.gsctl.impl import list_jobs -from graphscope.gsctl.impl import list_procedures +from graphscope.gsctl.impl import list_stored_procedures +from graphscope.gsctl.impl import submit_dataloading_job from graphscope.gsctl.impl import switch_context -from graphscope.gsctl.impl import update_procedure +from graphscope.gsctl.impl import unbind_edge_datasource +from graphscope.gsctl.impl import unbind_vertex_datasource from graphscope.gsctl.utils import TreeDisplay from graphscope.gsctl.utils import err from graphscope.gsctl.utils import info @@ -46,25 +49,19 @@ def cli(): @cli.group() def create(): - """Create stored procedure, loader job from file""" + """Create stored procedure, data source, loader job from file""" pass @cli.group() def delete(): - """Delete stored procedure, loader job by identifier""" - pass - - -@cli.group() -def update(): - """Update stored procedure from file""" + """Delete stored procedure, data source, loader job by id""" pass @cli.group() def desc(): - """Show details of job status and stored procedure by identifier""" + """Show details of job status and stored procedure by id""" pass @@ -84,17 +81,17 @@ def ls(): # noqa: F811 graphs = list_graphs() using_graph = None for g in graphs: - if g.name == current_context.context: + if g.id == current_context.context: using_graph = g break # schema tree.create_graph_node(using_graph) - # get data source from job configuration - job_config = get_dataloading_config(using_graph.name) - tree.create_datasource_node_for_interactive(using_graph, job_config) + # data source mapping + datasource_mapping = get_datasource_by_id(using_graph.id) + tree.create_datasource_mapping_node(using_graph, datasource_mapping) # stored procedure - procedures = list_procedures(using_graph.name) - tree.create_procedure_node(using_graph, procedures) + stored_procedures = list_stored_procedures(using_graph.id) + tree.create_stored_procedure_node(using_graph, stored_procedures) # job jobs = list_jobs() tree.create_job_node(using_graph, jobs) @@ -111,61 +108,93 @@ def ls(): # noqa: F811 required=True, help="Path of yaml file", ) -def procedure(filename): +def storedproc(filename): """Create a stored procedure from file""" if not is_valid_file_path(filename): err(f"Invalid file: {filename}") return current_context = get_current_context() - graph_name = current_context.context + graph_identifier = current_context.context try: - procedure = read_yaml_file(filename) - # overwrite graph name - procedure["bound_graph"] = graph_name - create_procedure(graph_name, procedure) + stored_procedure = read_yaml_file(filename) + create_stored_procedure(graph_identifier, stored_procedure) except Exception as e: err(f"Failed to create stored procedure: {str(e)}") else: - succ(f"Create stored procedure {procedure['name']} successfully.") + succ(f"Create stored procedure {stored_procedure['name']} successfully.") @delete.command() @click.argument("identifier", required=True) -def procedure(identifier): # noqa: F811 +def storedproc(identifier): # noqa: F811 """Delete a stored procedure, see identifier with `ls` command""" current_context = get_current_context() - graph_name = current_context.context + graph_identifier = current_context.context try: - delete_procedure_by_name(graph_name, identifier) + delete_stored_procedure_by_id(graph_identifier, identifier) except Exception as e: err(f"Failed to delete stored procedure: {str(e)}") else: succ(f"Delete stored procedure {identifier} successfully.") -@update.command() +@create.command @click.option( "-f", "--filename", required=True, help="Path of yaml file", ) -def procedure(filename): # noqa: F811 - """Update a stored procedure from file""" +def datasource(filename): # noqa: F811 + """Bind data source mapping from file""" if not is_valid_file_path(filename): err(f"Invalid file: {filename}") return current_context = get_current_context() - graph_name = current_context.context + graph_identifier = current_context.context + try: + datasource = read_yaml_file(filename) + bind_datasource_in_batch(graph_identifier, datasource) + except Exception as e: + err(f"Failed to bind data source: {str(e)}") + else: + succ("Bind data source successfully.") + + +@delete.command +@click.option( + "-t", + "--type", + required=True, + help="Vertex or edge type", +) +@click.option( + "-s", + "--source_vertex_type", + required=False, + help="Source vertex type of the edge [edge only]", +) +@click.option( + "-d", + "--destination_vertex_type", + required=False, + help="Destination vertex type of the edge [edge only]", +) +def datasource(type, source_vertex_type, destination_vertex_type): # noqa: F811 + """Unbind data source mapping on vertex or edge type""" try: - procedure = read_yaml_file(filename) - # overwrite graph name - procedure["bound_graph"] = graph_name - update_procedure(graph_name, procedure) + current_context = get_current_context() + graph_identifier = current_context.context + if source_vertex_type is not None and destination_vertex_type is not None: + unbind_edge_datasource( + graph_identifier, type, source_vertex_type, destination_vertex_type + ) + else: + unbind_vertex_datasource(graph_identifier, type) except Exception as e: - err(f"Failed to update stored procedure: {str(e)}") + err(f"Failed to unbind data source: {str(e)}") else: - succ(f"Update stored procedure {procedure['name']} successfully.") + succ("Unbind data source successfully.") @create.command() @@ -176,17 +205,15 @@ def procedure(filename): # noqa: F811 help="Path of yaml file", ) def loaderjob(filename): # noqa: F811 - """Create a dataloading job from file""" + """Create a data loading job from file""" if not is_valid_file_path(filename): err(f"Invalid file: {filename}") return current_context = get_current_context() - graph_name = current_context.context + graph_identifier = current_context.context try: config = read_yaml_file(filename) - # overwrite graph name - config["graph"] = graph_name - jobid = create_dataloading_job(graph_name, config) + jobid = submit_dataloading_job(graph_identifier, config) except Exception as e: err(f"Failed to create a job: {str(e)}") else: @@ -219,26 +246,26 @@ def job(identifier): # noqa: F811 @desc.command() @click.argument("identifier", required=True) -def procedure(identifier): # noqa: F811 +def storedproc(identifier): # noqa: F811 """Show details of stored procedure, see identifier with `ls` command""" current_context = get_current_context() - graph_name = current_context.context + graph_id = current_context.context try: - procedures = list_procedures(graph_name) + stored_procedures = list_stored_procedures(graph_id) except Exception as e: - err(f"Failed to list procedures: {str(e)}") + err(f"Failed to list stored procedures: {str(e)}") else: - if not procedures: - info(f"No stored procedures found on {graph_name}.") + if not stored_procedures: + info(f"No stored procedures found on {graph_id}.") return - specific_procedure_exist = False - for procedure in procedures: - if identifier == procedure.name: - info(yaml.dump(procedure.to_dict())) - specific_procedure_exist = True + specific_stored_procedure_exist = False + for stored_procedure in stored_procedures: + if identifier == stored_procedure.id: + info(yaml.dump(stored_procedure.to_dict())) + specific_stored_procedure_exist = True break - if not specific_procedure_exist: - err(f"Procedure {identifier} not found on {graph_name}.") + if not specific_stored_procedure_exist: + err(f"Stored Procedure {identifier} not found on {graph_id}.") @use.command(name="GLOBAL") diff --git a/python/graphscope/gsctl/gsctl.py b/python/graphscope/gsctl/gsctl.py index 027c648ce72f..dec78db1ff60 100644 --- a/python/graphscope/gsctl/gsctl.py +++ b/python/graphscope/gsctl/gsctl.py @@ -21,25 +21,16 @@ import click -try: - import graphscope -except ModuleNotFoundError: - # if graphscope is not installed, only basic functions or utilities - # can be used, e.g. install dependencies - graphscope = None +if "site-packages" not in os.path.dirname(os.path.realpath(__file__)): + sys.path.insert( + 0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..") + ) +from graphscope.gsctl.commands import get_command_collection +from graphscope.gsctl.config import get_current_context -def cli(): - if graphscope is None: - sys.path.insert( - 0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "commands") - ) - from dev import cli as dev_cli - - dev_cli() - from graphscope.gsctl.commands import get_command_collection - from graphscope.gsctl.config import get_current_context +def cli(): context = get_current_context() # get the specified commands under the FLEX architecture commands = get_command_collection(context) diff --git a/python/graphscope/gsctl/impl/__init__.py b/python/graphscope/gsctl/impl/__init__.py index 08bab8b9501f..12677c62629e 100644 --- a/python/graphscope/gsctl/impl/__init__.py +++ b/python/graphscope/gsctl/impl/__init__.py @@ -16,45 +16,28 @@ # limitations under the License. # -from graphscope.gsctl.impl.alert import delete_alert_receiver_by_id -from graphscope.gsctl.impl.alert import delete_alert_rule_by_name -from graphscope.gsctl.impl.alert import list_alert_messages -from graphscope.gsctl.impl.alert import list_alert_receivers -from graphscope.gsctl.impl.alert import list_alert_rules -from graphscope.gsctl.impl.alert import register_receiver -from graphscope.gsctl.impl.alert import update_alert_messages -from graphscope.gsctl.impl.alert import update_alert_receiver_by_id -from graphscope.gsctl.impl.alert import update_alert_rule from graphscope.gsctl.impl.common import connect_coordinator from graphscope.gsctl.impl.common import disconnect_coordinator -from graphscope.gsctl.impl.datasource import get_datasource -from graphscope.gsctl.impl.datasource import import_datasource +from graphscope.gsctl.impl.datasource import bind_datasource_in_batch +from graphscope.gsctl.impl.datasource import get_datasource_by_id from graphscope.gsctl.impl.datasource import unbind_edge_datasource from graphscope.gsctl.impl.datasource import unbind_vertex_datasource -from graphscope.gsctl.impl.deployment import get_deployment_info -from graphscope.gsctl.impl.deployment import get_node_status -from graphscope.gsctl.impl.graph import create_edge_type from graphscope.gsctl.impl.graph import create_graph -from graphscope.gsctl.impl.graph import create_vertex_type -from graphscope.gsctl.impl.graph import delete_edge_type -from graphscope.gsctl.impl.graph import delete_graph_by_name -from graphscope.gsctl.impl.graph import delete_vertex_type -from graphscope.gsctl.impl.graph import get_schema_by_name +from graphscope.gsctl.impl.graph import delete_graph_by_id +from graphscope.gsctl.impl.graph import get_graph_id_by_name from graphscope.gsctl.impl.graph import list_graphs -from graphscope.gsctl.impl.job import create_dataloading_job from graphscope.gsctl.impl.job import delete_job_by_id -from graphscope.gsctl.impl.job import get_dataloading_config from graphscope.gsctl.impl.job import get_job_by_id from graphscope.gsctl.impl.job import list_jobs -from graphscope.gsctl.impl.legacy import create_groot_dataloading_job -from graphscope.gsctl.impl.legacy import import_groot_schema -from graphscope.gsctl.impl.legacy import list_groot_graph -from graphscope.gsctl.impl.procedure import create_procedure -from graphscope.gsctl.impl.procedure import delete_procedure_by_name -from graphscope.gsctl.impl.procedure import list_procedures -from graphscope.gsctl.impl.procedure import update_procedure -from graphscope.gsctl.impl.service import get_service_status +from graphscope.gsctl.impl.job import submit_dataloading_job +from graphscope.gsctl.impl.service import list_service_status from graphscope.gsctl.impl.service import restart_service from graphscope.gsctl.impl.service import start_service from graphscope.gsctl.impl.service import stop_service +from graphscope.gsctl.impl.stored_procedure import create_stored_procedure +from graphscope.gsctl.impl.stored_procedure import delete_stored_procedure_by_id +from graphscope.gsctl.impl.stored_procedure import get_stored_procedure_by_id +from graphscope.gsctl.impl.stored_procedure import list_stored_procedures +from graphscope.gsctl.impl.stored_procedure import update_stored_procedure_by_id from graphscope.gsctl.impl.utils import switch_context +from graphscope.gsctl.impl.utils import upload_file diff --git a/python/graphscope/gsctl/impl/alert.py b/python/graphscope/gsctl/impl/alert.py deleted file mode 100644 index a8b746cec7a9..000000000000 --- a/python/graphscope/gsctl/impl/alert.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. All Rights Reserved. -# -# 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. -# - -from typing import List -from typing import Union - -import graphscope.flex.rest -from graphscope.flex.rest import AlertMessage -from graphscope.flex.rest import AlertReceiver -from graphscope.flex.rest import AlertRule -from graphscope.flex.rest import UpdateAlertMessagesRequest -from graphscope.gsctl.config import get_current_context - - -def list_alert_rules() -> List[AlertRule]: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.AlertApi(api_client) - return api_instance.list_alert_rules() - - -def update_alert_rule(rule: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - name = rule["name"] - api_instance = graphscope.flex.rest.AlertApi(api_client) - return api_instance.update_alert_rule_by_name(name, AlertRule.from_dict(rule)) - - -def delete_alert_rule_by_name(rule_name: str) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.AlertApi(api_client) - return api_instance.delete_alert_rule_by_name(rule_name) - - -def list_alert_messages( - status: str, severity: str, starttime: str, endtime: str -) -> List[AlertMessage]: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.AlertApi(api_client) - return api_instance.list_alert_messages( - None, status, severity, starttime, endtime - ) - - -def update_alert_messages(request: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - print(request) - api_instance = graphscope.flex.rest.AlertApi(api_client) - return api_instance.update_alert_messages( - UpdateAlertMessagesRequest.from_dict(request) - ) - - -def list_alert_receivers() -> List[AlertReceiver]: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.AlertApi(api_client) - return api_instance.list_receivers() - - -def register_receiver(receiver: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.AlertApi(api_client) - return api_instance.register_receiver(AlertReceiver.from_dict(receiver)) - - -def update_alert_receiver_by_id(receiver_id: str, receiver: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.AlertApi(api_client) - return api_instance.update_receiver_by_id( - receiver_id, AlertReceiver.from_dict(receiver) - ) - - -def delete_alert_receiver_by_id(receiver_id: str) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.AlertApi(api_client) - return api_instance.delete_receiver_by_id(receiver_id) diff --git a/python/graphscope/gsctl/impl/common.py b/python/graphscope/gsctl/impl/common.py index 8476e80cabcc..025ab853844c 100644 --- a/python/graphscope/gsctl/impl/common.py +++ b/python/graphscope/gsctl/impl/common.py @@ -19,29 +19,30 @@ from typing import Union import graphscope.flex.rest -from graphscope.flex.rest import ConnectionStatus +from graphscope.flex.rest import RunningDeploymentInfo from graphscope.gsctl.config import Context from graphscope.gsctl.config import load_gs_config -def connect_coordinator(coordinator_endpoint: str) -> ConnectionStatus: +def connect_coordinator(coordinator_endpoint: str) -> RunningDeploymentInfo: with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(coordinator_endpoint) ) as api_client: - api_instance = graphscope.flex.rest.ConnectionApi(api_client) - connection = graphscope.flex.rest.Connection.from_dict( - {"coordinator_endpoint": coordinator_endpoint} - ) - connection_status = api_instance.connect(connection) + api_instance = graphscope.flex.rest.DeploymentApi(api_client) + deployment_info = api_instance.get_deployment_info() # coordinator connected, set the context - if connection_status.status == "CONNECTED": - context = Context( - flex=connection_status.solution, - coordinator_endpoint=coordinator_endpoint, - ) - config = load_gs_config() - config.set_and_write(context) - return connection_status + flex = { + "engine": deployment_info.engine, + "storage": deployment_info.storage, + "frontend": deployment_info.frontend, + } + context = Context( + flex=flex, + coordinator_endpoint=coordinator_endpoint, + ) + config = load_gs_config() + config.set_and_write(context) + return deployment_info def disconnect_coordinator() -> Union[None, Context]: diff --git a/python/graphscope/gsctl/impl/datasource.py b/python/graphscope/gsctl/impl/datasource.py index 3d275128f3e9..a78fc3c1903a 100644 --- a/python/graphscope/gsctl/impl/datasource.py +++ b/python/graphscope/gsctl/impl/datasource.py @@ -18,59 +18,55 @@ import itertools import os -from typing import List import graphscope.flex.rest -from graphscope.flex.rest import DataSource +from graphscope.flex.rest import SchemaMapping from graphscope.gsctl.config import get_current_context from graphscope.gsctl.impl.utils import upload_file -def import_datasource(graph_name: str, datasource: dict) -> str: +def bind_datasource_in_batch(graph_identifier: str, datasource: dict) -> str: # upload files - for item in itertools.chain( - datasource["vertices_datasource"], datasource["edges_datasource"] + for mapping in itertools.chain( + datasource["vertex_mappings"], datasource["edge_mappings"] ): - location = item["location"] - if location.startswith("@"): - location = location[1:] - filename = os.path.basename(location) - with open(location, "rb") as f: - content = f.read() - path_after_uploaded = upload_file(filename, content, location) - item["location"] = path_after_uploaded - + for index, location in enumerate(mapping["inputs"]): + # path begin with "@" represents the local file + if location.startswith("@"): + location = location[1:] + mapping["inputs"][index] = upload_file(location) + # bind data source context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: - api_instance = graphscope.flex.rest.DatasourceApi(api_client) - return api_instance.import_datasource( - graph_name=graph_name, data_source=DataSource.from_dict(datasource) + api_instance = graphscope.flex.rest.DataSourceApi(api_client) + return api_instance.bind_datasource_in_batch( + graph_identifier, SchemaMapping.from_dict(datasource) ) -def get_datasource(graph_name: str) -> DataSource: +def get_datasource_by_id(graph_identifier: str) -> SchemaMapping: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: - api_instance = graphscope.flex.rest.DatasourceApi(api_client) - return api_instance.get_datasource(graph_name) + api_instance = graphscope.flex.rest.DataSourceApi(api_client) + return api_instance.get_datasource_by_id(graph_identifier) -def unbind_vertex_datasource(graph_name: str, vertex_type: str) -> str: +def unbind_vertex_datasource(graph_identifier: str, vertex_type: str) -> str: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: - api_instance = graphscope.flex.rest.DatasourceApi(api_client) - return api_instance.unbind_vertex_datasource(graph_name, vertex_type) + api_instance = graphscope.flex.rest.DataSourceApi(api_client) + return api_instance.unbind_vertex_datasource(graph_identifier, vertex_type) def unbind_edge_datasource( - graph_name: str, - edge_type: str, + graph_identifier: str, + vertex_type: str, source_vertex_type: str, destination_vertex_type: str, ) -> str: @@ -78,7 +74,7 @@ def unbind_edge_datasource( with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: - api_instance = graphscope.flex.rest.DatasourceApi(api_client) + api_instance = graphscope.flex.rest.DataSourceApi(api_client) return api_instance.unbind_edge_datasource( - graph_name, edge_type, source_vertex_type, destination_vertex_type + graph_identifier, vertex_type, source_vertex_type, destination_vertex_type ) diff --git a/python/graphscope/gsctl/impl/deployment.py b/python/graphscope/gsctl/impl/deployment.py deleted file mode 100644 index 2a089efa7b49..000000000000 --- a/python/graphscope/gsctl/impl/deployment.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. All Rights Reserved. -# -# 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. -# - -from typing import List - -import graphscope.flex.rest -from graphscope.flex.rest import DeploymentInfo -from graphscope.flex.rest import NodeStatus -from graphscope.gsctl.config import get_current_context - - -def get_node_status() -> List[NodeStatus]: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.DeploymentApi(api_client) - return api_instance.get_node_status() - - -def get_deployment_info() -> DeploymentInfo: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.DeploymentApi(api_client) - return api_instance.get_deployment_info() diff --git a/python/graphscope/gsctl/impl/graph.py b/python/graphscope/gsctl/impl/graph.py index 7355152b8db6..06399e7968d3 100644 --- a/python/graphscope/gsctl/impl/graph.py +++ b/python/graphscope/gsctl/impl/graph.py @@ -19,14 +19,12 @@ from typing import List import graphscope.flex.rest -from graphscope.flex.rest import EdgeType -from graphscope.flex.rest import Graph -from graphscope.flex.rest import ModelSchema -from graphscope.flex.rest import VertexType +from graphscope.flex.rest import CreateGraphRequest +from graphscope.flex.rest import GetGraphResponse from graphscope.gsctl.config import get_current_context -def list_graphs() -> List[Graph]: +def list_graphs() -> List[GetGraphResponse]: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) @@ -36,72 +34,39 @@ def list_graphs() -> List[Graph]: return graphs -def get_schema_by_name(graph_name: str) -> ModelSchema: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.GraphApi(api_client) - schema = api_instance.get_schema(graph_name) - return schema - - def create_graph(graph: dict) -> str: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: api_instance = graphscope.flex.rest.GraphApi(api_client) - return api_instance.create_graph(Graph.from_dict(graph)) - - -def delete_graph_by_name(graph_name: str) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.GraphApi(api_client) - return api_instance.delete_graph(graph_name) - - -def create_vertex_type(graph_name: str, vtype: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.GraphApi(api_client) - return api_instance.create_vertex_type(graph_name, VertexType.from_dict(vtype)) - - -def create_edge_type(graph_name: str, etype: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.GraphApi(api_client) - return api_instance.create_edge_type(graph_name, EdgeType.from_dict(etype)) + response = api_instance.create_graph(CreateGraphRequest.from_dict(graph)) + return response.graph_id -def delete_vertex_type(graph_name: str, vertex_type: str) -> str: +def delete_graph_by_id(graph_identifier: str) -> str: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: api_instance = graphscope.flex.rest.GraphApi(api_client) - return api_instance.delete_vertex_type(graph_name, vertex_type) - - -def delete_edge_type( - graph_name: str, - edge_type: str, - source_vertex_type: str, - destination_vertex_type: str, -) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.GraphApi(api_client) - return api_instance.delete_edge_type( - graph_name, edge_type, source_vertex_type, destination_vertex_type + return api_instance.delete_graph_by_id(graph_identifier) + + +def get_graph_id_by_name(name_or_id: str): + graphs = list_graphs() + id_candidate = [] + for g in graphs: + if name_or_id == g.id: + return name_or_id + if name_or_id == g.name: + id_candidate.append(g.id) + if not id_candidate: + raise RuntimeError( + f"Graph '{name_or_id}' not exists, see graph information with `ls` command." + ) + if len(id_candidate) > 1: + raise RuntimeError( + f"Found multiple id candidates {id_candidate} for graph {name_or_id}, please choose one." ) + return id_candidate[0] diff --git a/python/graphscope/gsctl/impl/job.py b/python/graphscope/gsctl/impl/job.py index 2b9ebd0a7406..0eb7ee027a66 100644 --- a/python/graphscope/gsctl/impl/job.py +++ b/python/graphscope/gsctl/impl/job.py @@ -16,75 +16,48 @@ # limitations under the License. # -import itertools -import os from typing import List import graphscope.flex.rest +from graphscope.flex.rest import DataloadingJobConfig from graphscope.flex.rest import JobStatus -from graphscope.flex.rest import SchemaMapping from graphscope.gsctl.config import get_current_context -from graphscope.gsctl.impl.utils import upload_file -def list_jobs() -> List[JobStatus]: +def submit_dataloading_job(graph_identifier: str, config: dict) -> str: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: api_instance = graphscope.flex.rest.JobApi(api_client) - jobs = api_instance.list_jobs() - return jobs - - -def get_job_by_id(job_id: str) -> JobStatus: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.JobApi(api_client) - job = api_instance.get_job_by_id(job_id) - return job + response = api_instance.submit_dataloading_job( + graph_identifier, DataloadingJobConfig.from_dict(config) + ) + return response.job_id -def create_dataloading_job(graph_name: str, job_config: dict) -> str: - # upload files - for mapping in itertools.chain( - job_config["vertex_mappings"], job_config["edge_mappings"] - ): - for index, location in enumerate(mapping["inputs"]): - # path begin with "@" represents the local file - if location.startswith("@"): - location = location[1:] - filename = os.path.basename(location) - with open(location, "rb") as f: - content = f.read() - path_after_uploaded = upload_file(filename, content, location) - mapping["inputs"][index] = path_after_uploaded - # create job +def list_jobs() -> List[JobStatus]: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: api_instance = graphscope.flex.rest.JobApi(api_client) - return api_instance.create_dataloading_job( - graph_name, SchemaMapping.from_dict(job_config) - ) + return api_instance.list_jobs() -def get_dataloading_config(graph_name: str) -> SchemaMapping: +def delete_job_by_id(job_identifier: str) -> str: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: api_instance = graphscope.flex.rest.JobApi(api_client) - return api_instance.get_dataloading_config(graph_name) + return api_instance.delete_job_by_id(job_identifier) -def delete_job_by_id(job_id: str) -> str: +def get_job_by_id(job_identifier: str) -> JobStatus: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: api_instance = graphscope.flex.rest.JobApi(api_client) - return api_instance.delete_job_by_id(job_id) + return api_instance.get_job_by_id(job_identifier) diff --git a/python/graphscope/gsctl/impl/legacy.py b/python/graphscope/gsctl/impl/legacy.py deleted file mode 100644 index 8815aec7862a..000000000000 --- a/python/graphscope/gsctl/impl/legacy.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. All Rights Reserved. -# -# 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. -# - -from typing import List - -import graphscope.flex.rest -from graphscope.flex.rest import GrootDataloadingJobConfig -from graphscope.flex.rest import GrootGraph -from graphscope.flex.rest import GrootSchema -from graphscope.gsctl.config import get_current_context - - -def list_groot_graph() -> List[GrootGraph]: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.LegacyApi(api_client) - return api_instance.list_groot_graph() - - -def import_groot_schema(graph_name: str, schema: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.LegacyApi(api_client) - return api_instance.import_groot_schema( - graph_name, GrootSchema.from_dict(schema) - ) - - -def create_groot_dataloading_job(graph_name: str, job_config: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.LegacyApi(api_client) - return api_instance.create_groot_dataloading_job( - graph_name, GrootDataloadingJobConfig.from_dict(job_config) - ) diff --git a/python/graphscope/gsctl/impl/procedure.py b/python/graphscope/gsctl/impl/procedure.py deleted file mode 100644 index 5361a23ba1cb..000000000000 --- a/python/graphscope/gsctl/impl/procedure.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright 2024 Alibaba Group Holding Limited. All Rights Reserved. -# -# 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. -# - -from typing import List -from typing import Union - -import graphscope.flex.rest -from graphscope.flex.rest import Procedure -from graphscope.gsctl.config import get_current_context - - -def create_procedure(graph_name: str, procedure: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.ProcedureApi(api_client) - return api_instance.create_procedure(graph_name, Procedure.from_dict(procedure)) - - -def list_procedures(graph_name: Union[None, str]) -> List[Procedure]: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.ProcedureApi(api_client) - if graph_name is None: - procedures = api_instance.list_procedures() - else: - procedures = api_instance.list_procedures_by_graph(graph_name) - return procedures - - -def update_procedure(graph_name: str, procedure: dict) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - procedure_name = procedure["name"] - api_instance = graphscope.flex.rest.ProcedureApi(api_client) - return api_instance.update_procedure( - graph_name, procedure_name, Procedure.from_dict(procedure) - ) - - -def delete_procedure_by_name(graph_name: str, procedure_name: str) -> str: - context = get_current_context() - with graphscope.flex.rest.ApiClient( - graphscope.flex.rest.Configuration(context.coordinator_endpoint) - ) as api_client: - api_instance = graphscope.flex.rest.ProcedureApi(api_client) - return api_instance.delete_procedure(graph_name, procedure_name) diff --git a/python/graphscope/gsctl/impl/service.py b/python/graphscope/gsctl/impl/service.py index 864b553e96c3..54eaacdf9f3b 100644 --- a/python/graphscope/gsctl/impl/service.py +++ b/python/graphscope/gsctl/impl/service.py @@ -16,29 +16,31 @@ # limitations under the License. # +from typing import List + import graphscope.flex.rest from graphscope.flex.rest import ServiceStatus from graphscope.flex.rest import StartServiceRequest from graphscope.gsctl.config import get_current_context -def get_service_status() -> ServiceStatus: +def list_service_status() -> List[ServiceStatus]: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: api_instance = graphscope.flex.rest.ServiceApi(api_client) - return api_instance.get_service_status() + return api_instance.list_service_status() -def start_service(graph_name: str) -> str: +def start_service(graph_identifier: str) -> str: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: api_instance = graphscope.flex.rest.ServiceApi(api_client) return api_instance.start_service( - StartServiceRequest.from_dict({"graph_name": graph_name}) + StartServiceRequest.from_dict({"graph_id": graph_identifier}) ) diff --git a/python/graphscope/gsctl/impl/stored_procedure.py b/python/graphscope/gsctl/impl/stored_procedure.py new file mode 100644 index 000000000000..d2fd2e76180d --- /dev/null +++ b/python/graphscope/gsctl/impl/stored_procedure.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2024 Alibaba Group Holding Limited. All Rights Reserved. +# +# 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. +# + +from typing import List + +import graphscope.flex.rest +from graphscope.flex.rest import CreateStoredProcRequest +from graphscope.flex.rest import GetStoredProcResponse +from graphscope.flex.rest import UpdateStoredProcRequest +from graphscope.gsctl.config import get_current_context + + +def create_stored_procedure(graph_identifier: str, stored_procedure: dict) -> str: + context = get_current_context() + with graphscope.flex.rest.ApiClient( + graphscope.flex.rest.Configuration(context.coordinator_endpoint) + ) as api_client: + api_instance = graphscope.flex.rest.StoredProcedureApi(api_client) + response = api_instance.create_stored_procedure( + graph_identifier, CreateStoredProcRequest.from_dict(stored_procedure) + ) + return response.stored_procedure_id + + +def list_stored_procedures(graph_identifier: str) -> List[GetStoredProcResponse]: + context = get_current_context() + with graphscope.flex.rest.ApiClient( + graphscope.flex.rest.Configuration(context.coordinator_endpoint) + ) as api_client: + api_instance = graphscope.flex.rest.StoredProcedureApi(api_client) + return api_instance.list_stored_procedures(graph_identifier) + + +def delete_stored_procedure_by_id( + graph_identifier: str, stored_procedure_identifier: str +) -> str: + context = get_current_context() + with graphscope.flex.rest.ApiClient( + graphscope.flex.rest.Configuration(context.coordinator_endpoint) + ) as api_client: + api_instance = graphscope.flex.rest.StoredProcedureApi(api_client) + return api_instance.delete_stored_procedure_by_id( + graph_identifier, stored_procedure_identifier + ) + + +def get_stored_procedure_by_id( + graph_identifier: str, stored_procedure_identifier: str +) -> GetStoredProcResponse: + context = get_current_context() + with graphscope.flex.rest.ApiClient( + graphscope.flex.rest.Configuration(context.coordinator_endpoint) + ) as api_client: + api_instance = graphscope.flex.rest.StoredProcedureApi(api_client) + return api_instance.get_stored_procedure_by_id( + graph_identifier, stored_procedure_identifier + ) + + +def update_stored_procedure_by_id( + graph_identifier: str, stored_procedure_identifier: str, stored_procedure: dict +) -> str: + context = get_current_context() + with graphscope.flex.rest.ApiClient( + graphscope.flex.rest.Configuration(context.coordinator_endpoint) + ) as api_client: + api_instance = graphscope.flex.rest.StoredProcedureApi(api_client) + return api_instance.update_stored_procedure_by_id( + graph_identifier, + stored_procedure_identifier, + UpdateStoredProcRequest.from_dict(stored_procedure), + ) diff --git a/python/graphscope/gsctl/impl/utils.py b/python/graphscope/gsctl/impl/utils.py index fe52b8c383cb..cd30821bddfe 100644 --- a/python/graphscope/gsctl/impl/utils.py +++ b/python/graphscope/gsctl/impl/utils.py @@ -21,13 +21,13 @@ from graphscope.gsctl.config import load_gs_config -def upload_file(filename: str, content: bytes, location: str) -> str: +def upload_file(location: str) -> str: context = get_current_context() with graphscope.flex.rest.ApiClient( graphscope.flex.rest.Configuration(context.coordinator_endpoint) ) as api_client: api_instance = graphscope.flex.rest.UtilsApi(api_client) - return api_instance.upload_file(location) + return api_instance.upload_file(location).file_path def switch_context(context: str): diff --git a/python/graphscope/gsctl/commands/insight/__init__.py b/python/graphscope/gsctl/tests/__init__.py similarity index 100% rename from python/graphscope/gsctl/commands/insight/__init__.py rename to python/graphscope/gsctl/tests/__init__.py diff --git a/python/graphscope/gsctl/tests/test_interactive.py b/python/graphscope/gsctl/tests/test_interactive.py new file mode 100644 index 000000000000..87035dfd14cd --- /dev/null +++ b/python/graphscope/gsctl/tests/test_interactive.py @@ -0,0 +1,359 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. +# +# 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. +# + +import warnings + +# Disable warnings +warnings.filterwarnings("ignore", category=Warning) + +import time + +import pytest +from click.testing import CliRunner + +from graphscope.gsctl.impl import bind_datasource_in_batch +from graphscope.gsctl.impl import connect_coordinator +from graphscope.gsctl.impl import create_graph +from graphscope.gsctl.impl import create_stored_procedure +from graphscope.gsctl.impl import delete_graph_by_id +from graphscope.gsctl.impl import delete_stored_procedure_by_id +from graphscope.gsctl.impl import disconnect_coordinator +from graphscope.gsctl.impl import get_datasource_by_id +from graphscope.gsctl.impl import get_job_by_id +from graphscope.gsctl.impl import get_stored_procedure_by_id +from graphscope.gsctl.impl import list_graphs +from graphscope.gsctl.impl import list_service_status +from graphscope.gsctl.impl import list_stored_procedures +from graphscope.gsctl.impl import restart_service +from graphscope.gsctl.impl import start_service +from graphscope.gsctl.impl import stop_service +from graphscope.gsctl.impl import submit_dataloading_job +from graphscope.gsctl.impl import unbind_edge_datasource +from graphscope.gsctl.impl import unbind_vertex_datasource +from graphscope.gsctl.impl import update_stored_procedure_by_id +from graphscope.gsctl.impl import upload_file + +COORDINATOR_ENDPOINT = "http://127.0.0.1:8080" + + +modern_graph = { + "name": "modern_graph", + "description": "This is a test graph", + "schema": { + "vertex_types": [ + { + "type_name": "person", + "properties": [ + { + "property_name": "id", + "property_type": {"primitive_type": "DT_SIGNED_INT64"}, + }, + { + "property_name": "name", + "property_type": {"string": {"long_text": ""}}, + }, + { + "property_name": "age", + "property_type": {"primitive_type": "DT_SIGNED_INT32"}, + }, + ], + "primary_keys": ["id"], + } + ], + "edge_types": [ + { + "type_name": "knows", + "vertex_type_pair_relations": [ + { + "source_vertex": "person", + "destination_vertex": "person", + "relation": "MANY_TO_MANY", + } + ], + "properties": [ + { + "property_name": "weight", + "property_type": {"primitive_type": "DT_DOUBLE"}, + } + ], + "primary_keys": [], + } + ], + }, +} + + +modern_graph_datasource = { + "vertex_mappings": [ + { + "type_name": "person", + "inputs": ["@/home/graphscope/alibaba/test/interative/person.csv"], + "column_mappings": [ + {"column": {"index": 0, "name": "id"}, "property": "id"}, + {"column": {"index": 1, "name": "name"}, "property": "name"}, + {"column": {"index": 2, "name": "age"}, "property": "age"}, + ], + } + ], + "edge_mappings": [ + { + "type_triplet": { + "edge": "knows", + "source_vertex": "person", + "destination_vertex": "person", + }, + "inputs": [ + "@/home/graphscope/alibaba/test/interative/person_knows_person.csv" + ], + "source_vertex_mappings": [ + {"column": {"index": 0, "name": "person.id"}, "property": "id"} + ], + "destination_vertex_mappings": [ + {"column": {"index": 1, "name": "person.id"}, "property": "id"} + ], + "column_mappings": [ + {"column": {"index": 2, "name": "weight"}, "property": "weight"} + ], + } + ], +} + + +person_csv_content = "id|name|age\n1|marko|29\n2|vadas|27\n4|josh|32\n6|peter|35" +person_knows_person_csv_content = "person.id|person.id|weight\n1|2|0.5\n1|4|1.0" + + +class TestE2EInteractive(object): + def setup_class(self): + self.deployment_info = connect_coordinator(COORDINATOR_ENDPOINT) + + def test_deployment_info(self): + assert self.deployment_info.instance_name == "demo" + assert self.deployment_info.cluster_type == "HOSTS" + assert self.deployment_info.engine == "Hiactor" + assert self.deployment_info.storage == "MutableCSR" + assert self.deployment_info.frontend == "Cypher/Gremlin" + assert self.deployment_info.version is not None + assert self.deployment_info.creation_time is not None + + def test_graph(self): + # test create a new graph + graph_id = create_graph(modern_graph) + assert graph_id is not None + new_graph_exist = False + graphs = list_graphs() + for g in graphs: + if g.name == "modern_graph" and g.id == graph_id: + new_graph_exist = True + assert new_graph_exist + # test delete a graph by id + delete_graph_by_id(graph_id) + new_graph_exist = False + graphs = list_graphs() + for g in graphs: + if g.name == "modern_graph" and g.id == graph_id: + new_graph_exist = True + assert not new_graph_exist + + def test_bulk_loading(self, tmpdir): + # person + person = tmpdir.join("person.csv") + person.write("id|name|age\n1|marko|29\n2|vadas|27\n4|josh|32\n6|peter|35") + # person -> knows -> person + person_knows_person = tmpdir.join("person_knows_person.csv") + person_knows_person.write("person.id|person.id|weight\n1|2|0.5\n1|4|1.0") + # data source mapping + datasource = { + "vertex_mappings": [ + { + "type_name": "person", + "inputs": [upload_file(str(person))], + "column_mappings": [ + {"column": {"index": 0, "name": "id"}, "property": "id"}, + {"column": {"index": 1, "name": "name"}, "property": "name"}, + {"column": {"index": 2, "name": "age"}, "property": "age"}, + ], + } + ], + "edge_mappings": [ + { + "type_triplet": { + "edge": "knows", + "source_vertex": "person", + "destination_vertex": "person", + }, + "inputs": [upload_file(str(person_knows_person))], + "source_vertex_mappings": [ + {"column": {"index": 0, "name": "person.id"}, "property": "id"} + ], + "destination_vertex_mappings": [ + {"column": {"index": 1, "name": "person.id"}, "property": "id"} + ], + "column_mappings": [ + {"column": {"index": 2, "name": "weight"}, "property": "weight"} + ], + } + ], + } + # test bind data source + graph_id = create_graph(modern_graph) + bind_datasource_in_batch(graph_id, datasource) + ds = get_datasource_by_id(graph_id) + assert ds.to_dict() == datasource + # test bulk loading + job_config = { + "loading_config": { + "import_option": "overwrite", + "format": { + "type": "csv", + "metadata": { + "delimiter": "|", + "header_row": "true", + }, + }, + }, + "vertices": [ + {"type_name": "person"}, + ], + "edges": [ + { + "type_name": "knows", + "source_vertex": "person", + "destination_vertex": "person", + }, + ], + } + job_id = submit_dataloading_job(graph_id, job_config) + start_time = time.time() + # waiting for 30s + while True: + time.sleep(1) + status = get_job_by_id(job_id) + if status.status == "SUCCESS": + assert status.id == job_id + assert status.start_time is not None + assert status.end_time is not None + assert status.log is not None + assert status.detail is not None + break + if time.time() - start_time > 30: + raise TimeoutError(f"Waiting timeout for loading job {job_id}") + # test unbind data source + unbind_vertex_datasource(graph_id, "person") + unbind_edge_datasource(graph_id, "knows", "person", "person") + ds = get_datasource_by_id(graph_id).to_dict() + assert not ds["vertex_mappings"] + assert not ds["edge_mappings"] + delete_graph_by_id(graph_id) + + def test_procedure(self): + stored_procedure_dict = { + "name": "procedure_name", + "description": "This is a test procedure", + "query": "MATCH (n) RETURN COUNT(n);", + "type": "cypher", + } + # test create a new procedure + graph_id = create_graph(modern_graph) + stored_procedure_id = create_stored_procedure(graph_id, stored_procedure_dict) + assert stored_procedure_id is not None + new_procedure_exist = False + procedures = list_stored_procedures(graph_id) + for p in procedures: + if p.id == stored_procedure_id and p.name == "procedure_name": + new_procedure_exist = True + assert new_procedure_exist + # test update a procedure + description = "This is an updated description" + update_stored_procedure_by_id( + graph_id, stored_procedure_id, {"description": description} + ) + procedure = get_stored_procedure_by_id(graph_id, stored_procedure_id) + assert procedure.description == description + # test delete a procedure + delete_stored_procedure_by_id(graph_id, stored_procedure_id) + new_procedure_exist = False + procedures = list_stored_procedures(graph_id) + for p in procedures: + if p.id == stored_procedure_id and p.name == "procedure_name": + new_procedure_exist = True + assert not new_procedure_exist + delete_graph_by_id(graph_id) + + def test_service(self): + original_graph_id = None + status = list_service_status() + for s in status: + if s.status == "Running": + original_graph_id = s.graph_id + assert original_graph_id is not None + # start service on a new graph + new_graph_id = create_graph(modern_graph) + start_service(new_graph_id) + status = list_service_status() + for s in status: + if s.graph_id == new_graph_id: + assert s.status == "Running" + else: + assert s.status == "Stopped" + # restart the service + restart_service() + status = list_service_status() + for s in status: + if s.graph_id == new_graph_id: + assert s.status == "Running" + else: + assert s.status == "Stopped" + # stop the service + stop_service() + status = list_service_status() + for s in status: + assert s.status == "Stopped" + # delete graph and switch to original graph + delete_graph_by_id(new_graph_id) + start_service(original_graph_id) + status = list_service_status() + for s in status: + if s.graph_id == original_graph_id: + assert s.status == "Running" + else: + assert s.status == "Stopped" + + def test_suit_case(self): + # case 1: + # during deleting a graph, make sure the stored procedures + # on that graph are deleted at the same time + stored_procedure_dict = { + "name": "procedure_name", + "description": "This is a test procedure", + "query": "MATCH (n) RETURN COUNT(n);", + "type": "cypher", + } + graph_id = create_graph(modern_graph) + graph_id_2 = create_graph(modern_graph) + # create a procedure on graph 1 + stored_procedure_id = create_stored_procedure(graph_id, stored_procedure_dict) + assert stored_procedure_id == "procedure_name" + # delete the graph 1, then create a new procedure on graph 2 + delete_graph_by_id(graph_id) + stored_procedure_id = create_stored_procedure(graph_id_2, stored_procedure_dict) + assert stored_procedure_id == "procedure_name" + delete_graph_by_id(graph_id_2) + + def teardown_class(self): + disconnect_coordinator() diff --git a/python/graphscope/gsctl/utils.py b/python/graphscope/gsctl/utils.py index 460de4df3b72..167cbe20839a 100644 --- a/python/graphscope/gsctl/utils.py +++ b/python/graphscope/gsctl/utils.py @@ -23,6 +23,9 @@ from treelib import Node from treelib import Tree +from graphscope.flex.rest import PrimitiveType +from graphscope.flex.rest import StringType + def read_yaml_file(path) -> dict: """Reads YAML file and returns as a python object.""" @@ -83,6 +86,15 @@ def __init__(self): self.root_identifier = "GRAPH" self.tree.create_node(identifier=self.root_identifier) + def parse_property_type(self, property): + actual_instance = property.actual_instance + if isinstance(actual_instance, PrimitiveType): + return actual_instance.primitive_type + elif isinstance(actual_instance, StringType): + return "string" + else: + return str(actual_instance) + def create_graph_node_for_groot(self, graph, recursive=True): # graph name must be unique self.tree.create_node( @@ -156,30 +168,32 @@ def create_schema_node_for_groot(self, graph): def create_graph_node(self, graph, recursive=True): # graph name must be unique self.tree.create_node( - tag=f"identifier: {graph.name}", - identifier=graph.name, + tag=f"{graph.name}(identifier: {graph.id})", + identifier=graph.id, parent=self.root_identifier, ) if recursive: self.create_schema_node(graph) def create_schema_node(self, graph): - schema_identifier = f"{graph.name}_schema" + schema_identifier = f"{graph.id}_schema" self.tree.create_node( - tag="schema", identifier=schema_identifier, parent=graph.name + tag="schema", identifier=schema_identifier, parent=graph.id ) # vertex type + vertex_type_identifier = f"{schema_identifier}_vertex_types" self.tree.create_node( tag="vertex types", - identifier=f"{schema_identifier}_vertex_types", + identifier=vertex_type_identifier, parent=schema_identifier, ) if graph.var_schema is not None and graph.var_schema.vertex_types is not None: for vertex in graph.var_schema.vertex_types: + vertex_identifier = f"{vertex_type_identifier}_{vertex.type_name}" self.tree.create_node( tag=f"{vertex.type_name}", - identifier=f"{graph.name}_{vertex.type_name}", - parent=f"{schema_identifier}_vertex_types", + identifier=vertex_identifier, + parent=vertex_type_identifier, ) # property if vertex.properties is not None: @@ -187,23 +201,22 @@ def create_schema_node(self, graph): is_primary_key = ( True if p.property_name in vertex.primary_keys else False ) - identifier = ( - f"{graph.name}_{vertex.type_name}_{p.property_name}" - ) + property_identifier = f"{vertex_identifier}_{p.property_name}" tag = "Property(name: {0}, type: {1}, is_primary_key: {2})".format( p.property_name, - p.property_type.primitive_type, + self.parse_property_type(p.property_type), is_primary_key, ) self.tree.create_node( tag=tag, - identifier=identifier, - parent=f"{graph.name}_{vertex.type_name}", + identifier=property_identifier, + parent=vertex_identifier, ) # edge type + edge_type_identifier = f"{schema_identifier}_edge_types" self.tree.create_node( tag="edge types", - identifier=f"{schema_identifier}_edge_types", + identifier=edge_type_identifier, parent=schema_identifier, ) if graph.var_schema is not None and graph.var_schema.edge_types is not None: @@ -214,55 +227,63 @@ def create_schema_node(self, graph): edge.type_name, relation.destination_vertex, ) + edge_identifier = f"{edge_type_identifier}_{edge_label}" self.tree.create_node( tag=f"{edge_label}", - identifier=f"{graph.name}_{edge_label}", - parent=f"{schema_identifier}_edge_types", + identifier=edge_identifier, + parent=edge_type_identifier, ) if edge.properties is not None: for p in edge.properties: - identifier = f"{graph.name}_{edge_label}_{p.property_name}" + is_primary_key = ( + True if p.property_name in edge.primary_keys else False + ) + property_identifier = f"{edge_identifier}_{p.property_name}" tag = "Property(name: {0}, type: {1}, is_primary_key: {2})".format( - p.property_name, p.property_type.primitive_type, False + p.property_name, + self.parse_property_type(p.property_type), + is_primary_key, ) self.tree.create_node( tag=tag, - identifier=identifier, - parent=f"{graph.name}_{edge_label}", + identifier=property_identifier, + parent=edge_identifier, ) - def create_procedure_node(self, graph, procedures): - procedure_identifier = f"{graph.name}_procedure" + def create_stored_procedure_node(self, graph, stored_procedures): + stored_procedure_identifier = f"{graph.id}_stored_procedure" self.tree.create_node( - tag="stored procedure", identifier=procedure_identifier, parent=graph.name + tag="stored procedure", + identifier=stored_procedure_identifier, + parent=graph.id, ) - for p in procedures: + for p in stored_procedures: self.tree.create_node( - tag="Procedure(identifier: {0}, type: {1}, runnable: {2}, query: {3}, description: {4})".format( - p.name, p.type, p.runnable, p.query, p.description + tag="StoredProc(identifier: {0}, type: {1}, runnable: {2}, query: {3}, description: {4})".format( + p.id, p.type, p.runnable, p.query, p.description ), - identifier=f"{procedure_identifier}_{p.name}", - parent=procedure_identifier, + identifier=f"{stored_procedure_identifier}_{p.id}", + parent=stored_procedure_identifier, ) def create_job_node(self, graph, jobs): - job_identifier = f"{graph.name}_job" - self.tree.create_node(tag="job", identifier=job_identifier, parent=graph.name) + job_identifier = f"{graph.id}_job" + self.tree.create_node(tag="job", identifier=job_identifier, parent=graph.id) for j in jobs: - if j.detail["graph_name"] != graph.name: + if j.detail["graph_id"] != graph.id: continue self.tree.create_node( tag="Job(identifier: {0}, type: {1}, status: {2}, start time: {3}, end time: {4})".format( - j.job_id, j.type, j.status, j.start_time, str(j.end_time) + j.id, j.type, j.status, j.start_time, str(j.end_time) ), - identifier=f"{job_identifier}_{j.job_id}", + identifier=f"{job_identifier}_{j.id}", parent=job_identifier, ) def create_datasource_node(self, graph, datasource): - datasource_identifier = f"{graph.name}_datasource" + datasource_identifier = f"{graph.id}_datasource" self.tree.create_node( - tag="data sources", identifier=datasource_identifier, parent=graph.name + tag="data sources", identifier=datasource_identifier, parent=graph.id ) # vertex mappings self.tree.create_node( @@ -351,32 +372,27 @@ def create_datasource_node(self, graph, datasource): parent=f"{datasource_identifier}_{edge_label}", ) - def create_datasource_node_for_interactive(self, graph, job_config): - """Create data source from job configuration""" - - def _get_vertex_primary_key(graph): - rlt = {} - for vertex in graph.var_schema.vertex_types: - rlt[vertex.type_name] = vertex.primary_keys[0] - return rlt - - datasource_identifier = f"{graph.name}_datasource" + def create_datasource_mapping_node(self, graph, datasource_mapping): + datasource_identifier = f"{graph.id}_datasource" self.tree.create_node( - tag="data sources", identifier=datasource_identifier, parent=graph.name + tag="data sources", identifier=datasource_identifier, parent=graph.id ) - vertex_type_2_primary_key = _get_vertex_primary_key(graph) # vertex mapping + vertex_mapping_identifier = f"{datasource_identifier}_vertex_mappings" self.tree.create_node( tag="vertex mappings", - identifier=f"{datasource_identifier}_vertex_mappings", + identifier=vertex_mapping_identifier, parent=datasource_identifier, ) - if job_config.vertex_mappings is not None: - for mapping in job_config.vertex_mappings: + if datasource_mapping.vertex_mappings is not None: + for mapping in datasource_mapping.vertex_mappings: + specific_vertex_mapping_identifier = ( + f"{vertex_mapping_identifier}_{mapping.type_name}" + ) self.tree.create_node( tag=f"{mapping.type_name}(input: {mapping.inputs[0]})", - identifier=f"{datasource_identifier}_{mapping.type_name}", - parent=f"{datasource_identifier}_vertex_mappings", + identifier=specific_vertex_mapping_identifier, + parent=vertex_mapping_identifier, ) for property_column_mapping in mapping.column_mappings: tag = "Property(name: {0}) -> DataSourceColumn(index: {1}, name: {2})".format( @@ -384,48 +400,47 @@ def _get_vertex_primary_key(graph): property_column_mapping.column.index, property_column_mapping.column.name, ) - identifier = f"{datasource_identifier}_{mapping.type_name}_{property_column_mapping.var_property}" + p_mapping_identifier = f"{specific_vertex_mapping_identifier}_{property_column_mapping.var_property}" self.tree.create_node( tag=tag, - identifier=identifier, - parent=f"{datasource_identifier}_{mapping.type_name}", + identifier=p_mapping_identifier, + parent=specific_vertex_mapping_identifier, ) # edge mapping + edge_mapping_identifier = f"{datasource_identifier}_edge_mappings" self.tree.create_node( tag="edge mappings", - identifier=f"{datasource_identifier}_edge_mappings", + identifier=edge_mapping_identifier, parent=datasource_identifier, ) - if job_config.edge_mappings is not None: - for mapping in job_config.edge_mappings: + if datasource_mapping.edge_mappings is not None: + for mapping in datasource_mapping.edge_mappings: edge_label = "({0}) -[{1}]-> ({2})".format( mapping.type_triplet.source_vertex, mapping.type_triplet.edge, mapping.type_triplet.destination_vertex, ) + specific_edge_mapping_identifier = ( + f"{edge_mapping_identifier}_{edge_label}" + ) self.tree.create_node( tag=f"{edge_label}(input: {mapping.inputs[0]})", - identifier=f"{datasource_identifier}_{edge_label}", - parent=f"{datasource_identifier}_edge_mappings", + identifier=specific_edge_mapping_identifier, + parent=edge_mapping_identifier, ) # source vertex mapping for source_vertex_column_mapping in mapping.source_vertex_mappings: self.tree.create_node( tag="SourceVertexPrimaryKey(name: {0}) -> DataSourceColumn(index: {1}, name: {2})".format( - vertex_type_2_primary_key[ - mapping.type_triplet.source_vertex - ], + source_vertex_column_mapping.var_property, source_vertex_column_mapping.column.index, source_vertex_column_mapping.column.name, ), - identifier="{0}_{1}_source_vertex_primary_key_{2}".format( - datasource_identifier, - edge_label, - vertex_type_2_primary_key[ - mapping.type_triplet.source_vertex - ], + identifier="{0}_source_vertex_primary_key_{1}".format( + specific_edge_mapping_identifier, + source_vertex_column_mapping.var_property, ), - parent=f"{datasource_identifier}_{edge_label}", + parent=specific_edge_mapping_identifier, ) # destination vertex mapping for ( @@ -433,20 +448,15 @@ def _get_vertex_primary_key(graph): ) in mapping.destination_vertex_mappings: self.tree.create_node( tag="DestinationVertexPrimaryKey(name: {0}) -> DataSourceColumn(index: {1}, name: {2})".format( - vertex_type_2_primary_key[ - mapping.type_triplet.destination_vertex - ], + destination_vertex_column_mapping.var_property, destination_vertex_column_mapping.column.index, destination_vertex_column_mapping.column.name, ), - identifier="{0}_{1}_destination_vertex_primary_key_{2}".format( - datasource_identifier, - edge_label, - vertex_type_2_primary_key[ - mapping.type_triplet.destination_vertex - ], + identifier="{0}_destination_vertex_primary_key_{1}".format( + specific_edge_mapping_identifier, + destination_vertex_column_mapping.var_property, ), - parent=f"{datasource_identifier}_{edge_label}", + parent=specific_edge_mapping_identifier, ) # property mapping for property_column_mapping in mapping.column_mappings: @@ -455,11 +465,11 @@ def _get_vertex_primary_key(graph): property_column_mapping.column.index, property_column_mapping.column.name, ) - identifier = f"{datasource_identifier}_{edge_label}_{property_column_mapping.var_property}" + p_mapping_identifier = f"{specific_edge_mapping_identifier}_{property_column_mapping.var_property}" self.tree.create_node( tag=tag, - identifier=identifier, - parent=f"{datasource_identifier}_{edge_label}", + identifier=p_mapping_identifier, + parent=specific_edge_mapping_identifier, ) def show(self, graph_identifier=None, stdout=False, sorting=False): @@ -469,8 +479,10 @@ def show(self, graph_identifier=None, stdout=False, sorting=False): click.secho(schema_tree.show(stdout=False, sorting=False)) datasource_tree = self.tree.subtree(f"{graph_identifier}_datasource") click.secho(datasource_tree.show(stdout=False, sorting=False)) - procedure_tree = self.tree.subtree(f"{graph_identifier}_procedure") - click.secho(procedure_tree.show(stdout=False, sorting=False)) + stored_procedure_tree = self.tree.subtree( + f"{graph_identifier}_stored_procedure" + ) + click.secho(stored_procedure_tree.show(stdout=False, sorting=False)) job_tree = self.tree.subtree(f"{graph_identifier}_job") click.secho(job_tree.show(stdout=False, sorting=False)) else: diff --git a/python/graphscope/learning/gl_torch_examples/k8s/client.yaml b/python/graphscope/learning/gl_torch_examples/k8s/client.yaml index 681ef15b3255..b39c49ea7b83 100644 --- a/python/graphscope/learning/gl_torch_examples/k8s/client.yaml +++ b/python/graphscope/learning/gl_torch_examples/k8s/client.yaml @@ -12,7 +12,7 @@ spec: spec: containers: - name: pytorch - image: registry.cn-hongkong.aliyuncs.com/graphscope/graphlearn-torch-client:0.28.0a20240416 + image: registry.cn-hongkong.aliyuncs.com/graphscope/graphlearn-torch:0.28.0a20240526 imagePullPolicy: IfNotPresent command: - bash @@ -39,7 +39,7 @@ spec: spec: containers: - name: pytorch - image: registry.cn-hongkong.aliyuncs.com/graphscope/graphlearn-torch-client:0.28.0a20240416 + image: registry.cn-hongkong.aliyuncs.com/graphscope/graphlearn-torch:0.28.0a20240526 imagePullPolicy: IfNotPresent command: - bash diff --git a/python/graphscope/learning/gl_torch_examples/k8s/k8s_launch.py b/python/graphscope/learning/gl_torch_examples/k8s/k8s_launch.py index ba65cb105288..9238b949a633 100644 --- a/python/graphscope/learning/gl_torch_examples/k8s/k8s_launch.py +++ b/python/graphscope/learning/gl_torch_examples/k8s/k8s_launch.py @@ -27,13 +27,14 @@ # load the ogbn_arxiv graph as an example. sess = gs.session( with_dataset=True, + enabled_engines="gae,glt", k8s_service_type="LoadBalancer", k8s_namespace="default", # to guarantee auth to launch the pytorchjobs k8s_vineyard_mem="8Gi", k8s_engine_mem="8Gi", vineyard_shared_mem="8Gi", k8s_image_pull_policy="IfNotPresent", - k8s_image_tag="0.28.0a20240511", + k8s_image_tag="0.28.0a20240526", num_workers=params["NUM_SERVER_NODES"], ) g = load_ogbn_arxiv(sess=sess, prefix="/dataset/ogbn_arxiv") diff --git a/python/graphscope/tests/unittest/test_graph.py b/python/graphscope/tests/unittest/test_graph.py index 227faec10196..7101bb72bebe 100644 --- a/python/graphscope/tests/unittest/test_graph.py +++ b/python/graphscope/tests/unittest/test_graph.py @@ -47,54 +47,60 @@ def test_graph_schema(arrow_property_graph): def test_graph_schema_todict(p2p_property_graph): rlt = { - "vertices": [ + "vertex_types": [ { - "label": "person", + "type_name": "person", "properties": [ { - "name": "weight", - "id": 0, - "type": "LONG", + "property_name": "weight", + "property_id": 0, + "property_type": {"primitive_type": "DT_SIGNED_INT64"}, "is_primary_key": False, - "comment": "", + "description": "", }, { - "name": "id", - "id": 1, - "type": "LONG", + "property_name": "id", + "property_id": 1, + "property_type": {"primitive_type": "DT_SIGNED_INT64"}, "is_primary_key": False, - "comment": "", + "description": "", }, ], + "primary_keys": [], + "description": "", } ], - "edges": [ + "edge_types": [ { - "label": "knows", + "type_name": "knows", "properties": [ { - "name": "src_label_id", - "id": 0, - "type": "LONG", + "property_name": "src_label_id", + "property_id": 0, + "property_type": {"primitive_type": "DT_SIGNED_INT64"}, "is_primary_key": False, - "comment": "", + "description": "", }, { - "name": "dst_label_id", - "id": 1, - "type": "LONG", + "property_name": "dst_label_id", + "property_id": 1, + "property_type": {"primitive_type": "DT_SIGNED_INT64"}, "is_primary_key": False, - "comment": "", + "description": "", }, { - "name": "dist", - "id": 2, - "type": "LONG", + "property_name": "dist", + "property_id": 2, + "property_type": {"primitive_type": "DT_SIGNED_INT64"}, "is_primary_key": False, - "comment": "", + "description": "", }, ], - "relations": [{"src_label": "person", "dst_label": "person"}], + "primary_keys": [], + "description": "", + "vertex_type_pair_relations": [ + {"source_vertex": "person", "destination_vertex": "person"} + ], } ], } diff --git a/python/requirements.txt b/python/requirements.txt index c898a22c2a79..4ebf3a40cc3e 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -22,7 +22,6 @@ ujson;python_version>="3.11" PyYAML rich tqdm -click vineyard>=0.16.3;sys_platform!="win32" simple-parsing graphscope-flex>=0.27.0 diff --git a/python/setup.cfg b/python/setup.cfg index 1fb307179120..df5bcf58104a 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -25,7 +25,7 @@ max-complexity = 18 # for flake8-quotes inline-quotes = double # for flake8-comprehensions -extend-ignore = E203,F401,F401,F403,C4,I250 +extend-ignore = E203,F401,F401,F403,C4,I250,E402 extend-exclude = *_pb2.py *_pb2_grpc.py diff --git a/python/setup.py b/python/setup.py index 390ec519ea7e..e656e0027fd7 100644 --- a/python/setup.py +++ b/python/setup.py @@ -285,7 +285,9 @@ def find_graphscope_packages(): packages = [] # add graphscope - for pkg in find_packages(".", exclude=["graphscope.flex.*"]): + for pkg in find_packages( + ".", exclude=["graphscope.flex.*", "graphscope.gsctl", "graphscope.gsctl.*"] + ): packages.append(pkg) return packages @@ -303,8 +305,6 @@ def parsed_package_data(): "graphscope": [ "VERSION", "proto/*.pyi", - "gsctl/scripts/*.sh", - "gsctl/scripts/lib/*.sh", ], } @@ -473,11 +473,6 @@ def parse_version(root, **kwargs): "Source": "https://github.com/alibaba/GraphScope", "Tracker": "https://github.com/alibaba/GraphScope/issues", }, - entry_points={ - "console_scripts": [ - "gsctl = graphscope.gsctl.gsctl:cli", - ], - }, ) if os.name == "nt": diff --git a/python/setup_gsctl.py b/python/setup_gsctl.py new file mode 100644 index 000000000000..58d2f145e7f5 --- /dev/null +++ b/python/setup_gsctl.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. +# +# 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. +# + +import os + +from setuptools import find_packages # noqa: H301 +from setuptools import setup + +pkg_root = os.path.dirname(os.path.abspath(__file__)) + + +def parse_version(root, **kwargs): + """ + Parse function for setuptools_scm that first tries to read '../VERSION' file + to get a version number. + """ + from setuptools_scm.git import parse + from setuptools_scm.version import meta + + version_file = os.path.join(pkg_root, "..", "VERSION") + if os.path.isfile(version_file): + with open(version_file, "r", encoding="utf-8") as fp: + return meta(fp.read().strip()) + return parse(root, **kwargs) + + +NAME = "gsctl" +PYTHON_REQUIRES = ">=3.7" +REQUIRES = ["click >= 8.1.6", "graphscope-flex >= 0.27.0"] + +setup( + name=NAME, + description="Command line tool for GraphScope", + author="GraphScope", + author_email="graphscope@alibaba-inc.com", + url="", + keywords=["GraphScope", "Command-line tool"], + use_scm_version={ + "root": pkg_root, + "parse": parse_version, + }, + install_requires=REQUIRES, + packages=find_packages(include=["graphscope.gsctl", "graphscope.gsctl.*"]), + include_package_data=True, + license="Apache 2.0", + long_description_content_type="text/markdown", + long_description="""\ + gsctl is a command-line utility for GraphScope. It provides a set of functionalities to make it easy to use GraphScope. These functionalities include building and testing binaries, managing sessions and resources, and more. + """, # noqa: E501 + package_data={"graphscope.gsctl": ["scripts/*.sh", "scripts/lib/*.sh"]}, + entry_points={ + "console_scripts": [ + "gsctl = graphscope.gsctl.gsctl:cli", + ], + }, +)