torque_rm 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +25 -0
- data/LICENSE.txt +20 -0
- data/README.html +230 -0
- data/README.md +231 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/bin/torque_rm_rest +147 -0
- data/features/step_definitions/common_steps.rb +21 -0
- data/features/step_definitions/qsub_steps.rb +47 -0
- data/features/step_definitions/torque_rm_steps.rb +0 -0
- data/features/support/env.rb +13 -0
- data/features/torque_rm.feature +9 -0
- data/features/torque_rm/common.feature +22 -0
- data/features/torque_rm/qsub.feature +52 -0
- data/lib/torque_rm.rb +11 -0
- data/lib/torque_rm/common.rb +74 -0
- data/lib/torque_rm/qdel.rb +13 -0
- data/lib/torque_rm/qstat.rb +308 -0
- data/lib/torque_rm/qsub.rb +342 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/torque_rm_spec.rb +7 -0
- data/torque_rm.gemspec +106 -0
- data/web/helpers/qstat.rb +19 -0
- data/web/views/qstat.haml +19 -0
- data/web/views/qstat_job.haml +14 -0
- metadata +271 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 06d6fce41705812d8811ac4cf5ed34b2e240dbc9
|
4
|
+
data.tar.gz: cdff027855a94198d26e746bd7bf4582b093b1a9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f98b672b55c96ef7fe2466d3cbf89e644ca429df8a105679c294a4e6c2f5e017ccdbd7d611878d2fa453fff602e9f0701682727d356879391c179c3d65deebc0
|
7
|
+
data.tar.gz: 32e1699707d447a6d01c9d49bc2d14f7f08c60dd7d6df751e88715d1d80ce6df68f4522df9f79bcb9ad4e3193ecdba152453eb4f91a7be6fde8daff59b5268e1
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem 'rye'
|
6
|
+
gem 'parslet'
|
7
|
+
gem "colorize"
|
8
|
+
gem "terminal-table"
|
9
|
+
gem 'sinatra'
|
10
|
+
gem 'sinatra-contrib'
|
11
|
+
gem 'shotgun'
|
12
|
+
gem 'haml'
|
13
|
+
gem 'sinatra-twitter-bootstrap', :require => 'sinatra/twitter-bootstrap'
|
14
|
+
# gem "awesome_print"
|
15
|
+
# gem 'sinatra-twitter-bootstrap', :require => 'sinatra/twitter-bootstrap'
|
16
|
+
# Add dependencies to develop your gem here.
|
17
|
+
# Include everything needed to run rake, tests, features, etc.
|
18
|
+
group :development do
|
19
|
+
gem "rspec", "~> 2.8.0"
|
20
|
+
gem "rdoc", "~> 3.12"
|
21
|
+
gem "cucumber", ">= 0"
|
22
|
+
gem "bundler", "> 1.0.0"
|
23
|
+
gem "jeweler", "~> 1.8.4"
|
24
|
+
# gem "rcov", "> 0"
|
25
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Raoul Jean Pierre Bonnal
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.html
ADDED
@@ -0,0 +1,230 @@
|
|
1
|
+
<h1>torque_rm</h1>
|
2
|
+
|
3
|
+
<p>Example of configuration:</p>
|
4
|
+
|
5
|
+
<pre><code>TORQUE.qcommands_path='/usr/bin'
|
6
|
+
TORQUE.server = "my_grid.remote.net"
|
7
|
+
job = TORQUE::Qsub.new m: "abe", name:"FirstTest", shell: '/bin/bash', ppn: 4
|
8
|
+
job.script = "echo `hostname`; sleep 1000"
|
9
|
+
job.submit
|
10
|
+
stats=TORQUE::Qstat.new
|
11
|
+
|
12
|
+
# get all stats on all jobs
|
13
|
+
stats.query
|
14
|
+
|
15
|
+
# select stats from only the submitted job
|
16
|
+
stat.query job_id: job.id
|
17
|
+
|
18
|
+
# it is also possible to get the stats from a single job
|
19
|
+
job.stat
|
20
|
+
</code></pre>
|
21
|
+
|
22
|
+
<h2>HowItWorks</h2>
|
23
|
+
|
24
|
+
<p>Torque<em>Rm uses Rye as interface with a local/remote computer/server, using ssh, so every command
|
25
|
+
is a executed with ssh. Rye also guarantees a certain level of security disabling dangerous operations
|
26
|
+
like moving, deleting files or traversing recursevely a directory. Obviously this feature can be disabled,
|
27
|
+
but for now it is the default way Torque</em>Rm operates.</p>
|
28
|
+
|
29
|
+
<h2>Job Configurations</h2>
|
30
|
+
|
31
|
+
<h3>Where files are saved ?</h3>
|
32
|
+
|
33
|
+
<p>By default torque_rm creates/transfers files in the user home directory <code>~</code>. It's possible to change
|
34
|
+
this default behaviour setting an internal variable when a <code>job</code> is created on managed.
|
35
|
+
Considering the example above configuring the wrinting directory before submitting the <code>job</code>:</p>
|
36
|
+
|
37
|
+
<pre><code>job.root_directory = '/my/personal/path'
|
38
|
+
</code></pre>
|
39
|
+
|
40
|
+
<p>or</p>
|
41
|
+
|
42
|
+
<pre><code>job.working_directory = '/my/personal/path'
|
43
|
+
</code></pre>
|
44
|
+
|
45
|
+
<p><code>root</code> has precedence on <code>working</code> directory. It is possible to configure the <code>root</code>/<code>working</code> directory
|
46
|
+
at the time of creation of the new job using the usual hash key/value convention.</p>
|
47
|
+
|
48
|
+
<pre><code>:root_directory => '/my/personal/path'
|
49
|
+
</code></pre>
|
50
|
+
|
51
|
+
<p>or </p>
|
52
|
+
|
53
|
+
<pre><code>:working_directory => '/my/personal/path'
|
54
|
+
</code></pre>
|
55
|
+
|
56
|
+
<h2>Configuration</h2>
|
57
|
+
|
58
|
+
<h3>Saving</h3>
|
59
|
+
|
60
|
+
<p>It is possible to save in a configuration file <code>server</code> and <code>path</code>.
|
61
|
+
User can sare a configuration file:</p>
|
62
|
+
|
63
|
+
<pre><code>TORQUE.qcommands_path='/usr/bin'
|
64
|
+
TORQUE.server = "my_grid.remote.net"
|
65
|
+
TORQUE.save_config
|
66
|
+
</code></pre>
|
67
|
+
|
68
|
+
<p>it will create a YAML file <code>~/.torque_rm.yaml</code> in the user home directory.
|
69
|
+
In case the user wants to save the configuration in a custom location </p>
|
70
|
+
|
71
|
+
<pre><code>TORQUE.save_config "file_name"
|
72
|
+
</code></pre>
|
73
|
+
|
74
|
+
<h3>Loading</h3>
|
75
|
+
|
76
|
+
<p>Read a configuration from the dafult location <code>~/.torque_rm.yaml</code></p>
|
77
|
+
|
78
|
+
<pre><code>TORQUE.load_config
|
79
|
+
</code></pre>
|
80
|
+
|
81
|
+
<p>In case the user has a custom file</p>
|
82
|
+
|
83
|
+
<pre><code>TORQUE.load_config "file_name"
|
84
|
+
</code></pre>
|
85
|
+
|
86
|
+
<h2>Define a job using a DSL</h2>
|
87
|
+
|
88
|
+
<pre><code>rhostname = TORQUE::Qsub.new do |job|
|
89
|
+
job.m = "abe"
|
90
|
+
job.name = "FirstTest"
|
91
|
+
job.shell = '/bin/bash'
|
92
|
+
job.ppn = 4
|
93
|
+
job.script = "echo `hostname`; sleep 1000"
|
94
|
+
end
|
95
|
+
rhostname.submit
|
96
|
+
rhostname.stat
|
97
|
+
</code></pre>
|
98
|
+
|
99
|
+
<h2>Stats</h2>
|
100
|
+
|
101
|
+
<p>When a job is submitted, is possible to get some stats</p>
|
102
|
+
|
103
|
+
<pre><code>[{:job_id=>"2750.sun.universe.space"@1387,
|
104
|
+
:job_name=>"FirstTest"@1421,
|
105
|
+
:job_owner=>"helios@sun.universe.space"@1447,
|
106
|
+
:job_state=>"Q"@1489,
|
107
|
+
:queue=>"bio"@1503,
|
108
|
+
:server=>"sun.universe.space"@1520,
|
109
|
+
:checkpoint=>"u"@1551,
|
110
|
+
:ctime=>"Tue Aug 27 15:56:41 2013"@1565,
|
111
|
+
:error_path=>
|
112
|
+
"sun.universe.space:/home/helios/FirstTest.e2750"@1607,
|
113
|
+
:hold_types=>"n"@1689,
|
114
|
+
:join_path=>"n"@1707,
|
115
|
+
:keep_files=>"n"@1726,
|
116
|
+
:mail_points=>"abe"@1746,
|
117
|
+
:mtime=>"Tue Aug 27 15:56:41 2013"@1762,
|
118
|
+
:output_path=>
|
119
|
+
"deep.space.nine:/home/helios/FirstTest.o2750"@1805,
|
120
|
+
:priority=>"0"@1885,
|
121
|
+
:qtime=>"Tue Aug 27 15:56:41 2013"@1899,
|
122
|
+
:rerunable=>"True"@1940,
|
123
|
+
:resource_list_nodect=>"1"@1972,
|
124
|
+
:resource_list_nodes=>"1:ppn=4"@2000,
|
125
|
+
:shell_path_list=>"/bin/bash"@2030,
|
126
|
+
:variable_list=>
|
127
|
+
"PBS_O_QUEUE=bio,PBS_O_HOST=deep.space.nine,PBS_O_HOME=/home/helios,PBS_O_LANG=it_IT.UTF-8,PBS_O_LOGNAME=helios,PBS_O_PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/helios/.rvm/bin,PBS_O_MAIL=/var/mail/helios,PBS_O_SHELL=/bin/bash,PBS_SERVER=spark,PBS_O_WORKDIR=/home/helios\n"@2060,
|
128
|
+
:etime=>"Tue Aug 27 15:56:41 2013"@2456,
|
129
|
+
:submit_args=>"FirstTest.qsub"@2499,
|
130
|
+
:fault_tolerant=>"False"@2535,
|
131
|
+
:submit_host=>"sun.universe.space"@2559}]
|
132
|
+
</code></pre>
|
133
|
+
|
134
|
+
<p>directly from the job</p>
|
135
|
+
|
136
|
+
<pre><code>job.stat
|
137
|
+
</code></pre>
|
138
|
+
|
139
|
+
<p>or by requesting the information using the specific object</p>
|
140
|
+
|
141
|
+
<pre><code>stats=TORQUE::Qstat.new
|
142
|
+
|
143
|
+
# select stats from only the submitted job
|
144
|
+
stat.query job_id: job.id
|
145
|
+
</code></pre>
|
146
|
+
|
147
|
+
<p>it will return an hash but is also possible to return the raw string from TORQUE/PBS</p>
|
148
|
+
|
149
|
+
<pre><code>stat.query job_id: job.id, type: :raw
|
150
|
+
</code></pre>
|
151
|
+
|
152
|
+
<p>Quering multiple jobs at the same time is possible as well (note the 's' after 'id'):</p>
|
153
|
+
|
154
|
+
<pre><code>stat.query job_ids: ["2751.sun.universe.space","2752.sun.universe.space","2754.sun.universe.space","2755.sun.universe.space"]
|
155
|
+
</code></pre>
|
156
|
+
|
157
|
+
<h2>Delete Jobs</h2>
|
158
|
+
|
159
|
+
<p>From a qsub object if submitted:</p>
|
160
|
+
|
161
|
+
<pre><code>job.rm
|
162
|
+
</code></pre>
|
163
|
+
|
164
|
+
<p>Directly from PBS:</p>
|
165
|
+
|
166
|
+
<pre><code>TORQUE::Qdel.rm("2750.sun.universe.space")
|
167
|
+
</code></pre>
|
168
|
+
|
169
|
+
<h2>REST Api</h2>
|
170
|
+
|
171
|
+
<p>All objects returned from TORQUE<em>RM</em>REST are in JSON format.</p>
|
172
|
+
|
173
|
+
<h3>Qstat</h3>
|
174
|
+
|
175
|
+
<h4>Get</h4>
|
176
|
+
|
177
|
+
<p><code>/qstat</code> Returns an Array of Hash with the following keys, if available <code>"job_id","job_name","job_owner","resources_used_cput","resources_used_mem","resources_used_vmem","resources_used_walltime","job_state","queue","server","checkpoint","ctime","error_path","exec_host","exec_port","hold_types","join_path","keep_files","mail_points","mail_users","mtime","output_path","priority","qtime","rerunable","resource_list","session_id","shell_path_list","variable_list","etime","exit_status","submit_args","start_time","start_count","fault_tolerant","comp_time","job_radix","total_runtime","submit_host"</code> .</p>
|
178
|
+
|
179
|
+
<p><code>/qstat/fields</code> Returns an Array of String, the available fields for a single <code>qstat</code> query.</p>
|
180
|
+
|
181
|
+
<p><code>/qstat/all/:field</code> Return an Array of Strings, each String is the <code>field</code> requested by the user. If the <code>field</code> requested is not valid, it will return 404</p>
|
182
|
+
|
183
|
+
<h3>Job</h3>
|
184
|
+
|
185
|
+
<h4>Get</h4>
|
186
|
+
|
187
|
+
<p><code>/qstat/:job_id</code> Returns an Hash with main key <code>job</code> and the JSON conversion of a TORQUE::Qstat::Job object. If the <code>job_id</code> does not exist will return 404</p>
|
188
|
+
|
189
|
+
<p><code>/qstat/job/fields</code> Returns and Hash <code>{"job_fields":["job_id","job_name","job_owner","resources_used_cput","resources_used_mem","resources_used_vmem","resources_used_walltime","job_state","queue","server","checkpoint","ctime","error_path","exec_host","exec_port","hold_types","join_path","keep_files","mail_points","mail_users","mtime","output_path","priority","qtime","rerunable","resource_list","session_id","shell_path_list","variable_list","etime","exit_status","submit_args","start_time","start_count","fault_tolerant","comp_time","job_radix","total_runtime","submit_host","is_runnig?","is_queued?","is_exited?","is_completed?","time","memory","node"]}</code> </p>
|
190
|
+
|
191
|
+
<p><code>/qstat/:job_id/:field</code> Returns and Hash with a single key which is the required <code>field</code>. If the <code>job_id</code> or <code>field</code> do not exist will return 404</p>
|
192
|
+
|
193
|
+
<h4>Post</h4>
|
194
|
+
|
195
|
+
<p><code>/qstat/:job_id/del</code> Removes the <code>job_id</code> from the queue. If the <code>job_id</code> does not exist will return 404</p>
|
196
|
+
|
197
|
+
<h3>Interacting from CLI</h3>
|
198
|
+
|
199
|
+
<p>To perform a query or call a fucntion use <code>curl</code> setting the content type. Extension <code>.json</code> is not considering for now, why? Read <a href="http://stackoverflow.com/questions/477816/what-is-the-correct-json-content-type">What-is-the-correct-json-content-type</a> discussion on <a href="http://stackoverflow.com/">Stackoverflow</a></p>
|
200
|
+
|
201
|
+
<p>curl -H "Content-type: application/json" "http://localhost:4567/qstat"</p>
|
202
|
+
|
203
|
+
<h3>WebApp</h3>
|
204
|
+
|
205
|
+
<p>A web application is under development and it will let you interact with you TORQUE/PBS server in a more fancy way, be patient and give us your feedback or request functionalities. A list of supported html pages:</p>
|
206
|
+
|
207
|
+
<ul>
|
208
|
+
<li>get: /qstat</li>
|
209
|
+
</ul>
|
210
|
+
|
211
|
+
<h3>HowIsItMade</h3>
|
212
|
+
|
213
|
+
<p><a href="http://www.sinatrarb.com/">Sinatra</a> is the low level framework used for developing the REST API and the web infrastructure. <a href="http://getbootstrap.com/">Twitter Bootstrap</a> is used to make the web app nice and fancy.</p>
|
214
|
+
|
215
|
+
<h2>Contributing to torque_rm</h2>
|
216
|
+
|
217
|
+
<ul>
|
218
|
+
<li>Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.</li>
|
219
|
+
<li>Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.</li>
|
220
|
+
<li>Fork the project.</li>
|
221
|
+
<li>Start a feature/bugfix branch.</li>
|
222
|
+
<li>Commit and push until you are happy with your contribution.</li>
|
223
|
+
<li>Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.</li>
|
224
|
+
<li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
|
225
|
+
</ul>
|
226
|
+
|
227
|
+
<h2>Copyright</h2>
|
228
|
+
|
229
|
+
<p>Copyright (c) 2013 Raoul Jean Pierre Bonnal. See LICENSE.txt for
|
230
|
+
further details.</p>
|
data/README.md
ADDED
@@ -0,0 +1,231 @@
|
|
1
|
+
# torque_rm
|
2
|
+
|
3
|
+
Example of configuration:
|
4
|
+
|
5
|
+
TORQUE.qcommands_path='/usr/bin'
|
6
|
+
TORQUE.server = "my_grid.remote.net"
|
7
|
+
job = TORQUE::Qsub.new m: "abe", name:"FirstTest", shell: '/bin/bash', ppn: 4
|
8
|
+
job.script = "echo `hostname`; sleep 1000"
|
9
|
+
job.submit
|
10
|
+
stats=TORQUE::Qstat.new
|
11
|
+
|
12
|
+
# get all stats on all jobs
|
13
|
+
stats.query
|
14
|
+
|
15
|
+
# select stats from only the submitted job
|
16
|
+
stat.query job_id: job.id
|
17
|
+
|
18
|
+
# it is also possible to get the stats from a single job
|
19
|
+
job.stat
|
20
|
+
|
21
|
+
## HowItWorks
|
22
|
+
Torque_Rm uses Rye as interface with a local/remote computer/server, using ssh, so every command
|
23
|
+
is a executed with ssh. Rye also guarantees a certain level of security disabling dangerous operations
|
24
|
+
like moving, deleting files or traversing recursevely a directory. Obviously this feature can be disabled,
|
25
|
+
but for now it is the default way Torque_Rm operates.
|
26
|
+
|
27
|
+
## Job Configurations
|
28
|
+
### Where files are saved ?
|
29
|
+
By default torque_rm creates/transfers files in the user home directory `~`. It's possible to change
|
30
|
+
this default behaviour setting an internal variable when a `job` is created on managed.
|
31
|
+
Considering the example above configuring the wrinting directory before submitting the `job`:
|
32
|
+
|
33
|
+
job.root_directory = '/my/personal/path'
|
34
|
+
|
35
|
+
or
|
36
|
+
|
37
|
+
job.working_directory = '/my/personal/path'
|
38
|
+
|
39
|
+
`root` has precedence on `working` directory. It is possible to configure the `root`/`working` directory
|
40
|
+
at the time of creation of the new job using the usual hash key/value convention.
|
41
|
+
|
42
|
+
:root_directory => '/my/personal/path'
|
43
|
+
or
|
44
|
+
|
45
|
+
:working_directory => '/my/personal/path'
|
46
|
+
|
47
|
+
## Configuration
|
48
|
+
|
49
|
+
### byHand
|
50
|
+
|
51
|
+
TORQUE_RM uses `yaml` configuration, user can create such a file in his/her home directory:
|
52
|
+
|
53
|
+
touch ~/.torque_rm.yaml
|
54
|
+
|
55
|
+
and fill it with similar details:
|
56
|
+
|
57
|
+
---
|
58
|
+
:hostname: deep.space.nine
|
59
|
+
:path: /usr/bin
|
60
|
+
|
61
|
+
### Saving
|
62
|
+
|
63
|
+
It is possible to save in a configuration file `server` and `path`.
|
64
|
+
User can save a configuration file:
|
65
|
+
|
66
|
+
TORQUE.qcommands_path='/usr/bin'
|
67
|
+
TORQUE.server = "my_grid.remote.net"
|
68
|
+
TORQUE.save_config
|
69
|
+
|
70
|
+
it will create a YAML file `~/.torque_rm.yaml` in the user home directory.
|
71
|
+
In case the user wants to save the configuration in a custom location
|
72
|
+
|
73
|
+
TORQUE.save_config "file_name"
|
74
|
+
|
75
|
+
### Loading
|
76
|
+
|
77
|
+
Read a configuration from the dafult location `~/.torque_rm.yaml`
|
78
|
+
|
79
|
+
TORQUE.load_config
|
80
|
+
|
81
|
+
In case the user has a custom file
|
82
|
+
|
83
|
+
TORQUE.load_config "file_name"
|
84
|
+
|
85
|
+
|
86
|
+
## Define a job using a DSL
|
87
|
+
|
88
|
+
rhostname = TORQUE::Qsub.new do |job|
|
89
|
+
job.m = "abe"
|
90
|
+
job.name = "FirstTest"
|
91
|
+
job.shell = '/bin/bash'
|
92
|
+
job.ppn = 4
|
93
|
+
job.script = "echo `hostname`; sleep 1000"
|
94
|
+
end
|
95
|
+
rhostname.submit
|
96
|
+
rhostname.stat
|
97
|
+
|
98
|
+
## Stats
|
99
|
+
|
100
|
+
When a job is submitted, is possible to get some stats
|
101
|
+
|
102
|
+
[{:job_id=>"2750.sun.universe.space"@1387,
|
103
|
+
:job_name=>"FirstTest"@1421,
|
104
|
+
:job_owner=>"helios@sun.universe.space"@1447,
|
105
|
+
:job_state=>"Q"@1489,
|
106
|
+
:queue=>"bio"@1503,
|
107
|
+
:server=>"sun.universe.space"@1520,
|
108
|
+
:checkpoint=>"u"@1551,
|
109
|
+
:ctime=>"Tue Aug 27 15:56:41 2013"@1565,
|
110
|
+
:error_path=>
|
111
|
+
"sun.universe.space:/home/helios/FirstTest.e2750"@1607,
|
112
|
+
:hold_types=>"n"@1689,
|
113
|
+
:join_path=>"n"@1707,
|
114
|
+
:keep_files=>"n"@1726,
|
115
|
+
:mail_points=>"abe"@1746,
|
116
|
+
:mtime=>"Tue Aug 27 15:56:41 2013"@1762,
|
117
|
+
:output_path=>
|
118
|
+
"deep.space.nine:/home/helios/FirstTest.o2750"@1805,
|
119
|
+
:priority=>"0"@1885,
|
120
|
+
:qtime=>"Tue Aug 27 15:56:41 2013"@1899,
|
121
|
+
:rerunable=>"True"@1940,
|
122
|
+
:resource_list_nodect=>"1"@1972,
|
123
|
+
:resource_list_nodes=>"1:ppn=4"@2000,
|
124
|
+
:shell_path_list=>"/bin/bash"@2030,
|
125
|
+
:variable_list=>
|
126
|
+
"PBS_O_QUEUE=bio,PBS_O_HOST=deep.space.nine,PBS_O_HOME=/home/helios,PBS_O_LANG=it_IT.UTF-8,PBS_O_LOGNAME=helios,PBS_O_PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/helios/.rvm/bin,PBS_O_MAIL=/var/mail/helios,PBS_O_SHELL=/bin/bash,PBS_SERVER=spark,PBS_O_WORKDIR=/home/helios\n"@2060,
|
127
|
+
:etime=>"Tue Aug 27 15:56:41 2013"@2456,
|
128
|
+
:submit_args=>"FirstTest.qsub"@2499,
|
129
|
+
:fault_tolerant=>"False"@2535,
|
130
|
+
:submit_host=>"sun.universe.space"@2559}]
|
131
|
+
|
132
|
+
directly from the job
|
133
|
+
|
134
|
+
job.stat
|
135
|
+
|
136
|
+
or by requesting the information using the specific object
|
137
|
+
|
138
|
+
stats=TORQUE::Qstat.new
|
139
|
+
|
140
|
+
# select stats from only the submitted job
|
141
|
+
stat.query job_id: job.id
|
142
|
+
|
143
|
+
it will return an hash but is also possible to return the raw string from TORQUE/PBS
|
144
|
+
|
145
|
+
stat.query job_id: job.id, type: :raw
|
146
|
+
|
147
|
+
Quering multiple jobs at the same time is possible as well (note the 's' after 'id'):
|
148
|
+
|
149
|
+
stat.query job_ids: ["2751.sun.universe.space","2752.sun.universe.space","2754.sun.universe.space","2755.sun.universe.space"]
|
150
|
+
|
151
|
+
|
152
|
+
## Delete Jobs
|
153
|
+
|
154
|
+
From a qsub object if submitted:
|
155
|
+
|
156
|
+
job.rm
|
157
|
+
|
158
|
+
Directly from PBS:
|
159
|
+
|
160
|
+
TORQUE::Qdel.rm("2750.sun.universe.space")
|
161
|
+
|
162
|
+
## REST Api
|
163
|
+
|
164
|
+
All objects returned from TORQUE_RM_REST are in JSON format.
|
165
|
+
|
166
|
+
### Qstat
|
167
|
+
#### Get
|
168
|
+
|
169
|
+
`/qstat` Returns an Array of Hash with the following keys, if available `"job_id","job_name","job_owner","resources_used_cput","resources_used_mem","resources_used_vmem","resources_used_walltime","job_state","queue","server","checkpoint","ctime","error_path","exec_host","exec_port","hold_types","join_path","keep_files","mail_points","mail_users","mtime","output_path","priority","qtime","rerunable","resource_list","session_id","shell_path_list","variable_list","etime","exit_status","submit_args","start_time","start_count","fault_tolerant","comp_time","job_radix","total_runtime","submit_host"` .
|
170
|
+
|
171
|
+
`/qstat/fields` Returns an Array of String, the available fields for a single `qstat` query.
|
172
|
+
|
173
|
+
`/qstat/all/:field` Return an Array of Strings, each String is the `field` requested by the user. If the `field` requested is not valid, it will return 404
|
174
|
+
|
175
|
+
### Job
|
176
|
+
#### Get
|
177
|
+
|
178
|
+
`/qstat/:job_id` Returns an Hash with main key `job` and the JSON conversion of a TORQUE::Qstat::Job object. If the `job_id` does not exist will return 404
|
179
|
+
|
180
|
+
`/qstat/job/fields` Returns and Hash `{"job_fields":["job_id","job_name","job_owner","resources_used_cput","resources_used_mem","resources_used_vmem","resources_used_walltime","job_state","queue","server","checkpoint","ctime","error_path","exec_host","exec_port","hold_types","join_path","keep_files","mail_points","mail_users","mtime","output_path","priority","qtime","rerunable","resource_list","session_id","shell_path_list","variable_list","etime","exit_status","submit_args","start_time","start_count","fault_tolerant","comp_time","job_radix","total_runtime","submit_host","is_runnig?","is_queued?","is_exited?","is_completed?","time","memory","node"]}`
|
181
|
+
|
182
|
+
`/qstat/:job_id/:field` Returns and Hash with a single key which is the required `field`. If the `job_id` or `field` do not exist will return 404
|
183
|
+
|
184
|
+
#### Post
|
185
|
+
|
186
|
+
`/qstat/:job_id/del` Removes the `job_id` from the queue. If the `job_id` does not exist will return 404
|
187
|
+
|
188
|
+
|
189
|
+
### Interacting from CLI
|
190
|
+
|
191
|
+
To perform a query or call a fucntion use `curl` setting the content type. Extension `.json` is not considering for now, why? Read [What-is-the-correct-json-content-type](http://stackoverflow.com/questions/477816/what-is-the-correct-json-content-type) discussion on [Stackoverflow](http://stackoverflow.com/)
|
192
|
+
|
193
|
+
curl -H "Content-type: application/json" "http://localhost:4567/qstat"
|
194
|
+
|
195
|
+
### WebApp
|
196
|
+
|
197
|
+
A web application is under development and it will let you interact with you TORQUE/PBS server in a more fancy way, be patient and give us your feedback or request functionalities. A list of supported html pages:
|
198
|
+
|
199
|
+
* get: /qstat
|
200
|
+
|
201
|
+
### HowIsItMade
|
202
|
+
|
203
|
+
[Sinatra](http://www.sinatrarb.com/) is the low level framework used for developing the REST API and the web infrastructure. [Twitter Bootstrap](http://getbootstrap.com/) is used to make the web app nice and fancy.
|
204
|
+
|
205
|
+
### Run the Web App as a Serv(er/ice)
|
206
|
+
|
207
|
+
From the command line
|
208
|
+
|
209
|
+
`torque_rm_rest`
|
210
|
+
|
211
|
+
click [here](http://localhost:4567/)
|
212
|
+
|
213
|
+
Remember to configure by hand the `~/.torque_rm.yaml` as documented at the beginning
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
## Contributing to torque_rm
|
218
|
+
|
219
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
220
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
221
|
+
* Fork the project.
|
222
|
+
* Start a feature/bugfix branch.
|
223
|
+
* Commit and push until you are happy with your contribution.
|
224
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
225
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
226
|
+
|
227
|
+
## Copyright
|
228
|
+
|
229
|
+
Copyright (c) 2013 Raoul Jean Pierre Bonnal. See LICENSE.txt for
|
230
|
+
further details.
|
231
|
+
|