Exemple #1
0
    def test_failed_operation_runs_sets_pipeline_run_to_finished(self):
        operation_run = OperationRunFactory()
        assert operation_run.last_status == OperationStatuses.CREATED
        assert operation_run.statuses.count() == 1
        pipeline_run = operation_run.pipeline_run
        assert pipeline_run.last_status == PipelineStatuses.CREATED
        assert pipeline_run.statuses.count() == 1

        # Stopping the first operation does not stop the pipeline
        operation_run.on_scheduled()
        operation_run.on_run()
        operation_run.on_failure()
        pipeline_run.refresh_from_db()
        assert operation_run.last_status == OperationStatuses.FAILED
        assert operation_run.statuses.count() == 4
        assert pipeline_run.last_status == PipelineStatuses.FINISHED
        assert pipeline_run.statuses.count() == 4
Exemple #2
0
    def test_running_operation_run_sets_pipeline_run_to_running(self):
        operation_run = OperationRunFactory()
        assert operation_run.last_status == OperationStatuses.CREATED
        assert operation_run.statuses.count() == 1
        pipeline_run = operation_run.pipeline_run
        assert pipeline_run.last_status == PipelineStatuses.CREATED
        assert pipeline_run.statuses.count() == 1

        # Create another operation run for this pipeline_run
        OperationRunFactory(pipeline_run=pipeline_run)

        operation_run.on_scheduled()
        pipeline_run.refresh_from_db()
        assert operation_run.last_status == OperationStatuses.SCHEDULED
        assert operation_run.statuses.count() == 2
        assert pipeline_run.last_status == PipelineStatuses.SCHEDULED
        assert pipeline_run.statuses.count() == 2

        operation_run.on_run()
        pipeline_run.refresh_from_db()
        assert operation_run.last_status == OperationStatuses.RUNNING
        assert operation_run.statuses.count() == 3
        assert pipeline_run.last_status == PipelineStatuses.RUNNING
        assert pipeline_run.statuses.count() == 3