Class: Cnvrg::JobCli

Inherits:
SubCommandBase show all
Defined in:
lib/cnvrg/job_cli.rb

Instance Method Summary collapse

Methods inherited from SubCommandBase

banner, subcommand_prefix

Instance Method Details

#install_reqsObject



33
34
35
36
37
38
39
40
# File 'lib/cnvrg/job_cli.rb', line 33

def install_reqs
    cli = Cnvrg::CLI.new
    cli.log_start(__method__, args, options)
    @project = Project.new(nil, owner: ENV['CNVRG_OWNER'], slug: ENV['CNVRG_PROJECT'])
    @executer = Helpers::Executer.new(project: @project, job_type: ENV['CNVRG_JOB_TYPE'], job_id: ENV['CNVRG_JOB_ID'])
    commands = @executer.get_requirements_commands
    @executer.execute_cmds(commands)
end

#log(*logs) ⇒ Object



7
8
9
10
11
# File 'lib/cnvrg/job_cli.rb', line 7

def log(*logs)
    Cnvrg::CLI.new.log_start(__method__, args, options)
    @project = Project.new(owner: ENV['CNVRG_OWNER'], slug: ENV['CNVRG_PROJECT'])
    @project.job_log(logs, level: options['level'], step: options['step'])
end

#requirementsObject



25
26
27
28
29
30
# File 'lib/cnvrg/job_cli.rb', line 25

def requirements
  cli = Cnvrg::CLI.new
  cli.log_start(__method__, args, options)
  project_dir = cli.get_project_home
  @project = Project.new(project_dir, owner: ENV['CNVRG_OWNER'], slug: ENV['CNVRG_PROJECT'])
end

#start(*logs) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/cnvrg/job_cli.rb', line 15

def start(*logs)
    cli = Cnvrg::CLI.new
    cli.log_start(__method__, args, options)
    @project = Project.new(nil, owner: ENV['CNVRG_OWNER'], slug: ENV['CNVRG_PROJECT'])
    @executer = Helpers::Executer.new(project: @project, job_type: ENV['CNVRG_JOB_TYPE'], job_id: ENV['CNVRG_JOB_ID'])
    commands = @executer.fetch_commands
    @executer.execute_cmds(commands)
end