Beispiel #1
0
 def test_skipping_pipeline_run_stops_operation_runs(self):
     pipeline_run = PipelineRunFactory()
     for _ in range(2):
         OperationRunFactory(pipeline_run=pipeline_run)
     assert pipeline_run.statuses.count() == 1
     assert pipeline_run.last_status == PipelineStatuses.CREATED
     assert OperationRunStatus.objects.filter().count() == 2
     assert set(OperationRunStatus.objects.values_list(
         'status', flat=True)) == {OperationStatuses.CREATED, }
     # Set pipeline run to skipped
     pipeline_run.on_skip()
     assert pipeline_run.statuses.count() == 2
     assert pipeline_run.last_status == PipelineStatuses.SKIPPED
     # Operation run are also skipped
     assert OperationRunStatus.objects.filter().count() == 6
     assert set(OperationRunStatus.objects.values_list(
         'status', flat=True)) == {OperationStatuses.CREATED,
                                   OperationStatuses.STOPPED,
                                   OperationStatuses.SKIPPED}
Beispiel #2
0
 def test_skipping_pipeline_run_stops_operation_runs(self):
     pipeline_run = PipelineRunFactory()
     for _ in range(2):
         OperationRunFactory(pipeline_run=pipeline_run)
     assert pipeline_run.statuses.count() == 1
     assert pipeline_run.last_status == PipelineStatuses.CREATED
     assert OperationRunStatus.objects.filter().count() == 2
     assert set(OperationRunStatus.objects.values_list(
         'status', flat=True)) == {OperationStatuses.CREATED, }
     # Set pipeline run to skipped
     pipeline_run.on_skip()
     assert pipeline_run.statuses.count() == 2
     assert pipeline_run.last_status == PipelineStatuses.SKIPPED
     # Operation run are also skipped
     assert OperationRunStatus.objects.filter().count() == 6
     assert set(OperationRunStatus.objects.values_list(
         'status', flat=True)) == {OperationStatuses.CREATED,
                                   OperationStatuses.STOPPED,
                                   OperationStatuses.SKIPPED}
Beispiel #3
0
 def test_skipping_pipeline_run_stops_operation_runs(self):
     pipeline_run = PipelineRunFactory()
     for _ in range(2):
         op_run = OperationRunFactory(pipeline_run=pipeline_run)
         assert start_operation_run(op_run) is False
     assert pipeline_run.statuses.count() == 1
     assert pipeline_run.last_status == PipelineLifeCycle.CREATED
     assert JobStatus.objects.filter().count() == 2
     assert set(JobStatus.objects.values_list('status', flat=True)) == {
         OperationStatuses.CREATED,
     }
     # Set pipeline run to skipped
     with patch('scheduler.tasks.jobs.jobs_stop.apply_async'
                ) as spawner_mock_stop:
         pipeline_run.on_skip()
     assert pipeline_run.statuses.count() == 2
     assert pipeline_run.last_status == PipelineLifeCycle.SKIPPED
     # Operation run are also skipped
     assert JobStatus.objects.filter().count(
     ) + spawner_mock_stop.call_count == 6
     assert set(JobStatus.objects.values_list('status', flat=True)) == {
         OperationStatuses.CREATED, OperationStatuses.SKIPPED
     }