server_scripts 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b272c99b33f7ecb954965b83b6a465c349721df
4
- data.tar.gz: 8d9d49ee51086a521c8144f935348302bf13cfb7
3
+ metadata.gz: 7fc3282ab4ef93f7e6de815343bca4bf11b6fb60
4
+ data.tar.gz: e9b5a827cda61da04b79f1526df3ed223b593bca
5
5
  SHA512:
6
- metadata.gz: 7fe5a9cc5b3ad76c397a9dbb0d7223f40b7e679fd0203749e4aeae7cc4e9194129ed8cdabf5117538ba75075a292dd9a8d3d090700e8eded4f196c10779bc7da
7
- data.tar.gz: e8ee6d52ccaf1c75c4404d656437bf8e32d1053cdb93945bd067af2b5bbcf584ea5cc61e50caf6312c7d91a35209f20473ebaad5b928aa3d31fedf3e993a712f
6
+ metadata.gz: 7a9d9cd9fd246095acc03507e37e7419da713ff0bad625dbb46582a6cc09f7e5d58a775b07f09cf3d7b72301233ddb338449c366a44946b68e0cf86f301c3ff1
7
+ data.tar.gz: 1c29990c502b25014a60feb44bb1d9e23e12be06b74c7e6663634ddd9a93572bc30bc94a35fa12f83acd616ce5572f9d83c0b275df636819f82acb96ab6a31d5
@@ -45,10 +45,10 @@ module ServerScripts
45
45
  attr_reader :system
46
46
 
47
47
  def initialize job_fname
48
- @job_fname = "sample_job_script.sh"
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
@@ -11,8 +11,8 @@ module ServerScripts
11
11
  #$ -l %{node_type}=%{nodes}
12
12
  #$ -l h_rt=%{walltime}
13
13
  #$ -N %{job_name}
14
- #$ -o %{out_file}.log
15
- #$ -e %{err_file}.log
14
+ #$ -o %{out_file}
15
+ #$ -e %{err_file}
16
16
  }
17
17
  end
18
18
  end
@@ -21,10 +21,6 @@ module ServerScripts
21
21
  def env_setter
22
22
  raise NotImplementedError
23
23
  end
24
-
25
- def job_submit_cmd
26
- raise NotImplementedError
27
- end
28
24
  end
29
25
  end
30
26
  end
@@ -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}.log
11
- #$ -e %{err_file}.log
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, batch_script:
30
+ def job_submit_cmd batch_script:, res_id: nil
31
31
  res = res_id ? " -ar #{res_id} " : ""
32
- "qsub -g #{ServeScripts.group_name} #{res} #{batch_script}"
32
+ "qsub -g #{ServerScripts.group_name} #{res} #{batch_script}"
33
33
  end
34
34
  end
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module ServerScripts
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sameer Deshmukh