funktor 0.4.7 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.tool-versions +2 -0
  3. data/Gemfile.lock +7 -3
  4. data/funktor-testapp/.envrc +1 -0
  5. data/funktor-testapp/.gitignore +7 -0
  6. data/funktor-testapp/Gemfile +25 -0
  7. data/funktor-testapp/Gemfile.lock +51 -0
  8. data/funktor-testapp/app/services/job_flood.rb +38 -0
  9. data/funktor-testapp/app/workers/audit_worker.rb +49 -0
  10. data/funktor-testapp/app/workers/greetings_worker.rb +3 -0
  11. data/funktor-testapp/app/workers/hello_worker.rb +18 -0
  12. data/funktor-testapp/deploy-dev.sh +5 -0
  13. data/funktor-testapp/funktor_config/boot.rb +17 -0
  14. data/funktor-testapp/funktor_config/environment.yml +15 -0
  15. data/funktor-testapp/funktor_config/function_definitions/default_queue_handler.yml +11 -0
  16. data/funktor-testapp/funktor_config/function_definitions/incoming_job_handler.yml +11 -0
  17. data/funktor-testapp/funktor_config/function_definitions/job_activator.yml +8 -0
  18. data/funktor-testapp/funktor_config/function_definitions/random_job_generator.yml +18 -0
  19. data/funktor-testapp/funktor_config/function_definitions/single_thread_queue_handler.yml +11 -0
  20. data/funktor-testapp/funktor_config/funktor.yml +114 -0
  21. data/funktor-testapp/funktor_config/iam_permissions/activity_table.yml +5 -0
  22. data/funktor-testapp/funktor_config/iam_permissions/default_queue.yml +8 -0
  23. data/funktor-testapp/funktor_config/iam_permissions/incoming_job_queue.yml +8 -0
  24. data/funktor-testapp/funktor_config/iam_permissions/jobs_table.yml +5 -0
  25. data/funktor-testapp/funktor_config/iam_permissions/jobs_table_secondary_index.yml +8 -0
  26. data/funktor-testapp/funktor_config/iam_permissions/single_thread_queue.yml +8 -0
  27. data/funktor-testapp/funktor_config/iam_permissions/ssm.yml +5 -0
  28. data/funktor-testapp/funktor_config/package.yml +11 -0
  29. data/funktor-testapp/funktor_config/resources/activity_table.yml +22 -0
  30. data/funktor-testapp/funktor_config/resources/cloudwatch_dashboard.yml +804 -0
  31. data/funktor-testapp/funktor_config/resources/default_queue.yml +22 -0
  32. data/funktor-testapp/funktor_config/resources/incoming_job_queue.yml +22 -0
  33. data/funktor-testapp/funktor_config/resources/incoming_job_queue_user.yml +26 -0
  34. data/funktor-testapp/funktor_config/resources/jobs_table.yml +44 -0
  35. data/funktor-testapp/funktor_config/resources/single_thread_queue.yml +22 -0
  36. data/funktor-testapp/funktor_config/ruby_layer.yml +11 -0
  37. data/funktor-testapp/funktor_init.yml +61 -0
  38. data/funktor-testapp/lambda_event_handlers/default_queue_handler.rb +8 -0
  39. data/funktor-testapp/lambda_event_handlers/incoming_job_handler.rb +8 -0
  40. data/funktor-testapp/lambda_event_handlers/job_activator.rb +8 -0
  41. data/funktor-testapp/lambda_event_handlers/random_job_generator.rb +35 -0
  42. data/funktor-testapp/lambda_event_handlers/single_thread_queue_handler.rb +8 -0
  43. data/funktor-testapp/package-lock.json +248 -0
  44. data/funktor-testapp/package.json +8 -0
  45. data/funktor-testapp/serverless.yml +65 -0
  46. data/funktor.gemspec +1 -0
  47. data/lib/active_job/queue_adapters/funktor_adapter.rb +3 -3
  48. data/lib/funktor.rb +39 -7
  49. data/lib/funktor/activity_tracker.rb +102 -0
  50. data/lib/funktor/cli/bootstrap.rb +0 -1
  51. data/lib/funktor/cli/init.rb +13 -0
  52. data/lib/funktor/cli/templates/app/workers/hello_worker.rb +1 -1
  53. data/lib/funktor/cli/templates/funktor_config/environment.yml +4 -0
  54. data/lib/funktor/cli/templates/funktor_config/function_definitions/job_activator.yml +8 -0
  55. data/lib/funktor/cli/templates/funktor_config/funktor.yml +28 -2
  56. data/lib/funktor/cli/templates/funktor_config/iam_permissions/activity_table.yml +5 -0
  57. data/lib/funktor/cli/templates/funktor_config/iam_permissions/jobs_table.yml +5 -0
  58. data/lib/funktor/cli/templates/funktor_config/iam_permissions/jobs_table_secondary_index.yml +8 -0
  59. data/lib/funktor/cli/templates/funktor_config/resources/activity_table.yml +22 -0
  60. data/lib/funktor/cli/templates/funktor_config/resources/cloudwatch_dashboard.yml +10 -10
  61. data/lib/funktor/cli/templates/funktor_config/resources/jobs_table.yml +44 -0
  62. data/lib/funktor/cli/templates/funktor_init.yml.tt +2 -8
  63. data/lib/funktor/cli/templates/lambda_event_handlers/job_activator.rb +8 -0
  64. data/lib/funktor/cli/templates/lambda_event_handlers/work_queue_handler.rb +1 -1
  65. data/lib/funktor/cli/templates/serverless.yml +2 -2
  66. data/lib/funktor/counter.rb +4 -1
  67. data/lib/funktor/incoming_job_handler.rb +52 -12
  68. data/lib/funktor/job.rb +10 -5
  69. data/lib/funktor/job_activator.rb +98 -0
  70. data/lib/funktor/job_pusher.rb +0 -2
  71. data/lib/funktor/middleware/metrics.rb +8 -3
  72. data/lib/funktor/testing.rb +49 -47
  73. data/lib/funktor/version.rb +1 -1
  74. data/lib/funktor/{active_job_handler.rb → work_queue_handler.rb} +17 -15
  75. data/lib/funktor/worker.rb +0 -7
  76. metadata +69 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d94ef31a3eeefcc0da81890f83168ab12d427ed53144bb7b65af723b5b2a39f
