server_scripts 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fc3282ab4ef93f7e6de815343bca4bf11b6fb60
|
4
|
+
data.tar.gz: e9b5a827cda61da04b79f1526df3ed223b593bca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a9d9cd9fd246095acc03507e37e7419da713ff0bad625dbb46582a6cc09f7e5d58a775b07f09cf3d7b72301233ddb338449c366a44946b68e0cf86f301c3ff1
|
7
|
+
data.tar.gz: 1c29990c502b25014a60feb44bb1d9e23e12be06b74c7e6663634ddd9a93572bc30bc94a35fa12f83acd616ce5572f9d83c0b275df636819f82acb96ab6a31d5
|
data/lib/server_scripts.rb
CHANGED
@@ -45,10 +45,10 @@ module ServerScripts
|
|
45
45
|
attr_reader :system
|
46
46
|
|
47
47
|
def initialize job_fname
|
48
|
-
@job_fname =
|
48
|
+
@job_fname = job_fname
|
49
49
|
@job_name = "sample"
|
50
|
-
@out_file = "sample_out"
|
51
|
-
@err_file = "sample_err"
|
50
|
+
@out_file = "sample_out.log"
|
51
|
+
@err_file = "sample_err.log"
|
52
52
|
@wall_time = "1:00:00"
|
53
53
|
@node_type = NodeType::FULL
|
54
54
|
@nodes = 1
|
@@ -58,7 +58,7 @@ module ServerScripts
|
|
58
58
|
@executor = :vanilla
|
59
59
|
@env = {}
|
60
60
|
@executable = "./a.out"
|
61
|
-
@job_script =
|
61
|
+
@job_script = nil
|
62
62
|
@enable_intel_itac = false
|
63
63
|
@additional_commands = []
|
64
64
|
|
@@ -70,27 +70,32 @@ module ServerScripts
|
|
70
70
|
@env[var] = value
|
71
71
|
end
|
72
72
|
|
73
|
+
def write_job_script!
|
74
|
+
generate_job_script! unless @job_script
|
75
|
+
File.write(@job_fname, @job_script)
|
76
|
+
end
|
77
|
+
|
78
|
+
def submit!
|
79
|
+
write_job_script!
|
80
|
+
exec @system.job_submit_cmd(batch_script: @job_fname)
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
73
85
|
def generate_job_script!
|
74
86
|
@system = ServerScripts.system.new(@node_type, @nodes, @job_name,
|
75
87
|
@wall_time, @out_file, @err_file, @env)
|
76
88
|
configure_executor!
|
77
89
|
|
90
|
+
@job_script = ""
|
78
91
|
@job_script += @system.header
|
79
92
|
@job_script += @system.env_setter
|
80
93
|
@additional_commands.each do |c|
|
81
94
|
@job_script += c + "\n"
|
82
95
|
end
|
83
|
-
@job_script += "#{@executor.run_cmd} #{@executable} #{@options}"
|
96
|
+
@job_script += "#{@executor.run_cmd} #{@executable} #{@options}\n"
|
84
97
|
end
|
85
98
|
|
86
|
-
def submit!
|
87
|
-
generate_job_script! unless @job_script
|
88
|
-
File.write(@job_fname, @job_script)
|
89
|
-
# system(@system.job_submit_cmd(batch_script: @job_fname))
|
90
|
-
end
|
91
|
-
|
92
|
-
private
|
93
|
-
|
94
99
|
def configure_executor!
|
95
100
|
check_process_counts
|
96
101
|
@nprocs = @npernode * @nodes
|
@@ -7,8 +7,8 @@ module ServerScripts
|
|
7
7
|
#$ -l %{node_type}=%{nodes}
|
8
8
|
#$ -l h_rt=%{wall_time}
|
9
9
|
#$ -N %{job_name}
|
10
|
-
#$ -o %{out_file}
|
11
|
-
#$ -e %{err_file}
|
10
|
+
#$ -o %{out_file}
|
11
|
+
#$ -e %{err_file}
|
12
12
|
}
|
13
13
|
|
14
14
|
FULL_NODE = "f_node"
|
@@ -27,9 +27,9 @@ module ServerScripts
|
|
27
27
|
str
|
28
28
|
end
|
29
29
|
|
30
|
-
def job_submit_cmd res_id: nil
|
30
|
+
def job_submit_cmd batch_script:, res_id: nil
|
31
31
|
res = res_id ? " -ar #{res_id} " : ""
|
32
|
-
"qsub -g #{
|
32
|
+
"qsub -g #{ServerScripts.group_name} #{res} #{batch_script}"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|