qtools 0.1.0 → 0.2.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: 6ed2d64dbe14a964bbedfff825b1f7fcf878e900
4
- data.tar.gz: e6cfa1e6905e2ef6f0302e7d8c7472bf368e3a6b
3
+ metadata.gz: a24f89187ce4a9fa8cb311cb67124bf5db0b23e7
4
+ data.tar.gz: 9c45dd74946bd5f309d597c74ede078be9c07e0a
5
5
  SHA512:
6
- metadata.gz: 9b2ba9c5e1cbfccd2bbf941e0efed436812845e9b4649436810270983b9726d3e4d7ab151ad4cc0441c72cb2405862593afb9e70e12b6069c2c1ff3e5d22c65f
7
- data.tar.gz: 274544a27219e7aa73cbc4fe5b696cfcf2831288e01c4d93a5af52cd722721045d78dad1f8f150fed7c42b0247c5946f2a6bbc2318c2cb94d4562b48907e0766
6
+ metadata.gz: 2332ff59ecc9f734fd68ed9d96b6d0d1dd5f27029a51a4bd9fde3a8b81ac9980be9ff2e7fd2eed6a72c6673c154e7a833e0360b25b2f94aca1dcaf0b55ce5679
7
+ data.tar.gz: 4de88930e6b3db1800fa16aa403a683834ff1b4e672f2f67319b58dbc7109f19dc8f847dc6894f176f867811d8f335cd7c4e77ae30c6e737c70022bf9ba41c8a
data/README.md CHANGED
@@ -12,9 +12,10 @@ Install `qtools` using `gem`:
12
12
  ## Usage
13
13
 
14
14
  - `qqsub` to submit a script or a compiled executable
15
+ - `qclean` to remove `.e[0-9]*` and `.o[0-9]*` files in the current directory
15
16
  - `qwatch` to see the running jobs for the current user
16
17
  - `qcount` to see the number of running jobs for the current user
17
- - `qclean` to remove `.e[0-9]*` and `.o[0-9]*` files in the current directory
18
+ - `qnode` to see the free nodes
18
19
 
19
20
  ### qqsub
20
21
 
@@ -52,6 +53,14 @@ Usage:
52
53
 
53
54
  Count the number of jobs for the `$USER`. Running `qcount -a` will output the number of jobs for all the users.
54
55
 
56
+ ### qnode
57
+
58
+ Usage:
59
+
60
+ $ qnode
61
+
62
+ The command above will print the list of free nodes sorted by their `LOAD`. Use `qnode -m` to sort the list of free nodes by memory available and `qnode -c` to sort the list by the number of free cores.
63
+
55
64
  ## Contributing
56
65
 
57
66
  Bug reports and pull requests are welcome on [GitHub](https://github.com/kerkomen/qtools).
data/bin/qcount CHANGED
@@ -5,7 +5,7 @@ require 'optparse'
5
5
 
6
6
  options = {}
7
7
  OptionParser.new do |opts|
8
- opts.banner = "Usage: qwatch [options]"
8
+ opts.banner = "Usage: qcount [options]"
9
9
 
10
10
  opts.on("-a", "--all", "Count jobs for all users") do |n|
11
11
  options[:all] = n
data/bin/qnode ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'qtools'
4
+ require 'optparse'
5
+
6
+ options = {}
7
+ OptionParser.new do |opts|
8
+ opts.banner = "Usage: qnode [options]"
9
+
10
+ opts.on("-m", "--memory", "Sort free nodes by available memory") do |m|
11
+ options[:memory] = m
12
+ end
13
+ opts.on("-c", "--cores", "Sort free nodes by free cores") do |c|
14
+ options[:cores] = c
15
+ end
16
+ end.parse!
17
+
18
+ flags = []
19
+ flags << (options[:memory] ? '-k5nr' : '-k3n') # :cores is a special case
20
+ flags_str = flags.join(' ')
21
+
22
+ unless options[:cores]
23
+ puts `qhost | head -n2`
24
+ puts `qhost | grep free | sort #{flags_str}`
25
+ else
26
+ header = `qhost | head -n1`
27
+ new_header = header.strip.gsub("CORES_TOTAL(USED)", "CORES_TOTAL\tCORES_USED") + "\tCORES_FREE"
28
+ puts new_header
29
+ puts `qhost | head -n2 | tail -n1`
30
+ puts `qhost | egrep 'free' | sort -k5nr | tr "(" "\t" | tr -d ")" | awk 'BEGIN {OFS="\t"}; {print $0, $2-$3}'`
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Qtools
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.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/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/setup lib/qtools.rb lib/qtools/version.rb qtools.gemspec}
27
27
  spec.bindir = "bin"
28
- spec.executables = ["qwatch", "qclean", "qqsub", "qcount"]
28
+ spec.executables = ["qwatch", "qclean", "qqsub", "qcount", "qnode"]
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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel
@@ -46,6 +46,7 @@ executables:
46
46
  - qclean
47
47
  - qqsub
48
48
  - qcount
49
+ - qnode
49
50
  extensions: []
50
51
  extra_rdoc_files: []
51
52
  files:
@@ -58,6 +59,7 @@ files:
58
59
  - bin/console
59
60
  - bin/qclean
60
61
  - bin/qcount
62
+ - bin/qnode
61
63
  - bin/qqsub
62
64
  - bin/qwatch
63
65
  - bin/setup