Files
openclaw-mission-control/scripts/rq-docker
copilot-swe-agent[bot] 35b3829da0 refactor: use custom worker script instead of standard RQ CLI
- Add scripts/rq-docker for Docker container compatibility
- Update Dockerfile to copy scripts directory
- Replace standard rq worker command with custom worker script
- Custom worker includes built-in scheduling via _drain_ready_scheduled_tasks

Co-authored-by: abhi1693 <5083532+abhi1693@users.noreply.github.com>
2026-03-02 14:57:00 +00:00

47 lines
1.1 KiB
Python

#!/usr/bin/env python
"""RQ worker entrypoint for Docker containers."""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
# In Docker, the working directory is /app and app code is at /app/app/
# Add /app to sys.path so we can import app.services.queue_worker
WORKDIR = Path.cwd()
sys.path.insert(0, str(WORKDIR))
from app.services.queue_worker import run_worker
def cmd_worker(args: argparse.Namespace) -> int:
try:
run_worker()
except KeyboardInterrupt:
return 0
return 0
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="RQ background worker helpers.")
subparsers = parser.add_subparsers(dest="command", required=True)
worker_parser = subparsers.add_parser(
"worker",
help="Continuously process queued background work.",
)
worker_parser.set_defaults(func=cmd_worker)
return parser
def main() -> None:
parser = build_parser()
args = parser.parse_args()
sys.exit(args.func(args))
if __name__ == "__main__":
main()