funktor 0.4.6 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +2 -0
- data/Gemfile.lock +24 -5
- data/funktor-testapp/.envrc +1 -0
- data/funktor-testapp/.gitignore +7 -0
- data/funktor-testapp/Gemfile +25 -0
- data/funktor-testapp/Gemfile.lock +51 -0
- data/funktor-testapp/app/services/job_flood.rb +38 -0
- data/funktor-testapp/app/workers/audit_worker.rb +49 -0
- data/funktor-testapp/app/workers/greetings_worker.rb +3 -0
- data/funktor-testapp/app/workers/hello_worker.rb +18 -0
- data/funktor-testapp/app/workers/single_thread_audit_worker.rb +3 -0
- data/funktor-testapp/deploy-dev.sh +5 -0
- data/funktor-testapp/funktor_config/boot.rb +17 -0
- data/funktor-testapp/funktor_config/environment.yml +15 -0
- data/funktor-testapp/funktor_config/function_definitions/default_queue_handler.yml +13 -0
- data/funktor-testapp/funktor_config/function_definitions/incoming_job_handler.yml +13 -0
- data/funktor-testapp/funktor_config/function_definitions/job_activator.yml +7 -0
- data/funktor-testapp/funktor_config/function_definitions/low_concurrency_queue_handler.yml +13 -0
- data/funktor-testapp/funktor_config/function_definitions/random_job_generator.yml +18 -0
- data/funktor-testapp/funktor_config/funktor.yml +114 -0
- data/funktor-testapp/funktor_config/iam_permissions/activity_table.yml +5 -0
- data/funktor-testapp/funktor_config/iam_permissions/default_queue.yml +8 -0
- data/funktor-testapp/funktor_config/iam_permissions/incoming_job_queue.yml +8 -0
- data/funktor-testapp/funktor_config/iam_permissions/jobs_table.yml +5 -0
- data/funktor-testapp/funktor_config/iam_permissions/jobs_table_secondary_index.yml +8 -0
- data/funktor-testapp/funktor_config/iam_permissions/low_concurrency_queue.yml +8 -0
- data/funktor-testapp/funktor_config/iam_permissions/ssm.yml +5 -0
- data/funktor-testapp/funktor_config/package.yml +11 -0
- data/funktor-testapp/funktor_config/resources/activity_table.yml +22 -0
- data/funktor-testapp/funktor_config/resources/cloudwatch_dashboard.yml +809 -0
- data/funktor-testapp/funktor_config/resources/default_queue.yml +22 -0
- data/funktor-testapp/funktor_config/resources/incoming_job_queue.yml +22 -0
- data/funktor-testapp/funktor_config/resources/incoming_job_queue_user.yml +26 -0
- data/funktor-testapp/funktor_config/resources/jobs_table.yml +56 -0
- data/funktor-testapp/funktor_config/resources/low_concurrency_queue.yml +22 -0
- data/funktor-testapp/funktor_config/ruby_layer.yml +11 -0
- data/funktor-testapp/funktor_init.yml +69 -0
- data/funktor-testapp/lambda_event_handlers/default_queue_handler.rb +8 -0
- data/funktor-testapp/lambda_event_handlers/incoming_job_handler.rb +8 -0
- data/funktor-testapp/lambda_event_handlers/job_activator.rb +8 -0
- data/funktor-testapp/lambda_event_handlers/low_concurrency_queue_handler.rb +8 -0
- data/funktor-testapp/lambda_event_handlers/random_job_generator.rb +35 -0
- data/funktor-testapp/package-lock.json +248 -0
- data/funktor-testapp/package.json +8 -0
- data/funktor-testapp/serverless.yml +66 -0
- data/funktor.gemspec +4 -1
- data/lib/active_job/queue_adapters/funktor_adapter.rb +3 -3
- data/lib/funktor/activity_tracker.rb +106 -0
- data/lib/funktor/cli/bootstrap.rb +0 -1
- data/lib/funktor/cli/init.rb +13 -0
- data/lib/funktor/cli/templates/app/workers/hello_worker.rb +1 -1
- data/lib/funktor/cli/templates/funktor_config/environment.yml +4 -0
- data/lib/funktor/cli/templates/funktor_config/function_definitions/incoming_job_handler.yml +3 -1
- data/lib/funktor/cli/templates/funktor_config/function_definitions/job_activator.yml +7 -0
- data/lib/funktor/cli/templates/funktor_config/function_definitions/work_queue_handler.yml +3 -1
- data/lib/funktor/cli/templates/funktor_config/funktor.yml +32 -6
- data/lib/funktor/cli/templates/funktor_config/iam_permissions/activity_table.yml +5 -0
- data/lib/funktor/cli/templates/funktor_config/iam_permissions/jobs_table.yml +5 -0
- data/lib/funktor/cli/templates/funktor_config/iam_permissions/jobs_table_secondary_index.yml +8 -0
- data/lib/funktor/cli/templates/funktor_config/resources/activity_table.yml +22 -0
- data/lib/funktor/cli/templates/funktor_config/resources/cloudwatch_dashboard.yml +13 -12
- data/lib/funktor/cli/templates/funktor_config/resources/incoming_job_queue.yml +2 -2
- data/lib/funktor/cli/templates/funktor_config/resources/jobs_table.yml +56 -0
- data/lib/funktor/cli/templates/funktor_config/resources/work_queue.yml +2 -2
- data/lib/funktor/cli/templates/funktor_init.yml.tt +16 -16
- data/lib/funktor/cli/templates/lambda_event_handlers/job_activator.rb +8 -0
- data/lib/funktor/cli/templates/lambda_event_handlers/work_queue_handler.rb +1 -1
- data/lib/funktor/cli/templates/serverless.yml +3 -2
- data/lib/funktor/counter.rb +4 -1
- data/lib/funktor/incoming_job_handler.rb +54 -18
- data/lib/funktor/job.rb +57 -7
- data/lib/funktor/job_activator.rb +124 -0
- data/lib/funktor/job_pusher.rb +0 -2
- data/lib/funktor/middleware/metrics.rb +8 -3
- data/lib/funktor/shard_utils.rb +6 -0
- data/lib/funktor/testing.rb +52 -29
- data/lib/funktor/version.rb +1 -1
- data/lib/funktor/web/application.rb +139 -0
- data/lib/funktor/web/views/index.erb +3 -0
- data/lib/funktor/web/views/layout.erb +58 -0
- data/lib/funktor/web/views/processing.erb +29 -0
- data/lib/funktor/web/views/queued.erb +29 -0
- data/lib/funktor/web/views/retries.erb +35 -0
- data/lib/funktor/web/views/scheduled.erb +26 -0
- data/lib/funktor/web/views/stats.erb +9 -0
- data/lib/funktor/web/views/table_stats_with_buttons.erb +11 -0
- data/lib/funktor/web.rb +1 -0
- data/lib/funktor/work_queue_handler.rb +101 -0
- data/lib/funktor/worker/funktor_options.rb +3 -1
- data/lib/funktor/worker.rb +8 -18
- data/lib/funktor.rb +52 -20
- metadata +109 -3
- data/lib/funktor/active_job_handler.rb +0 -58
@@ -0,0 +1,29 @@
|
|
1
|
+
<h1>Processing</h1>
|
2
|
+
<p>Showing <%= jobs.count %> of <%= @activity_stats["processing"] %></p>
|
3
|
+
<table role="grid">
|
4
|
+
<tr>
|
5
|
+
<td>ID</td>
|
6
|
+
<td>Perform at</td>
|
7
|
+
<td>Worker</td>
|
8
|
+
<td>Queue</td>
|
9
|
+
<td>Params</td>
|
10
|
+
<td>Attempts</td>
|
11
|
+
<td>Last error</td>
|
12
|
+
</tr>
|
13
|
+
<% jobs.each do |job| %>
|
14
|
+
<tr>
|
15
|
+
<td><%= job.job_id %></td>
|
16
|
+
<td><%= job.perform_at %></td>
|
17
|
+
<td><%= job.worker_class_name %></td>
|
18
|
+
<td><%= job.queue %></td>
|
19
|
+
<td><%= job.worker_params %></td>
|
20
|
+
<td><%= job.retries %></td>
|
21
|
+
<td>
|
22
|
+
<%= job.error_class %> - <%= job.error_message %>
|
23
|
+
<br/>
|
24
|
+
<%= job.error_backtrace.first %>
|
25
|
+
</td>
|
26
|
+
</tr>
|
27
|
+
<% end %>
|
28
|
+
</table>
|
29
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h1>Queued</h1>
|
2
|
+
<p>Showing <%= jobs.count %> of <%= @activity_stats["queued"] %></p>
|
3
|
+
<table role="grid">
|
4
|
+
<tr>
|
5
|
+
<td>ID</td>
|
6
|
+
<td>Perform at</td>
|
7
|
+
<td>Worker</td>
|
8
|
+
<td>Queue</td>
|
9
|
+
<td>Params</td>
|
10
|
+
<td>Attempts</td>
|
11
|
+
<td>Last error</td>
|
12
|
+
</tr>
|
13
|
+
<% jobs.each do |job| %>
|
14
|
+
<tr>
|
15
|
+
<td><%= job.job_id %></td>
|
16
|
+
<td><%= job.perform_at %></td>
|
17
|
+
<td><%= job.worker_class_name %></td>
|
18
|
+
<td><%= job.queue %></td>
|
19
|
+
<td><%= job.worker_params %></td>
|
20
|
+
<td><%= job.retries %></td>
|
21
|
+
<td>
|
22
|
+
<%= job.error_class %> - <%= job.error_message %>
|
23
|
+
<br/>
|
24
|
+
<%= job.error_backtrace.first %>
|
25
|
+
</td>
|
26
|
+
</tr>
|
27
|
+
<% end %>
|
28
|
+
</table>
|
29
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<h1>Retries</h1>
|
2
|
+
<form action="/update_jobs" method="post" accept-charset="utf-8">
|
3
|
+
<input type="hidden" name="source" value="retry" />
|
4
|
+
<%= erb :table_stats_with_buttons, locals: { jobs: jobs, stat_category: 'retries' } %>
|
5
|
+
<table role="grid">
|
6
|
+
<tr>
|
7
|
+
<td> </td>
|
8
|
+
<td>ID</td>
|
9
|
+
<td>Perform at</td>
|
10
|
+
<td>Worker</td>
|
11
|
+
<td>Queue</td>
|
12
|
+
<td>Params</td>
|
13
|
+
<td>Attempts</td>
|
14
|
+
<td>Last error</td>
|
15
|
+
</tr>
|
16
|
+
<% jobs.each do |job| %>
|
17
|
+
<tr>
|
18
|
+
<td><input type="checkbox" name="job_id[]" value="<%= job.job_id %>" id=""></td>
|
19
|
+
<td><%= job.job_id %></td>
|
20
|
+
<td><%= job.perform_at %></td>
|
21
|
+
<td><%= job.worker_class_name %></td>
|
22
|
+
<td><%= job.queue %></td>
|
23
|
+
<td><%= job.worker_params %></td>
|
24
|
+
<td><%= job.retries %></td>
|
25
|
+
<td>
|
26
|
+
<%= job.error_class %> - <%= job.error_message %>
|
27
|
+
<br/>
|
28
|
+
<%= job.error_backtrace.first %>
|
29
|
+
</td>
|
30
|
+
</tr>
|
31
|
+
<% end %>
|
32
|
+
</table>
|
33
|
+
<%= erb :table_stats_with_buttons, locals: { jobs: jobs, stat_category: 'retries' } %>
|
34
|
+
</form>
|
35
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<h1>Scheduled</h1>
|
2
|
+
<form action="/update_jobs" method="post" accept-charset="utf-8">
|
3
|
+
<input type="hidden" name="source" value="scheduled" />
|
4
|
+
<%= erb :table_stats_with_buttons, locals: { jobs: jobs, stat_category: 'scheduled' } %>
|
5
|
+
<table role="grid">
|
6
|
+
<tr>
|
7
|
+
<td> </td>
|
8
|
+
<td>ID</td>
|
9
|
+
<td>Perform at</td>
|
10
|
+
<td>Worker</td>
|
11
|
+
<td>Queue</td>
|
12
|
+
<td>Params</td>
|
13
|
+
</tr>
|
14
|
+
<% jobs.each do |job| %>
|
15
|
+
<tr>
|
16
|
+
<td><input type="checkbox" name="job_id[]" value="<%= job.job_id %>" id=""></td>
|
17
|
+
<td><%= job.job_id %></td>
|
18
|
+
<td><%= job.perform_at %></td>
|
19
|
+
<td><%= job.worker_class_name %></td>
|
20
|
+
<td><%= job.queue %></td>
|
21
|
+
<td><%= job.worker_params %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</table>
|
25
|
+
<%= erb :table_stats_with_buttons, locals: { jobs: jobs, stat_category: 'scheduled' } %>
|
26
|
+
</form>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="grid">
|
2
|
+
<div>
|
3
|
+
Showing <%= jobs.count %> of <%= @activity_stats[stat_category] %>
|
4
|
+
</div>
|
5
|
+
<div>
|
6
|
+
<input type="submit" name="submit" value="Delete Selected Jobs" />
|
7
|
+
</div>
|
8
|
+
<div>
|
9
|
+
<input type="submit" name="submit" value="Queue Selected Jobs" />
|
10
|
+
</div>
|
11
|
+
</div>
|
data/lib/funktor/web.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
include 'funktor/web/application'
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'aws-sdk-sqs'
|
2
|
+
require 'aws-sdk-dynamodb'
|
3
|
+
|
4
|
+
module Funktor
|
5
|
+
class WorkQueueHandler
|
6
|
+
include Funktor::ErrorHandler
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@failed_counter = Funktor::Counter.new('failed')
|
10
|
+
@processed_counter = Funktor::Counter.new('processed')
|
11
|
+
@tracker = Funktor::ActivityTracker.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(event:, context:)
|
15
|
+
event = Funktor::Aws::Sqs::Event.new(event)
|
16
|
+
Funktor.logger.debug "event.jobs.count = #{event.jobs.count}"
|
17
|
+
event.jobs.each do |job|
|
18
|
+
dispatch(job)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def dynamodb_client
|
23
|
+
@dynamodb_client ||= ::Aws::DynamoDB::Client.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def sqs_client
|
27
|
+
@sqs_client ||= ::Aws::SQS::Client.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def dispatch(job)
|
31
|
+
begin
|
32
|
+
@tracker.track(:processingStarted, job)
|
33
|
+
update_job_category(job, "processing")
|
34
|
+
Funktor.work_queue_handler_middleware.invoke(job) do
|
35
|
+
job.execute
|
36
|
+
end
|
37
|
+
@processed_counter.incr(job)
|
38
|
+
@tracker.track(:processingComplete, job)
|
39
|
+
delete_job_from_dynamodb(job)
|
40
|
+
# rescue Funktor::Job::InvalidJsonError # TODO Make this work
|
41
|
+
rescue Exception => e
|
42
|
+
handle_error(e, job)
|
43
|
+
@failed_counter.incr(job)
|
44
|
+
job.error = e
|
45
|
+
if job.can_retry
|
46
|
+
@tracker.track(:retrying, job)
|
47
|
+
update_job_category(job, "retry")
|
48
|
+
trigger_retry(job)
|
49
|
+
else
|
50
|
+
@tracker.track(:bailingOut, job)
|
51
|
+
update_job_category(job, "dead")
|
52
|
+
Funktor.logger.error "We retried max times. We're bailing on this one."
|
53
|
+
Funktor.logger.error job.to_json
|
54
|
+
end
|
55
|
+
@tracker.track(:processingFailed, job)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def trigger_retry(job)
|
60
|
+
job.increment_retries
|
61
|
+
Funktor.logger.error "scheduling retry # #{job.retries} with delay of #{job.delay}"
|
62
|
+
Funktor.logger.error job.to_json
|
63
|
+
sqs_client.send_message({
|
64
|
+
queue_url: job.retry_queue_url,
|
65
|
+
message_body: job.to_json
|
66
|
+
})
|
67
|
+
end
|
68
|
+
|
69
|
+
def delayed_job_table
|
70
|
+
ENV['FUNKTOR_JOBS_TABLE']
|
71
|
+
end
|
72
|
+
|
73
|
+
def update_job_category(job, category)
|
74
|
+
dynamodb_client.update_item({
|
75
|
+
key: {
|
76
|
+
"jobShard" => job.shard,
|
77
|
+
"jobId" => job.job_id
|
78
|
+
},
|
79
|
+
table_name: delayed_job_table,
|
80
|
+
update_expression: "SET category = :category, queueable = :queueable",
|
81
|
+
expression_attribute_values: {
|
82
|
+
":queueable" => "false",
|
83
|
+
":category" => category
|
84
|
+
},
|
85
|
+
return_values: "ALL_OLD"
|
86
|
+
})
|
87
|
+
end
|
88
|
+
|
89
|
+
def delete_job_from_dynamodb(job)
|
90
|
+
dynamodb_client.delete_item({
|
91
|
+
key: {
|
92
|
+
"jobShard" => job.shard,
|
93
|
+
"jobId" => job.job_id
|
94
|
+
},
|
95
|
+
table_name: delayed_job_table,
|
96
|
+
return_values: "ALL_OLD"
|
97
|
+
})
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'active_support/core_ext/class/attribute'
|
2
|
+
|
1
3
|
module Funktor
|
2
4
|
module Worker
|
3
5
|
module FunktorOptions
|
4
6
|
def self.included(base)
|
5
7
|
base.extend ClassMethods
|
6
8
|
base.class_eval do
|
7
|
-
|
9
|
+
class_attribute :funktor_options_hash
|
8
10
|
end
|
9
11
|
end
|
10
12
|
module ClassMethods
|
data/lib/funktor/worker.rb
CHANGED
@@ -18,37 +18,27 @@ module Funktor::Worker
|
|
18
18
|
self.perform_in(0, *worker_params)
|
19
19
|
end
|
20
20
|
|
21
|
-
def perform_at(
|
22
|
-
|
23
|
-
if delay < 0
|
24
|
-
delay = 0
|
25
|
-
end
|
26
|
-
self.perform_in(delay, *worker_params)
|
21
|
+
def perform_at(job_time, *worker_params)
|
22
|
+
self.push(job_time, *worker_params)
|
27
23
|
end
|
28
24
|
|
29
25
|
def perform_in(delay, *worker_params)
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
self.push(delay, *worker_params)
|
26
|
+
job_time = Time.now.utc + delay
|
27
|
+
self.perform_at(job_time, *worker_params)
|
34
28
|
end
|
35
29
|
|
36
|
-
def push(
|
37
|
-
payload = build_job_payload(
|
30
|
+
def push(job_time, *worker_params)
|
31
|
+
payload = build_job_payload(job_time, *worker_params)
|
38
32
|
Funktor.job_pusher.push(payload)
|
39
33
|
end
|
40
34
|
|
41
|
-
def
|
42
|
-
900
|
43
|
-
end
|
44
|
-
|
45
|
-
def build_job_payload(delay, *worker_params)
|
35
|
+
def build_job_payload(job_time, *worker_params)
|
46
36
|
{
|
47
37
|
worker: self.name,
|
48
38
|
worker_params: worker_params,
|
49
39
|
queue: self.work_queue,
|
50
40
|
incoming_job_queue_url: self.queue_url,
|
51
|
-
|
41
|
+
perform_at: job_time.utc,
|
52
42
|
funktor_options: get_funktor_options
|
53
43
|
}
|
54
44
|
end
|
data/lib/funktor.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
require_relative "funktor/version"
|
2
|
+
require_relative 'funktor/aws/sqs/event'
|
3
|
+
require_relative 'funktor/aws/sqs/record'
|
4
|
+
require_relative 'funktor/counter'
|
5
|
+
require_relative 'funktor/job'
|
6
|
+
require_relative 'funktor/job_pusher'
|
7
|
+
require_relative 'funktor/logger'
|
8
|
+
require_relative 'funktor/worker'
|
9
|
+
require_relative 'funktor/middleware_chain'
|
10
|
+
require_relative 'funktor/incoming_job_handler'
|
11
|
+
require_relative 'funktor/job_activator'
|
12
|
+
require_relative 'funktor/activity_tracker'
|
11
13
|
|
12
14
|
require 'json'
|
13
15
|
|
@@ -33,14 +35,14 @@ module Funktor
|
|
33
35
|
@job_pusher_chain
|
34
36
|
end
|
35
37
|
|
36
|
-
def self.
|
38
|
+
def self.configure_work_queue_handler
|
37
39
|
yield self
|
38
40
|
end
|
39
41
|
|
40
|
-
def self.
|
41
|
-
@
|
42
|
-
yield @
|
43
|
-
@
|
42
|
+
def self.work_queue_handler_middleware
|
43
|
+
@work_queue_handler_chain ||= MiddlewareChain.new
|
44
|
+
yield @work_queue_handler_chain if block_given?
|
45
|
+
@work_queue_handler_chain
|
44
46
|
end
|
45
47
|
|
46
48
|
# TODO - Maybe we don't need this either? Maybe this should be a super dumb thing that also
|
@@ -58,6 +60,18 @@ module Funktor
|
|
58
60
|
@incoming_job_handler_chain
|
59
61
|
end
|
60
62
|
|
63
|
+
# TODO - Does this actually make any sense? Should the JobActivator even know about
|
64
|
+
# jobs/classes? Maybe it should be super dumb and just push JSON blobs around?
|
65
|
+
def self.configure_job_activator
|
66
|
+
yield self
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.job_activator_middleware
|
70
|
+
@job_activator_chain ||= MiddlewareChain.new
|
71
|
+
yield @job_activator_chain if block_given?
|
72
|
+
@job_activator_chain
|
73
|
+
end
|
74
|
+
|
61
75
|
def self.parse_json(string)
|
62
76
|
JSON.parse(string)
|
63
77
|
end
|
@@ -95,13 +109,31 @@ module Funktor
|
|
95
109
|
|
96
110
|
@logger = logger
|
97
111
|
end
|
112
|
+
|
113
|
+
# We have a raw_logger that doesn't add timestamps and what not. This is used to publish
|
114
|
+
# CloudWatch metrics that can be used in dashboards.
|
115
|
+
def self.raw_logger
|
116
|
+
@raw_logger ||= Funktor::Logger.new($stdout, level: options[:log_level], formatter: proc {|severity, datetime, progname, msg|
|
117
|
+
"#{msg}\n"
|
118
|
+
})
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.raw_logger=(raw_logger)
|
122
|
+
if raw_logger.nil?
|
123
|
+
self.raw_logger.level = Logger::FATAL
|
124
|
+
return self.raw_logger
|
125
|
+
end
|
126
|
+
|
127
|
+
@raw_logger = raw_logger
|
128
|
+
end
|
98
129
|
end
|
99
130
|
|
100
|
-
# TODO - Should we require this by default or let people opt in?
|
101
131
|
# TODO - Is it a code smell that we need to include these at the bottom, after
|
102
132
|
# the main Funktor module is defined?
|
103
|
-
|
104
|
-
require
|
105
|
-
|
133
|
+
#
|
134
|
+
# TODO - Should we require metrics by default or let people opt in?
|
135
|
+
require_relative 'funktor/middleware/metrics'
|
136
|
+
require_relative 'funktor/error_handler'
|
137
|
+
require_relative 'funktor/work_queue_handler'
|
106
138
|
|
107
|
-
|
139
|
+
require_relative 'funktor/rails' if defined?(::Rails::Engine)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: funktor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Green
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-sqs
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.37'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aws-sdk-dynamodb
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.62'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.62'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: activesupport
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,34 @@ dependencies:
|
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: sinatra
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: timecop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
111
153
|
description: Background processing in AWS Lambda.
|
112
154
|
email:
|
113
155
|
- jeremy@octolabs.com
|
@@ -120,6 +162,7 @@ files:
|
|
120
162
|
- ".github/workflows/ruby.yml"
|
121
163
|
- ".gitignore"
|
122
164
|
- ".rspec"
|
165
|
+
- ".tool-versions"
|
123
166
|
- ".travis.yml"
|
124
167
|
- CODE_OF_CONDUCT.md
|
125
168
|
- Gemfile
|
@@ -131,10 +174,53 @@ files:
|
|
131
174
|
- bin/setup
|
132
175
|
- exe/funktor
|
133
176
|
- exe/funktor-deploy
|
177
|
+
- funktor-testapp/.envrc
|
178
|
+
- funktor-testapp/.gitignore
|
179
|
+
- funktor-testapp/Gemfile
|
180
|
+
- funktor-testapp/Gemfile.lock
|
181
|
+
- funktor-testapp/app/services/job_flood.rb
|
182
|
+
- funktor-testapp/app/workers/audit_worker.rb
|
183
|
+
- funktor-testapp/app/workers/greetings_worker.rb
|
184
|
+
- funktor-testapp/app/workers/hello_worker.rb
|
185
|
+
- funktor-testapp/app/workers/single_thread_audit_worker.rb
|
186
|
+
- funktor-testapp/deploy-dev.sh
|
187
|
+
- funktor-testapp/funktor_config/boot.rb
|
188
|
+
- funktor-testapp/funktor_config/environment.yml
|
189
|
+
- funktor-testapp/funktor_config/function_definitions/default_queue_handler.yml
|
190
|
+
- funktor-testapp/funktor_config/function_definitions/incoming_job_handler.yml
|
191
|
+
- funktor-testapp/funktor_config/function_definitions/job_activator.yml
|
192
|
+
- funktor-testapp/funktor_config/function_definitions/low_concurrency_queue_handler.yml
|
193
|
+
- funktor-testapp/funktor_config/function_definitions/random_job_generator.yml
|
194
|
+
- funktor-testapp/funktor_config/funktor.yml
|
195
|
+
- funktor-testapp/funktor_config/iam_permissions/activity_table.yml
|
196
|
+
- funktor-testapp/funktor_config/iam_permissions/default_queue.yml
|
197
|
+
- funktor-testapp/funktor_config/iam_permissions/incoming_job_queue.yml
|
198
|
+
- funktor-testapp/funktor_config/iam_permissions/jobs_table.yml
|
199
|
+
- funktor-testapp/funktor_config/iam_permissions/jobs_table_secondary_index.yml
|
200
|
+
- funktor-testapp/funktor_config/iam_permissions/low_concurrency_queue.yml
|
201
|
+
- funktor-testapp/funktor_config/iam_permissions/ssm.yml
|
202
|
+
- funktor-testapp/funktor_config/package.yml
|
203
|
+
- funktor-testapp/funktor_config/resources/activity_table.yml
|
204
|
+
- funktor-testapp/funktor_config/resources/cloudwatch_dashboard.yml
|
205
|
+
- funktor-testapp/funktor_config/resources/default_queue.yml
|
206
|
+
- funktor-testapp/funktor_config/resources/incoming_job_queue.yml
|
207
|
+
- funktor-testapp/funktor_config/resources/incoming_job_queue_user.yml
|
208
|
+
- funktor-testapp/funktor_config/resources/jobs_table.yml
|
209
|
+
- funktor-testapp/funktor_config/resources/low_concurrency_queue.yml
|
210
|
+
- funktor-testapp/funktor_config/ruby_layer.yml
|
211
|
+
- funktor-testapp/funktor_init.yml
|
212
|
+
- funktor-testapp/lambda_event_handlers/default_queue_handler.rb
|
213
|
+
- funktor-testapp/lambda_event_handlers/incoming_job_handler.rb
|
214
|
+
- funktor-testapp/lambda_event_handlers/job_activator.rb
|
215
|
+
- funktor-testapp/lambda_event_handlers/low_concurrency_queue_handler.rb
|
216
|
+
- funktor-testapp/lambda_event_handlers/random_job_generator.rb
|
217
|
+
- funktor-testapp/package-lock.json
|
218
|
+
- funktor-testapp/package.json
|
219
|
+
- funktor-testapp/serverless.yml
|
134
220
|
- funktor.gemspec
|
135
221
|
- lib/active_job/queue_adapters/funktor_adapter.rb
|
136
222
|
- lib/funktor.rb
|
137
|
-
- lib/funktor/
|
223
|
+
- lib/funktor/activity_tracker.rb
|
138
224
|
- lib/funktor/aws/sqs/event.rb
|
139
225
|
- lib/funktor/aws/sqs/record.rb
|
140
226
|
- lib/funktor/cli/application.rb
|
@@ -148,20 +234,27 @@ files:
|
|
148
234
|
- lib/funktor/cli/templates/funktor_config/boot.rb
|
149
235
|
- lib/funktor/cli/templates/funktor_config/environment.yml
|
150
236
|
- lib/funktor/cli/templates/funktor_config/function_definitions/incoming_job_handler.yml
|
237
|
+
- lib/funktor/cli/templates/funktor_config/function_definitions/job_activator.yml
|
151
238
|
- lib/funktor/cli/templates/funktor_config/function_definitions/work_queue_handler.yml
|
152
239
|
- lib/funktor/cli/templates/funktor_config/funktor.yml
|
240
|
+
- lib/funktor/cli/templates/funktor_config/iam_permissions/activity_table.yml
|
153
241
|
- lib/funktor/cli/templates/funktor_config/iam_permissions/incoming_job_queue.yml
|
242
|
+
- lib/funktor/cli/templates/funktor_config/iam_permissions/jobs_table.yml
|
243
|
+
- lib/funktor/cli/templates/funktor_config/iam_permissions/jobs_table_secondary_index.yml
|
154
244
|
- lib/funktor/cli/templates/funktor_config/iam_permissions/ssm.yml
|
155
245
|
- lib/funktor/cli/templates/funktor_config/iam_permissions/work_queue.yml
|
156
246
|
- lib/funktor/cli/templates/funktor_config/package.yml
|
247
|
+
- lib/funktor/cli/templates/funktor_config/resources/activity_table.yml
|
157
248
|
- lib/funktor/cli/templates/funktor_config/resources/cloudwatch_dashboard.yml
|
158
249
|
- lib/funktor/cli/templates/funktor_config/resources/incoming_job_queue.yml
|
159
250
|
- lib/funktor/cli/templates/funktor_config/resources/incoming_job_queue_user.yml
|
251
|
+
- lib/funktor/cli/templates/funktor_config/resources/jobs_table.yml
|
160
252
|
- lib/funktor/cli/templates/funktor_config/resources/work_queue.yml
|
161
253
|
- lib/funktor/cli/templates/funktor_config/ruby_layer.yml
|
162
254
|
- lib/funktor/cli/templates/funktor_init.yml.tt
|
163
255
|
- lib/funktor/cli/templates/gitignore
|
164
256
|
- lib/funktor/cli/templates/lambda_event_handlers/incoming_job_handler.rb
|
257
|
+
- lib/funktor/cli/templates/lambda_event_handlers/job_activator.rb
|
165
258
|
- lib/funktor/cli/templates/lambda_event_handlers/work_queue_handler.rb
|
166
259
|
- lib/funktor/cli/templates/package.json
|
167
260
|
- lib/funktor/cli/templates/serverless.yml
|
@@ -170,13 +263,26 @@ files:
|
|
170
263
|
- lib/funktor/fake_job_queue.rb
|
171
264
|
- lib/funktor/incoming_job_handler.rb
|
172
265
|
- lib/funktor/job.rb
|
266
|
+
- lib/funktor/job_activator.rb
|
173
267
|
- lib/funktor/job_pusher.rb
|
174
268
|
- lib/funktor/logger.rb
|
175
269
|
- lib/funktor/middleware/metrics.rb
|
176
270
|
- lib/funktor/middleware_chain.rb
|
177
271
|
- lib/funktor/rails.rb
|
272
|
+
- lib/funktor/shard_utils.rb
|
178
273
|
- lib/funktor/testing.rb
|
179
274
|
- lib/funktor/version.rb
|
275
|
+
- lib/funktor/web.rb
|
276
|
+
- lib/funktor/web/application.rb
|
277
|
+
- lib/funktor/web/views/index.erb
|
278
|
+
- lib/funktor/web/views/layout.erb
|
279
|
+
- lib/funktor/web/views/processing.erb
|
280
|
+
- lib/funktor/web/views/queued.erb
|
281
|
+
- lib/funktor/web/views/retries.erb
|
282
|
+
- lib/funktor/web/views/scheduled.erb
|
283
|
+
- lib/funktor/web/views/stats.erb
|
284
|
+
- lib/funktor/web/views/table_stats_with_buttons.erb
|
285
|
+
- lib/funktor/work_queue_handler.rb
|
180
286
|
- lib/funktor/worker.rb
|
181
287
|
- lib/funktor/worker/funktor_options.rb
|
182
288
|
homepage: https://github.com/Octo-Labs/funktor
|