From eac165ca6c43b7a5b4121ffa541c44b948119544 Mon Sep 17 00:00:00 2001 From: Jens Pots Date: Mon, 29 Jul 2024 20:49:13 +0200 Subject: [PATCH] feat: init python runner --- .pre-commit-config.yaml | 8 - runners/python/.gitignore | 289 ++++++++++++++++++ runners/python/README.md | 9 + runners/python/index.ttl | 17 ++ runners/python/poetry.lock | 157 +++++++++- runners/python/pyproject.toml | 11 +- runners/python/src/main.py | 12 +- runners/python/src/proto/__init__.py | 0 runners/python/src/proto/channel_pb2.py | 33 ++ runners/python/src/proto/channel_pb2.pyi | 35 +++ runners/python/src/proto/channel_pb2_grpc.py | 32 ++ runners/python/src/proto/empty_pb2.py | 27 ++ runners/python/src/proto/empty_pb2.pyi | 9 + runners/python/src/proto/empty_pb2_grpc.py | 32 ++ runners/python/src/proto/index_pb2.py | 32 ++ runners/python/src/proto/index_pb2.pyi | 7 + runners/python/src/proto/index_pb2_grpc.py | 159 ++++++++++ runners/python/src/proto/intermediate_pb2.py | 67 ++++ runners/python/src/proto/intermediate_pb2.pyi | 145 +++++++++ .../python/src/proto/intermediate_pb2_grpc.py | 32 ++ runners/python/src/runtime/__init__.py | 3 + runners/python/src/runtime/processor.py | 11 + runners/python/src/runtime/runner.py | 2 + runners/python/src/server/__init__.py | 3 + runners/python/src/server/server.py | 35 +++ 25 files changed, 1154 insertions(+), 13 deletions(-) create mode 100644 runners/python/.gitignore create mode 100644 runners/python/index.ttl mode change 100644 => 100755 runners/python/src/main.py create mode 100644 runners/python/src/proto/__init__.py create mode 100644 runners/python/src/proto/channel_pb2.py create mode 100644 runners/python/src/proto/channel_pb2.pyi create mode 100644 runners/python/src/proto/channel_pb2_grpc.py create mode 100644 runners/python/src/proto/empty_pb2.py create mode 100644 runners/python/src/proto/empty_pb2.pyi create mode 100644 runners/python/src/proto/empty_pb2_grpc.py create mode 100644 runners/python/src/proto/index_pb2.py create mode 100644 runners/python/src/proto/index_pb2.pyi create mode 100644 runners/python/src/proto/index_pb2_grpc.py create mode 100644 runners/python/src/proto/intermediate_pb2.py create mode 100644 runners/python/src/proto/intermediate_pb2.pyi create mode 100644 runners/python/src/proto/intermediate_pb2_grpc.py create mode 100644 runners/python/src/runtime/__init__.py create mode 100644 runners/python/src/runtime/processor.py create mode 100644 runners/python/src/runtime/runner.py create mode 100644 runners/python/src/server/__init__.py create mode 100644 runners/python/src/server/server.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5295143..959eb63 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,4 @@ repos: - - repo: https://github.com/pycqa/flake8 - rev: 7.1.0 - hooks: - - id: flake8 - additional_dependencies: - - flake8-bugbear==24.2.6 - - flake8-comprehensions - - flake8-simplify - repo: https://github.com/pre-commit/pre-commit rev: v3.7.0 hooks: diff --git a/runners/python/.gitignore b/runners/python/.gitignore new file mode 100644 index 0000000..4167464 --- /dev/null +++ b/runners/python/.gitignore @@ -0,0 +1,289 @@ +# Created by https://www.toptal.com/developers/gitignore/api/python,pycharm +# Edit at https://www.toptal.com/developers/gitignore?templates=python,pycharm + +### PyCharm ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### PyCharm Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij +.idea/**/azureSettings.xml + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# 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/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +# End of https://www.toptal.com/developers/gitignore/api/python,pycharm \ No newline at end of file diff --git a/runners/python/README.md b/runners/python/README.md index e69de29..bbbc982 100644 --- a/runners/python/README.md +++ b/runners/python/README.md @@ -0,0 +1,9 @@ +# Python Runner + +## Development Guide + +### gRPC Code Generation + +```shell +python -m grpc_tools.protoc -I../../protos --python_out=. --pyi_out=. --grpc_python_out=. ../../protos/helloworld.proto +``` \ No newline at end of file diff --git a/runners/python/index.ttl b/runners/python/index.ttl new file mode 100644 index 0000000..9c9c673 --- /dev/null +++ b/runners/python/index.ttl @@ -0,0 +1,17 @@ +@prefix rdfc: . + +rdfc:PythonPackage + a rdfc:Package ; + rdfc:version "0.0.1" ; + rdfc:author "Jens Pots" ; + rdfc:description "A gRPC based Python runner." ; + rdfc:repo "https://github.com/rdf-connect/orchestrator" ; + rdfc:license "MIT" ; + rdfc:prepare ( + "poetry install" + ) ; + rdfc:runners rdfc:NodeRunner . + +rdfc:PythonRunner + a rdfc:GRPCRunner ; + rdfc:entrypoint "poetry run server" . diff --git a/runners/python/poetry.lock b/runners/python/poetry.lock index 1034779..1834158 100644 --- a/runners/python/poetry.lock +++ b/runners/python/poetry.lock @@ -1,7 +1,160 @@ # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. -package = [] + +[[package]] +name = "grpcio" +version = "1.65.1" +description = "HTTP/2-based RPC framework" +optional = false +python-versions = ">=3.8" +files = [ + {file = "grpcio-1.65.1-cp310-cp310-linux_armv7l.whl", hash = "sha256:3dc5f928815b8972fb83b78d8db5039559f39e004ec93ebac316403fe031a062"}, + {file = "grpcio-1.65.1-cp310-cp310-macosx_12_0_universal2.whl", hash = "sha256:8333ca46053c35484c9f2f7e8d8ec98c1383a8675a449163cea31a2076d93de8"}, + {file = "grpcio-1.65.1-cp310-cp310-manylinux_2_17_aarch64.whl", hash = "sha256:7af64838b6e615fff0ec711960ed9b6ee83086edfa8c32670eafb736f169d719"}, + {file = "grpcio-1.65.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dbb64b4166362d9326f7efbf75b1c72106c1aa87f13a8c8b56a1224fac152f5c"}, + {file = "grpcio-1.65.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a8422dc13ad93ec8caa2612b5032a2b9cd6421c13ed87f54db4a3a2c93afaf77"}, + {file = "grpcio-1.65.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:4effc0562b6c65d4add6a873ca132e46ba5e5a46f07c93502c37a9ae7f043857"}, + {file = "grpcio-1.65.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a6c71575a2fedf259724981fd73a18906513d2f306169c46262a5bae956e6364"}, + {file = "grpcio-1.65.1-cp310-cp310-win32.whl", hash = "sha256:34966cf526ef0ea616e008d40d989463e3db157abb213b2f20c6ce0ae7928875"}, + {file = "grpcio-1.65.1-cp310-cp310-win_amd64.whl", hash = "sha256:ca931de5dd6d9eb94ff19a2c9434b23923bce6f767179fef04dfa991f282eaad"}, + {file = "grpcio-1.65.1-cp311-cp311-linux_armv7l.whl", hash = "sha256:bbb46330cc643ecf10bd9bd4ca8e7419a14b6b9dedd05f671c90fb2c813c6037"}, + {file = "grpcio-1.65.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d827a6fb9215b961eb73459ad7977edb9e748b23e3407d21c845d1d8ef6597e5"}, + {file = "grpcio-1.65.1-cp311-cp311-manylinux_2_17_aarch64.whl", hash = "sha256:6e71aed8835f8d9fbcb84babc93a9da95955d1685021cceb7089f4f1e717d719"}, + {file = "grpcio-1.65.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9a1c84560b3b2d34695c9ba53ab0264e2802721c530678a8f0a227951f453462"}, + {file = "grpcio-1.65.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27adee2338d697e71143ed147fe286c05810965d5d30ec14dd09c22479bfe48a"}, + {file = "grpcio-1.65.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:f62652ddcadc75d0e7aa629e96bb61658f85a993e748333715b4ab667192e4e8"}, + {file = "grpcio-1.65.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:71a05fd814700dd9cb7d9a507f2f6a1ef85866733ccaf557eedacec32d65e4c2"}, + {file = "grpcio-1.65.1-cp311-cp311-win32.whl", hash = "sha256:b590f1ad056294dfaeac0b7e1b71d3d5ace638d8dd1f1147ce4bd13458783ba8"}, + {file = "grpcio-1.65.1-cp311-cp311-win_amd64.whl", hash = "sha256:12e9bdf3b5fd48e5fbe5b3da382ad8f97c08b47969f3cca81dd9b36b86ed39e2"}, + {file = "grpcio-1.65.1-cp312-cp312-linux_armv7l.whl", hash = "sha256:54cb822e177374b318b233e54b6856c692c24cdbd5a3ba5335f18a47396bac8f"}, + {file = "grpcio-1.65.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:aaf3c54419a28d45bd1681372029f40e5bfb58e5265e3882eaf21e4a5f81a119"}, + {file = "grpcio-1.65.1-cp312-cp312-manylinux_2_17_aarch64.whl", hash = "sha256:557de35bdfbe8bafea0a003dbd0f4da6d89223ac6c4c7549d78e20f92ead95d9"}, + {file = "grpcio-1.65.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8bfd95ef3b097f0cc86ade54eafefa1c8ed623aa01a26fbbdcd1a3650494dd11"}, + {file = "grpcio-1.65.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e6a8f3d6c41e6b642870afe6cafbaf7b61c57317f9ec66d0efdaf19db992b90"}, + {file = "grpcio-1.65.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:1faaf7355ceed07ceaef0b9dcefa4c98daf1dd8840ed75c2de128c3f4a4d859d"}, + {file = "grpcio-1.65.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:60f1f38eed830488ad2a1b11579ef0f345ff16fffdad1d24d9fbc97ba31804ff"}, + {file = "grpcio-1.65.1-cp312-cp312-win32.whl", hash = "sha256:e75acfa52daf5ea0712e8aa82f0003bba964de7ae22c26d208cbd7bc08500177"}, + {file = "grpcio-1.65.1-cp312-cp312-win_amd64.whl", hash = "sha256:ff5a84907e51924973aa05ed8759210d8cdae7ffcf9e44fd17646cf4a902df59"}, + {file = "grpcio-1.65.1-cp38-cp38-linux_armv7l.whl", hash = "sha256:1fbd6331f18c3acd7e09d17fd840c096f56eaf0ef830fbd50af45ae9dc8dfd83"}, + {file = "grpcio-1.65.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:de5b6be29116e094c5ef9d9e4252e7eb143e3d5f6bd6d50a78075553ab4930b0"}, + {file = "grpcio-1.65.1-cp38-cp38-manylinux_2_17_aarch64.whl", hash = "sha256:e4a3cdba62b2d6aeae6027ae65f350de6dc082b72e6215eccf82628e79efe9ba"}, + {file = "grpcio-1.65.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:941c4869aa229d88706b78187d60d66aca77fe5c32518b79e3c3e03fc26109a2"}, + {file = "grpcio-1.65.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f40cebe5edb518d78b8131e87cb83b3ee688984de38a232024b9b44e74ee53d3"}, + {file = "grpcio-1.65.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:2ca684ba331fb249d8a1ce88db5394e70dbcd96e58d8c4b7e0d7b141a453dce9"}, + {file = "grpcio-1.65.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8558f0083ddaf5de64a59c790bffd7568e353914c0c551eae2955f54ee4b857f"}, + {file = "grpcio-1.65.1-cp38-cp38-win32.whl", hash = "sha256:8d8143a3e3966f85dce6c5cc45387ec36552174ba5712c5dc6fcc0898fb324c0"}, + {file = "grpcio-1.65.1-cp38-cp38-win_amd64.whl", hash = "sha256:76e81a86424d6ca1ce7c16b15bdd6a964a42b40544bf796a48da241fdaf61153"}, + {file = "grpcio-1.65.1-cp39-cp39-linux_armv7l.whl", hash = "sha256:cb5175f45c980ff418998723ea1b3869cce3766d2ab4e4916fbd3cedbc9d0ed3"}, + {file = "grpcio-1.65.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:b12c1aa7b95abe73b3e04e052c8b362655b41c7798da69f1eaf8d186c7d204df"}, + {file = "grpcio-1.65.1-cp39-cp39-manylinux_2_17_aarch64.whl", hash = "sha256:3019fb50128b21a5e018d89569ffaaaa361680e1346c2f261bb84a91082eb3d3"}, + {file = "grpcio-1.65.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7ae15275ed98ea267f64ee9ddedf8ecd5306a5b5bb87972a48bfe24af24153e8"}, + {file = "grpcio-1.65.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5f096ffb881f37e8d4f958b63c74bfc400c7cebd7a944b027357cd2fb8d91a57"}, + {file = "grpcio-1.65.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:2f56b5a68fdcf17a0a1d524bf177218c3c69b3947cb239ea222c6f1867c3ab68"}, + {file = "grpcio-1.65.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:941596d419b9736ab548aa0feb5bbba922f98872668847bf0720b42d1d227b9e"}, + {file = "grpcio-1.65.1-cp39-cp39-win32.whl", hash = "sha256:5fd7337a823b890215f07d429f4f193d24b80d62a5485cf88ee06648591a0c57"}, + {file = "grpcio-1.65.1-cp39-cp39-win_amd64.whl", hash = "sha256:1bceeec568372cbebf554eae1b436b06c2ff24cfaf04afade729fb9035408c6c"}, + {file = "grpcio-1.65.1.tar.gz", hash = "sha256:3c492301988cd720cd145d84e17318d45af342e29ef93141228f9cd73222368b"}, +] + +[package.extras] +protobuf = ["grpcio-tools (>=1.65.1)"] + +[[package]] +name = "grpcio-tools" +version = "1.65.1" +description = "Protobuf code generator for gRPC" +optional = false +python-versions = ">=3.8" +files = [ + {file = "grpcio_tools-1.65.1-cp310-cp310-linux_armv7l.whl", hash = "sha256:16f2f49048c76a68a8171507c39652c8be9ed4e7408deb9877002813aea4c396"}, + {file = "grpcio_tools-1.65.1-cp310-cp310-macosx_12_0_universal2.whl", hash = "sha256:6f75bf562057723818dff7bf4e05884c220653ead3db19effe5873ce88c7cfd2"}, + {file = "grpcio_tools-1.65.1-cp310-cp310-manylinux_2_17_aarch64.whl", hash = "sha256:e859001e20d4199ac90979e11d0d0ecb83f6b0235b08f8bfae93c2bd1401795a"}, + {file = "grpcio_tools-1.65.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:257decc1782b9adca422a2625663529be64018c056d7346d8bbc7c9bf0fe3b80"}, + {file = "grpcio_tools-1.65.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac8cc2684bcde43296cf5a350b80b73713610f0789ff912c88f898ef065a0b6c"}, + {file = "grpcio_tools-1.65.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:b8ef108fceabb12ed29f750f2cb4827d7bad5033dc13596ad0de092f015f5123"}, + {file = "grpcio_tools-1.65.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:32fa16e64f4b1684ed634155af9b03fdeabdf641d484e53c453e592e0f574f03"}, + {file = "grpcio_tools-1.65.1-cp310-cp310-win32.whl", hash = "sha256:d4afb3e74c7a567eabda3c447421eb8fb5c6cbf19bb9292319056beff4ab49a1"}, + {file = "grpcio_tools-1.65.1-cp310-cp310-win_amd64.whl", hash = "sha256:edb4731b4ad068c3c48d52bbfa1404236cbcdd2524eb01a655e8adfadc2f0034"}, + {file = "grpcio_tools-1.65.1-cp311-cp311-linux_armv7l.whl", hash = "sha256:fabbc0698cf0c614059c3e103b06c74d07190e9c7518f457703e98617ed467c0"}, + {file = "grpcio_tools-1.65.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ee1353c741f8f2fcf4fcce8764d4570e2d7c3025cc4c918a0c6532c18b6cbac5"}, + {file = "grpcio_tools-1.65.1-cp311-cp311-manylinux_2_17_aarch64.whl", hash = "sha256:f49acf17ae7b1a35b5e0e5907ed9b70c042b3e7ab8769ea9fd26f20b2b888743"}, + {file = "grpcio_tools-1.65.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c50895d383d41a379f9a235ce6d14c6639f36d43bf71c7148bf8a114a8f0936a"}, + {file = "grpcio_tools-1.65.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c394cf5b77eb71ff5c0ab857877f59dfee080cc95fb24d47e97d3965aaaf3c64"}, + {file = "grpcio_tools-1.65.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:e24819f8d11fc9e6bad1e13a1d7fddd6027ed2a1aad583f093cfe027852ff3f9"}, + {file = "grpcio_tools-1.65.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2ec7e376f3f53e7ab90614d5a2404c19c7902750bcc5bed8219ab864f9bc1c4b"}, + {file = "grpcio_tools-1.65.1-cp311-cp311-win32.whl", hash = "sha256:9b6dbddca8e399ad96d263b786d0803acc67194cb80d01117691a9f239ac8dc9"}, + {file = "grpcio_tools-1.65.1-cp311-cp311-win_amd64.whl", hash = "sha256:3135888461888dcc7b358c17d60f32654cb36daf02bb805c84c0f8ab550743eb"}, + {file = "grpcio_tools-1.65.1-cp312-cp312-linux_armv7l.whl", hash = "sha256:b8fe0bd8e63a4dd84c022ccbb6057e9f3c338e036a1b95c2a6dbcc928c35b4f9"}, + {file = "grpcio_tools-1.65.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:bfb1a5e429756cdc9ce7183cca24a90bd7e68626379c83ea065bb30125d7aca4"}, + {file = "grpcio_tools-1.65.1-cp312-cp312-manylinux_2_17_aarch64.whl", hash = "sha256:4dde0d90f96e29670c58a08aeeac61da49792f71602cb7421943be8918857a2a"}, + {file = "grpcio_tools-1.65.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a89203d864dd024c4a13032f2df792eb465c63c224f9b82460d53f0cf30a3d16"}, + {file = "grpcio_tools-1.65.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7813a67cb427847e1a88d4fd4cbabfd2ed272455bd78b4f417377361d3b8edbd"}, + {file = "grpcio_tools-1.65.1-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:33e4c602221f91c1d87c4574c496621f11826d4f8867f31f4c4c2ff1b144a777"}, + {file = "grpcio_tools-1.65.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fd2fe61d40e7421dc64c90912e29c05f1c419dd7a90452c84a1b456e06bd8530"}, + {file = "grpcio_tools-1.65.1-cp312-cp312-win32.whl", hash = "sha256:013017df92d6165e1556a17c618cf22471ef131fb614b428683730968b54b46d"}, + {file = "grpcio_tools-1.65.1-cp312-cp312-win_amd64.whl", hash = "sha256:1ab64a9af7ce0aeb639a77423fa99de91863a0b8ce0e43fc50f57fc460a0d30e"}, + {file = "grpcio_tools-1.65.1-cp38-cp38-linux_armv7l.whl", hash = "sha256:a95fd13dc17b065a934f00a0b99078de7773d4743772312efc8e75521ab62f7b"}, + {file = "grpcio_tools-1.65.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e44c69c029614fc61da2701587299fe19e52031aa1fba2a69a02c2dd77f903fe"}, + {file = "grpcio_tools-1.65.1-cp38-cp38-manylinux_2_17_aarch64.whl", hash = "sha256:196e12c18f0ebe5ac7f5446fc1daef8d9c69ba40a987a1f8379bfdf6c32e54af"}, + {file = "grpcio_tools-1.65.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:881ccc523a171235bb6b1d8e965c2f11e525b54eb1d66aeb8fea5a72f84d6e02"}, + {file = "grpcio_tools-1.65.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d5a12e0bd2a0f33af11e11d89f19cddea66568716b53b77f3f5dc605ceb32e0"}, + {file = "grpcio_tools-1.65.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:1d8671d82449206ef040756a14484b0c5189615a0aac5f4734ad3d023d07d4b1"}, + {file = "grpcio_tools-1.65.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:dc904f0de72eecbd024c111caa3e3165522349ff3c89361e4cbf06035c93061a"}, + {file = "grpcio_tools-1.65.1-cp38-cp38-win32.whl", hash = "sha256:b6e45377dbe50c7a737d81620841b8c3f3a1650c76cb56a87b5b0414d10f9987"}, + {file = "grpcio_tools-1.65.1-cp38-cp38-win_amd64.whl", hash = "sha256:5c9b4d95d2623b8b9435103305c3d375f8b4a266ee6fbbf29b5f4a57a8405047"}, + {file = "grpcio_tools-1.65.1-cp39-cp39-linux_armv7l.whl", hash = "sha256:4b0714458a6a3a1ed587271f3e7c301b735ccbdd7946071a1d85a6d0aabcb57a"}, + {file = "grpcio_tools-1.65.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:1ece34ebb677a869606200812653f274757844754f0b684e59d61244b194f002"}, + {file = "grpcio_tools-1.65.1-cp39-cp39-manylinux_2_17_aarch64.whl", hash = "sha256:4887af67ff130174fa7fb420ee985d38659a7c960053639de28980003fe710eb"}, + {file = "grpcio_tools-1.65.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d99945dc53daa7987ae8c33227f96697ccc4d0a4a1ca6c366e28fcc9fc1c55fb"}, + {file = "grpcio_tools-1.65.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:68d14cbd135541366bbef18c1d463f5d560878629f1901cae03777dad87755d9"}, + {file = "grpcio_tools-1.65.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:bc55edf7a0af0ad7384887845b6498fdb1a75d3633d11807f953cac531a34588"}, + {file = "grpcio_tools-1.65.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:074fce3b96a5c59ed526bdd07c04c6243c07b13278388837a0540840ae10bf5b"}, + {file = "grpcio_tools-1.65.1-cp39-cp39-win32.whl", hash = "sha256:004232fa8ef82298eeb01b391d708b3a89317910e2f7c623b566aea0448c8dcc"}, + {file = "grpcio_tools-1.65.1-cp39-cp39-win_amd64.whl", hash = "sha256:9cc6f342b8e8a2aa801d2d1640290a47563d8bb1a802671191dc3fc218747da3"}, + {file = "grpcio_tools-1.65.1.tar.gz", hash = "sha256:24cffe8bc90fb8237f0bcf240bd6c70304255fe27b69db32601499a043f871be"}, +] + +[package.dependencies] +grpcio = ">=1.65.1" +protobuf = ">=5.26.1,<6.0dev" +setuptools = "*" + +[[package]] +name = "protobuf" +version = "5.27.2" +description = "" +optional = false +python-versions = ">=3.8" +files = [ + {file = "protobuf-5.27.2-cp310-abi3-win32.whl", hash = "sha256:354d84fac2b0d76062e9b3221f4abbbacdfd2a4d8af36bab0474f3a0bb30ab38"}, + {file = "protobuf-5.27.2-cp310-abi3-win_amd64.whl", hash = "sha256:0e341109c609749d501986b835f667c6e1e24531096cff9d34ae411595e26505"}, + {file = "protobuf-5.27.2-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:a109916aaac42bff84702fb5187f3edadbc7c97fc2c99c5ff81dd15dcce0d1e5"}, + {file = "protobuf-5.27.2-cp38-abi3-manylinux2014_aarch64.whl", hash = "sha256:176c12b1f1c880bf7a76d9f7c75822b6a2bc3db2d28baa4d300e8ce4cde7409b"}, + {file = "protobuf-5.27.2-cp38-abi3-manylinux2014_x86_64.whl", hash = "sha256:b848dbe1d57ed7c191dfc4ea64b8b004a3f9ece4bf4d0d80a367b76df20bf36e"}, + {file = "protobuf-5.27.2-cp38-cp38-win32.whl", hash = "sha256:4fadd8d83e1992eed0248bc50a4a6361dc31bcccc84388c54c86e530b7f58863"}, + {file = "protobuf-5.27.2-cp38-cp38-win_amd64.whl", hash = "sha256:610e700f02469c4a997e58e328cac6f305f649826853813177e6290416e846c6"}, + {file = "protobuf-5.27.2-cp39-cp39-win32.whl", hash = "sha256:9e8f199bf7f97bd7ecebffcae45ebf9527603549b2b562df0fbc6d4d688f14ca"}, + {file = "protobuf-5.27.2-cp39-cp39-win_amd64.whl", hash = "sha256:7fc3add9e6003e026da5fc9e59b131b8f22b428b991ccd53e2af8071687b4fce"}, + {file = "protobuf-5.27.2-py3-none-any.whl", hash = "sha256:54330f07e4949d09614707c48b06d1a22f8ffb5763c159efd5c0928326a91470"}, + {file = "protobuf-5.27.2.tar.gz", hash = "sha256:f3ecdef226b9af856075f28227ff2c90ce3a594d092c39bee5513573f25e2714"}, +] + +[[package]] +name = "setuptools" +version = "72.1.0" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "setuptools-72.1.0-py3-none-any.whl", hash = "sha256:5a03e1860cf56bb6ef48ce186b0e557fdba433237481a9a625176c2831be15d1"}, + {file = "setuptools-72.1.0.tar.gz", hash = "sha256:8d243eff56d095e5817f796ede6ae32941278f542e0f941867cc05ae52b162ec"}, +] + +[package.extras] +core = ["importlib-metadata (>=6)", "importlib-resources (>=5.10.2)", "jaraco.text (>=3.7)", "more-itertools (>=8.8)", "ordered-set (>=3.1.1)", "packaging (>=24)", "platformdirs (>=2.6.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"] +doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test", "mypy (==1.11.*)", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (<0.4)", "pytest-ruff (>=0.2.1)", "pytest-ruff (>=0.3.2)", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "34e39677d8527182346093002688d17a5d2fc204b9eb3e094b2e6ac519028228" +content-hash = "6012e73116ef8ffaff88bf0c3c5c65446edd7156ae1e1f866d82f4144c0374ab" diff --git a/runners/python/pyproject.toml b/runners/python/pyproject.toml index 609d803..9e13f7f 100644 --- a/runners/python/pyproject.toml +++ b/runners/python/pyproject.toml @@ -1,12 +1,21 @@ [tool.poetry] -name = "RDF-Connect Python Runner" +name = "Python Runner for RDF-Connect" version = "0.1.0" description = "Python runner for RDF-Connect using gRPC." authors = ["Jens Pots "] readme = "README.md" +packages = [ + { include = "src" } +] + +[tool.poetry.scripts] +server = "src.main:main" + [tool.poetry.dependencies] python = "^3.12" +grpcio = "^1.65.1" +grpcio-tools = "^1.65.1" [build-system] diff --git a/runners/python/src/main.py b/runners/python/src/main.py old mode 100644 new mode 100755 index cd6ecd9..f1a3626 --- a/runners/python/src/main.py +++ b/runners/python/src/main.py @@ -1,2 +1,10 @@ -if __name__ == "__main__": - print("Hello, World!") +from src.server import Server +import asyncio + + +def main(): + asyncio.run(async_main()) + + +async def async_main(): + await Server.launch() diff --git a/runners/python/src/proto/__init__.py b/runners/python/src/proto/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/runners/python/src/proto/channel_pb2.py b/runners/python/src/proto/channel_pb2.py new file mode 100644 index 0000000..bc190a0 --- /dev/null +++ b/runners/python/src/proto/channel_pb2.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: channel.proto +# Protobuf Python Version: 5.26.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n\rchannel.proto\x12\x04rdfc"\x16\n\x07\x43hannel\x12\x0b\n\x03uri\x18\x01 \x01(\t"\x1c\n\x0b\x43hannelData\x12\r\n\x05\x62ytes\x18\x01 \x01(\x0c"\x87\x01\n\x0e\x43hannelMessage\x12\x1e\n\x07\x63hannel\x18\x01 \x01(\x0b\x32\r.rdfc.Channel\x12&\n\x04type\x18\x02 \x01(\x0e\x32\x18.rdfc.ChannelMessageType\x12$\n\x04\x64\x61ta\x18\x03 \x01(\x0b\x32\x11.rdfc.ChannelDataH\x00\x88\x01\x01\x42\x07\n\x05_data*)\n\x12\x43hannelMessageType\x12\x08\n\x04\x44\x41TA\x10\x00\x12\t\n\x05\x43LOSE\x10\x01\x62\x06proto3' +) + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "channel_pb2", _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals["_CHANNELMESSAGETYPE"]._serialized_start = 215 + _globals["_CHANNELMESSAGETYPE"]._serialized_end = 256 + _globals["_CHANNEL"]._serialized_start = 23 + _globals["_CHANNEL"]._serialized_end = 45 + _globals["_CHANNELDATA"]._serialized_start = 47 + _globals["_CHANNELDATA"]._serialized_end = 75 + _globals["_CHANNELMESSAGE"]._serialized_start = 78 + _globals["_CHANNELMESSAGE"]._serialized_end = 213 +# @@protoc_insertion_point(module_scope) diff --git a/runners/python/src/proto/channel_pb2.pyi b/runners/python/src/proto/channel_pb2.pyi new file mode 100644 index 0000000..dc57834 --- /dev/null +++ b/runners/python/src/proto/channel_pb2.pyi @@ -0,0 +1,35 @@ +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class ChannelMessageType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + DATA: _ClassVar[ChannelMessageType] + CLOSE: _ClassVar[ChannelMessageType] +DATA: ChannelMessageType +CLOSE: ChannelMessageType + +class Channel(_message.Message): + __slots__ = ("uri",) + URI_FIELD_NUMBER: _ClassVar[int] + uri: str + def __init__(self, uri: _Optional[str] = ...) -> None: ... + +class ChannelData(_message.Message): + __slots__ = ("bytes",) + BYTES_FIELD_NUMBER: _ClassVar[int] + bytes: bytes + def __init__(self, bytes: _Optional[bytes] = ...) -> None: ... + +class ChannelMessage(_message.Message): + __slots__ = ("channel", "type", "data") + CHANNEL_FIELD_NUMBER: _ClassVar[int] + TYPE_FIELD_NUMBER: _ClassVar[int] + DATA_FIELD_NUMBER: _ClassVar[int] + channel: Channel + type: ChannelMessageType + data: ChannelData + def __init__(self, channel: _Optional[_Union[Channel, _Mapping]] = ..., type: _Optional[_Union[ChannelMessageType, str]] = ..., data: _Optional[_Union[ChannelData, _Mapping]] = ...) -> None: ... diff --git a/runners/python/src/proto/channel_pb2_grpc.py b/runners/python/src/proto/channel_pb2_grpc.py new file mode 100644 index 0000000..0471494 --- /dev/null +++ b/runners/python/src/proto/channel_pb2_grpc.py @@ -0,0 +1,32 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + + +GRPC_GENERATED_VERSION = "1.65.1" +GRPC_VERSION = grpc.__version__ +EXPECTED_ERROR_RELEASE = "1.66.0" +SCHEDULED_RELEASE_DATE = "August 6, 2024" +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + + _version_not_supported = first_version_is_lower( + GRPC_VERSION, GRPC_GENERATED_VERSION + ) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + warnings.warn( + f"The grpc package installed is at version {GRPC_VERSION}," + + f" but the generated code in channel_pb2_grpc.py depends on" + + f" grpcio>={GRPC_GENERATED_VERSION}." + + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." + + f" This warning will become an error in {EXPECTED_ERROR_RELEASE}," + + f" scheduled for release on {SCHEDULED_RELEASE_DATE}.", + RuntimeWarning, + ) diff --git a/runners/python/src/proto/empty_pb2.py b/runners/python/src/proto/empty_pb2.py new file mode 100644 index 0000000..5e036ee --- /dev/null +++ b/runners/python/src/proto/empty_pb2.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: empty.proto +# Protobuf Python Version: 5.26.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n\x0b\x65mpty.proto\x12\x04rdfc"\x07\n\x05\x45mptyb\x06proto3' +) + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "empty_pb2", _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals["_EMPTY"]._serialized_start = 21 + _globals["_EMPTY"]._serialized_end = 28 +# @@protoc_insertion_point(module_scope) diff --git a/runners/python/src/proto/empty_pb2.pyi b/runners/python/src/proto/empty_pb2.pyi new file mode 100644 index 0000000..05ad539 --- /dev/null +++ b/runners/python/src/proto/empty_pb2.pyi @@ -0,0 +1,9 @@ +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar + +DESCRIPTOR: _descriptor.FileDescriptor + +class Empty(_message.Message): + __slots__ = () + def __init__(self) -> None: ... diff --git a/runners/python/src/proto/empty_pb2_grpc.py b/runners/python/src/proto/empty_pb2_grpc.py new file mode 100644 index 0000000..ca965d5 --- /dev/null +++ b/runners/python/src/proto/empty_pb2_grpc.py @@ -0,0 +1,32 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + + +GRPC_GENERATED_VERSION = "1.65.1" +GRPC_VERSION = grpc.__version__ +EXPECTED_ERROR_RELEASE = "1.66.0" +SCHEDULED_RELEASE_DATE = "August 6, 2024" +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + + _version_not_supported = first_version_is_lower( + GRPC_VERSION, GRPC_GENERATED_VERSION + ) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + warnings.warn( + f"The grpc package installed is at version {GRPC_VERSION}," + + f" but the generated code in empty_pb2_grpc.py depends on" + + f" grpcio>={GRPC_GENERATED_VERSION}." + + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." + + f" This warning will become an error in {EXPECTED_ERROR_RELEASE}," + + f" scheduled for release on {SCHEDULED_RELEASE_DATE}.", + RuntimeWarning, + ) diff --git a/runners/python/src/proto/index_pb2.py b/runners/python/src/proto/index_pb2.py new file mode 100644 index 0000000..ef364e3 --- /dev/null +++ b/runners/python/src/proto/index_pb2.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: index.proto +# Protobuf Python Version: 5.26.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +import src.proto.channel_pb2 as channel__pb2 +import src.proto.empty_pb2 as empty__pb2 +import src.proto.intermediate_pb2 as intermediate__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n\x0bindex.proto\x12\x04rdfc\x1a\rchannel.proto\x1a\x0b\x65mpty.proto\x1a\x12intermediate.proto2d\n\x06Runner\x12"\n\x04load\x12\r.rdfc.IRStage\x1a\x0b.rdfc.Empty\x12\x36\n\x04\x65xec\x12\x14.rdfc.ChannelMessage\x1a\x14.rdfc.ChannelMessage(\x01\x30\x01\x62\x06proto3' +) + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "index_pb2", _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals["_RUNNER"]._serialized_start = 69 + _globals["_RUNNER"]._serialized_end = 169 +# @@protoc_insertion_point(module_scope) diff --git a/runners/python/src/proto/index_pb2.pyi b/runners/python/src/proto/index_pb2.pyi new file mode 100644 index 0000000..6eae5a8 --- /dev/null +++ b/runners/python/src/proto/index_pb2.pyi @@ -0,0 +1,7 @@ +import src.proto.channel_pb2 as _channel_pb2 +import src.proto.empty_pb2 as _empty_pb2 +import src.proto.intermediate_pb2 as _intermediate_pb2 +from google.protobuf import descriptor as _descriptor +from typing import ClassVar as _ClassVar + +DESCRIPTOR: _descriptor.FileDescriptor diff --git a/runners/python/src/proto/index_pb2_grpc.py b/runners/python/src/proto/index_pb2_grpc.py new file mode 100644 index 0000000..be9d340 --- /dev/null +++ b/runners/python/src/proto/index_pb2_grpc.py @@ -0,0 +1,159 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + +import src.proto.channel_pb2 as channel__pb2 +import src.proto.empty_pb2 as empty__pb2 +import src.proto.intermediate_pb2 as intermediate__pb2 + +GRPC_GENERATED_VERSION = "1.65.1" +GRPC_VERSION = grpc.__version__ +EXPECTED_ERROR_RELEASE = "1.66.0" +SCHEDULED_RELEASE_DATE = "August 6, 2024" +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + + _version_not_supported = first_version_is_lower( + GRPC_VERSION, GRPC_GENERATED_VERSION + ) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + warnings.warn( + f"The grpc package installed is at version {GRPC_VERSION}," + + f" but the generated code in index_pb2_grpc.py depends on" + + f" grpcio>={GRPC_GENERATED_VERSION}." + + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." + + f" This warning will become an error in {EXPECTED_ERROR_RELEASE}," + + f" scheduled for release on {SCHEDULED_RELEASE_DATE}.", + RuntimeWarning, + ) + + +class RunnerStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.load = channel.unary_unary( + "/rdfc.Runner/load", + request_serializer=intermediate__pb2.IRStage.SerializeToString, + response_deserializer=empty__pb2.Empty.FromString, + _registered_method=True, + ) + self.exec = channel.stream_stream( + "/rdfc.Runner/exec", + request_serializer=channel__pb2.ChannelMessage.SerializeToString, + response_deserializer=channel__pb2.ChannelMessage.FromString, + _registered_method=True, + ) + + +class RunnerServicer(object): + """Missing associated documentation comment in .proto file.""" + + def load(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def exec(self, request_iterator, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + +def add_RunnerServicer_to_server(servicer, server): + rpc_method_handlers = { + "load": grpc.unary_unary_rpc_method_handler( + servicer.load, + request_deserializer=intermediate__pb2.IRStage.FromString, + response_serializer=empty__pb2.Empty.SerializeToString, + ), + "exec": grpc.stream_stream_rpc_method_handler( + servicer.exec, + request_deserializer=channel__pb2.ChannelMessage.FromString, + response_serializer=channel__pb2.ChannelMessage.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "rdfc.Runner", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers("rdfc.Runner", rpc_method_handlers) + + +# This class is part of an EXPERIMENTAL API. +class Runner(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def load( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/rdfc.Runner/load", + intermediate__pb2.IRStage.SerializeToString, + empty__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) + + @staticmethod + def exec( + request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.stream_stream( + request_iterator, + target, + "/rdfc.Runner/exec", + channel__pb2.ChannelMessage.SerializeToString, + channel__pb2.ChannelMessage.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True, + ) diff --git a/runners/python/src/proto/intermediate_pb2.py b/runners/python/src/proto/intermediate_pb2.py new file mode 100644 index 0000000..a9e5d59 --- /dev/null +++ b/runners/python/src/proto/intermediate_pb2.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: intermediate.proto +# Protobuf Python Version: 5.26.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( + b'\n\x12intermediate.proto\x12\x04rdfc"\x8c\x01\n\x0cIRParameters\x12\x36\n\nparameters\x18\x01 \x03(\x0b\x32".rdfc.IRParameters.ParametersEntry\x1a\x44\n\x0fParametersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12 \n\x05value\x18\x02 \x01(\x0b\x32\x11.rdfc.IRParameter:\x02\x38\x01"\xb9\x01\n\x0bIRParameter\x12\'\n\x06simple\x18\x01 \x01(\x0e\x32\x15.rdfc.IRParameterTypeH\x00\x12%\n\x07\x63omplex\x18\x02 \x01(\x0b\x32\x12.rdfc.IRParametersH\x00\x12+\n\x08presence\x18\x03 \x01(\x0e\x32\x19.rdfc.IRParameterPresence\x12%\n\x05\x63ount\x18\x04 \x01(\x0e\x32\x16.rdfc.IRParameterCountB\x06\n\x04type"\x8f\x02\n\x0bIRProcessor\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12\x12\n\nentrypoint\x18\x02 \x01(\t\x12\x35\n\nparameters\x18\x03 \x03(\x0b\x32!.rdfc.IRProcessor.ParametersEntry\x12\x31\n\x08metadata\x18\x04 \x03(\x0b\x32\x1f.rdfc.IRProcessor.MetadataEntry\x1a\x44\n\x0fParametersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12 \n\x05value\x18\x02 \x01(\x0b\x32\x11.rdfc.IRParameter:\x02\x38\x01\x1a/\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"!\n\x10IRArgumentSimple\x12\r\n\x05value\x18\x01 \x03(\t"\x8a\x01\n\rIRArgumentMap\x12\x35\n\targuments\x18\x01 \x03(\x0b\x32".rdfc.IRArgumentMap.ArgumentsEntry\x1a\x42\n\x0e\x41rgumentsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1f\n\x05value\x18\x02 \x01(\x0b\x32\x10.rdfc.IRArgument:\x02\x38\x01"7\n\x11IRArgumentComplex\x12"\n\x05value\x18\x01 \x03(\x0b\x32\x13.rdfc.IRArgumentMap"k\n\nIRArgument\x12(\n\x06simple\x18\x01 \x01(\x0b\x32\x16.rdfc.IRArgumentSimpleH\x00\x12*\n\x07\x63omplex\x18\x02 \x01(\x0b\x32\x17.rdfc.IRArgumentComplexH\x00\x42\x07\n\x05value"\xb1\x01\n\x07IRStage\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12$\n\tprocessor\x18\x02 \x01(\x0b\x32\x11.rdfc.IRProcessor\x12/\n\targuments\x18\x03 \x03(\x0b\x32\x1c.rdfc.IRStage.ArgumentsEntry\x1a\x42\n\x0e\x41rgumentsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1f\n\x05value\x18\x02 \x01(\x0b\x32\x10.rdfc.IRArgument:\x02\x38\x01*\x80\x01\n\x0fIRParameterType\x12\x0b\n\x07\x42OOLEAN\x10\x00\x12\x08\n\x04\x42YTE\x10\x01\x12\x08\n\x04\x44\x41TE\x10\x02\x12\n\n\x06\x44OUBLE\x10\x03\x12\t\n\x05\x46LOAT\x10\x04\x12\x07\n\x03INT\x10\x05\x12\x08\n\x04LONG\x10\x06\x12\n\n\x06STRING\x10\x07\x12\n\n\x06WRITER\x10\x08\x12\n\n\x06READER\x10\t*1\n\x13IRParameterPresence\x12\x0c\n\x08OPTIONAL\x10\x00\x12\x0c\n\x08REQUIRED\x10\x01*(\n\x10IRParameterCount\x12\n\n\x06SINGLE\x10\x00\x12\x08\n\x04LIST\x10\x01\x62\x06proto3' +) + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "intermediate_pb2", _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals["_IRPARAMETERS_PARAMETERSENTRY"]._loaded_options = None + _globals["_IRPARAMETERS_PARAMETERSENTRY"]._serialized_options = b"8\001" + _globals["_IRPROCESSOR_PARAMETERSENTRY"]._loaded_options = None + _globals["_IRPROCESSOR_PARAMETERSENTRY"]._serialized_options = b"8\001" + _globals["_IRPROCESSOR_METADATAENTRY"]._loaded_options = None + _globals["_IRPROCESSOR_METADATAENTRY"]._serialized_options = b"8\001" + _globals["_IRARGUMENTMAP_ARGUMENTSENTRY"]._loaded_options = None + _globals["_IRARGUMENTMAP_ARGUMENTSENTRY"]._serialized_options = b"8\001" + _globals["_IRSTAGE_ARGUMENTSENTRY"]._loaded_options = None + _globals["_IRSTAGE_ARGUMENTSENTRY"]._serialized_options = b"8\001" + _globals["_IRPARAMETERTYPE"]._serialized_start = 1156 + _globals["_IRPARAMETERTYPE"]._serialized_end = 1284 + _globals["_IRPARAMETERPRESENCE"]._serialized_start = 1286 + _globals["_IRPARAMETERPRESENCE"]._serialized_end = 1335 + _globals["_IRPARAMETERCOUNT"]._serialized_start = 1337 + _globals["_IRPARAMETERCOUNT"]._serialized_end = 1377 + _globals["_IRPARAMETERS"]._serialized_start = 29 + _globals["_IRPARAMETERS"]._serialized_end = 169 + _globals["_IRPARAMETERS_PARAMETERSENTRY"]._serialized_start = 101 + _globals["_IRPARAMETERS_PARAMETERSENTRY"]._serialized_end = 169 + _globals["_IRPARAMETER"]._serialized_start = 172 + _globals["_IRPARAMETER"]._serialized_end = 357 + _globals["_IRPROCESSOR"]._serialized_start = 360 + _globals["_IRPROCESSOR"]._serialized_end = 631 + _globals["_IRPROCESSOR_PARAMETERSENTRY"]._serialized_start = 101 + _globals["_IRPROCESSOR_PARAMETERSENTRY"]._serialized_end = 169 + _globals["_IRPROCESSOR_METADATAENTRY"]._serialized_start = 584 + _globals["_IRPROCESSOR_METADATAENTRY"]._serialized_end = 631 + _globals["_IRARGUMENTSIMPLE"]._serialized_start = 633 + _globals["_IRARGUMENTSIMPLE"]._serialized_end = 666 + _globals["_IRARGUMENTMAP"]._serialized_start = 669 + _globals["_IRARGUMENTMAP"]._serialized_end = 807 + _globals["_IRARGUMENTMAP_ARGUMENTSENTRY"]._serialized_start = 741 + _globals["_IRARGUMENTMAP_ARGUMENTSENTRY"]._serialized_end = 807 + _globals["_IRARGUMENTCOMPLEX"]._serialized_start = 809 + _globals["_IRARGUMENTCOMPLEX"]._serialized_end = 864 + _globals["_IRARGUMENT"]._serialized_start = 866 + _globals["_IRARGUMENT"]._serialized_end = 973 + _globals["_IRSTAGE"]._serialized_start = 976 + _globals["_IRSTAGE"]._serialized_end = 1153 + _globals["_IRSTAGE_ARGUMENTSENTRY"]._serialized_start = 741 + _globals["_IRSTAGE_ARGUMENTSENTRY"]._serialized_end = 807 +# @@protoc_insertion_point(module_scope) diff --git a/runners/python/src/proto/intermediate_pb2.pyi b/runners/python/src/proto/intermediate_pb2.pyi new file mode 100644 index 0000000..5acd63e --- /dev/null +++ b/runners/python/src/proto/intermediate_pb2.pyi @@ -0,0 +1,145 @@ +from google.protobuf.internal import containers as _containers +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class IRParameterType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + BOOLEAN: _ClassVar[IRParameterType] + BYTE: _ClassVar[IRParameterType] + DATE: _ClassVar[IRParameterType] + DOUBLE: _ClassVar[IRParameterType] + FLOAT: _ClassVar[IRParameterType] + INT: _ClassVar[IRParameterType] + LONG: _ClassVar[IRParameterType] + STRING: _ClassVar[IRParameterType] + WRITER: _ClassVar[IRParameterType] + READER: _ClassVar[IRParameterType] + +class IRParameterPresence(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + OPTIONAL: _ClassVar[IRParameterPresence] + REQUIRED: _ClassVar[IRParameterPresence] + +class IRParameterCount(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + SINGLE: _ClassVar[IRParameterCount] + LIST: _ClassVar[IRParameterCount] +BOOLEAN: IRParameterType +BYTE: IRParameterType +DATE: IRParameterType +DOUBLE: IRParameterType +FLOAT: IRParameterType +INT: IRParameterType +LONG: IRParameterType +STRING: IRParameterType +WRITER: IRParameterType +READER: IRParameterType +OPTIONAL: IRParameterPresence +REQUIRED: IRParameterPresence +SINGLE: IRParameterCount +LIST: IRParameterCount + +class IRParameters(_message.Message): + __slots__ = ("parameters",) + class ParametersEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: str + value: IRParameter + def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[IRParameter, _Mapping]] = ...) -> None: ... + PARAMETERS_FIELD_NUMBER: _ClassVar[int] + parameters: _containers.MessageMap[str, IRParameter] + def __init__(self, parameters: _Optional[_Mapping[str, IRParameter]] = ...) -> None: ... + +class IRParameter(_message.Message): + __slots__ = ("simple", "complex", "presence", "count") + SIMPLE_FIELD_NUMBER: _ClassVar[int] + COMPLEX_FIELD_NUMBER: _ClassVar[int] + PRESENCE_FIELD_NUMBER: _ClassVar[int] + COUNT_FIELD_NUMBER: _ClassVar[int] + simple: IRParameterType + complex: IRParameters + presence: IRParameterPresence + count: IRParameterCount + def __init__(self, simple: _Optional[_Union[IRParameterType, str]] = ..., complex: _Optional[_Union[IRParameters, _Mapping]] = ..., presence: _Optional[_Union[IRParameterPresence, str]] = ..., count: _Optional[_Union[IRParameterCount, str]] = ...) -> None: ... + +class IRProcessor(_message.Message): + __slots__ = ("uri", "entrypoint", "parameters", "metadata") + class ParametersEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: str + value: IRParameter + def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[IRParameter, _Mapping]] = ...) -> None: ... + class MetadataEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: str + value: str + def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ... + URI_FIELD_NUMBER: _ClassVar[int] + ENTRYPOINT_FIELD_NUMBER: _ClassVar[int] + PARAMETERS_FIELD_NUMBER: _ClassVar[int] + METADATA_FIELD_NUMBER: _ClassVar[int] + uri: str + entrypoint: str + parameters: _containers.MessageMap[str, IRParameter] + metadata: _containers.ScalarMap[str, str] + def __init__(self, uri: _Optional[str] = ..., entrypoint: _Optional[str] = ..., parameters: _Optional[_Mapping[str, IRParameter]] = ..., metadata: _Optional[_Mapping[str, str]] = ...) -> None: ... + +class IRArgumentSimple(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, value: _Optional[_Iterable[str]] = ...) -> None: ... + +class IRArgumentMap(_message.Message): + __slots__ = ("arguments",) + class ArgumentsEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: str + value: IRArgument + def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[IRArgument, _Mapping]] = ...) -> None: ... + ARGUMENTS_FIELD_NUMBER: _ClassVar[int] + arguments: _containers.MessageMap[str, IRArgument] + def __init__(self, arguments: _Optional[_Mapping[str, IRArgument]] = ...) -> None: ... + +class IRArgumentComplex(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: _containers.RepeatedCompositeFieldContainer[IRArgumentMap] + def __init__(self, value: _Optional[_Iterable[_Union[IRArgumentMap, _Mapping]]] = ...) -> None: ... + +class IRArgument(_message.Message): + __slots__ = ("simple", "complex") + SIMPLE_FIELD_NUMBER: _ClassVar[int] + COMPLEX_FIELD_NUMBER: _ClassVar[int] + simple: IRArgumentSimple + complex: IRArgumentComplex + def __init__(self, simple: _Optional[_Union[IRArgumentSimple, _Mapping]] = ..., complex: _Optional[_Union[IRArgumentComplex, _Mapping]] = ...) -> None: ... + +class IRStage(_message.Message): + __slots__ = ("uri", "processor", "arguments") + class ArgumentsEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: str + value: IRArgument + def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[IRArgument, _Mapping]] = ...) -> None: ... + URI_FIELD_NUMBER: _ClassVar[int] + PROCESSOR_FIELD_NUMBER: _ClassVar[int] + ARGUMENTS_FIELD_NUMBER: _ClassVar[int] + uri: str + processor: IRProcessor + arguments: _containers.MessageMap[str, IRArgument] + def __init__(self, uri: _Optional[str] = ..., processor: _Optional[_Union[IRProcessor, _Mapping]] = ..., arguments: _Optional[_Mapping[str, IRArgument]] = ...) -> None: ... diff --git a/runners/python/src/proto/intermediate_pb2_grpc.py b/runners/python/src/proto/intermediate_pb2_grpc.py new file mode 100644 index 0000000..871bd53 --- /dev/null +++ b/runners/python/src/proto/intermediate_pb2_grpc.py @@ -0,0 +1,32 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + + +GRPC_GENERATED_VERSION = "1.65.1" +GRPC_VERSION = grpc.__version__ +EXPECTED_ERROR_RELEASE = "1.66.0" +SCHEDULED_RELEASE_DATE = "August 6, 2024" +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + + _version_not_supported = first_version_is_lower( + GRPC_VERSION, GRPC_GENERATED_VERSION + ) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + warnings.warn( + f"The grpc package installed is at version {GRPC_VERSION}," + + f" but the generated code in intermediate_pb2_grpc.py depends on" + + f" grpcio>={GRPC_GENERATED_VERSION}." + + f" Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}" + + f" or downgrade your generated code using grpcio-tools<={GRPC_VERSION}." + + f" This warning will become an error in {EXPECTED_ERROR_RELEASE}," + + f" scheduled for release on {SCHEDULED_RELEASE_DATE}.", + RuntimeWarning, + ) diff --git a/runners/python/src/runtime/__init__.py b/runners/python/src/runtime/__init__.py new file mode 100644 index 0000000..5c62df7 --- /dev/null +++ b/runners/python/src/runtime/__init__.py @@ -0,0 +1,3 @@ +from .processor import Processor + +__ALL__ = ["Processor"] diff --git a/runners/python/src/runtime/processor.py b/runners/python/src/runtime/processor.py new file mode 100644 index 0000000..5cce553 --- /dev/null +++ b/runners/python/src/runtime/processor.py @@ -0,0 +1,11 @@ +from typing import Any, Mapping + + +class Processor: + args: Mapping[str, Any] + + def __init__(self, args: Mapping[str, Any]): + self.args = args + + async def exec(self): + NotImplementedError() diff --git a/runners/python/src/runtime/runner.py b/runners/python/src/runtime/runner.py new file mode 100644 index 0000000..01158f1 --- /dev/null +++ b/runners/python/src/runtime/runner.py @@ -0,0 +1,2 @@ +class Runner: + pass diff --git a/runners/python/src/server/__init__.py b/runners/python/src/server/__init__.py new file mode 100644 index 0000000..3fd21c3 --- /dev/null +++ b/runners/python/src/server/__init__.py @@ -0,0 +1,3 @@ +from .server import Server + +__ALL__ = ["Server"] diff --git a/runners/python/src/server/server.py b/runners/python/src/server/server.py new file mode 100644 index 0000000..b9caad6 --- /dev/null +++ b/runners/python/src/server/server.py @@ -0,0 +1,35 @@ +from typing import Iterator + +import grpc.aio +from grpc.aio import ServicerContext + +from src.proto.index_pb2_grpc import RunnerServicer, add_RunnerServicer_to_server +from src.proto.intermediate_pb2 import IRStage +from src.proto.empty_pb2 import Empty +from src.proto.channel_pb2 import ChannelMessage + + +class Server(RunnerServicer): + def __init__(self): + super().__init__() + print("Starting server.") + + def load(self, stage: IRStage, context: ServicerContext): + print(f"Loading IRStage: {stage.uri}") + return Empty() + + def exec(self, incoming: Iterator[ChannelMessage], context): + print("Executing pipeline.") + for message in incoming: + print(f"Incoming data: {message.channel.uri}") + + # Function as an echo server and return the data verbatim. + yield incoming + + @staticmethod + async def launch(): + server = grpc.aio.server() + add_RunnerServicer_to_server(Server(), server) + server.add_insecure_port("[::]:50051") + await server.start() + await server.wait_for_termination()