torque_rm 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/torque_rm_rest +16 -8
- data/lib/torque_rm.rb +2 -0
- data/lib/torque_rm/common.rb +10 -0
- data/lib/torque_rm/qstat.rb +4 -4
- data/lib/torque_rm/qsub.rb +20 -3
- data/torque_rm.gemspec +5 -3
- data/web/views/qstat.haml +3 -1
- data/web/views/qsub.haml +3 -0
- data/web/views/qsub_submit.haml +4 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a3c575e33e3109de2fad9850237a9655c66da8c
|
4
|
+
data.tar.gz: 96083ade5954f07f18683df48a0ed09734253a7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da18e68261fb612d5d7fb60ccf34f61ebe0f2ddaf104902a30964e7de58084fe5a4eadfa971220e1ab8cf6f59fd1aa6d71f4a5f359c0b7336108c171cbe1062
|
7
|
+
data.tar.gz: a042cf22ed24af4dfdc403fef6216a2aaaaa8cadb7dfb0a75b9c2883773c6100586ac0042c928e31b04959afd401e99f3e0e59618a0b55ea91f850daf53cd7f1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/bin/torque_rm_rest
CHANGED
@@ -52,22 +52,17 @@ end
|
|
52
52
|
|
53
53
|
### JOBS
|
54
54
|
|
55
|
-
get '/qstat/:job_id', :provides => [:json] do |job_id|
|
55
|
+
get '/qstat/:job_id', :provides => [:json, :html] do |job_id|
|
56
|
+
job = TORQUE::Qstat.new.query job_id: job_id
|
56
57
|
respond_to do |format|
|
57
58
|
format.json do
|
58
|
-
job = TORQUE::Qstat.new.query job_id: job_id
|
59
|
-
# q = TORQUE::Qstat.new
|
60
|
-
# p = TORQUE::Qstat::Parser.new
|
61
|
-
# t = TORQUE::Qstat::Trans.new
|
62
|
-
|
63
|
-
# s= "Job Id: 2770.deep.space.nine\n Job_Name = STDIN\n Job_Owner = johndoe@deep.space.nine\n resources_used.cput = 00:00:00\n resources_used.mem = 3148kb\n resources_used.vmem = 32528kb\n resources_used.walltime = 00:28:05\n job_state = R\n queue = bio\n server = deep.space.nine\n Checkpoint = u\n ctime = Mon Sep 2 18:43:10 2013\n Error_Path = deep.space.nine:/mnt/bio/ngs/data/home/johndoe/STDIN.e2770\n exec_host = scrapper/0\n exec_port = 15003\n Hold_Types = n\n Join_Path = n\n Keep_Files = n\n Mail_Points = a\n mtime = Mon Sep 2 18:43:11 2013\n Output_Path = deep.space.nine:/mnt/bio/ngs/data/home/johndoe/STDIN.o2770\n\t\n Priority = 0\n qtime = Mon Sep 2 18:43:10 2013\n Rerunable = True\n Resource_List.ncpus = 2\n Resource_List.nice = 0\n session_id = 16963\n Variable_List = PBS_O_QUEUE=bio,PBS_O_HOST=deep.space.nine,\n\tPBS_O_HOME=/mnt/bio/ngs/data/home/johndoe,PBS_O_LANG=it_IT.UTF-8,\n\tPBS_O_LOGNAME=johndoe,\n\tPBS_O_PATH=/mnt/bio/ngs/data/opt/fastx_toolkit/bin:/mnt/bio/ngs/data/\n\topt/bedtools/bin:/mnt/bio/ngs/data/opt/fuseki:/mnt/bio/ngs/data/opt/je\n\tna/bin:/mnt/bio/ngs/data/opt/CASAVA/bin:/mnt/bio/ngs/data/bin/cloaked-\n\thipster/utils:/mnt/bio/ngs/data/bin/cloaked-hipster/utils/ngs/pipeline\n\ts:/mnt/bio/ngs/data/bin/cloaked-hipster/utils/db:/mnt/bio/ngs/data/opt\n\t/trimmomatic:/mnt/bio/ngs/data/opt/PHYLOCSF/hmmer-3.0-linux-intel-x86_\n\t64/binaries:/mnt/bio/ngs/data/opt/PHYLOCSF/mlin-PhyloCSF-983a652/:/mnt\n\t/bio/ngs/data/bin/cloaked-hipster/ncrnapp/PBS_pipeline/:/mnt/bio/ngs/d\n\tata/opt/bowtie-0.12.9:/mnt/bio/ngs/data/opt/bowtie_current:/mnt/bio/ng\n\ts/data/opt/STAR_current:/mnt/bio/ngs/data/opt/RSeQC-2.3.5/RQC/usr/loca\n\tl/bin:/mnt/bio/ngs/data/opt/tophat_current:/mnt/bio/ngs/data/opt/PASA/\n\tscripts:/mnt/bio/ngs/data/opt/PASA/bin:/mnt/bio/ngs/data/opt/fasta/bin\n\t:/mnt/bio/ngs/data/opt/cufflinks:/mnt/bio/ngs/data/opt/samtools:/mnt/b\n\tio/ngs/data/opt/samtools/bcftools:/mnt/bio/ngs/data/opt/samtools/misc:\n\t/mnt/bio/ngs/data/opt/STAR_current/bin:/mnt/bio/ngs/data/opt/gmap/bin:\n\t/mnt/bio/ngs/data/opt/velvet:/mnt/bio/ngs/data/opt/velvet/contrib/colu\n\tmbus_scripts:/opt/blat:/mnt/bio/ngs/data/opt/oases/:/mnt/bio/ngs/data/\n\topt/oases/scripts:/mnt/bio/ngs/data/opt/trinityrnaseq:/mnt/bio/ngs/dat\n\ta/opt/trinityrnaseq/util:/usr/local/bin/:/mnt/bio/ngs/data/home/bonnal\n\traoul/.rbenv/bin:/mnt/bio/ngs/data/home/johndoe/.rbenv/shims:/mnt/\n\tbio/ngs/data/home/johndoe/.rbenv/bin:/usr/local/sbin:/usr/local/bi\n\tn:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games,\n\tPBS_O_MAIL=/var/mail/johndoe,PBS_O_SHELL=/bin/bash,\n\tPBS_SERVER=spark,PBS_O_WORKDIR=/mnt/bio/ngs/data/home/johndoe\n etime = Mon Sep 2 18:43:10 2013\n submit_args = -l ncpus=2 -l nice=0\n start_time = Mon Sep 2 18:43:11 2013\n start_count = 1\n fault_tolerant = False\n submit_host = deep.space.nine"
|
64
|
-
# job = job_id == "2770" ? q.mock(t.apply(p.parse(s.gsub(/\n\t/,'')))) : []
|
65
59
|
if job.empty?
|
66
60
|
return status 404
|
67
61
|
else
|
68
62
|
json :job => job.first
|
69
63
|
end
|
70
64
|
end
|
65
|
+
format.html { haml :qstat_job, :format => :html5, :locals => {:job => job.first}}
|
71
66
|
end
|
72
67
|
# if job.empty?
|
73
68
|
# "There is no job running with id #{job_id}"
|
@@ -115,6 +110,19 @@ post '/qstat/:job_id/del', :provides => [:json] do |job_id|
|
|
115
110
|
end
|
116
111
|
|
117
112
|
|
113
|
+
get '/qsub' do
|
114
|
+
haml :qsub
|
115
|
+
end
|
116
|
+
|
117
|
+
post '/submit' do
|
118
|
+
job = TORQUE::Qsub.new
|
119
|
+
job.script = params[:script]
|
120
|
+
job_id = job.submit
|
121
|
+
haml :qsub_submit, :locals => {:job => job, :job_id => job_id}
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
|
118
126
|
|
119
127
|
__END__
|
120
128
|
|
data/lib/torque_rm.rb
CHANGED
data/lib/torque_rm/common.rb
CHANGED
@@ -20,6 +20,15 @@ module TORQUE
|
|
20
20
|
@@username = username
|
21
21
|
end
|
22
22
|
|
23
|
+
def self.username
|
24
|
+
@@username
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.user
|
28
|
+
@@username
|
29
|
+
end
|
30
|
+
|
31
|
+
|
23
32
|
|
24
33
|
def self.qcommands_path=(path)
|
25
34
|
@@qcommands_path = path
|
@@ -71,4 +80,5 @@ module TORQUE
|
|
71
80
|
def self.hostname
|
72
81
|
self.server.hostname
|
73
82
|
end
|
83
|
+
|
74
84
|
end
|
data/lib/torque_rm/qstat.rb
CHANGED
@@ -31,7 +31,7 @@ module TORQUE
|
|
31
31
|
|
32
32
|
# Cast generic types from string to most near type selected by pattern matching
|
33
33
|
def casting
|
34
|
-
each_pair do |k,v| #converting
|
34
|
+
@table.each_pair do |k,v| #converting
|
35
35
|
if v =~ (/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/)
|
36
36
|
send "#{k}=", Time.parse(v)
|
37
37
|
elsif k.to_s =~ /time/ && v.is_a?(String) && v =~ (/^[0-9]+$/)
|
@@ -49,7 +49,7 @@ module TORQUE
|
|
49
49
|
end #casting
|
50
50
|
|
51
51
|
def alias_case_insensitive_methods
|
52
|
-
each_pair do |k,v| #adding methods
|
52
|
+
@table.each_pair do |k,v| #adding methods
|
53
53
|
unless k == k.downcase
|
54
54
|
original=k.to_sym
|
55
55
|
newer=k.downcase.to_sym
|
@@ -285,13 +285,13 @@ module TORQUE
|
|
285
285
|
end # do
|
286
286
|
if hash.key? :job_id
|
287
287
|
# if hash[:job_id]..is_a? String
|
288
|
-
jobs.select
|
288
|
+
jobs.select {|job| (hash[:job_id].to_s == job.job_id || hash[:job_id].to_s == job.job_id.split(".").first)}
|
289
289
|
# else
|
290
290
|
# warn "You gave me #{hash[:job_id].class}, only String is supported."
|
291
291
|
# end
|
292
292
|
elsif hash.key? :job_ids
|
293
293
|
if hash[:job_ids].is_a? Array
|
294
|
-
jobs.select
|
294
|
+
jobs.select {|job| (hash[:job_ids].include?(job.job_id) || hash[:job_ids].include?(job.job_id.split(".").first))}
|
295
295
|
elsif hash[:job_ids].is_a? String
|
296
296
|
warn "To be implemented for String object."
|
297
297
|
else
|
data/lib/torque_rm/qsub.rb
CHANGED
@@ -16,10 +16,10 @@ module TORQUE
|
|
16
16
|
|
17
17
|
class Qsub
|
18
18
|
attr_accessor :a, :A,:b,:c,:C,:d,:D,:e,:f,:h,:I,:j,:k,:l
|
19
|
-
attr_accessor :m,:M,:
|
19
|
+
attr_accessor :m,:M,:o,:p,:P,:q,:r,:S,:t,:u,:v,:V,:W,:X,:z, :script
|
20
20
|
attr_accessor :walltime,:gres,:ppn, :procs
|
21
21
|
attr_accessor :id
|
22
|
-
attr_writer :nodes
|
22
|
+
attr_writer :nodes, :N
|
23
23
|
|
24
24
|
# def script(*args)
|
25
25
|
# if args.size == 1
|
@@ -29,6 +29,14 @@ module TORQUE
|
|
29
29
|
# end
|
30
30
|
# end
|
31
31
|
|
32
|
+
def N
|
33
|
+
if @N.nil?
|
34
|
+
@N = SecureRandom.urlsafe_base64(20)
|
35
|
+
else
|
36
|
+
@N
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
32
40
|
|
33
41
|
alias :cpus :ppn
|
34
42
|
alias :cpus= :ppn=
|
@@ -221,9 +229,10 @@ module TORQUE
|
|
221
229
|
# if root or working directories are not defined the user home directory is
|
222
230
|
# the default directory
|
223
231
|
def script_dir
|
224
|
-
root_directory || working_directory ||
|
232
|
+
root_directory || working_directory || user_directory
|
225
233
|
end
|
226
234
|
|
235
|
+
# in case name of the job has not been specified, it will be generated randomly
|
227
236
|
def script_filename
|
228
237
|
"#{name}.pbs"
|
229
238
|
end
|
@@ -232,6 +241,14 @@ module TORQUE
|
|
232
241
|
File.join(script_dir,script_filename)
|
233
242
|
end
|
234
243
|
|
244
|
+
def user_directory
|
245
|
+
if run_as_user
|
246
|
+
File.join("/home",run_as_user)
|
247
|
+
elsif TORQUE.username
|
248
|
+
File.join("/home",TORQUE.username)
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
235
252
|
|
236
253
|
# Defines the options that will apply to the job. If the job executes upon a host which does not support checkpoint, these options will be ignored.
|
237
254
|
# Valid checkpoint options are:
|
data/torque_rm.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "torque_rm"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Raoul Jean Pierre Bonnal"]
|
12
|
-
s.date = "2013-09-
|
12
|
+
s.date = "2013-09-18"
|
13
13
|
s.description = "TORQUE Resource Manager for Ruby. Submit, check and control your job directly from Ruby."
|
14
14
|
s.email = "ilpuccio.febo@gmail.com"
|
15
15
|
s.executables = ["torque_rm_rest"]
|
@@ -44,7 +44,9 @@ Gem::Specification.new do |s|
|
|
44
44
|
"torque_rm.gemspec",
|
45
45
|
"web/helpers/qstat.rb",
|
46
46
|
"web/views/qstat.haml",
|
47
|
-
"web/views/qstat_job.haml"
|
47
|
+
"web/views/qstat_job.haml",
|
48
|
+
"web/views/qsub.haml",
|
49
|
+
"web/views/qsub_submit.haml"
|
48
50
|
]
|
49
51
|
s.homepage = "http://github.com/helios/torque_rm"
|
50
52
|
s.licenses = ["MIT"]
|
data/web/views/qstat.haml
CHANGED
data/web/views/qsub.haml
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torque_rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raoul Jean Pierre Bonnal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rye
|
@@ -257,6 +257,8 @@ files:
|
|
257
257
|
- web/helpers/qstat.rb
|
258
258
|
- web/views/qstat.haml
|
259
259
|
- web/views/qstat_job.haml
|
260
|
+
- web/views/qsub.haml
|
261
|
+
- web/views/qsub_submit.haml
|
260
262
|
- README.html
|
261
263
|
homepage: http://github.com/helios/torque_rm
|
262
264
|
licenses:
|