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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cecd319ceb7e03d909a5bbf9ca418c34849b37d0
4
- data.tar.gz: d347dabb8547f7e0910cbff2b85597b0bb8b41c7
3
+ metadata.gz: 0a3c575e33e3109de2fad9850237a9655c66da8c
4
+ data.tar.gz: 96083ade5954f07f18683df48a0ed09734253a7a
5
5
  SHA512:
6
- metadata.gz: 9f39a0e547e59ca092292ef1c8dbc9d267679164d564169c5d46dd83fcf872202803170ab4e1ea29710292779febb8aebcf05e9a143ecf03e3c72462078b2deb
7
- data.tar.gz: 6b05080ffd4438fd55b18fd10d9e68ac335b454149f7df4374348d7433cbb9f9cc4d4a3c70084a1681d3a1125efaa02eefcbda578b3b875e643bded0505e0176
6
+ metadata.gz: 1da18e68261fb612d5d7fb60ccf34f61ebe0f2ddaf104902a30964e7de58084fe5a4eadfa971220e1ab8cf6f59fd1aa6d71f4a5f359c0b7336108c171cbe1062
7
+ data.tar.gz: a042cf22ed24af4dfdc403fef6216a2aaaaa8cadb7dfb0a75b9c2883773c6100586ac0042c928e31b04959afd401e99f3e0e59618a0b55ea91f850daf53cd7f1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.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
@@ -7,6 +7,8 @@ require 'torque_rm/qsub'
7
7
  require 'torque_rm/qstat'
8
8
  require 'torque_rm/qdel'
9
9
  require 'active_support/core_ext/hash/conversions'
10
+ require 'securerandom'
11
+
10
12
 
11
13
  # Try to laod the default configuration
12
14
  TORQUE.load_config
@@ -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
@@ -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! {|job| (hash[:job_id].to_s == job.job_id || hash[:job_id].to_s == job.job_id.split(".").first)}
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! {|job| (hash[:job_ids].include?(job.job_id) || hash[:job_ids].include?(job.job_id.split(".").first))}
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
@@ -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,:N,:o,:p,:P,:q,:r,:S,:t,:u,:v,:V,:W,:X,:z, :script
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.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-17"
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
@@ -5,7 +5,9 @@
5
5
  %tbody
6
6
  - jobs.each do |job|
7
7
  %tr{job_line_color(job)}
8
- %td= job.job_id.split(".").first
8
+ %td
9
+ %a{:href=>"qstat/#{job.job_id.split(".").first}"}
10
+ = job.job_id.split(".").first
9
11
  %td= job.job_name
10
12
  %td= job.node
11
13
  %td= "#{job.memory} mb"
@@ -0,0 +1,3 @@
1
+ %form{:method=> "post", :action=>"submit"}
2
+ %input{:type=>"textarea", :rows=>"80", :cols=>"40", :name => "script"}
3
+ %input{:type => "submit", :value => "Place in queue!"}
@@ -0,0 +1,4 @@
1
+ %p
2
+ Your job has been submitted with id
3
+ %a{:href=>"qstat/#{job_id.split(".").first}"}
4
+ = job_id.split(".").first
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.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-17 00:00:00.000000000 Z
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: