Skip to content

Commit

Permalink
Fix clean jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
florealcab committed Feb 21, 2018
1 parent 176ad29 commit 5bbcba4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/dgenies/bin/clean_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ def parse_database(app_data, max_age, fake=False):
is_gallery = len(Gallery.select().join(Job).where(Job.id_job == id_job)) > 0
if is_gallery:
gallery_jobs.append(id_job)
print("Removing job %s..." % id_job)
data_dir = os.path.join(app_data, id_job)
if os.path.exists(data_dir) and os.path.isdir(data_dir):
if not fake:
shutil.rmtree(data_dir)
else:
print("Job %s has no data folder!" % id_job)
if not fake:
job.delete_instance()
print("Removing job %s..." % id_job)
data_dir = os.path.join(app_data, id_job)
if os.path.exists(data_dir) and os.path.isdir(data_dir):
if not fake:
shutil.rmtree(data_dir)
else:
print("Job %s has no data folder!" % id_job)
if not fake:
job.delete_instance()
return gallery_jobs


Expand Down

0 comments on commit 5bbcba4

Please sign in to comment.