Skip to content

Commit bb9cf10

Browse files
committed
Fix airbyte deploy job and stop apply policy tagging for final tables only
1 parent 3ad0e8e commit bb9cf10

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

lib/dfe/analytics/jobs/airbyte_deploy_job.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def perform
3737

3838
Rails.logger.info('Finished WaitForSync')
3939

40-
# Trigger policy tagging
41-
BigQueryApplyPolicyTagsJob.perform_later
40+
# Trigger policy tagging for final tables
41+
DfE::Analytics::Services::ApplyAirbyteFinalTablesPolicyTags.call
4242

43-
Rails.logger.info('Finished BigQueryApplyPolicyTagsJob')
43+
Rails.logger.info('Finished AirbyteDeployJob')
4444
rescue StandardError => e
4545
Rails.logger.error(e.message)
4646
raise "AirbyteDeployJob failed: #{e.message}"

lib/dfe/analytics/tasks/big_query_apply_policy_tags.rake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ namespace :dfe do
77
puts "Calling DfE::Analytics::Services::ApplyAirbyteFinalTablesPolicyTags.call(delay_in_minutes: #{delay})"
88
DfE::Analytics::Services::ApplyAirbyteFinalTablesPolicyTags.call(delay_in_minutes: delay)
99

10-
puts "Calling DfE::Analytics::Services::ApplyAirbyteInternalTablesPolicyTags.call(delay_in_minutes: #{delay})"
11-
DfE::Analytics::Services::ApplyAirbyteInternalTablesPolicyTags.call(delay_in_minutes: delay)
10+
# Internal tables no longer created by airbyte - remove following code following testing
11+
#puts "Calling DfE::Analytics::Services::ApplyAirbyteInternalTablesPolicyTags.call(delay_in_minutes: #{delay})"
12+
#DfE::Analytics::Services::ApplyAirbyteInternalTablesPolicyTags.call(delay_in_minutes: delay)
1213
end
1314
end
1415
end

spec/dfe/analytics/jobs/airbyte_deploy_job_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
allow(Services::Airbyte::JobLast).to receive(:call).and_return(nil)
3232
allow(Services::Airbyte::StartSync).to receive(:call).and_return(job_id)
3333
allow(Services::Airbyte::WaitForSync).to receive(:call).and_return('succeeded')
34-
allow(DfE::Analytics::Jobs::BigQueryApplyPolicyTagsJob).to receive(:perform_later)
34+
allow(DfE::Analytics::Services::ApplyAirbyteFinalTablesPolicyTags).to receive(:call)
3535
end
3636

3737
it 'calls all Airbyte orchestration steps in order' do
@@ -54,7 +54,7 @@
5454
connection_id: connection_id,
5555
job_id: job_id
5656
)
57-
expect(DfE::Analytics::Jobs::BigQueryApplyPolicyTagsJob).to have_received(:perform_later)
57+
expect(DfE::Analytics::Services::ApplyAirbyteFinalTablesPolicyTags).to have_received(:call)
5858
end
5959

6060
context 'when last job is running' do

spec/dfe/analytics/tasks/big_query_apply_policy_tag_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
require 'rake'
22

3-
require_relative '../../../../lib/dfe/analytics/services/apply_airbyte_final_tables_policy_tags'
4-
require_relative '../../../../lib/dfe/analytics/services/apply_airbyte_internal_tables_policy_tags'
5-
63
RSpec.describe 'dfe:analytics:big_query_apply_policy_tags' do
74
before :all do
85
Rake.application.rake_require('big_query_apply_policy_tags', [File.expand_path('../../../../lib/dfe/analytics/tasks', __dir__)])
@@ -15,7 +12,6 @@
1512

1613
before do
1714
allow(DfE::Analytics::Services::ApplyAirbyteFinalTablesPolicyTags).to receive(:call)
18-
allow(DfE::Analytics::Services::ApplyAirbyteInternalTablesPolicyTags).to receive(:call)
1915
task.reenable # allow re-invocation in the same test run
2016
end
2117

@@ -24,7 +20,6 @@
2420
task.invoke('15')
2521

2622
expect(DfE::Analytics::Services::ApplyAirbyteFinalTablesPolicyTags).to have_received(:call).with(delay_in_minutes: 15)
27-
expect(DfE::Analytics::Services::ApplyAirbyteInternalTablesPolicyTags).to have_received(:call).with(delay_in_minutes: 15)
2823
end
2924
end
3025

@@ -33,7 +28,6 @@
3328
task.invoke
3429

3530
expect(DfE::Analytics::Services::ApplyAirbyteFinalTablesPolicyTags).to have_received(:call).with(delay_in_minutes: 0)
36-
expect(DfE::Analytics::Services::ApplyAirbyteInternalTablesPolicyTags).to have_received(:call).with(delay_in_minutes: 0)
3731
end
3832
end
3933
end

0 commit comments

Comments
 (0)