Beispiel #1
0
    def test_project_deletion_cascade_to_notebook_job(self):
        assert NotebookJob.objects.count() == 0
        project = ProjectFactory()
        NotebookJobFactory(project=project)
        assert NotebookJob.objects.count() == 1

        with patch('scheduler.tensorboard_scheduler.stop_tensorboard') as _:  # noqa
            with patch('scheduler.notebook_scheduler.stop_notebook') as _:  # noqa
                project.delete()
        assert NotebookJob.objects.count() == 0
Beispiel #2
0
    def test_project_deletion_cascade_to_notebook_job(self):
        assert NotebookJob.objects.count() == 0
        project = ProjectFactory()
        NotebookJobFactory(project=project)
        assert NotebookJob.objects.count() == 1

        with patch('scheduler.tensorboard_scheduler.stop_tensorboard') as _:  # noqa
            with patch('scheduler.notebook_scheduler.stop_notebook') as _:  # noqa
                project.delete()
        assert NotebookJob.objects.count() == 0
Beispiel #3
0
    def test_project_deletion_cascade_to_tensorboard_job(self):
        assert TensorboardJob.objects.count() == 0
        project = ProjectFactory()
        project.tensorboard = TensorboardJobFactory()
        project.save()
        assert TensorboardJob.objects.count() == 1

        with patch('schedulers.tensorboard_scheduler.stop_tensorboard') as _:
            with patch('schedulers.notebook_scheduler.stop_notebook') as _:
                project.delete()
        assert TensorboardJob.objects.count() == 0
Beispiel #4
0
    def test_delete_remove_paths(self, delete_outputs_path, delete_logs_path):
        project = ProjectFactory()
        for _ in range(2):
            ExperimentGroupFactory(project=project)
            ExperimentFactory(project=project)
        assert ExperimentGroup.objects.count() == 2
        assert Experiment.objects.count() == 2

        with patch('libs.paths.projects.delete_path'
                   ) as delete_path_project_mock_stop:
            project.delete()
        # 1 repo
        assert delete_path_project_mock_stop.call_count == 1
        # 1 project + 2 * groups + 2 experiments
        assert delete_outputs_path.call_count == 5
        assert delete_logs_path.call_count == 5
Beispiel #5
0
    def test_delete_remove_paths(self):
        project = ProjectFactory()
        for _ in range(2):
            ExperimentGroupFactory(project=project)
            ExperimentFactory(project=project)
        assert ExperimentGroup.objects.count() == 2
        assert Experiment.objects.count() == 2

        with patch('libs.paths.projects.delete_path') as delete_path_project_mock_stop:
            with patch('libs.paths.experiment_groups.delete_path') as delete_path_group_mock_stop:
                with patch('libs.paths.experiments.delete_path') as delete_path_xp_mock_stop:
                    project.delete()
        # 2 * project + 1 repo
        assert delete_path_project_mock_stop.call_count == 3
        # 2 * 2 * groups
        assert delete_path_group_mock_stop.call_count
        assert delete_path_xp_mock_stop.call_count == 4  # 2 * 2  * groups