canvas_sync 0.16.5 → 0.17.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +49 -137
- data/app/models/canvas_sync/sync_batch.rb +5 -0
- data/db/migrate/20201018210836_create_canvas_sync_sync_batches.rb +11 -0
- data/lib/canvas_sync/importers/bulk_importer.rb +4 -7
- data/lib/canvas_sync/job.rb +4 -10
- data/lib/canvas_sync/job_batches/batch.rb +399 -0
- data/lib/canvas_sync/job_batches/batch_aware_job.rb +62 -0
- data/lib/canvas_sync/job_batches/callback.rb +153 -0
- data/lib/canvas_sync/job_batches/chain_builder.rb +203 -0
- data/lib/canvas_sync/job_batches/context_hash.rb +147 -0
- data/lib/canvas_sync/job_batches/jobs/base_job.rb +7 -0
- data/lib/canvas_sync/job_batches/jobs/concurrent_batch_job.rb +18 -0
- data/lib/canvas_sync/job_batches/jobs/serial_batch_job.rb +73 -0
- data/lib/canvas_sync/job_batches/sidekiq.rb +91 -0
- data/lib/canvas_sync/job_batches/status.rb +63 -0
- data/lib/canvas_sync/jobs/begin_sync_chain_job.rb +34 -0
- data/lib/canvas_sync/jobs/report_checker.rb +3 -6
- data/lib/canvas_sync/jobs/report_processor_job.rb +2 -5
- data/lib/canvas_sync/jobs/report_starter.rb +28 -20
- data/lib/canvas_sync/jobs/sync_accounts_job.rb +3 -5
- data/lib/canvas_sync/jobs/sync_admins_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_assignment_groups_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_assignments_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_context_module_items_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_context_modules_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_provisioning_report_job.rb +4 -31
- data/lib/canvas_sync/jobs/sync_roles_job.rb +2 -5
- data/lib/canvas_sync/jobs/sync_simple_table_job.rb +11 -32
- data/lib/canvas_sync/jobs/sync_submissions_job.rb +2 -4
- data/lib/canvas_sync/jobs/sync_terms_job.rb +22 -7
- data/lib/canvas_sync/processors/assignment_groups_processor.rb +2 -3
- data/lib/canvas_sync/processors/assignments_processor.rb +2 -3
- data/lib/canvas_sync/processors/context_module_items_processor.rb +2 -3
- data/lib/canvas_sync/processors/context_modules_processor.rb +2 -3
- data/lib/canvas_sync/processors/normal_processor.rb +1 -2
- data/lib/canvas_sync/processors/provisioning_report_processor.rb +2 -10
- data/lib/canvas_sync/processors/submissions_processor.rb +2 -3
- data/lib/canvas_sync/version.rb +1 -1
- data/lib/canvas_sync.rb +34 -97
- data/spec/canvas_sync/canvas_sync_spec.rb +126 -153
- data/spec/canvas_sync/jobs/job_spec.rb +9 -17
- data/spec/canvas_sync/jobs/report_checker_spec.rb +1 -3
- data/spec/canvas_sync/jobs/report_processor_job_spec.rb +0 -3
- data/spec/canvas_sync/jobs/report_starter_spec.rb +19 -28
- data/spec/canvas_sync/jobs/sync_admins_job_spec.rb +1 -4
- data/spec/canvas_sync/jobs/sync_assignment_groups_job_spec.rb +2 -1
- data/spec/canvas_sync/jobs/sync_assignments_job_spec.rb +3 -2
- data/spec/canvas_sync/jobs/sync_context_module_items_job_spec.rb +3 -2
- data/spec/canvas_sync/jobs/sync_context_modules_job_spec.rb +3 -2
- data/spec/canvas_sync/jobs/sync_provisioning_report_job_spec.rb +3 -35
- data/spec/canvas_sync/jobs/sync_roles_job_spec.rb +1 -4
- data/spec/canvas_sync/jobs/sync_simple_table_job_spec.rb +5 -12
- data/spec/canvas_sync/jobs/sync_submissions_job_spec.rb +2 -1
- data/spec/canvas_sync/jobs/sync_terms_job_spec.rb +1 -4
- data/spec/dummy/config/environments/test.rb +2 -0
- data/spec/dummy/db/schema.rb +9 -1
- data/spec/job_batching/batch_aware_job_spec.rb +100 -0
- data/spec/job_batching/batch_spec.rb +363 -0
- data/spec/job_batching/callback_spec.rb +38 -0
- data/spec/job_batching/flow_spec.rb +91 -0
- data/spec/job_batching/integration/integration.rb +57 -0
- data/spec/job_batching/integration/nested.rb +88 -0
- data/spec/job_batching/integration/simple.rb +47 -0
- data/spec/job_batching/integration/workflow.rb +134 -0
- data/spec/job_batching/integration_helper.rb +48 -0
- data/spec/job_batching/sidekiq_spec.rb +124 -0
- data/spec/job_batching/status_spec.rb +92 -0
- data/spec/job_batching/support/base_job.rb +14 -0
- data/spec/job_batching/support/sample_callback.rb +2 -0
- data/spec/spec_helper.rb +10 -0
- metadata +91 -23
- data/lib/canvas_sync/job_chain.rb +0 -102
- data/lib/canvas_sync/jobs/fork_gather.rb +0 -74
- data/spec/canvas_sync/jobs/fork_gather_spec.rb +0 -73
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -1248
- data/spec/dummy/log/test.log +0 -43258
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv +0 -3
- data/spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv +0 -4
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'integration_helper'
|
2
|
+
|
3
|
+
# Complex workflow with sequential and nested
|
4
|
+
# Also test sub batches without callbacks
|
5
|
+
# Batches:
|
6
|
+
# - Overall
|
7
|
+
# - Worker1
|
8
|
+
# - Worker3
|
9
|
+
# - Worker2 + Worker3
|
10
|
+
# - Worker1
|
11
|
+
# - Worker3
|
12
|
+
# - Worker4
|
13
|
+
# - Worker5
|
14
|
+
|
15
|
+
class Callbacks
|
16
|
+
def worker1 status, opts
|
17
|
+
Sidekiq.logger.info "Success 1 #{status.data}"
|
18
|
+
|
19
|
+
overall = CanvasSync::JobBatches::Batch.new status.parent_bid
|
20
|
+
overall.jobs do
|
21
|
+
batch = CanvasSync::JobBatches::Batch.new
|
22
|
+
batch.on(:success, "Callbacks#worker2")
|
23
|
+
batch.jobs do
|
24
|
+
Worker2.perform_async
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def worker2 status, opts
|
30
|
+
Sidekiq.logger.info "Success 2 #{status.data}"
|
31
|
+
overall = CanvasSync::JobBatches::Batch.new status.parent_bid
|
32
|
+
overall.jobs do
|
33
|
+
batch = CanvasSync::JobBatches::Batch.new
|
34
|
+
batch.on(:success, "Callbacks#worker4")
|
35
|
+
batch.jobs do
|
36
|
+
Worker4.perform_async
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
def worker4 status, opts
|
43
|
+
Sidekiq.logger.info "Success 4 #{status.data}"
|
44
|
+
overall = CanvasSync::JobBatches::Batch.new status.parent_bid
|
45
|
+
overall.jobs do
|
46
|
+
batch = CanvasSync::JobBatches::Batch.new
|
47
|
+
batch.on(:success, "Callbacks#worker5")
|
48
|
+
batch.jobs do
|
49
|
+
Worker5.perform_async
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def worker5 status, opts
|
55
|
+
Sidekiq.logger.info "Success 5 #{status.data}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class Worker1
|
60
|
+
include Sidekiq::Worker
|
61
|
+
|
62
|
+
def perform
|
63
|
+
Sidekiq.logger.info "Work 1"
|
64
|
+
batch = CanvasSync::JobBatches::Batch.new
|
65
|
+
batch.jobs do
|
66
|
+
Worker3.perform_async
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class Worker2
|
72
|
+
include Sidekiq::Worker
|
73
|
+
|
74
|
+
def perform
|
75
|
+
Sidekiq.logger.info "Work 2"
|
76
|
+
if bid
|
77
|
+
batch.jobs do
|
78
|
+
Worker3.perform_async
|
79
|
+
end
|
80
|
+
newb = CanvasSync::JobBatches::Batch.new
|
81
|
+
newb.jobs do
|
82
|
+
Worker1.perform_async
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
class Worker3
|
89
|
+
include Sidekiq::Worker
|
90
|
+
def perform
|
91
|
+
Sidekiq.logger.info "Work 3"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class Worker4
|
96
|
+
include Sidekiq::Worker
|
97
|
+
def perform
|
98
|
+
Sidekiq.logger.info "Work 4"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class Worker5
|
103
|
+
include Sidekiq::Worker
|
104
|
+
def perform
|
105
|
+
Sidekiq.logger.info "Work 5"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
class MyCallback
|
110
|
+
def on_success(status, options)
|
111
|
+
Sidekiq.logger.info "Overall Success #{options} #{status.data}"
|
112
|
+
end
|
113
|
+
alias_method :multi, :on_success
|
114
|
+
|
115
|
+
def on_complete(status, options)
|
116
|
+
Sidekiq.logger.info "Overall Complete #{options} #{status.data}"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
overall = CanvasSync::JobBatches::Batch.new
|
121
|
+
overall.on(:success, MyCallback, to: 'success@gmail.com')
|
122
|
+
overall.on(:complete, MyCallback, to: 'success@gmail.com')
|
123
|
+
overall.jobs do
|
124
|
+
batch1 = CanvasSync::JobBatches::Batch.new
|
125
|
+
batch1.on(:success, "Callbacks#worker1")
|
126
|
+
batch1.jobs do
|
127
|
+
Worker1.perform_async
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
puts "Overall bid #{overall.bid}"
|
132
|
+
|
133
|
+
output, keys = process_tests
|
134
|
+
overall_tests output, keys
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'sidekiq/batch'
|
3
|
+
require 'sidekiq/testing'
|
4
|
+
|
5
|
+
Sidekiq::Testing.server_middleware do |chain|
|
6
|
+
chain.add CanvasSync::JobBatches::Batch::Middleware::ServerMiddleware
|
7
|
+
end
|
8
|
+
|
9
|
+
Sidekiq.redis { |r| r.flushdb }
|
10
|
+
|
11
|
+
def redis_keys
|
12
|
+
Sidekiq.redis { |r| r.keys('BID-*') }
|
13
|
+
end
|
14
|
+
|
15
|
+
def dump_redis_keys
|
16
|
+
puts redis_keys.inspect
|
17
|
+
end
|
18
|
+
|
19
|
+
def process_tests
|
20
|
+
out_buf = StringIO.new
|
21
|
+
Sidekiq.logger = Logger.new out_buf
|
22
|
+
|
23
|
+
# Sidekiq.logger.level = :info
|
24
|
+
|
25
|
+
Sidekiq::Worker.drain_all
|
26
|
+
|
27
|
+
output = out_buf.string
|
28
|
+
keys = redis_keys
|
29
|
+
puts out_buf.string
|
30
|
+
|
31
|
+
[output, keys]
|
32
|
+
end
|
33
|
+
|
34
|
+
def overall_tests output, keys
|
35
|
+
describe "sidekiq batch" do
|
36
|
+
it "runs overall complete callback" do
|
37
|
+
expect(output).to include "Overall Complete"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "runs overall success callback" do
|
41
|
+
expect(output).to include "Overall Success"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "cleans redis keys" do
|
45
|
+
expect(keys).to eq([])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe CanvasSync::JobBatches::Sidekiq do
|
4
|
+
describe CanvasSync::JobBatches::Sidekiq::ServerMiddleware do
|
5
|
+
context 'when without batch' do
|
6
|
+
it 'just yields' do
|
7
|
+
yielded = false
|
8
|
+
expect(CanvasSync::JobBatches::Batch).not_to receive(:process_successful_job)
|
9
|
+
expect(CanvasSync::JobBatches::Batch).not_to receive(:process_failed_job)
|
10
|
+
subject.call(nil, {}, nil) { yielded = true }
|
11
|
+
expect(yielded).to be_truthy
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when in batch' do
|
16
|
+
let(:bid) { 'SAMPLEBID' }
|
17
|
+
let(:jid) { 'SAMPLEJID' }
|
18
|
+
|
19
|
+
context 'when successful' do
|
20
|
+
it 'yields' do
|
21
|
+
yielded = false
|
22
|
+
subject.call(nil, { 'bid' => bid, 'jid' => jid }, nil) { yielded = true }
|
23
|
+
expect(yielded).to be_truthy
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'calls process_successful_job' do
|
27
|
+
expect(CanvasSync::JobBatches::Batch).to receive(:process_successful_job).with(bid, nil)
|
28
|
+
subject.call(nil, { 'bid' => bid }, nil) {}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'when failed' do
|
33
|
+
it 'calls process_failed_job and reraises exception' do
|
34
|
+
reraised = false
|
35
|
+
expect(CanvasSync::JobBatches::Batch).to receive(:process_failed_job)
|
36
|
+
begin
|
37
|
+
subject.call(nil, { 'bid' => bid }, nil) { raise 'ERR' }
|
38
|
+
rescue
|
39
|
+
reraised = true
|
40
|
+
end
|
41
|
+
expect(reraised).to be_truthy
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe CanvasSync::JobBatches::Sidekiq::ClientMiddleware do
|
48
|
+
context 'when without batch' do
|
49
|
+
it 'just yields' do
|
50
|
+
yielded = false
|
51
|
+
expect(CanvasSync::JobBatches::Batch).not_to receive(:increment_job_queue)
|
52
|
+
subject.call(nil, {}, nil) { yielded = true }
|
53
|
+
expect(yielded).to be_truthy
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when in batch' do
|
58
|
+
let(:bid) { 'SAMPLEBID' }
|
59
|
+
let(:jid) { 'SAMPLEJID' }
|
60
|
+
before { Thread.current[:batch] = CanvasSync::JobBatches::Batch.new(bid) }
|
61
|
+
|
62
|
+
it 'yields' do
|
63
|
+
yielded = false
|
64
|
+
subject.call(nil, { 'jid' => jid }, nil) { yielded = true }
|
65
|
+
expect(yielded).to be_truthy
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'increments job queue' do
|
69
|
+
# expect(CanvasSync::JobBatches::Batch).to receive(:increment_job_queue).with(bid)
|
70
|
+
# subject.call(nil, { 'jid' => jid }, nil) {}
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'assigns bid to msg' do
|
74
|
+
msg = { 'jid' => jid }
|
75
|
+
subject.call(nil, msg, nil) {}
|
76
|
+
expect(msg[:bid]).to eq(bid)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
RSpec.describe CanvasSync::JobBatches::Sidekiq do
|
83
|
+
let(:config) { class_double(Sidekiq) }
|
84
|
+
let(:client_middleware) { double(Sidekiq::Middleware::Chain) }
|
85
|
+
|
86
|
+
context 'client' do
|
87
|
+
it 'adds client middleware' do
|
88
|
+
expect(Sidekiq).to receive(:configure_client).and_yield(config)
|
89
|
+
expect(config).to receive(:client_middleware).and_yield(client_middleware)
|
90
|
+
expect(client_middleware).to receive(:add).with(CanvasSync::JobBatches::Sidekiq::ClientMiddleware)
|
91
|
+
CanvasSync::JobBatches::Sidekiq.configure
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'server' do
|
96
|
+
let(:server_middleware) { double(Sidekiq::Middleware::Chain) }
|
97
|
+
let(:death_handlers) { double(Array) }
|
98
|
+
|
99
|
+
it 'adds client and server middleware' do
|
100
|
+
expect(Sidekiq).to receive(:configure_server).and_yield(config)
|
101
|
+
expect(config).to receive(:client_middleware).and_yield(client_middleware)
|
102
|
+
expect(config).to receive(:server_middleware).and_yield(server_middleware)
|
103
|
+
expect(config).to receive(:death_handlers).and_return(death_handlers)
|
104
|
+
expect(client_middleware).to receive(:add).with(CanvasSync::JobBatches::Sidekiq::ClientMiddleware)
|
105
|
+
expect(server_middleware).to receive(:add).with(CanvasSync::JobBatches::Sidekiq::ServerMiddleware)
|
106
|
+
expect(death_handlers).to receive(:<<)
|
107
|
+
CanvasSync::JobBatches::Sidekiq.configure
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'worker' do
|
112
|
+
it 'defines method bid' do
|
113
|
+
expect(Sidekiq::Worker.instance_methods).to include(:bid)
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'defines method batch' do
|
117
|
+
expect(Sidekiq::Worker.instance_methods).to include(:batch)
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'defines method valid_within_batch?' do
|
121
|
+
expect(Sidekiq::Worker.instance_methods).to include(:valid_within_batch?)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe CanvasSync::JobBatches::Batch::Status do
|
4
|
+
let(:bid) { 'BID' }
|
5
|
+
let(:batch) { CanvasSync::JobBatches::Batch.new(bid) }
|
6
|
+
subject { described_class.new(bid) }
|
7
|
+
|
8
|
+
describe '#join' do
|
9
|
+
it 'raises info' do
|
10
|
+
expect { subject.join }.to raise_error('Not supported')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#pending' do
|
15
|
+
context 'when not initalized' do
|
16
|
+
it 'returns 0 pending jobs' do
|
17
|
+
expect(subject.pending).to eq(0)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when more than 0' do
|
22
|
+
before { batch.jobs do TestWorker.perform_async end }
|
23
|
+
it 'returns pending jobs' do
|
24
|
+
expect(subject.pending).to eq(1)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#failures' do
|
30
|
+
context 'when not initalized' do
|
31
|
+
it 'returns 0 failed jobs' do
|
32
|
+
expect(subject.failures).to eq(0)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'when more than 0' do
|
37
|
+
before { batch.increment_job_queue(bid) }
|
38
|
+
before { CanvasSync::JobBatches::Batch.process_failed_job(bid, 'FAILEDID') }
|
39
|
+
|
40
|
+
it 'returns failed jobs' do
|
41
|
+
expect(subject.failures).to eq(1)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#failure_info' do
|
47
|
+
context 'when not initalized' do
|
48
|
+
it 'returns empty array' do
|
49
|
+
expect(subject.failure_info).to eq([])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when with error' do
|
54
|
+
before { CanvasSync::JobBatches::Batch.process_failed_job(bid, 'jid123') }
|
55
|
+
|
56
|
+
it 'returns array with failed jids' do
|
57
|
+
expect(subject.failure_info).to eq(['jid123'])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#total' do
|
63
|
+
context 'when not initalized' do
|
64
|
+
it 'returns 0 failed jobs' do
|
65
|
+
expect(subject.total).to eq(0)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'when more than 0' do
|
70
|
+
before { batch.jobs do TestWorker.perform_async end }
|
71
|
+
|
72
|
+
it 'returns failed jobs' do
|
73
|
+
expect(subject.total).to eq(1)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '#data' do
|
79
|
+
it 'returns batch description' do
|
80
|
+
expect(subject.data).to include(total: 0, failures: 0, pending: 0, created_at: nil, complete: false, failure_info: [], parent_bid: nil)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#created_at' do
|
85
|
+
it 'returns time' do
|
86
|
+
batch = CanvasSync::JobBatches::Batch.new
|
87
|
+
batch.jobs do TestWorker.perform_async end
|
88
|
+
status = described_class.new(batch.bid)
|
89
|
+
expect(status.created_at).not_to be_nil
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -13,6 +13,12 @@ require 'shoulda/matchers'
|
|
13
13
|
require 'pry'
|
14
14
|
require 'pry-nav'
|
15
15
|
|
16
|
+
require 'sidekiq/testing'
|
17
|
+
Sidekiq::Testing.fake!
|
18
|
+
|
19
|
+
require 'fakeredis/rspec'
|
20
|
+
Dir[File.dirname(__FILE__) + "/job_batching/support/**/*.rb"].each {|f| require f }
|
21
|
+
|
16
22
|
ActiveRecord::Migration.maintain_test_schema!
|
17
23
|
|
18
24
|
RSpec.configure do |config|
|
@@ -51,3 +57,7 @@ end
|
|
51
57
|
def canvas_sync_client
|
52
58
|
Bearcat::Client.new(token: 'cool-token', prefix: 'http://test.instructure.com')
|
53
59
|
end
|
60
|
+
|
61
|
+
def set_batch_context(ctx)
|
62
|
+
allow_any_instance_of(ActiveJob::Base).to receive(:batch_context).and_return(ctx.with_indifferent_access)
|
63
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Collings
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -234,6 +234,34 @@ dependencies:
|
|
234
234
|
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: fakeredis
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ">="
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
244
|
+
type: :development
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ">="
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: sidekiq
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - ">="
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '0'
|
258
|
+
type: :development
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - ">="
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0'
|
237
265
|
- !ruby/object:Gem::Dependency
|
238
266
|
name: activejob
|
239
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +276,20 @@ dependencies:
|
|
248
276
|
- - ">="
|
249
277
|
- !ruby/object:Gem::Version
|
250
278
|
version: '0'
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: redis
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - "<"
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '4.2'
|
286
|
+
type: :runtime
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - "<"
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '4.2'
|
251
293
|
- !ruby/object:Gem::Dependency
|
252
294
|
name: rails
|
253
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -304,7 +346,7 @@ dependencies:
|
|
304
346
|
- - ">="
|
305
347
|
- !ruby/object:Gem::Version
|
306
348
|
version: '0'
|
307
|
-
description:
|
349
|
+
description:
|
308
350
|
email:
|
309
351
|
- ncollings@instructure.com
|
310
352
|
executables: []
|
@@ -316,10 +358,12 @@ files:
|
|
316
358
|
- app/controllers/api/v1/health_check_controller.rb
|
317
359
|
- app/controllers/api/v1/live_events_controller.rb
|
318
360
|
- app/models/canvas_sync/job_log.rb
|
361
|
+
- app/models/canvas_sync/sync_batch.rb
|
319
362
|
- config/initializers/apartment.rb
|
320
363
|
- db/migrate/20170915210836_create_canvas_sync_job_log.rb
|
321
364
|
- db/migrate/20180725155729_add_job_id_to_canvas_sync_job_logs.rb
|
322
365
|
- db/migrate/20190916154829_add_fork_count_to_canvas_sync_job_logs.rb
|
366
|
+
- db/migrate/20201018210836_create_canvas_sync_sync_batches.rb
|
323
367
|
- lib/canvas_sync.rb
|
324
368
|
- lib/canvas_sync/api_syncable.rb
|
325
369
|
- lib/canvas_sync/class_callback_executor.rb
|
@@ -377,8 +421,17 @@ files:
|
|
377
421
|
- lib/canvas_sync/importers/bulk_importer.rb
|
378
422
|
- lib/canvas_sync/importers/legacy_importer.rb
|
379
423
|
- lib/canvas_sync/job.rb
|
380
|
-
- lib/canvas_sync/
|
381
|
-
- lib/canvas_sync/
|
424
|
+
- lib/canvas_sync/job_batches/batch.rb
|
425
|
+
- lib/canvas_sync/job_batches/batch_aware_job.rb
|
426
|
+
- lib/canvas_sync/job_batches/callback.rb
|
427
|
+
- lib/canvas_sync/job_batches/chain_builder.rb
|
428
|
+
- lib/canvas_sync/job_batches/context_hash.rb
|
429
|
+
- lib/canvas_sync/job_batches/jobs/base_job.rb
|
430
|
+
- lib/canvas_sync/job_batches/jobs/concurrent_batch_job.rb
|
431
|
+
- lib/canvas_sync/job_batches/jobs/serial_batch_job.rb
|
432
|
+
- lib/canvas_sync/job_batches/sidekiq.rb
|
433
|
+
- lib/canvas_sync/job_batches/status.rb
|
434
|
+
- lib/canvas_sync/jobs/begin_sync_chain_job.rb
|
382
435
|
- lib/canvas_sync/jobs/report_checker.rb
|
383
436
|
- lib/canvas_sync/jobs/report_processor_job.rb
|
384
437
|
- lib/canvas_sync/jobs/report_starter.rb
|
@@ -407,7 +460,6 @@ files:
|
|
407
460
|
- lib/canvas_sync/sidekiq_job.rb
|
408
461
|
- lib/canvas_sync/version.rb
|
409
462
|
- spec/canvas_sync/canvas_sync_spec.rb
|
410
|
-
- spec/canvas_sync/jobs/fork_gather_spec.rb
|
411
463
|
- spec/canvas_sync/jobs/job_spec.rb
|
412
464
|
- spec/canvas_sync/jobs/report_checker_spec.rb
|
413
465
|
- spec/canvas_sync/jobs/report_processor_job_spec.rb
|
@@ -524,9 +576,6 @@ files:
|
|
524
576
|
- spec/dummy/db/migrate/20200416214248_create_group_memberships.rb
|
525
577
|
- spec/dummy/db/migrate/20201016181346_create_pseudonyms.rb
|
526
578
|
- spec/dummy/db/schema.rb
|
527
|
-
- spec/dummy/db/test.sqlite3
|
528
|
-
- spec/dummy/log/development.log
|
529
|
-
- spec/dummy/log/test.log
|
530
579
|
- spec/factories/account_factory.rb
|
531
580
|
- spec/factories/admin_factory.rb
|
532
581
|
- spec/factories/assignment_factory.rb
|
@@ -542,6 +591,19 @@ files:
|
|
542
591
|
- spec/factories/submission_factory.rb
|
543
592
|
- spec/factories/term_factory.rb
|
544
593
|
- spec/factories/user_factory.rb
|
594
|
+
- spec/job_batching/batch_aware_job_spec.rb
|
595
|
+
- spec/job_batching/batch_spec.rb
|
596
|
+
- spec/job_batching/callback_spec.rb
|
597
|
+
- spec/job_batching/flow_spec.rb
|
598
|
+
- spec/job_batching/integration/integration.rb
|
599
|
+
- spec/job_batching/integration/nested.rb
|
600
|
+
- spec/job_batching/integration/simple.rb
|
601
|
+
- spec/job_batching/integration/workflow.rb
|
602
|
+
- spec/job_batching/integration_helper.rb
|
603
|
+
- spec/job_batching/sidekiq_spec.rb
|
604
|
+
- spec/job_batching/status_spec.rb
|
605
|
+
- spec/job_batching/support/base_job.rb
|
606
|
+
- spec/job_batching/support/sample_callback.rb
|
545
607
|
- spec/spec_helper.rb
|
546
608
|
- spec/support/fake_canvas.rb
|
547
609
|
- spec/support/fixtures/canvas_responses/admins.json
|
@@ -558,8 +620,6 @@ files:
|
|
558
620
|
- spec/support/fixtures/reports/group_memberships.csv
|
559
621
|
- spec/support/fixtures/reports/groups.csv
|
560
622
|
- spec/support/fixtures/reports/provisioning_csv
|
561
|
-
- spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv
|
562
|
-
- spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
|
563
623
|
- spec/support/fixtures/reports/sections.csv
|
564
624
|
- spec/support/fixtures/reports/submissions.csv
|
565
625
|
- spec/support/fixtures/reports/users.csv
|
@@ -567,7 +627,7 @@ files:
|
|
567
627
|
homepage: https://instructure.com
|
568
628
|
licenses: []
|
569
629
|
metadata: {}
|
570
|
-
post_install_message:
|
630
|
+
post_install_message:
|
571
631
|
rdoc_options: []
|
572
632
|
require_paths:
|
573
633
|
- lib
|
@@ -578,17 +638,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
578
638
|
version: '0'
|
579
639
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
580
640
|
requirements:
|
581
|
-
- - "
|
641
|
+
- - ">"
|
582
642
|
- !ruby/object:Gem::Version
|
583
|
-
version:
|
643
|
+
version: 1.3.1
|
584
644
|
requirements: []
|
585
|
-
|
586
|
-
|
645
|
+
rubyforge_project:
|
646
|
+
rubygems_version: 2.5.2.1
|
647
|
+
signing_key:
|
587
648
|
specification_version: 4
|
588
649
|
summary: Gem for generating Canvas models and migrations and syncing data from Canvas
|
589
650
|
test_files:
|
590
651
|
- spec/canvas_sync/canvas_sync_spec.rb
|
591
|
-
- spec/canvas_sync/jobs/fork_gather_spec.rb
|
592
652
|
- spec/canvas_sync/jobs/job_spec.rb
|
593
653
|
- spec/canvas_sync/jobs/report_checker_spec.rb
|
594
654
|
- spec/canvas_sync/jobs/report_processor_job_spec.rb
|
@@ -705,9 +765,6 @@ test_files:
|
|
705
765
|
- spec/dummy/db/migrate/20200416214248_create_group_memberships.rb
|
706
766
|
- spec/dummy/db/migrate/20201016181346_create_pseudonyms.rb
|
707
767
|
- spec/dummy/db/schema.rb
|
708
|
-
- spec/dummy/db/test.sqlite3
|
709
|
-
- spec/dummy/log/development.log
|
710
|
-
- spec/dummy/log/test.log
|
711
768
|
- spec/factories/account_factory.rb
|
712
769
|
- spec/factories/admin_factory.rb
|
713
770
|
- spec/factories/assignment_factory.rb
|
@@ -723,6 +780,19 @@ test_files:
|
|
723
780
|
- spec/factories/submission_factory.rb
|
724
781
|
- spec/factories/term_factory.rb
|
725
782
|
- spec/factories/user_factory.rb
|
783
|
+
- spec/job_batching/batch_aware_job_spec.rb
|
784
|
+
- spec/job_batching/batch_spec.rb
|
785
|
+
- spec/job_batching/callback_spec.rb
|
786
|
+
- spec/job_batching/flow_spec.rb
|
787
|
+
- spec/job_batching/integration/integration.rb
|
788
|
+
- spec/job_batching/integration/nested.rb
|
789
|
+
- spec/job_batching/integration/simple.rb
|
790
|
+
- spec/job_batching/integration/workflow.rb
|
791
|
+
- spec/job_batching/integration_helper.rb
|
792
|
+
- spec/job_batching/sidekiq_spec.rb
|
793
|
+
- spec/job_batching/status_spec.rb
|
794
|
+
- spec/job_batching/support/base_job.rb
|
795
|
+
- spec/job_batching/support/sample_callback.rb
|
726
796
|
- spec/spec_helper.rb
|
727
797
|
- spec/support/fake_canvas.rb
|
728
798
|
- spec/support/fixtures/canvas_responses/admins.json
|
@@ -739,8 +809,6 @@ test_files:
|
|
739
809
|
- spec/support/fixtures/reports/group_memberships.csv
|
740
810
|
- spec/support/fixtures/reports/groups.csv
|
741
811
|
- spec/support/fixtures/reports/provisioning_csv
|
742
|
-
- spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv
|
743
|
-
- spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
|
744
812
|
- spec/support/fixtures/reports/sections.csv
|
745
813
|
- spec/support/fixtures/reports/submissions.csv
|
746
814
|
- spec/support/fixtures/reports/users.csv
|