Avinashnalla7 commited on
Commit
582aaa1
·
1 Parent(s): 88fbcdb

Bootstrap worker: FastAPI + health endpoint

Browse files
Files changed (8) hide show
  1. .env.example +2 -0
  2. .gitignore +3 -0
  3. Dockerfile +12 -0
  4. README.md +7 -0
  5. app/config.py +4 -0
  6. app/health.py +11 -0
  7. app/main.py +6 -0
  8. requirements.txt +2 -0
.env.example ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ROOT_FOLDER_ID=13YXKcx2HY2jqf5aaCX3GVngkPm4tp8r8
2
+ POLL_SECONDS=300
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .env
2
+ __pycache__/
3
+ *.pyc
Dockerfile ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+ RUN pip install --no-cache-dir -r requirements.txt
7
+
8
+ COPY app ./app
9
+
10
+ EXPOSE 7860
11
+
12
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -8,3 +8,10 @@ pinned: false
8
  ---
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
8
  ---
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
11
+
12
+ # SA Resume Worker
13
+
14
+ Background worker service.
15
+ - Polls Google Drive
16
+ - Tracks processed files
17
+ - Emits heartbeat signals
app/config.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import os
2
+
3
+ ROOT_FOLDER_ID = os.getenv("ROOT_FOLDER_ID")
4
+ POLL_SECONDS = int(os.getenv("POLL_SECONDS", "300"))
app/health.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import APIRouter
2
+ import time
3
+
4
+ router = APIRouter()
5
+
6
+ @router.get("/health")
7
+ def health():
8
+ return {
9
+ "status": "ok",
10
+ "ts": int(time.time())
11
+ }
app/main.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from app.health import router as health_router
3
+
4
+ app = FastAPI(title="SA Resume Worker")
5
+
6
+ app.include_router(health_router)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastapi
2
+ uvicorn[standard]