Sha256: 8eb6938b51695b20bae862d41aeeaa21f254b9a3e5c186728fb741338baac8c9

Contents?: true

Size: 1.2 KB

Versions: 18

Compression:

Stored size: 1.2 KB

Contents

require 'json'

# Job public methods get turned into Lambda functions.
#
# Jets::Job::Base < Jets::Lambda::Functions
# Both Jets::Job::Base and Jets::Lambda::Functions have Dsl modules included.
# So the Jets::Job::Dsl overrides some of the Jets::Lambda::Functions behavior.
class Jets::Job
  autoload :Helpers, "jets/job/helpers"

  class Base < Jets::Lambda::Functions
    include Dsl

    # non-DSL methods
    include Helpers::KinesisEventHelper
    include Helpers::LogEventHelper
    include Helpers::S3EventHelper

    # Tracks bucket each time an s3_event is declared
    # Map of bucket_name => stack_name (nested part)
    cattr_accessor :s3_events # dont want this to be inheritable intentionally
    self.s3_events = {}

    class << self
      def process(event, context, meth)
        job = new(event, context, meth)
        job.send(meth)
      end

      def perform_now(meth, event={}, context={})
        new(event, context, meth).send(meth)
      end

      def perform_later(meth, event={}, context={})
        function_name = "#{self.to_s.underscore}-#{meth}"
        call = Jets::Commands::Call.new(function_name, JSON.dump(event), invocation_type: "Event")
        call.run
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
jets-1.9.7 lib/jets/job/base.rb
jets-1.9.6 lib/jets/job/base.rb
jets-1.9.5 lib/jets/job/base.rb
jets-1.9.4 lib/jets/job/base.rb
jets-1.9.3 lib/jets/job/base.rb
jets-1.9.2 lib/jets/job/base.rb
jets-1.9.1 lib/jets/job/base.rb
jets-1.9.0 lib/jets/job/base.rb
jets-1.8.14 lib/jets/job/base.rb
jets-1.8.13 lib/jets/job/base.rb
jets-1.8.12 lib/jets/job/base.rb
jets-1.8.11 lib/jets/job/base.rb
jets-1.8.10 lib/jets/job/base.rb
jets-1.8.9 lib/jets/job/base.rb
jets-1.8.8 lib/jets/job/base.rb
jets-1.8.7 lib/jets/job/base.rb
jets-1.8.6 lib/jets/job/base.rb
jets-1.8.5 lib/jets/job/base.rb