Skip to content

Commit bd9bc86

Browse files
committed
feat: add wells endpoint and health check to transfer service
1 parent a182088 commit bd9bc86

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

transfers/entrypoint.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,22 @@
1616

1717
from fastapi import FastAPI
1818

19-
from transfers.transfer import main_transfer
19+
from core.dependencies import session_dependency
20+
from transfers.well_transfer import transfer_wells
2021

2122
app = FastAPI(title="Transfer Service")
2223

2324

24-
@app.get("/trigger")
25-
async def trigger():
26-
main_transfer()
25+
@app.get("/wells")
26+
async def wells(session: session_dependency):
2727

28-
return
28+
results = transfer_wells(session, limit=50)
29+
return results
30+
31+
32+
@app.get("/health")
33+
async def health():
34+
return {"status": "ok"}
2935

3036

3137
# ============= EOF =============================================

transfers/well_transfer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def transfer_wells(session, limit=None):
4646

4747
n = len(wdf)
4848
start_time = time.time()
49-
49+
results = {"n": n, }
50+
made_things = []
5051
for i, row in enumerate(wdf.itertuples()):
5152
if limit and i >= limit:
5253
print("Reached limit of", limit, "rows. Stopping migration.")
@@ -107,6 +108,10 @@ def transfer_wells(session, limit=None):
107108
assoc.location = location
108109
assoc.thing = well
109110
session.add(assoc)
111+
made_things.append(row.PointID)
112+
113+
results["made_things"] = made_things
114+
return results
110115

111116

112117
def transfer_wellscreens(session, limit=None):

0 commit comments

Comments
 (0)