Class: Seira::Jobs

Inherits:
Object
  • Object
show all
Includes:
Commands
Defined in:
lib/seira/jobs.rb

Constant Summary collapse

VALID_ACTIONS =
%w[help list delete run].freeze
SUMMARY =
"Manage your application's jobs.".freeze
RESOURCE_SIZES =
{
  '1' => {
    'CPU_REQUEST' => '200m',
    'CPU_LIMIT' => '500m',
    'MEMORY_REQUEST' => '500Mi',
    'MEMORY_LIMIT' => '1Gi',
  },
  '2' => {
    'CPU_REQUEST' => '1',
    'CPU_LIMIT' => '2',
    'MEMORY_REQUEST' => '2Gi',
    'MEMORY_LIMIT' => '4Gi',
  },
  '3' => {
    'CPU_REQUEST' => '4',
    'CPU_LIMIT' => '6',
    'MEMORY_REQUEST' => '10Gi',
    'MEMORY_LIMIT' => '15Gi',
  }
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Commands

#gcloud, gcloud, kubectl, #kubectl

Constructor Details

#initialize(app:, action:, args:, context:) ⇒ Jobs

Returns a new instance of Jobs.



32
33
34
35
36
37
38
# File 'lib/seira/jobs.rb', line 32

def initialize(app:, action:, args:, context:)
  @app = app
  @action = action
  @context = context
  @args = args
  @job_name = args[0]
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



30
31
32
# File 'lib/seira/jobs.rb', line 30

def action
  @action
end

#appObject (readonly)

Returns the value of attribute app.



30
31
32
# File 'lib/seira/jobs.rb', line 30

def app
  @app
end

#argsObject (readonly)

Returns the value of attribute args.



30
31
32
# File 'lib/seira/jobs.rb', line 30

def args
  @args
end

#contextObject (readonly)

Returns the value of attribute context.



30
31
32
# File 'lib/seira/jobs.rb', line 30

def context
  @context
end

#job_nameObject (readonly)

Returns the value of attribute job_name.



30
31
32
# File 'lib/seira/jobs.rb', line 30

def job_name
  @job_name
end

Instance Method Details

#runObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/seira/jobs.rb', line 40

def run
  case action
  when 'help'
    run_help
  when 'list'
    run_list
  when 'delete'
    run_delete
  when 'run'
    run_run
  else
    fail "Unknown command encountered"
  end
end