From d47d35984becd63099c0af417044c99d6ee8ea5e Mon Sep 17 00:00:00 2001 From: Sebastiaan la Fleur Date: Fri, 26 Jan 2024 12:00:39 +0100 Subject: [PATCH] First version of omotes_sdk_protocol. --- .github/workflows/ci.yml | 25 +++ .github/workflows/python_release.yml | 36 ++++ .gitignore | 224 +++++++++++++++++++++ README.md | 29 +++ ci/linux/create_venv.sh | 5 + ci/linux/gen_protocol.sh | 8 + ci/linux/install_dependencies.sh | 4 + ci/linux/update_dependencies.sh | 5 + dev-requirements.txt | 25 +++ pyproject.toml | 42 ++++ python/ci/linux/build_python_package.sh | 5 + python/ci/linux/create_venv.sh | 5 + python/ci/linux/install_dependencies.sh | 4 + python/ci/linux/update_dependencies.sh | 5 + python/dev-requirements.txt | 32 +++ python/pyproject.toml | 45 +++++ python/requirements.txt | 8 + python/src/omotes_sdk_protocol/__init__.py | 0 python/src/omotes_sdk_protocol/job_pb2.py | 38 ++++ python/src/omotes_sdk_protocol/job_pb2.pyi | 141 +++++++++++++ requirements.txt | 6 + src/job.proto | 40 ++++ 22 files changed, 732 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/python_release.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100755 ci/linux/create_venv.sh create mode 100755 ci/linux/gen_protocol.sh create mode 100755 ci/linux/install_dependencies.sh create mode 100755 ci/linux/update_dependencies.sh create mode 100644 dev-requirements.txt create mode 100644 pyproject.toml create mode 100755 python/ci/linux/build_python_package.sh create mode 100755 python/ci/linux/create_venv.sh create mode 100755 python/ci/linux/install_dependencies.sh create mode 100755 python/ci/linux/update_dependencies.sh create mode 100644 python/dev-requirements.txt create mode 100644 python/pyproject.toml create mode 100644 python/requirements.txt create mode 100644 python/src/omotes_sdk_protocol/__init__.py create mode 100644 python/src/omotes_sdk_protocol/job_pb2.py create mode 100644 python/src/omotes_sdk_protocol/job_pb2.pyi create mode 100644 requirements.txt create mode 100644 src/job.proto diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0ce08f5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: Build-Test-Lint-etc (linux) + +on: [push] + +jobs: + build: + name: Build the python package + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ "3.8", "3.11" ] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + - run: | + ./python/ci/linux/create_venv.sh + ./python/ci/linux/install_dependencies.sh + + - name: build + run: | + ./python/ci/linux/build_python_package.sh diff --git a/.github/workflows/python_release.yml b/.github/workflows/python_release.yml new file mode 100644 index 0000000..0fef77f --- /dev/null +++ b/.github/workflows/python_release.yml @@ -0,0 +1,36 @@ +name: PyPi release +run-name: Releasing next version 🚀 +on: + push: + tags: + - '*' + +jobs: + pypi-publish: + name: upload release to PyPI + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ "3.11" ] + # Specifying a GitHub environment is optional, but strongly encouraged + environment: release + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + - run: | + ./python/ci/linux/create_venv.sh + ./python/ci/linux/install_dependencies.sh + + - name: build + run: | + ./python/ci/linux/build_python_package.sh + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85047aa --- /dev/null +++ b/.gitignore @@ -0,0 +1,224 @@ +# 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/ +pip-wheel-metadata/ +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/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +doc/*/_build/ +doc/*/_static/ +doc/*/_templates/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.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 + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__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/ + +### PyCharm+all ### +# 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+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +unit_test_coverage/ +test-results.xml + +.env.* \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..cceb8de --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# OMOTES orchestrator + +This repository is part of the 'Nieuwe Warmte Nu Design Toolkit' project. + +Orchestrator component of OMOTES project which monitors workflows and starts the various steps of each workflow. + + +# Developers Guide +Please install `protoc` on your machine and make sure it is available in your `PATH`. + +The protobuf definition is under `src/` and any language specific generated code resides under the language +folder. For instance, the Python implementation resides under `python/`. The same holds for any packaging +and build tools, they reside under the language folder as well. The tools for generating the language-specific +code us under root `/`. + +To generate new language-specific implementations of the protocol: +- Alter the protobuf defintions under `src/`. +- Run `ci/linux/create_venv.sh` and `ci/linux/install_dependencies.sh` to create a Python environment in + which `protoc` plugins are installed. +- Run `ci/linux/gen_protocol.sh` to generate the language-specific implementations. + +# Python-specific implementation Developers Guide +A number of tools are available to create the Python package: +- `./python/ci/linux/create_venv.sh`: Creates a virtualenvironment specific to the Python implementation of the + generated protobuf messages under `./python/.venv/`. +- `./python/ci/linux/install_dependencies.sh`: Installs the build and package dependencies in `./python/.venv/`. +- `./python/ci/linux/update_dependencies.sh`: Updates the build and package dependencies. +- `./python/ci/linux/build_python_package.sh`: Generates the python package containing the python generated protobuf + messages. diff --git a/ci/linux/create_venv.sh b/ci/linux/create_venv.sh new file mode 100755 index 0000000..b6345ed --- /dev/null +++ b/ci/linux/create_venv.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +python3.11 -m venv ./.venv +. .venv/bin/activate +pip3 install pip-tools diff --git a/ci/linux/gen_protocol.sh b/ci/linux/gen_protocol.sh new file mode 100755 index 0000000..38a0328 --- /dev/null +++ b/ci/linux/gen_protocol.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. .venv/bin/activate +rm -Rf python/src/omotes_sdk_protocol/ +mkdir -p python/src/omotes_sdk_protocol/ +protoc -I src/ --python_out python/src/omotes_sdk_protocol/ ./src/job.proto +protoc -I src/ --mypy_out python/src/omotes_sdk_protocol/ ./src/job.proto +touch python/src/omotes_sdk_protocol/__init__.py diff --git a/ci/linux/install_dependencies.sh b/ci/linux/install_dependencies.sh new file mode 100755 index 0000000..0447bed --- /dev/null +++ b/ci/linux/install_dependencies.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +. .venv/bin/activate +pip-sync ./dev-requirements.txt ./requirements.txt diff --git a/ci/linux/update_dependencies.sh b/ci/linux/update_dependencies.sh new file mode 100755 index 0000000..0d5bb9a --- /dev/null +++ b/ci/linux/update_dependencies.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +. .venv/bin/activate +pip-compile --output-file=requirements.txt pyproject.toml +pip-compile --extra=dev -c requirements.txt --output-file=dev-requirements.txt pyproject.toml diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000..7d9e74c --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,25 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --constraint=requirements.txt --extra=dev --output-file=dev-requirements.txt pyproject.toml +# +build==1.0.3 + # via orchestrator (pyproject.toml) +mypy-protobuf==3.5.0 + # via orchestrator (pyproject.toml) +packaging==23.2 + # via + # build + # setuptools-git-versioning +protobuf==4.25.2 + # via mypy-protobuf +pyproject-hooks==1.0.0 + # via build +setuptools-git-versioning==1.13.5 + # via orchestrator (pyproject.toml) +types-protobuf==4.24.0.20240106 + # via mypy-protobuf + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f41cfb2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,42 @@ +[project] +name = "omotes_sdk_protocol_generation" +dynamic = ["version"] +authors = [{ name = "Sebastiaan la Fleur", email = "sebastiaan.lafleur@tno.nl" }] +description = "Maintains and generates the OMOTES SDK protocol in various language." +classifiers = [ + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", + "Operating System :: OS Independent", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Intended Audience :: Information Technology", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Mathematics", + "Topic :: Scientific/Engineering :: Physics", +] + +dependencies = [ +] + +[project.optional-dependencies] +dev = [ + "pip-tools~=7.3.0", + "mypy-protobuf ~= 3.5.0", + "build ~= 1.0.3", + "setuptools-git-versioning < 2" +] + +[project.urls] +homepage = "https://www.nwn.nu" +documentation = "https://readthedocs.org" +repository = "https://github.com/Project-OMOTES/omotes_sdk_protocol/" +changelog = "https://github.com/Project-OMOTES/omotes_sdk_protocol/blob/main/CHANGELOG.md" + +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools ~= 69.0.3", "wheel ~= 0.40.0", "setuptools-git-versioning<2"] + +[tool.setuptools-git-versioning] +enabled = true diff --git a/python/ci/linux/build_python_package.sh b/python/ci/linux/build_python_package.sh new file mode 100755 index 0000000..7277145 --- /dev/null +++ b/python/ci/linux/build_python_package.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +. ./python/.venv/bin/activate +cd ./python/ +python -m build diff --git a/python/ci/linux/create_venv.sh b/python/ci/linux/create_venv.sh new file mode 100755 index 0000000..2db6531 --- /dev/null +++ b/python/ci/linux/create_venv.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +python3.11 -m venv ./python/.venv +. ./python/.venv/bin/activate +pip3 install pip-tools diff --git a/python/ci/linux/install_dependencies.sh b/python/ci/linux/install_dependencies.sh new file mode 100755 index 0000000..7e059a5 --- /dev/null +++ b/python/ci/linux/install_dependencies.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +. ./python/.venv/bin/activate +pip-sync ./python/dev-requirements.txt ./python/requirements.txt diff --git a/python/ci/linux/update_dependencies.sh b/python/ci/linux/update_dependencies.sh new file mode 100755 index 0000000..0584ba6 --- /dev/null +++ b/python/ci/linux/update_dependencies.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +. ./python/.venv/bin/activate +pip-compile --output-file=./python/requirements.txt ./python/pyproject.toml +pip-compile --extra=dev -c ./python/requirements.txt --output-file=./python/dev-requirements.txt ./python/pyproject.toml diff --git a/python/dev-requirements.txt b/python/dev-requirements.txt new file mode 100644 index 0000000..fefee86 --- /dev/null +++ b/python/dev-requirements.txt @@ -0,0 +1,32 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --constraint=./python/requirements.txt --extra=dev --output-file=./python/dev-requirements.txt ./python/pyproject.toml +# +build==1.0.3 + # via + # omotes_sdk_protocol (./python/pyproject.toml) + # pip-tools +click==8.1.7 + # via pip-tools +packaging==23.2 + # via + # build + # setuptools-git-versioning +pip-tools==7.3.0 + # via omotes_sdk_protocol (./python/pyproject.toml) +protobuf==4.25.2 + # via + # -c ./python/requirements.txt + # omotes_sdk_protocol (./python/pyproject.toml) +pyproject-hooks==1.0.0 + # via build +setuptools-git-versioning==1.13.5 + # via omotes_sdk_protocol (./python/pyproject.toml) +wheel==0.42.0 + # via pip-tools + +# The following packages are considered to be unsafe in a requirements file: +# pip +# setuptools diff --git a/python/pyproject.toml b/python/pyproject.toml new file mode 100644 index 0000000..c63e1ed --- /dev/null +++ b/python/pyproject.toml @@ -0,0 +1,45 @@ +[project] +name = "omotes_sdk_protocol" +dynamic = ["version"] +authors = [{ name = "Sebastiaan la Fleur", email = "sebastiaan.lafleur@tno.nl" }] +description = "Python implementation of OMOTES SDK protocol through which jobs may be submitted and administered. Messages include checking on progress, cancelling a job and receiving status updates." +classifiers = [ + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", + "Operating System :: OS Independent", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Intended Audience :: Information Technology", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Mathematics", + "Topic :: Scientific/Engineering :: Physics", +] + +dependencies = [ + "protobuf ~= 4.25.2" +] + +[project.optional-dependencies] +dev = [ + "pip-tools ~= 7.3.0", + "build ~= 1.0.3", + "setuptools-git-versioning < 2" +] + +[project.urls] +homepage = "https://www.nwn.nu" +documentation = "https://readthedocs.org" +repository = "https://github.com/Project-OMOTES/omotes_sdk_protocol/" +changelog = "https://github.com/Project-OMOTES/omotes_sdk_protocol/blob/main/CHANGELOG.md" + +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools ~= 69.0.3", "wheel ~= 0.40.0", "setuptools-git-versioning<2"] + +[tools.setuptools] +packages = ["src/omotes_sdk_protocol"] + +[tool.setuptools-git-versioning] +enabled = true diff --git a/python/requirements.txt b/python/requirements.txt new file mode 100644 index 0000000..2808acc --- /dev/null +++ b/python/requirements.txt @@ -0,0 +1,8 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --output-file=./python/requirements.txt ./python/pyproject.toml +# +protobuf==4.25.2 + # via omotes_sdk_protocol (./python/pyproject.toml) diff --git a/python/src/omotes_sdk_protocol/__init__.py b/python/src/omotes_sdk_protocol/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python/src/omotes_sdk_protocol/job_pb2.py b/python/src/omotes_sdk_protocol/job_pb2.py new file mode 100644 index 0000000..9519607 --- /dev/null +++ b/python/src/omotes_sdk_protocol/job_pb2.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: job.proto +# Protobuf Python Version: 4.25.2 +"""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\tjob.proto\"j\n\rJobSubmission\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x17\n\ntimeout_ms\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x15\n\rworkflow_type\x18\x03 \x01(\t\x12\x0c\n\x04\x65sdl\x18\x04 \x01(\x0c\x42\r\n\x0b_timeout_ms\"z\n\tJobResult\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12*\n\x0bresult_type\x18\x02 \x01(\x0e\x32\x15.JobResult.ResultType\"3\n\nResultType\x12\r\n\tSUCCEEDED\x10\x00\x12\x0b\n\x07TIMEOUT\x10\x01\x12\t\n\x05\x45RROR\x10\x02\"3\n\x11JobProgressUpdate\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x10\n\x08progress\x18\x02 \x01(\x01\"e\n\x0fJobStatusUpdate\x12\x0c\n\x04uuid\x18\x01 \x01(\t\"D\n\tJobStatus\x12\x0e\n\nREGISTERED\x10\x00\x12\x0c\n\x08\x45NQUEUED\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\x0c\n\x08\x46INISHED\x10\x03\"\x19\n\tJobCancel\x12\x0c\n\x04uuid\x18\x01 \x01(\tb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'job_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_JOBSUBMISSION']._serialized_start=13 + _globals['_JOBSUBMISSION']._serialized_end=119 + _globals['_JOBRESULT']._serialized_start=121 + _globals['_JOBRESULT']._serialized_end=243 + _globals['_JOBRESULT_RESULTTYPE']._serialized_start=192 + _globals['_JOBRESULT_RESULTTYPE']._serialized_end=243 + _globals['_JOBPROGRESSUPDATE']._serialized_start=245 + _globals['_JOBPROGRESSUPDATE']._serialized_end=296 + _globals['_JOBSTATUSUPDATE']._serialized_start=298 + _globals['_JOBSTATUSUPDATE']._serialized_end=399 + _globals['_JOBSTATUSUPDATE_JOBSTATUS']._serialized_start=331 + _globals['_JOBSTATUSUPDATE_JOBSTATUS']._serialized_end=399 + _globals['_JOBCANCEL']._serialized_start=401 + _globals['_JOBCANCEL']._serialized_end=426 +# @@protoc_insertion_point(module_scope) diff --git a/python/src/omotes_sdk_protocol/job_pb2.pyi b/python/src/omotes_sdk_protocol/job_pb2.pyi new file mode 100644 index 0000000..849bdba --- /dev/null +++ b/python/src/omotes_sdk_protocol/job_pb2.pyi @@ -0,0 +1,141 @@ +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" +import builtins +import google.protobuf.descriptor +import google.protobuf.internal.enum_type_wrapper +import google.protobuf.message +import sys +import typing + +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +@typing_extensions.final +class JobSubmission(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + UUID_FIELD_NUMBER: builtins.int + TIMEOUT_MS_FIELD_NUMBER: builtins.int + WORKFLOW_TYPE_FIELD_NUMBER: builtins.int + ESDL_FIELD_NUMBER: builtins.int + uuid: builtins.str + timeout_ms: builtins.int + workflow_type: builtins.str + esdl: builtins.bytes + def __init__( + self, + *, + uuid: builtins.str = ..., + timeout_ms: builtins.int | None = ..., + workflow_type: builtins.str = ..., + esdl: builtins.bytes = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["_timeout_ms", b"_timeout_ms", "timeout_ms", b"timeout_ms"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["_timeout_ms", b"_timeout_ms", "esdl", b"esdl", "timeout_ms", b"timeout_ms", "uuid", b"uuid", "workflow_type", b"workflow_type"]) -> None: ... + def WhichOneof(self, oneof_group: typing_extensions.Literal["_timeout_ms", b"_timeout_ms"]) -> typing_extensions.Literal["timeout_ms"] | None: ... + +global___JobSubmission = JobSubmission + +@typing_extensions.final +class JobResult(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + class _ResultType: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _ResultTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[JobResult._ResultType.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + SUCCEEDED: JobResult._ResultType.ValueType # 0 + TIMEOUT: JobResult._ResultType.ValueType # 1 + ERROR: JobResult._ResultType.ValueType # 2 + + class ResultType(_ResultType, metaclass=_ResultTypeEnumTypeWrapper): ... + SUCCEEDED: JobResult.ResultType.ValueType # 0 + TIMEOUT: JobResult.ResultType.ValueType # 1 + ERROR: JobResult.ResultType.ValueType # 2 + + UUID_FIELD_NUMBER: builtins.int + RESULT_TYPE_FIELD_NUMBER: builtins.int + uuid: builtins.str + result_type: global___JobResult.ResultType.ValueType + def __init__( + self, + *, + uuid: builtins.str = ..., + result_type: global___JobResult.ResultType.ValueType = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["result_type", b"result_type", "uuid", b"uuid"]) -> None: ... + +global___JobResult = JobResult + +@typing_extensions.final +class JobProgressUpdate(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + UUID_FIELD_NUMBER: builtins.int + PROGRESS_FIELD_NUMBER: builtins.int + uuid: builtins.str + progress: builtins.float + def __init__( + self, + *, + uuid: builtins.str = ..., + progress: builtins.float = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["progress", b"progress", "uuid", b"uuid"]) -> None: ... + +global___JobProgressUpdate = JobProgressUpdate + +@typing_extensions.final +class JobStatusUpdate(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + class _JobStatus: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _JobStatusEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[JobStatusUpdate._JobStatus.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + REGISTERED: JobStatusUpdate._JobStatus.ValueType # 0 + ENQUEUED: JobStatusUpdate._JobStatus.ValueType # 1 + RUNNING: JobStatusUpdate._JobStatus.ValueType # 2 + FINISHED: JobStatusUpdate._JobStatus.ValueType # 3 + + class JobStatus(_JobStatus, metaclass=_JobStatusEnumTypeWrapper): ... + REGISTERED: JobStatusUpdate.JobStatus.ValueType # 0 + ENQUEUED: JobStatusUpdate.JobStatus.ValueType # 1 + RUNNING: JobStatusUpdate.JobStatus.ValueType # 2 + FINISHED: JobStatusUpdate.JobStatus.ValueType # 3 + + UUID_FIELD_NUMBER: builtins.int + uuid: builtins.str + def __init__( + self, + *, + uuid: builtins.str = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["uuid", b"uuid"]) -> None: ... + +global___JobStatusUpdate = JobStatusUpdate + +@typing_extensions.final +class JobCancel(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + UUID_FIELD_NUMBER: builtins.int + uuid: builtins.str + def __init__( + self, + *, + uuid: builtins.str = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["uuid", b"uuid"]) -> None: ... + +global___JobCancel = JobCancel diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d4ce6de --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --output-file=requirements.txt pyproject.toml +# diff --git a/src/job.proto b/src/job.proto new file mode 100644 index 0000000..e6dd7ea --- /dev/null +++ b/src/job.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +message JobSubmission { + string uuid = 1; + optional uint32 timeout_ms = 2; + string workflow_type = 3; + bytes esdl = 4; + +} + +message JobResult { + string uuid = 1; + ResultType result_type = 2; + + enum ResultType { + SUCCEEDED = 0; + TIMEOUT = 1; + ERROR = 2; + } +} + +message JobProgressUpdate { + string uuid = 1; + double progress = 2; +} + +message JobStatusUpdate { + string uuid = 1; + + enum JobStatus { + REGISTERED = 0; + ENQUEUED = 1; + RUNNING = 2; + FINISHED = 3; + } +} + +message JobCancel { + string uuid = 1; +} \ No newline at end of file