Skip to content

Commit

Permalink
Renamed worker to runner everywhere (#1055)
Browse files Browse the repository at this point in the history
* Renamed worker to runner everywhere

* renamed module

* added runner

* modified gitignore

* Updated redis dependency

* Commit pdm.lock changes

---------

Co-authored-by: ritwik-g <[email protected]>
  • Loading branch information
ritwik-g and ritwik-g authored Jan 8, 2025
1 parent ddcb988 commit ab24e7b
Show file tree
Hide file tree
Showing 38 changed files with 624 additions and 634 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-container-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- 'unstract/**'
- 'platform-service/**'
- 'x2text-service/**'
- 'worker/**'
- 'runner/**'
- 'docker/dockerfiles/**'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
Expand All @@ -27,7 +27,7 @@ on:
- 'unstract/**'
- 'platform-service/**'
- 'x2text-service/**'
- 'worker/**'
- 'runner/**'
- 'docker/dockerfiles/**'

jobs:
Expand All @@ -52,7 +52,7 @@ jobs:
cp ../backend/sample.env ../backend/.env
cp ../platform-service/sample.env ../platform-service/.env
cp ../prompt-service/sample.env ../prompt-service/.env
cp ../worker/sample.env ../worker/.env
cp ../runner/sample.env ../runner/.env
cp ../x2text-service/sample.env ../x2text-service/.env
cp sample.essentials.env essentials.env
cp sample.env .env
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ jobs:
- name: Render the report to the PR
uses: marocchino/sticky-pull-request-comment@v2
with:
header: worker-test-report
header: runner-test-report
recreate: true
path: worker-report.md
path: runner-report.md

- name: Output reports to the job summary when tests fail
shell: bash
run: |
if [ -f "worker-report.md" ]; then
echo "<details><summary>Worker Test Report</summary>" >> $GITHUB_STEP_SUMMARY
if [ -f "runner-report.md" ]; then
echo "<details><summary>Runner Test Report</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
cat "worker-report.md" >> $GITHUB_STEP_SUMMARY
cat "runner-report.md" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi
2 changes: 1 addition & 1 deletion .github/workflows/production-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
service_name: [backend, frontend, platform-service, prompt-service, worker, x2text-service]
service_name: [backend, frontend, platform-service, prompt-service, runner, x2text-service]

steps:
- name: Checkout code for release
Expand Down
2 changes: 1 addition & 1 deletion backend/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ API_STORAGE_DIR = "/data/api"
PLATFORM_SERVICE_HOST=http://unstract-platform-service
PLATFORM_SERVICE_PORT=3001

# Tool Runner (Worker Service)
# Tool Runner
UNSTRACT_RUNNER_HOST=http://unstract-runner
UNSTRACT_RUNNER_PORT=5002

Expand Down
6 changes: 3 additions & 3 deletions docker/docker-compose.build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ services:
build:
dockerfile: docker/dockerfiles/backend.Dockerfile
context: ..
worker:
image: unstract/worker:${VERSION}
runner:
image: unstract/runner:${VERSION}
build:
dockerfile: docker/dockerfiles/worker.Dockerfile
dockerfile: docker/dockerfiles/runner.Dockerfile
context: ..
platform-service:
image: unstract/platform-service:${VERSION}
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ services:
- traefik.enable=false

runner:
image: unstract/worker:${VERSION}
image: unstract/runner:${VERSION}
container_name: unstract-runner
restart: unless-stopped
ports:
- 5002:5002
env_file:
- ../worker/.env
- ../runner/.env
volumes:
- ./workflow_data:/data
# Docker socket bind mount to spawn tool containers
Expand Down
2 changes: 1 addition & 1 deletion docker/dockerfiles/backend.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ platform-service
prompt-service
tools
!unstract
worker
runner
x2text-service
2 changes: 1 addition & 1 deletion docker/dockerfiles/frontend.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ platform-service
prompt-service
tools
unstract
worker
runner
x2text-service
2 changes: 1 addition & 1 deletion docker/dockerfiles/platform.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ frontend
prompt-service
tools
!unstract
worker
runner
x2text-service
2 changes: 1 addition & 1 deletion docker/dockerfiles/prompt.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ tools
unstract
!unstract/core
!unstract/flags
worker
runner
x2text-service
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /unstract

ENV BUILD_CONTEXT_PATH worker
ENV BUILD_CONTEXT_PATH runner
ENV BUILD_PACKAGES_PATH unstract
ENV PDM_VERSION 2.16.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ tools
unstract
!unstract/core
!unstract/flags
!worker
!runner
x2text-service
2 changes: 1 addition & 1 deletion docker/dockerfiles/x2text.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ platform-service
prompt-service
tools
unstract
worker
runner
!x2text-service
2 changes: 1 addition & 1 deletion docker/scripts/pdm-lock-gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Helps generate pdm's lockfiles by running the command `pdm lock -G :all -v` on a
- project root
- `backend`
- `prompt-service`
- `worker`
- `runner`
- `unstract/core`
- `unstract/flags`
- `platform-service`
Expand Down
2 changes: 1 addition & 1 deletion docker/scripts/pdm-lock-gen/pdm-lock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ directories=(
"."
"backend"
"prompt-service"
"worker"
"runner"
"unstract/filesystem"
"unstract/core"
"unstract/flags"
Expand Down
7 changes: 0 additions & 7 deletions worker/.gitignore → runner/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,3 @@ cython_debug/
# 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/

src/unstract/worker/clients/
!src/unstract/worker/clients/__init__.py
!src/unstract/worker/clients/interface.py
!src/unstract/worker/clients/helper.py
!src/unstract/worker/clients/docker.py
!src/unstract/worker/clients/test_docker.py
12 changes: 6 additions & 6 deletions worker/README.md → runner/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# Unstract Worker
# Unstract Runner

This module contains the logic for how Tools are executed in DND mode.

## Docker build and publish

Build docker image
```
docker build -t unstract/worker:1.1.1 .
docker build -t unstract/runner:1.1.1 .
```

Then publish it into Docker hub

```
docker push unstract/worker:1.1.1
docker push unstract/runner:1.1.1
```

## Run docker compose

To expose the Unstract worker service.
To expose the Unstract runner service.

```
docker compose -f docker-compose.yaml up
```

## Using with Docker Desktop

The worker makes use of the python docker client's [from_env()](https://docker-py.readthedocs.io/en/stable/client.html#docker.client.from_env) to initialize the docker client. If you are using Docker Desktop, this might not work as expected due to the issue described [here](https://github.com/docker/docker-py/issues/3059). In that case follow the resolutions from the issue
The runner makes use of the python docker client's [from_env()](https://docker-py.readthedocs.io/en/stable/client.html#docker.client.from_env) to initialize the docker client. If you are using Docker Desktop, this might not work as expected due to the issue described [here](https://github.com/docker/docker-py/issues/3059). In that case follow the resolutions from the issue
- Either set `DOCKER_HOST` env to wherever the docker endpoint is configured.
```
export DOCKER_HOST=unix:///$HOME/.docker/desktop/docker.sock
Expand All @@ -44,5 +44,5 @@ sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock
| `TOOL_CONTAINER_LABELS` | Labels applied to tool containers for observability [Optional]. |
| `WORKFLOW_DATA_DIR` | Source mount bind directory for tool containers to access input files. |
| `TOOL_DATA_DIR` | Target mount directory within tool containers. (Default: "/data") |
| `LOG_LEVEL` | Log level for worker (Options: INFO, WARNING, ERROR, DEBUG, etc.) |
| `LOG_LEVEL` | Log level for runner (Options: INFO, WARNING, ERROR, DEBUG, etc.) |
| `REMOVE_CONTAINER_ON_EXIT`| Flag to decide whether to clean up/ remove the tool container after execution. (Default: True) |
2 changes: 1 addition & 1 deletion worker/entrypoint.sh → runner/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
--log-level debug \
--timeout 900 \
--access-logfile - \
unstract.worker.main:app
unstract.runner.main:app
Loading

0 comments on commit ab24e7b

Please sign in to comment.