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 new_project(sender, **kwargs): instance = kwargs['instance'] created = kwargs.get('created', False) if not created: return # Clean outputs and logs delete_project_outputs(instance.unique_name) delete_project_logs(instance.unique_name)
def test_project_outputs_path_creation_deletion(self): with patch('experiments.tasks.build_experiment.apply_async') as _: experiment = ExperimentFactory(user=self.project.user, project=self.project) create_experiment_outputs_path(experiment.unique_name) experiment_outputs_path = get_experiment_outputs_path(experiment.unique_name) project_outputs_path = get_project_outputs_path(self.project.unique_name) assert os.path.exists(experiment_outputs_path) is True assert os.path.exists(project_outputs_path) is True delete_project_outputs(self.project.unique_name) assert os.path.exists(experiment_outputs_path) is False assert os.path.exists(project_outputs_path) is False
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)