-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i thought buildpack did this but nope...
- Loading branch information
Showing
3 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
"gcloud", | ||
"googleapis", | ||
"gserviceaccount", | ||
"Gunicorn", | ||
"imdecode", | ||
"imencode", | ||
"IMREAD", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
opencv-python==4.7.* | ||
pdf2image==1.16.* | ||
pandas==1.5.* | ||
google-cloud-storage==2.7.* | ||
google-cloud-logging==3.5.* | ||
pdf2image==1.16.* | ||
fastparquet==2023.1.0 | ||
flask==2.2.* | ||
google-cloud-documentai==2.12.* | ||
google-cloud-logging==3.5.* | ||
google-cloud-storage==2.7.* | ||
gunicorn==20.1.* | ||
pyarrow==11.* | ||
fastparquet==2023.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python | ||
# * coding: utf8 * | ||
""" | ||
server.py | ||
a module that can receive web requests. this will be google cloud pub sub and | ||
possibly github web hooks | ||
""" | ||
|
||
import logging | ||
from os import getenv | ||
from sys import stdout | ||
|
||
from flask import Flask | ||
|
||
import row_run | ||
|
||
PORT = int(str(getenv("PORT"))) if getenv("PORT") else 8080 | ||
app = Flask(__name__) | ||
|
||
logging.basicConfig(stream=stdout, level=logging.DEBUG) | ||
|
||
|
||
@app.route("/", methods=["POST"]) | ||
def schedule(): | ||
"""schedule: the route that gcp cloud scheduler invokes""" | ||
row_run.ocr_all_mosaics() | ||
|
||
return ("", 204) | ||
|
||
|
||
def start(): | ||
"""start: start the server for cloud run""" | ||
|
||
# This is used when running locally. Gunicorn is used to run the | ||
# application on Cloud Run. See entrypoint in Dockerfile. | ||
app.run(host="127.0.0.1", port=PORT, debug=False) | ||
|
||
|
||
if __name__ == "__main__": | ||
start() |