Auto-cleanup local cache after job completion
This commit is contained in:
parent
7d1e052326
commit
a1f05817fa
1 changed files with 12 additions and 0 deletions
|
|
@ -343,6 +343,12 @@ def process_job(host: str, remote_root: str, job: str, work_dir: Path, extra_arg
|
||||||
})
|
})
|
||||||
write_state(host, job_dir, new_state)
|
write_state(host, job_dir, new_state)
|
||||||
print(f"published preview: {job} -> {preview_output}")
|
print(f"published preview: {job} -> {preview_output}")
|
||||||
|
|
||||||
|
# Cleanup local cache
|
||||||
|
if local_input.exists():
|
||||||
|
shutil.rmtree(local_input)
|
||||||
|
if local_out.exists():
|
||||||
|
shutil.rmtree(local_out)
|
||||||
return
|
return
|
||||||
|
|
||||||
output = publish_output(host, remote_root, local_mp4, old_output)
|
output = publish_output(host, remote_root, local_mp4, old_output)
|
||||||
|
|
@ -361,6 +367,12 @@ def process_job(host: str, remote_root: str, job: str, work_dir: Path, extra_arg
|
||||||
})
|
})
|
||||||
write_state(host, job_dir, new_state)
|
write_state(host, job_dir, new_state)
|
||||||
print(f"published: {job} -> {output}")
|
print(f"published: {job} -> {output}")
|
||||||
|
|
||||||
|
# Cleanup local cache after successful job
|
||||||
|
if local_input.exists():
|
||||||
|
shutil.rmtree(local_input)
|
||||||
|
if local_out.exists():
|
||||||
|
shutil.rmtree(local_out)
|
||||||
return
|
return
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue