Skip to content

Commit

Permalink
fix: remove after notify and send empty file if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
danellecline committed Oct 6, 2023
1 parent 9303157 commit ccde746
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/daemon/docker_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ async def check(self, database_path: Path) -> None:
if runner.is_successful():
info(f'Job {job_id} docker container {runner.container_name} processing complete')
jobs_to_remove.append(job_id)
await runner.fini()

# Update the job status and notify
with session_maker.begin() as db:
Expand All @@ -63,11 +62,11 @@ async def check(self, database_path: Path) -> None:
Status.SUCCESS,
metadata_b64=json_b64_encode(metadata))
await notify(job, local_path)
await runner.fini()

if runner.failed():
warn(f'Job {job_id} docker container {runner.container_name} failed')
jobs_to_remove.append(job_id)
await runner.fini()
# Update the job status and notify
with session_maker.begin() as db:
job = db.query(JobLocal).filter(JobLocal.id == job_id).first()
Expand All @@ -79,7 +78,11 @@ async def check(self, database_path: Path) -> None:
job.media[0].name,
Status.FAILED,
metadata_b64=json_b64_encode(metadata))
# Create a track tar file that is empty
local_path = Path(f'/tmp/empty.tar.gz')
local_path.touch()
await notify(job, local_path)
await runner.fini()

# Remove the instances
for job_id in jobs_to_remove:
Expand Down

0 comments on commit ccde746

Please sign in to comment.