Fix timestamps in sist2-admin #359

This commit is contained in:
2023-05-25 20:51:06 -04:00
parent 6bf2b4c74d
commit f0fd708082
5 changed files with 11 additions and 13 deletions

View File

@@ -80,9 +80,8 @@ async def get_jobs():
@app.put("/api/job/{name:str}")
async def update_job(name: str, new_job: Sist2Job):
# TODO: Check etag
new_job.last_modified = datetime.now()
new_job.last_modified = datetime.utcnow()
job = db["jobs"][name]
if not job:
raise HTTPException(status_code=404)
@@ -135,7 +134,7 @@ async def kill_job(task_id: str):
def _run_job(job: Sist2Job):
job.last_modified = datetime.now()
job.last_modified = datetime.utcnow()
if job.status == JobStatus("created"):
job.status = JobStatus("started")
db["jobs"][job.name] = job
@@ -352,7 +351,7 @@ async def ws_tail_log(websocket: WebSocket, task_id: str, n: int):
def main():
uvicorn.run(app, port=WEBSERVER_PORT, host="0.0.0.0")
uvicorn.run(app, port=WEBSERVER_PORT, host="0.0.0.0", timeout_graceful_shutdown=0)
def initialize_db():