Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
fix: correct update job logic
Browse files Browse the repository at this point in the history
  • Loading branch information
radufalcusan committed Jan 25, 2024
1 parent c064ed6 commit 2cd08f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ async def create(input: ExecutionInput, background_tasks: BackgroundTasks):
id=str(uuid.uuid4())
create_execution(id, input, background_tasks)
return create_job(id)


@app.get('/{id}')
def get_status(id):
Expand Down
7 changes: 3 additions & 4 deletions src/job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ def update_job_status(id, isDone):
job.status = ExecutionStatus.COMPLETED
else:
job = Job(id = id, status = ExecutionStatus.COMPLETED, createdAt = format_timestamp(time.time()))
elif not isDone and not job:
job = Job(id = id, status = ExecutionStatus.IN_PROGRESS, createdAt = format_timestamp(time.time()))
elif not isDone and job:
job.status = ExecutionStatus.IN_PROGRESS

jobs[id] = job
return job

def delete_job(id):
del jobs[id]

0 comments on commit 2cd08f4

Please sign in to comment.