def project_deleted(sender, **kwargs): instance = kwargs['instance'] scheduler.stop_tensorboard(instance) # Delete outputs and logs delete_project_outputs(instance.unique_name) delete_project_logs(instance.unique_name)
def handle(self, *args, **options): for project in Project.objects.filter( Q(has_tensorboard=True) | Q(has_notebook=True)): if project.has_notebook: scheduler.stop_notebook(project) if project.has_tensorboard: scheduler.stop_tensorboard(project)
def stop_tensorboard(project_id): try: project = Project.objects.get(id=project_id) except Project.DoesNotExist: logger.info('Project id `{}` does not exist'.format(project_id)) return None scheduler.stop_tensorboard(project)
def project_deleted(sender, **kwargs): instance = kwargs['instance'] scheduler.stop_tensorboard(instance) scheduler.stop_notebook(instance) # 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 scheduler.stop_tensorboard(project)