4
- data.tar.gz: bf7e0c0d492a5561ac7d90b429d594c64d3b6fdadde4abc75b5d937e60561b12
3
+ metadata.gz: 6216b831ca8e28aa8d17cb86295d740bf63e95df6ce36ec966f435b6df7f427c
4
+ data.tar.gz: 7ade52e2f087fce2b5f61461bcbec625f7a72a82557500e3c2efb98606deadb7
5
5
  SHA512:
6
- metadata.gz: 19dc49ea92ff06d03126e50fd2a871fe09b7e2552a8757391b761758772373bd2d99568928f6d967011185a12ba35ecb39d6f8275976fc1cc3c38258f157f4e9
7
- data.tar.gz: d7eaf3c888e0a6741999199f56b2203ca3a35f539efab69852c83ef80f69adf46f6efdffe2fb1ce9342e3d09cb57c0732a68ba84376027bd71b5fec89e9e7b19
6
+ metadata.gz: 6a9b429d66bbf60a0bd64a040616eb7743b861466646550f98151dc99320ed882233e131a82d21badcacfc2f7916b05c5b6c52168bb8899c8c81823289b24ab3
7
+ data.tar.gz: c594578835a62eda89537a42c55021badcdb1a5e240abb1a493d36dea7e3aed5e4a3cf7126afd2aef75bcae17c7619c0e404268488308c6f5e1974d2e2ffc322
data/.tool-versions ADDED
@@ -0,0 +1,2 @@
1
+ ruby 2.7.3
2
+ nodejs 14.16.1
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- funktor (0.4.7)
4
+ funktor (0.5.0)
5
5
  activesupport
6
+ aws-sdk-dynamodb (~> 1.62)
6
7
  aws-sdk-sqs (~> 1.37)
7
8
  thor
8
9
 
@@ -18,15 +19,18 @@ GEM
18
19
  minitest (>= 5.1)
19
20
  tzinfo (~> 2.0)
20
21
  zeitwerk (~> 2.3)
21
- addressable (2.7.0)
22
+ addressable (2.8.0)
22
23
  public_suffix (>= 2.0.2, < 5.0)
