qtools 0.3.0 → 0.4.0

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: ff64b4d0551d64bc0271ada2001d0d293cb70b0c
4
- data.tar.gz: 295eb6942865985a0cbeac0d1756fec46329eb33
3
+ metadata.gz: e0d76a13024d569a65ccd1934078073de89ecc67
4
+ data.tar.gz: e0402dda42b8217f6c999dafb586f49c39e9e9ba
5
5
  SHA512:
6
- metadata.gz: cbb6bb21edf9c6becead7fe74ad01df9288e6fa6c72208238181ff405510d30f2585a25e271c7821a6d0432ff4f31e452ee12259801866e49bad9ef375b81f5b
7
- data.tar.gz: 8507473670fcb4405637c42da0656537711b019130c42f83436fc62ec705beddc3394f5cd89c33015a6a9694a56e77b4469ad84ec47615cb42918005af7c61c0
6
+ metadata.gz: e67fcc4cdb5bddec31d79e8b3cb46ebad101c69d7fa016c031866f8ec834ff27ec3ba5c1a4974f00fd1c46b18cf1321121c407fd3fcabc8fcb5f0828087625ac
7
+ data.tar.gz: e91e8e618428a10c3d1d37b575eb21c13d69122412753350487e187f4d2cba1bf8ff99f445419fd3fc9d4c551e1be667ac521dd889bcb7eab040e8dd0e08ec82
data/README.md CHANGED
@@ -17,6 +17,7 @@ Install `qtools` using `gem`:
17
17
  - `qcount` to see the number of running jobs for the current user
18
18
  - `qnode` to list the free nodes
19
19
  - `qundo` to stop the last submitted job for the current user
20
+ - `qless` to read the last error log `.e[0-9]*` in the current folder
20
21
 
21
22
  ### qqsub
22
23
 
@@ -70,6 +71,14 @@ Usage:
70
71
 
71
72
  The command above will try to run `qdel` for the last job submitted.
72
73
 
74
+ ### qless
75
+
76
+ Usage:
77
+
78
+ $ qless
79
+
80
+ The command above will try to read the last default error log `.e[0-9]*` in the current folder. Use `-o` flag to read the last default output file.
81
+
73
82
  ## Contributing
74
83
 
75
84
  Bug reports and pull requests are welcome on [GitHub](https://github.com/kerkomen/qtools).
data/bin/qless ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'qtools'
4
+ require 'optparse'
5
+
6
+ options = {}
7
+ OptionParser.new do |opts|
8
+ opts.banner = "Usage: qless [options]"
9
+
10
+ opts.on("-o", "--out", "Read the last output") do |o|
11
+ options[:out] = o
12
+ end
13
+
14
+ # default
15
+ opts.on("-e", "--err", "Read the last error log") do |e|
16
+ options[:err] = e
17
+ end
18
+
19
+ end.parse!
20
+
21
+ o_file = `ls -tr *.o[0-9]* 2> /dev/null | tail -n1`
22
+ e_file = `ls -tr *.e[0-9]* 2> /dev/null | tail -n1`
23
+
24
+ if options[:out]
25
+ unless o_file.empty?
26
+ system("less #{o_file.strip}")
27
+ else
28
+ puts "-- No default output files in this foder."
29
+ end
30
+ else
31
+ unless e_file.empty?
32
+ system("less #{e_file.strip}")
33
+ else
34
+ puts "-- No default error files in this foder."
35
+ end
36
+ end
data/bin/qqsub CHANGED
@@ -46,7 +46,9 @@ end
46
46
 
47
47
  header_pbs = header_pbs_tree.map { |k, v| "#PBS -#{k} #{v.join(',')}" }.join("\n")
48
48
 
49
- sh_name = command[0].split[1].match(/(.*)\.(.*?)/)[1] + '.sh'
49
+ sh_prefix_guess = (command[0].split[1].include?('.') or command[0].split.length == 1) ? command[0].split[1] : command[0].split[0] # guess if script or executable
50
+ sh_prefix = sh_prefix_guess.include?('.') ? sh_prefix_guess.match(/(.*)\.(.*?)/)[1] : sh_prefix_guess
51
+ sh_name = (header_pbs_tree[:N] ? header_pbs_tree[:N][0] : sh_prefix) + '.sh'
50
52
 
51
53
  File.write(sh_name, [header_shell, header_pbs, "", command[0]].join("\n"))
52
54
 
data/lib/qtools.rb CHANGED
@@ -9,6 +9,7 @@ help_string = <<-HELP
9
9
  - qcount to see the number of running jobs for the current user
10
10
  - qnode to list the free nodes
11
11
  - qundo to stop the last job for the current user
12
+ - qless to read the last error log (.e[0-9]*) in the current folder
12
13
 
13
14
  HELP
14
15
 
@@ -1,3 +1,3 @@
1
1
  module Qtools
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/qtools.gemspec CHANGED
@@ -23,9 +23,9 @@ Gem::Specification.new do |spec|
23
23
  end
24
24
 
25
25
  # spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.files = %w{ .gitignore .travis.yml Gemfile LICENSE.txt README.md Rakefile bin/console bin/qclean bin/qqsub bin/qwatch bin/qcount bin/qnode bin/qundo bin/setup lib/qtools.rb lib/qtools/version.rb qtools.gemspec}
26
+ spec.files = %w{ .gitignore .travis.yml Gemfile LICENSE.txt README.md Rakefile bin/console bin/qclean bin/qqsub bin/qwatch bin/qcount bin/qnode bin/qundo bin/qless bin/setup lib/qtools.rb lib/qtools/version.rb qtools.gemspec}
27
27
  spec.bindir = "bin"
28
- spec.executables = ["qwatch", "qclean", "qqsub", "qcount", "qnode", "qundo"]
28
+ spec.executables = ["qwatch", "qclean", "qqsub", "qcount", "qnode", "qundo", "qless"]
29
29
  spec.require_paths = ["lib"]
30
30
 
31
31
  spec.add_development_dependency "bundler", "~> 1.10"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel
@@ -48,6 +48,7 @@ executables:
48
48
  - qcount
49
49
  - qnode
50
50
  - qundo
51
+ - qless
51
52
  extensions: []
52
53
  extra_rdoc_files: []
53
54
  files:
@@ -60,6 +61,7 @@ files:
60
61
  - bin/console
61
62
  - bin/qclean
62
63
  - bin/qcount
64
+ - bin/qless
63
65
  - bin/qnode
64
66
  - bin/qqsub
65
67
  - bin/qundo