def _clean(): for project in Project.objects.filter( Q(has_tensorboard=True) | Q(has_notebook=True)): if project.has_notebook: notebook_scheduler.stop_notebook(project, update_status=False) if project.has_tensorboard: tensorboard_scheduler.stop_tensorboard(project, update_status=False)
def project_deleted(sender, **kwargs): instance = kwargs['instance'] tensorboard_scheduler.stop_tensorboard(instance, update_status=False) notebook_scheduler.stop_notebook(instance, update_status=False) # Delete tensorboard job if instance.tensorboard: instance.tensorboard.delete() # Delete notebook job if instance.notebook: instance.notebook.delete() # Clean outputs, logs, and repos delete_project_outputs(instance.unique_name) delete_project_logs(instance.unique_name) delete_project_repos(instance.unique_name)
def stop_tensorboard(project_id): project = get_valid_project(project_id) if not project: return None tensorboard_scheduler.stop_tensorboard(project, update_status=True)