Skip to content

Commit

Permalink
sigh
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Reynolds committed Aug 20, 2024
1 parent 8070d1d commit 11bffab
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions base/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@
import petname
from flask import Flask, jsonify

state_base = "/var/lib/private/orijen-udf-base/"

def run_flask(app):
"""Function to run the Flask app on a separate thread."""
app.run(host='0.0.0.0', port=5123)

def save_state(file, state):
os.makedirs(os.path.dirname(file), exist_ok=True)
with open(file, 'w') as f:
os.makedirs(os.path.dirname(state_base + file), exist_ok=True)
with open(state_base+ file, 'w') as f:
json.dump(state, f)

def load_state(file):
try:
with open(file, 'r') as f:
with open(state_base + file, 'r') as f:
return json.load(f)
except FileNotFoundError:
return {}
Expand Down Expand Up @@ -226,14 +228,12 @@ def send_sqs(meta: dict, kill: bool=False) -> dict|None:
def main():
"""
Main Function
"""
state_base = "/var/lib/private/orijen-udf-base/"

"""
metadata = query_metadata()
labInfo = get_lab_info(metadata)
sqsMeta = build_sqs_meta(metadata, labInfo)

petName = load_state(state_base + "petname.json")
petName = load_state("petname.json")
if not petName:
petName = generate_petname()

Expand Down

0 comments on commit 11bffab

Please sign in to comment.