Module: OffsiteStep
- Extended by:
- Annotation
- Defined in:
- lib/scout/offsite/step.rb
Instance Method Summary
collapse
Methods included from Annotation
list_tsv_values, load_info, load_tsv, load_tsv_values, obj_tsv_values, resolve_tsv_array, tsv
Instance Method Details
#done? ⇒ Boolean
67
68
69
|
# File 'lib/scout/offsite/step.rb', line 67
def done?
status == :done
end
|
#exec ⇒ Object
84
85
86
87
88
89
90
91
|
# File 'lib/scout/offsite/step.rb', line 84
def exec
bundle_files = offsite_job_ssh <<~EOF
job.run
job.bundle_files
EOF
SSHLine.sync(bundle_files, source: server)
self.load
end
|
#info ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/scout/offsite/step.rb', line 55
def info
info = @info ||= offsite_job_ssh <<~EOF
info = Open.exists?(job.info_file) ? job.info : {}
info[:running] = true if job.running?
info
EOF
@info = nil unless %w(done aborted error).include?(info[:status].to_s)
info
end
|
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/scout/offsite/step.rb', line 10
def inputs_directory
@inputs_directory ||= begin
if provided_inputs && provided_inputs.any?
file = ".scout/tmp/step_inputs/#{workflow}/#{task_name}/#{name}"
TmpFile.with_path do |inputs_dir|
save_inputs(inputs_dir)
SSHLine.rsync(inputs_dir, file, target: server, directory: true)
end
file
end
end
end
|
#offsite_job_ssh(script) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/scout/offsite/step.rb', line 27
def offsite_job_ssh(script)
parts = []
parts << <<~EOF.strip
wf = Workflow.require_workflow "#{workflow_name}";
EOF
if inputs_directory
parts << <<~EOF.strip
job = wf.job(:#{task_name}, "#{clean_name}", :load_inputs => "#{inputs_directory}");
EOF
else
parts << <<~EOF.strip
job = wf.job(:#{task_name}, "#{clean_name}");
EOF
end
parts << script
SSHLine.scout server, parts * "\n"
end
|
#offsite_path ⇒ Object
49
50
51
52
53
|
# File 'lib/scout/offsite/step.rb', line 49
def offsite_path
@path = offsite_job_ssh <<~EOF
job.path.identify
EOF
end
|
#orchestrate_slurm ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/scout/offsite/step.rb', line 71
def orchestrate_slurm
bundle_files = offsite_job_ssh <<~EOF
require 'rbbt/hpc'
HPC::BATCH_MODULE = HPC.batch_system "SLURM"
HPC::BATCH_MODULE.orchestrate_job(job, {})
job.join
job.bundle_files
EOF
SSHLine.sync(bundle_files, source: server)
self.load
end
|
#run ⇒ Object
93
94
95
96
97
98
99
|
# File 'lib/scout/offsite/step.rb', line 93
def run
if slurm
orchestrate_slurm
else
exec
end
end
|
#workflow_name ⇒ Object
23
24
25
|
# File 'lib/scout/offsite/step.rb', line 23
def workflow_name
@workflow_name || workflow.to_s
end
|