Class: Cnvrg::JobCli
Instance Method Summary
collapse
banner, subcommand_prefix
Instance Method Details
#install_reqs ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/cnvrg/job_cli.rb', line 27
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
8
9
10
11
12
13
14
15
16
|
# File 'lib/cnvrg/job_cli.rb', line 8
def log(*logs)
Cnvrg::CLI.new.log_start(__method__, args, options)
@project = Project.new(owner: ENV['CNVRG_OWNER'], slug: ENV['CNVRG_PROJECT'])
if options['restart'] == @project.check_job_pod_restart[0] or options['step'] == "ready"
@project.job_log(logs, level: options['level'], step: options['step'])
else
@project.job_log(nil, level: options['level'], step: options['step'])
end
end
|
#pre_pod_stop ⇒ Object
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/cnvrg/job_cli.rb', line 62
def pre_pod_stop
cli = Cnvrg::CLI.new
cli.log_start(__method__, args, options)
owner = ENV["CNVRG_OWNER"]
machine_activity = YAML.load_file("/conf/.machine_activity.yml") rescue {:slug => ENV["CNVRG_MACHINE_ACTIVITY"]}
machine_activity_slug = machine_activity[:slug]
job_id = ENV["CNVRG_JOB_ID"]
@executer = Cnvrg::Helpers::Executer.new(machine_activity: machine_activity_slug, owner: owner, job_id: job_id)
@executer.pre_pod_stop
end
|
#requirements ⇒ Object
19
20
21
22
23
24
|
# File 'lib/cnvrg/job_cli.rb', line 19
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 ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/cnvrg/job_cli.rb', line 37
def start
cli = Cnvrg::CLI.new
cli.log_start(__method__, args, options)
cli.auth
poll_every = (ENV["CNVRG_AGENT_POLL_EVERY"] || '30').to_i
owner = ENV["CNVRG_OWNER"]
machine_activity_slug = ENV["CNVRG_MACHINE_ACTIVITY"]
job_id = ENV["CNVRG_JOB_ID"]
@executer = Cnvrg::Helpers::Executer.new(machine_activity: machine_activity_slug, poll_every: poll_every, owner: owner, job_id: job_id)
@executer.main_thread
end
|
#stats ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/cnvrg/job_cli.rb', line 50
def stats
cli = Cnvrg::CLI.new
cli.log_start(__method__, args, options)
poll_every = (ENV["CNVRG_AGENT_POLL_EVERY"] || '30').to_i
owner = ENV["CNVRG_OWNER"]
machine_activity_slug = ENV["CNVRG_MACHINE_ACTIVITY"]
job_id = ENV["CNVRG_JOB_ID"]
@executer = Cnvrg::Helpers::Executer.new(machine_activity: machine_activity_slug, poll_every: poll_every, owner: owner, job_id: job_id)
@executer.executer_stats
end
|