23
24
  aws-eventstream (1.1.1)
24
- aws-partitions (1.482.0)
25
+ aws-partitions (1.487.0)
25
26
  aws-sdk-core (3.119.0)
26
27
  aws-eventstream (~> 1, >= 1.0.2)
27
28
  aws-partitions (~> 1, >= 1.239.0)
28
29
  aws-sigv4 (~> 1.1)
29
30
  jmespath (~> 1.0)
31
+ aws-sdk-dynamodb (1.62.0)
32
+ aws-sdk-core (~> 3, >= 3.119.0)
33
+ aws-sigv4 (~> 1.1)
30
34
  aws-sdk-sqs (1.42.0)
31
35
  aws-sdk-core (~> 3, >= 3.119.0)
32
36
  aws-sigv4 (~> 1.1)
@@ -0,0 +1 @@
1
+ dotenv
@@ -0,0 +1,7 @@
1
+ .env
2
+ .serverless
3
+ node_modules
4
+
5
+ # This is our copy of the development stuff
6
+ funktor
7
+
@@ -0,0 +1,25 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby '~> 2.7'
5
+
6
+ # We use the 1.0 branch for it's circular dependency resolution,
7
+ # just because it's easy, and the classes in this project don't do
8
+ # anything fancy that would cause problems for it.
9
+ gem 'require_all', '~> 1.0'
10
+
11
+
12
+ # We're not using funktor as a regular gem because this is an app for testing funktor
13
+ # during development.
14
+ #
15
+ # gem 'funktor'
16
+ #
17
+ # Instead we're going to recreate the dependencies here so that we can use a local copy
18
+ # of the gem directly. TODO - Figure out if we can have this happen automatically so we
19
+ # don't have to keep things in sync.
20
+
21
+ gem 'aws-sdk-sqs', '~> 1.37'
22
+ gem 'aws-sdk-dynamodb', '~> 1.62'
23
+ gem "activesupport"
24
+ gem "thor" # Thor drives the CLI TODO - Maybe we don't need it here?
25
+
@@ -0,0 +1,51 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (6.1.4)
5
+ concurrent-ruby (~> 1.0, >= 1.0.2)
6
+ i18n (>= 1.6, < 2)
7
+ minitest (>= 5.1)
8
+ tzinfo (~> 2.0)
9
+ zeitwerk (~> 2.3)
10
+ aws-eventstream (1.1.1)
11
+ aws-partitions (1.483.0)
12
+ aws-sdk-core (3.119.0)
13
+ aws-eventstream (~> 1, >= 1.0.2)
14
+ aws-partitions (~> 1, >= 1.239.0)
15
+ aws-sigv4 (~> 1.1)
16
+ jmespath (~> 1.0)
17
+ aws-sdk-dynamodb (1.62.0)
18
+ aws-sdk-core (~> 3, >= 3.119.0)
19
+ aws-sigv4 (~> 1.1)
20
+ aws-sdk-sqs (1.42.0)
21
+ aws-sdk-core (~> 3, >= 3.119.0)
22
+ aws-sigv4 (~> 1.1)
23
+ aws-sigv4 (1.2.4)
24
+ aws-eventstream (~> 1, >= 1.0.2)
25
+ concurrent-ruby (1.1.9)
26
+ i18n (1.8.10)
27
+ concurrent-ruby (~> 1.0)
28
+ jmespath (1.4.0)
29
+ minitest (5.14.4)
30
+ require_all (1.5.0)
31
+ thor (1.1.0)
32
+ tzinfo (2.0.4)
33
+ concurrent-ruby (~> 1.0)
34
+ zeitwerk (2.4.2)
35
+
36
+ PLATFORMS
37
+ x86_64-darwin-20
38
+ x86_64-linux
39
+
40
+ DEPENDENCIES
41
+ activesupport
42
+ aws-sdk-dynamodb (~> 1.62)
43
+ aws-sdk-sqs (~> 1.37)
44
+ require_all (~> 1.0)
45
+ thor
46
+
47
+ RUBY VERSION
48
+ ruby 2.7.3p183
49
+
50
+ BUNDLED WITH
51
+ 2.2.25
@@ -0,0 +1,38 @@
1
+ class JobFlood
2
+ attr_accessor :length_in_minutes
3
+ attr_accessor :min_jobs_per_minute
4
+ attr_accessor :max_jobs_per_minute
5
+ attr_accessor :max_job_length_in_seconds
6
+ attr_accessor :error_percentage
7
+ attr_accessor :error_percentage
8
+
9
+ def initialize length_in_minutes: 5, min_jobs_per_minute: 30, max_jobs_per_minute: 120, max_job_length_in_seconds: 3, error_percentage: 25
10
+ @length_in_minutes = length_in_minutes
11
+ @min_jobs_per_minute = min_jobs_per_minute
12
+ @max_jobs_per_minute = max_jobs_per_minute
13
+ @max_job_length_in_seconds = max_job_length_in_seconds
14
+ @error_percentage = error_percentage
15
+ end
16
+
17
+ def flood
18
+ total_jobs = 0
19
+ length_in_minutes.times do |minute|
20
+ jobs_to_generate = rand(min_jobs_per_minute..max_jobs_per_minute)
21
+ jobs_to_generate.times do
22
+ total_jobs += 1
23
+ job_target_time = Time.now + (minute * 60) + rand(60)
24
+ job_sleep = rand(0.0..max_job_length_in_seconds.to_f)
25
+ puts job_target_time
26
+ AuditWorker.perform_at(job_target_time, {
27
+ mode: 'later',
28
+ message: 'msg: from random JobFlood - ' + SecureRandom.hex,
29
+ target_time: job_target_time,
30
+ error_percentage: error_percentage,
31
+ job_sleep: job_sleep
32
+ })
33
+ end
34
+ end
35
+ puts "generated #{total_jobs} jobs over the next #{length_in_minutes} minutes"
36
+ end
37
+
38
+ end
@@ -0,0 +1,49 @@
1
+ class AuditWorker
2
+ include Funktor::Worker
3
+
4
+ def perform(arg_hash)
5
+ time_now = Time.now
6
+ target_time = Time.parse arg_hash['target_time']
7
+ time_diff = time_now - target_time
8
+ Funktor.raw_logger.unknown Funktor.dump_json(metric_hash(time_diff))
9
+
10
+ puts "Greetings from the #{self.class.name}! Time diff = #{time_diff}"
11
+ puts arg_hash.class.name
12
+ puts arg_hash
13
+
14
+ if arg_hash["error_percentage"] && rand(100) < arg_hash["error_percentage"].to_i
15
+ raise "Oops, we encountered a 'random error'"
16
+ end
17
+ if arg_hash["job_sleep"]
18
+ puts "Working (sleeping) for #{arg_hash["job_sleep"]} seconds"
19
+ sleep arg_hash["job_sleep"]
20
+ end
21
+ puts "So long from the #{self.class.name}, and thanks for all the fish!"
22
+ end
23
+
24
+ def metric_hash(time_diff)
25
+ {
26
+ "_aws": {
27
+ "Timestamp": Time.now.strftime('%s%3N').to_i,
28
+ "CloudWatchMetrics": [
29
+ {
30
+ "Namespace": ENV['FUNKTOR_APP_NAME'],
31
+ "Dimensions": [["WorkerClassName"]],
32
+ "Metrics": [ # CPU, Memory, Duration, etc...
33
+ {
34
+ "Name": "TimeDiff",
35
+ "Unit": "Seconds"
36
+ }
37
+ ]
38
+ }
39
+ ]
40
+ },
41
+ "WorkerClassName": self.class.name,
42
+ "TimeDiff": time_diff
43
+ #"count": value,
44
+ #"requestId": "989ffbf8-9ace-4817-a57c-e4dd734019ee"
45
+ }
46
+ #data[key] = value
47
+ end
48
+ end
49
+
@@ -0,0 +1,3 @@
1
+ class GreetingsWorker < HelloWorker
2
+
3
+ end
@@ -0,0 +1,18 @@
1
+ class HelloWorker
2
+ include Funktor::Worker
3
+
4
+ def perform(arg_hash)
5
+ puts "Greetings from the #{self.class.name}!"
6
+ puts arg_hash.class.name
7
+ puts arg_hash
8
+ if arg_hash["error_percentage"] && rand(100) < arg_hash["error_percentage"].to_i
9
+ raise "Oops, we encountered a 'random error'"
10
+ end
11
+ if arg_hash["job_sleep"]
12
+ puts "Working (sleeping) for #{arg_hash["job_sleep"]} seconds"
13
+ sleep arg_hash["job_sleep"]
14
+ end
15
+ puts "So long from the #{self.class.name}, and thanks for all the fish!"
16
+ end
17
+ end
18
+
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ cp -r ../lib ./funktor
4
+
5
+ serverless deploy --stage dev -v
@@ -0,0 +1,17 @@
1
+ # Point at our Gemfile
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
+
4
+ # load rubygems & bundler
5
+ require "rubygems"
6
+ require 'bundler/setup'
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ Bundler.require(:default, :production)
10
+
11
+ # Here we load our development copy of funktor that we copy in using deploy-dev.sh
12
+ $LOAD_PATH.unshift 'funktor/lib'
13
+ require 'funktor'
14
+
15
+ # Load all ruby files in the app directory
16
+ require_rel File.join('..', 'app')
17
+
@@ -0,0 +1,15 @@
1
+ BUNDLE_WITHOUT: development:test:assets
2
+ BUNDLE_PLUGINS: false
3
+ BUNDLE_FROZEN: true
4
+ SERVERLESS_STAGE: ${self:custom.stage}
5
+ FUNKTOR_APP_NAME: funktor-testapp
6
+ FUNKTOR_INCOMING_JOB_QUEUE:
7
+ Ref: IncomingJobQueue
8
+ FUNKTOR_DEFAULT_QUEUE:
9
+ Ref: DefaultQueue
10
+ FUNKTOR_SINGLE_THREAD_QUEUE:
11
+ Ref: SingleThreadQueue
12
+ FUNKTOR_ACTIVITY_TABLE:
13
+ Ref: ActivityTable
14
+ FUNKTOR_JOBS_TABLE:
15
+ Ref: JobsTable
@@ -0,0 +1,11 @@
1
+ handler: lambda_event_handlers/default_queue_handler.call
2
+ timeout: ${self:custom.funktor.DefaultQueueHandler.timeout, 900}
3
+ reservedConcurrency: ${self:custom.funktor.DefaultQueueHandler.reservedConcurrency, null}
4
+ provisionedConcurrency: ${self:custom.funktor.DefaultQueueHandler.provisionedConcurrency, null}
5
+ memorySize: ${self:custom.funktor.DefaultQueueHandler.memorySize, 256}
6
+ events:
7
+ - sqs:
8
+ arn:
9
+ Fn::GetAtt:
10
+ - DefaultQueue
11
+ - Arn
@@ -0,0 +1,11 @@
1
+ handler: lambda_event_handlers/incoming_job_handler.call
2
+ timeout: ${self:custom.funktor.IncomingJobHandler.timeout, 30}
3
+ reservedConcurrency: ${self:custom.funktor.IncomingJobHandler.reservedConcurrency, null}
4
+ provisionedConcurrency: ${self:custom.funktor.IncomingJobHandler.provisionedConcurrency, null}
5
+ memorySize: ${self:custom.funktor.IncomingJobHandler.memorySize, 256}
6
+ events:
7
+ - sqs:
8
+ arn:
9
+ Fn::GetAtt:
10
+ - IncomingJobQueue
11
+ - Arn
@@ -0,0 +1,8 @@
1
+ handler: lambda_event_handlers/job_activator.call
2
+ timeout: ${self:custom.funktor.JobActivator.timeout, 30}
3
+ reservedConcurrency: ${self:custom.funktor.JobActivator.reservedConcurrency, null}
4
+ provisionedConcurrency: ${self:custom.funktor.JobActivator.provisionedConcurrency, null}
5
+ memorySize: ${self:custom.funktor.JobActivator.memorySize, 256}
6
+ #reservedConcurrency: 1
7
+ events:
8
+ - schedule: rate(1 minute)
@@ -0,0 +1,18 @@
1
+ handler: lambda_event_handlers/random_job_generator.RandomJobGenerator.call
2
+ timeout: 58
3
+ reservedConcurrency: 0
4
+ events:
5
+ - schedule: rate(1 minute)
6
+ environment:
7
+ # MAX_JOB_DELAY_IN_SECONDS controls the maximum delay that will be put on a randomly generated job.
8
+ MAX_JOB_DELAY_IN_SECONDS: 1200 # 20 minutes
9
+ # These values control how many random jobs will be generated per second. With extremely high values
10
+ # the generator may become limited by how quickly it can push to SQS. If you need to test LOTS of
11
+ # jobs you may want to set the tiemout to be longer and increase reservedConcurrency so that you
12
+ # can have multiple random generators running at one time.
13
+ MIN_RANDOM_JOBS_PER_MINUTE: 30
14
+ MAX_RANDOM_JOBS_PER_MINUTE: 120
15
+ # MAX_JOB_LENGTH_IN_SECONDS controls how long the slowest job will take to execute (by sleeping)
16
+ MAX_JOB_LENGTH_IN_SECONDS: 3
17
+ # ERROR_PERCENTAGE is the percent of requests that should raise an error and be retried.
18
+ ERROR_PERCENTAGE: 25
@@ -0,0 +1,11 @@
1
+ handler: lambda_event_handlers/single_thread_queue_handler.call
2
+ timeout: ${self:custom.funktor.SingleThreadQueueHandler.timeout, 900}
3
+ reservedConcurrency: ${self:custom.funktor.SingleThreadQueueHandler.reservedConcurrency, null}
4
+ provisionedConcurrency: ${self:custom.funktor.SingleThreadQueueHandler.provisionedConcurrency, null}
5
+ memorySize: ${self:custom.funktor.SingleThreadQueueHandler.memorySize, 256}
6
+ events:
7
+ - sqs:
8
+ arn:
9
+ Fn::GetAtt:
10
+ - SingleThreadQueue
11
+ - Arn
@@ -0,0 +1,114 @@
1
+ IncomingJobHandler:
2
+ # timeout is how long the handler can possibly run. Up to 10 messages may be delivered
3
+ # to a handler at one time, so you'll want this to be at least 10x the maximum time you
4
+ # expect to spend for one message. The incoming job handler usually will be pretty fast,
5
+ # but we default to a high number here to allow for the times when things go weird.
6
+ timeout: 300
7
+ # reservedConcurrency represents the maximum number of concurrent executions.
8
+ # For the incoming job handler you probably don't want to limit it because you
9
+ # want to get things onto work queues as quickly as possible.
10
+ reservedConcurrency: null
11
+ # provisionedConcurrency represents the number of lambda functions that will always
12
+ # be available. For the incoming jobs handler you probably don't need to set this
13
+ # unless your jobs are very bursty AND very time sensitive.
14
+ provisionedConcurrency: null
15
+ # Use memory_size to adjust the reousrces (both memory and CPU) available.
16
+ # For the incoming jobs handler you probably don't need this to be too large,
17
+ # but if you're seeing large delays at this stage it might help to bump it up.
18
+ memorySize: 256
19
+ batchSize: 10
20
+ maximumBatchingWindow: 1
21
+ visibilityTimeout: 900
22
+ logRetentionInDays: 30
23
+
24
+ JobActivator:
25
+ # timeout is how long the handler can possibly run. Up to 10 messages may be delivered
26
+ # to a handler at one time, so you'll want this to be at least 10x the maximum time you
27
+ # expect to spend for one message. The job activator usually will be pretty fast,
28
+ # but we default to a high number here to allow for the times when things go weird.
29
+ timeout: 300
30
+ # reservedConcurrency represents the maximum number of concurrent executions.
31
+ # For the job activator you probably don't want to limit it because you
32
+ # want to get things onto work queues as quickly as possible when they're ready.
33
+ reservedConcurrency: null
34
+ # provisionedConcurrency represents the number of lambda functions that will always
35
+ # be available. For the job activator you probably don't need to set this
36
+ # since it will be running on a schedule
37
+ provisionedConcurrency: null
38
+ # Use memory_size to adjust the reousrces (both memory and CPU) available.
39
+ # For the job activator you probably don't need this to be too large,
40
+ # but if you're seeing large delays at this stage it might help to bump it up.
41
+ memorySize: 256
42
+ batchSize: 10
43
+ maximumBatchingWindow: 1
44
+ visibilityTimeout: 900
45
+ logRetentionInDays: 30
46
+
47
+
48
+
49
+ DefaultQueueHandler:
50
+ # timeout is how long the handler can possibly run. Up to 10 messages may be delivered
51
+ # to a handler at one time, so you'll want this to be at least 10x the maximum time you
52
+ # expect to spend for one message. The active job handler may be slow if your jobs are
53
+ # doing a lot of work, so we default to the maximum here.
54
+ timeout: 300
55
+ # reservedConcurrency represents the maximum number of concurrent executions.
56
+ # For the active job handler you may want to limit it if you have resource limitations
57
+ # like database connections that you need to avoid exhausting.
58
+ reservedConcurrency: null
59
+ # provisionedConcurrency represents the number of lambda functions that will always
60
+ # be available. For the active job handler you probably don't need to set this
61
+ # unless your jobs are very bursty AND very time sensitive.
62
+ provisionedConcurrency: null
63
+ # Use memory_size to adjust the reousrces (both memory and CPU) available.
64
+ # For the active jobs handler you'll want this to be at least as large as the memory
65
+ # required to actually do your jobs. You can choose an even higher number to increase
66
+ # the available CPU to make the jobs run faster.
67
+ memorySize: 256
68
+ batchSize: 10
69
+ maximumBatchingWindow: 1
70
+ visibilityTimeout: 900
71
+ logRetentionInDays: 30
72
+
73
+ SingleThreadQueueHandler:
74
+ # timeout is how long the handler can possibly run. Up to 10 messages may be delivered
75
+ # to a handler at one time, so you'll want this to be at least 10x the maximum time you
76
+ # expect to spend for one message. The active job handler may be slow if your jobs are
77
+ # doing a lot of work, so we default to the maximum here.
78
+ timeout: 300
79
+ # reservedConcurrency represents the maximum number of concurrent executions.
80
+ # For the active job handler you may want to limit it if you have resource limitations
81
+ # like database connections that you need to avoid exhausting.
82
+ reservedConcurrency: 1
83
+ # provisionedConcurrency represents the number of lambda functions that will always
84
+ # be available. For the active job handler you probably don't need to set this
85
+ # unless your jobs are very bursty AND very time sensitive.
86
+ provisionedConcurrency: null
87
+ # Use memory_size to adjust the reousrces (both memory and CPU) available.
88
+ # For the active jobs handler you'll want this to be at least as large as the memory
89
+ # required to actually do your jobs. You can choose an even higher number to increase
90
+ # the available CPU to make the jobs run faster.
91
+ memorySize: 256
92
+ batchSize: 10
93
+ maximumBatchingWindow: 1
94
+ visibilityTimeout: 900
95
+ logRetentionInDays: 30
96
+
97
+
98
+
99
+ # You shouldn't need to mess with these under most circumstances. But you could if you want to change
100
+ # the name of some of your resources in AWS.
101
+ IncomingJobQueueName: ${self:service}-${self:custom.stage}-incoming-jobs
102
+ IncomingDeadJobQueueName: ${self:service}-${self:custom.stage}-incoming-dead
103
+ IncomingJobHandlerName: ${self:service}-${self:custom.stage}-IncomingJobHandler
104
+ IncomingJobQueueAccessPolicyName: ${self:service}-${self:custom.stage}-incoming-job-queue-access
105
+ DashboardName: ${self:service}-${self:custom.stage}-dashboard
106
+ DefaultQueueName: ${self:service}-${self:custom.stage}-default
107
+ DefaultDeadJobQueueName: ${self:service}-${self:custom.stage}-default-dead
108
+ DefaultQueueHandlerName: ${self:service}-${self:custom.stage}-DefaultQueueHandler
109
+ SingleThreadQueueName: ${self:service}-${self:custom.stage}-single-thread
110
+ SingleThreadDeadJobQueueName: ${self:service}-${self:custom.stage}-single-thread-dead
111
+ SingleThreadQueueHandlerName: ${self:service}-${self:custom.stage}-SingleThreadQueueHandler
112
+ JobsTableName: ${self:service}-${self:custom.stage}-jobs
113
+ ActivityTableName: ${self:service}-${self:custom.stage}-activity
114
+ JobActivatorName: ${self:service}-${self:custom.stage}-JobActivator