Skip to main content

Open Translation Environment (OTE) API.

Project description

Open Translation Environment (OTE) API

Run in Docker

Development target

The development target will allow for automatic reloading when source code changes. This requires that the local directory is bind-mounted using the -v or --volume argument. To build and run the development target from the command line:

docker build --rm -q -f Dockerfile \
    --label "ontotrans.oteapi=development" \
    --target development \
    -t "ontotrans/oteapi-development:latest" .

Production target

The production target will not reload itself on code change and will run a predictable version of the code on port 80. Also you might want to use a named container with the --restart=always option to ensure that the container is restarted indefinitely regardless of the exit status. To build and run the production target from the command line:

docker build --rm -q -f Dockerfile \
    --label "ontotrans.oteapi=production" \
    -t "ontotrans/oteapi:latest" .

Run redis

Redis with persistance needs to run as a prerequisite to starting oteapi. Redis needs to share the same network as oteapi.

docker network create -d bridge otenet
docker volume create redis-persist
docker run \
    --detach \
    --name redis \
    --volume redis-persist:/data \
    --network otenet \
    redis:latest

Run oteapi (development)

Run the services by attaching to the otenet network and set the environmental variables for connecting to Redis.

docker run \
    --rm \
    --network otenet \
    --detach \
    --volume ${PWD}:/app \
    --publish 8080:8080 \
    --env REDIS_TYPE=redis \
    --env REDIS_HOST=redis \
    --env REDIS_PORT=6379 \
    ontotrans/oteapi-development:latest

Open the following URL in a browser http://localhost:8080/redoc.

Run the Atmoz SFTP Server

To test the data access via SFTP, the atmoz sftp-server can be run:

docker volume create sftpdrive
docker run \
    --detach \
    --network=otenet \
    --volume sftpdrive:/home/foo/upload \
    --publish 2222:22 \
    atmoz/sftp foo:pass:1001

Entry points for plugins

Suggestion: Use setuptools entry points to load plugins.

The entry point groups could be named as something like this:

  • "oteapi.download_strategy", "oteapi.filter_strategy"
  • "oteapi.download", "oteapi.filter"
  • "oteapi.interfaces.download", "oteapi.interfaces.filter"

The value for an entrypoint should then be:

setup(
    # ...,
    entry_points={
        "oteapi.download_strategy": [
            "my_plugin.p2p = my_plugin.strategies.download.peer_2_peer",
            "my_plugin.mongo = my_plugin.strategies.download.mongo_get",
        ],
    },
)

or as part of a YAML/JSON/setup.cfg setup files as such:

entry_points:
  oteapi.download_strategy:
  - "my_plugin.p2p = my_plugin.strategies.download.peer_2_peer"
  - "my_plugin.mongo = my_plugin.strategies.download.mongo_get"
{
  "entry_points": {
    "oteapi.download_strategy": [
      "my_plugin.p2p = my_plugin.strategies.download.peer_2_peer",
      "my_plugin.mongo = my_plugin.strategies.download.mongo_get"
    ]
  }
}
[options.entry_points]
oteapi.download_strategy =
    my_plugin.p2p = my_plugin.strategies.download.peer_2_peer
    my_plugin.mongo = my_plugin.strategies.download.mongo_get

The plugins will then automagically load all installed strategy module plugins, registering the strategies according to the StrategyFactory decorator.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oteapi-core-0.0.2.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

oteapi_core-0.0.2-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

Details for the file oteapi-core-0.0.2.tar.gz.

File metadata

  • Download URL: oteapi-core-0.0.2.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for oteapi-core-0.0.2.tar.gz
Algorithm Hash digest
SHA256 cf515357efc168b21f1be96aa94c4de62f2139d329363996130ce59cb8087e53
MD5 16204615626fa8b1ecb402b6c912b80f
BLAKE2b-256 2fe7c31a28cccecb8b0ef366094252d485ef7eb93bf7b46a33f81a6351382837

See more details on using hashes here.

File details

Details for the file oteapi_core-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: oteapi_core-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 36.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for oteapi_core-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c85f27055adc949064d7ccc5b49d06b66655412a40e0e651490073620fe2b5c
MD5 05ace8835343aca1b3fcfebb1319726b
BLAKE2b-256 cbbe9e9476d3f92f724432387c7a51fd6ebcedaea2f9cbb7e581d20913909283

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page