Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete task logs #982

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions pybossa/repositories/task_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,31 +202,34 @@ def update(self, element):
raise DBIntegrityError(e)

def delete(self, element):
start_time = time.time()
tstart = time.time()
self._delete(element)
tend = time.time()
current_app.logger.info("Delete task profiling. Time for self._delete %f seconds (task %d, project %d)", tend - tstart, element.id, element.project_id)
time_delete = tend - tstart

tstart = time.time()
project = element.project
tend = time.time()
time_project = tend - tstart

tstart = time.time()
self.db.session.commit()
tend = time.time()
current_app.logger.info("Delete task profiling. Time for self.db.session.commit %f seconds (task %d, project %d)", tend - tstart, element.id, element.project_id)
time_commit = tend - tstart

tstart = time.time()
cached_projects.clean_project(element.project_id)
tend = time.time()
current_app.logger.info("Delete task profiling. Time for cached_projects.clean_project %f seconds (task %d, project %d)", tend - tstart, element.id, element.project_id)
time_clean_project = tend - tstart

tstart = time.time()
self._delete_zip_files_from_store(project)
tend = time.time()
current_app.logger.info("Delete task profiling. Time for self._delete_zip_files_from_store %f seconds (task %d, project %d)", tend - tstart, element.id, element.project_id)
time_delete_zip = tend - tstart

end_time = time.time()
time_diff = end_time - start_time
current_app.logger.info("Delete task profiling. Total deletion time for task %d, project %d was %f seconds", element.id, element.project_id, time_diff)
time_total = time_delete + time_project + time_commit + time_clean_project + time_delete_zip
current_app.logger.info("Delete task profiling task %d, project %d Total time %f seconds. self._delete %f seconds, element.project %f seconds, db.session.commit %f seconds, cached_projects.clean_project %f seconds, self._delete_zip_files_from_store %f seconds",
element.id, element.project_id, time_total, time_delete, time_project, time_commit, time_clean_project, time_delete_zip)

def delete_task_by_id(self, project_id, task_id):
from pybossa.jobs import check_and_send_task_notifications
Expand Down
Loading