canvas_sync 0.16.4 → 0.17.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -137
- data/app/models/canvas_sync/sync_batch.rb +5 -0
- data/db/migrate/20170915210836_create_canvas_sync_job_log.rb +12 -31
- data/db/migrate/20180725155729_add_job_id_to_canvas_sync_job_logs.rb +4 -13
- data/db/migrate/20190916154829_add_fork_count_to_canvas_sync_job_logs.rb +3 -11
- data/db/migrate/20201018210836_create_canvas_sync_sync_batches.rb +11 -0
- data/lib/canvas_sync.rb +35 -118
- data/lib/canvas_sync/job.rb +5 -5
- 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 +27 -19
- 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/misc_helper.rb +15 -0
- data/lib/canvas_sync/version.rb +1 -1
- 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/app/models/account.rb +3 -0
- data/spec/dummy/app/models/pseudonym.rb +14 -0
- data/spec/dummy/app/models/submission.rb +1 -0
- data/spec/dummy/app/models/user.rb +1 -0
- data/spec/dummy/config/environments/test.rb +2 -0
- data/spec/dummy/db/migrate/20201016181346_create_pseudonyms.rb +24 -0
- data/spec/dummy/db/schema.rb +24 -4
- 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 +90 -8
- data/lib/canvas_sync/job_chain.rb +0 -57
- data/lib/canvas_sync/jobs/fork_gather.rb +0 -59
- data/spec/canvas_sync/jobs/fork_gather_spec.rb +0 -73
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe CanvasSync::JobBatches::Batch::Callback::Worker do
|
4
|
+
describe '#perform' do
|
5
|
+
it 'does not do anything if it cannot find the callback class' do
|
6
|
+
subject.perform('SampleCallback', 'complete', {}, 'ABCD', 'EFGH')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'does not do anything if event is different from complete or success' do
|
10
|
+
expect(SampleCallback).not_to receive(:new)
|
11
|
+
subject.perform('SampleCallback', 'ups', {}, 'ABCD', 'EFGH')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'calls on_success if defined' do
|
15
|
+
callback_instance = double('SampleCallback', on_success: true)
|
16
|
+
expect(SampleCallback).to receive(:new).and_return(callback_instance)
|
17
|
+
expect(callback_instance).to receive(:on_success)
|
18
|
+
.with(instance_of(CanvasSync::JobBatches::Batch::Status), {})
|
19
|
+
subject.perform('SampleCallback', 'success', {}, 'ABCD', 'EFGH')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'calls on_complete if defined' do
|
23
|
+
callback_instance = double('SampleCallback')
|
24
|
+
expect(SampleCallback).to receive(:new).and_return(callback_instance)
|
25
|
+
expect(callback_instance).to receive(:on_complete)
|
26
|
+
.with(instance_of(CanvasSync::JobBatches::Batch::Status), {})
|
27
|
+
subject.perform('SampleCallback', 'complete', {}, 'ABCD', 'EFGH')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'calls specific callback if defined' do
|
31
|
+
callback_instance = double('SampleCallback')
|
32
|
+
expect(SampleCallback).to receive(:new).and_return(callback_instance)
|
33
|
+
expect(callback_instance).to receive(:sample_method)
|
34
|
+
.with(instance_of(CanvasSync::JobBatches::Batch::Status), {})
|
35
|
+
subject.perform('SampleCallback#sample_method', 'complete', {}, 'ABCD', 'EFGH')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class WorkerA < BatchTestJobBase
|
4
|
+
def perform
|
5
|
+
puts 'A'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class WorkerB < BatchTestJobBase
|
10
|
+
def perform
|
11
|
+
puts 'B'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class WorkerC < BatchTestJobBase
|
16
|
+
def perform
|
17
|
+
puts 'C'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
RSpec.describe 'Batch flow' do
|
22
|
+
context 'when handling a batch' do
|
23
|
+
let(:batch) { CanvasSync::JobBatches::Batch.new }
|
24
|
+
before { batch.on(:complete, SampleCallback, :id => 42) }
|
25
|
+
before { batch.description = 'describing the batch' }
|
26
|
+
let(:status) { CanvasSync::JobBatches::Batch::Status.new(batch.bid) }
|
27
|
+
let(:jids) { batch.jobs do 3.times do TestWorker.perform_async end end }
|
28
|
+
let(:queue) { Sidekiq::Queue.new }
|
29
|
+
|
30
|
+
it 'correctly initializes' do
|
31
|
+
expect(jids.size).to eq(3)
|
32
|
+
|
33
|
+
expect(batch.bid).not_to be_nil
|
34
|
+
expect(batch.description).to eq('describing the batch')
|
35
|
+
|
36
|
+
batch.jobs {}
|
37
|
+
|
38
|
+
expect(status.total).to eq(3)
|
39
|
+
expect(status.pending).to eq(3)
|
40
|
+
expect(status.failures).to eq(0)
|
41
|
+
expect(status.complete?).to be false
|
42
|
+
expect(status.created_at).not_to be_nil
|
43
|
+
expect(status.bid).to eq(batch.bid)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'handles an empty batch' do
|
47
|
+
batch = CanvasSync::JobBatches::Batch.new
|
48
|
+
jids = batch.jobs do nil end
|
49
|
+
expect(jids.size).to eq(0)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when handling a nested batch' do
|
54
|
+
let(:batchA) { CanvasSync::JobBatches::Batch.new }
|
55
|
+
let(:batchB) { CanvasSync::JobBatches::Batch.new }
|
56
|
+
let(:batchC) { CanvasSync::JobBatches::Batch.new(batchA.bid) }
|
57
|
+
let(:batchD) { CanvasSync::JobBatches::Batch.new }
|
58
|
+
let(:jids) { [] }
|
59
|
+
let(:parent) { batchA.bid }
|
60
|
+
let(:children) { [] }
|
61
|
+
|
62
|
+
it 'handles a basic nested batch' do
|
63
|
+
batchA.jobs do
|
64
|
+
jids << WorkerA.perform_async
|
65
|
+
batchB.jobs do
|
66
|
+
jids << WorkerB.perform_async
|
67
|
+
end
|
68
|
+
jids << WorkerA.perform_async
|
69
|
+
children << batchB.bid
|
70
|
+
end
|
71
|
+
|
72
|
+
batchC.jobs do
|
73
|
+
batchD.jobs do
|
74
|
+
jids << WorkerC.perform_async
|
75
|
+
end
|
76
|
+
children << batchD.bid
|
77
|
+
end
|
78
|
+
|
79
|
+
expect(jids.size).to eq(4)
|
80
|
+
expect(CanvasSync::JobBatches::Batch::Status.new(parent).child_count).to eq(2)
|
81
|
+
children.each do |kid|
|
82
|
+
status = CanvasSync::JobBatches::Batch::Status.new(kid)
|
83
|
+
expect(status.child_count).to eq(0)
|
84
|
+
expect(status.pending).to eq(1)
|
85
|
+
expect(status.parent_bid).to eq(parent)
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'integration_helper'
|
2
|
+
|
3
|
+
# Simple test of adding jobs to the current batch
|
4
|
+
# Batches:
|
5
|
+
# - Overall (TestWoker) + Another worker
|
6
|
+
|
7
|
+
class AnotherWorker
|
8
|
+
include Sidekiq::Worker
|
9
|
+
|
10
|
+
def perform
|
11
|
+
Sidekiq.logger.info "Another Worker"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class TestWorker
|
16
|
+
include Sidekiq::Worker
|
17
|
+
|
18
|
+
def perform
|
19
|
+
Sidekiq.logger.info "Test Worker"
|
20
|
+
if bid
|
21
|
+
batch.jobs do
|
22
|
+
AnotherWorker.perform_async
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class MyCallback
|
29
|
+
def on_success(status, options)
|
30
|
+
Sidekiq.logger.info "Success #{options} #{status.data}"
|
31
|
+
end
|
32
|
+
alias_method :multi, :on_success
|
33
|
+
|
34
|
+
def on_complete(status, options)
|
35
|
+
Sidekiq.logger.info "Complete #{options} #{status.data}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
batch = CanvasSync::JobBatches::Batch.new
|
40
|
+
batch.description = 'Test batch'
|
41
|
+
batch.callback_queue = :default
|
42
|
+
batch.on(:success, 'MyCallback#on_success', to: 'success@gmail.com')
|
43
|
+
batch.on(:success, 'MyCallback#multi', to: 'success@gmail.com')
|
44
|
+
batch.on(:complete, MyCallback, to: 'complete@gmail.com')
|
45
|
+
|
46
|
+
batch.jobs do
|
47
|
+
10.times do
|
48
|
+
TestWorker.perform_async
|
49
|
+
end
|
50
|
+
end
|
51
|
+
puts CanvasSync::JobBatches::Batch::Status.new(batch.bid).data
|
52
|
+
|
53
|
+
dump_redis_keys
|
54
|
+
|
55
|
+
Sidekiq::Worker.drain_all
|
56
|
+
|
57
|
+
dump_redis_keys
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'integration_helper'
|
2
|
+
|
3
|
+
# Tests deep nesting of batches
|
4
|
+
# Batches:
|
5
|
+
# - Overall (Worker 1)
|
6
|
+
# - Worker 2
|
7
|
+
# - Worker 3
|
8
|
+
# - Worker 4
|
9
|
+
|
10
|
+
class Worker1
|
11
|
+
include Sidekiq::Worker
|
12
|
+
|
13
|
+
def perform
|
14
|
+
Sidekiq.logger.info "Work1"
|
15
|
+
batch = CanvasSync::JobBatches::Batch.new
|
16
|
+
batch.on(:success, Worker2)
|
17
|
+
batch.jobs do
|
18
|
+
Worker2.perform_async
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Worker2
|
24
|
+
include Sidekiq::Worker
|
25
|
+
|
26
|
+
def perform
|
27
|
+
Sidekiq.logger.info "Work2"
|
28
|
+
batch = CanvasSync::JobBatches::Batch.new
|
29
|
+
batch.on(:success, Worker3)
|
30
|
+
batch.jobs do
|
31
|
+
Worker3.perform_async
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def on_success status, opts
|
36
|
+
Sidekiq.logger.info "Worker 2 Success"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Worker3
|
41
|
+
include Sidekiq::Worker
|
42
|
+
|
43
|
+
def perform
|
44
|
+
Sidekiq.logger.info "Work3"
|
45
|
+
batch = CanvasSync::JobBatches::Batch.new
|
46
|
+
batch.on(:success, Worker4)
|
47
|
+
batch.jobs do
|
48
|
+
Worker4.perform_async
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def on_success status, opts
|
53
|
+
Sidekiq.logger.info "Worker 3 Success"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class Worker4
|
58
|
+
include Sidekiq::Worker
|
59
|
+
|
60
|
+
def perform
|
61
|
+
Sidekiq.logger.info "Work4"
|
62
|
+
end
|
63
|
+
|
64
|
+
def on_success status, opts
|
65
|
+
Sidekiq.logger.info "Worker 4 Success"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
class SomeClass
|
71
|
+
def on_complete(status, options)
|
72
|
+
Sidekiq.logger.info "Overall Complete #{options} #{status.data}"
|
73
|
+
end
|
74
|
+
def on_success(status, options)
|
75
|
+
Sidekiq.logger.info "Overall Success #{options} #{status.data}"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
batch = CanvasSync::JobBatches::Batch.new
|
79
|
+
batch.on(:success, SomeClass, 'uid' => 3)
|
80
|
+
batch.on(:complete, SomeClass, 'uid' => 3)
|
81
|
+
batch.jobs do
|
82
|
+
Worker1.perform_async
|
83
|
+
end
|
84
|
+
|
85
|
+
puts "Overall bid #{batch.bid}"
|
86
|
+
|
87
|
+
output, keys = process_tests
|
88
|
+
overall_tests output, keys
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'integration_helper'
|
2
|
+
|
3
|
+
# Simple nested batch without callbacks
|
4
|
+
# Batches:
|
5
|
+
# - Overall (Worker1)
|
6
|
+
# - Worker2
|
7
|
+
|
8
|
+
class Worker1
|
9
|
+
include Sidekiq::Worker
|
10
|
+
|
11
|
+
def perform
|
12
|
+
Sidekiq.logger.info "Work1"
|
13
|
+
batch = CanvasSync::JobBatches::Batch.new
|
14
|
+
batch.jobs do
|
15
|
+
Worker2.perform_async
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Worker2
|
21
|
+
include Sidekiq::Worker
|
22
|
+
|
23
|
+
def perform
|
24
|
+
Sidekiq.logger.info "Work2"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class SomeClass
|
29
|
+
def on_complete(status, options)
|
30
|
+
Sidekiq.logger.info "Overall Complete #{options} #{status.data}"
|
31
|
+
end
|
32
|
+
def on_success(status, options)
|
33
|
+
Sidekiq.logger.info "Overall Success #{options} #{status.data}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
batch = CanvasSync::JobBatches::Batch.new
|
38
|
+
batch.on(:success, SomeClass)
|
39
|
+
batch.on(:complete, SomeClass)
|
40
|
+
batch.jobs do
|
41
|
+
Worker1.perform_async
|
42
|
+
end
|
43
|
+
|
44
|
+
puts "Overall bid #{batch.bid}"
|
45
|
+
|
46
|
+
output, keys = process_tests
|
47
|
+
overall_tests output, keys
|
@@ -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
|