This webservice allows the MapEditor to call the Omotes SDK to submit new workflow jobs, see their status and retrieve the results.
The webservice is based on TNOs Flask REST API Template.
Copy .env.template
to .env
and fill with the appropriate values.
To set up the components (for windows run in Git Bash
):
./scripts/setup.sh
To start the components:
./scripts/start.sh
To stop the components:
./scripts/stop.sh
There is a dev mode for start which will use the local code for omotes-rest
, omotes-sdk-python
and omotes-sdk-protocol
(assuming the repos are all in the same folder as this omotes-rest
repo), instead of released docker images, and it will expose the postgres port:
./scripts/start-dev.sh
The following directory structure is used:
ci/
: Contains all CI & other development scripts to help standardize the development workflow for Linux.config/
: Contains orchestrator workflow definitions configuration. Theworkflow_config.json
file will be overwritten by a volume mount when deploying via docker.scripts/
: Setup, start en stop scripts.src/
: Source code for omotes-rest.unit_test/
: All unit tests for omotes-rest..dockerignore
: Contains all files and directories which should not be available while building the docker image..env.template
: Template.env
file to run the orchestrator locally outside of docker..gitignore
: Contains all files and directories which are not kept in Git source control.dev-requirements.txt
: Pinned versions of all development and non-development dependencies.Dockerfile
: The build instructions for building the docker image.dev.Dockerfile
: Used when running or testing with local code from theomotes-system
repository.pyproject.toml
: The Python project (meta) information.requirements.txt
: Pinned versions of all dependencies needed to run the orchestrator.
The scripts under ci/
are used to standardize the development proces.
create_venv
: Creates a local virtual environment (.venv/
) in which all dependencies may be installed.install_dependencies
: Installs all development and non-development dependencies in the local virtual environment.lint
: Run theflake8
to check for linting issues.test_unit
: Run all unit tests underunit_test/
usingpytest
.typecheck
: Runmypy
to check the type annotations and look for typing issues.update_dependencies
: Updatedev-requirements.txt
andrequirements.txt
based on the dependencies specified inpyproject.toml
A typical development workflow would be:
- create and configure
.env
from.env.template
- run
create_venv
- run
install_dependencies
. - develop or update the codebase according to the requirements...
- run
lint
,test_unit
, andtypecheck
to check for code quality issues.
All these scripts are expected to run from the root of the repository.
First set up the development environment with create_venv
and install_dependencies
. Then you
can make the necessary changes to src/omotes-rest/db_models/
. Finally, a new SQL schema
revision may be generated using alembic
by running:
./scripts/db_models_generate_new_revision.sh "revision message"
All database revisions will be automatically applied when omotes-rest is started.
In case more control is necessary, you can run the necessary alembic commands directly after activating the virtual environment.
First, change directory: cd src/
- Make a revision:
alembic revision --autogenerate -m "<some message>"
- Perform all revisions:
alembic upgrade head
- Downgrade to a revision:
alembic downgrade <revision>
(revision 'base' to undo everything.)