Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
mcantelon committed Apr 17, 2024
1 parent 35c2e06 commit 11015ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions AIPscan/Aggregator/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,6 @@ def delete_fetch_job(fetch_job_id):
if os.path.exists(fetch_job.download_directory):
shutil.rmtree(fetch_job.download_directory)
db.session.delete(fetch_job)

index_task_objects = index_tasks.query.filter_by(fetch_job_id=fetch_job_id).all()

for index_task_obj in index_task_objects:
db.session.delete(index_task_obj)

db.session.commit()


Expand Down
5 changes: 4 additions & 1 deletion AIPscan/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class get_mets_tasks(db.Model):
class index_tasks(db.Model):
__bind_key__ = "celery"
index_task_id = db.Column(db.String(36), primary_key=True)
fetch_job_id = db.Column(db.String(36))
fetch_job_id = db.Column(
db.String(36), db.ForeignKey("fetch_job.id"), nullable=False
)
indexing_start = db.Column(db.DateTime())
indexing_progress = db.Column(db.String(255))
indexing_end = db.Column(db.DateTime())
Expand Down Expand Up @@ -266,6 +268,7 @@ class FetchJob(db.Model):
db.Integer(), db.ForeignKey("storage_service.id"), nullable=False
)
aips = db.relationship("AIP", cascade="all,delete", backref="fetch_job", lazy=True)
index_tasks = db.relationship("index_tasks", cascade="all,delete", backref="fetch_job", lazy=True)

def __init__(
self,
Expand Down

0 comments on commit 11015ef

Please sign in to comment.