qtools 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/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +62 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/qclean +21 -0
- data/bin/qcount +19 -0
- data/bin/qqsub +60 -0
- data/bin/qwatch +19 -0
- data/bin/setup +7 -0
- data/lib/qtools.rb +15 -0
- data/lib/qtools/version.rb +3 -0
- data/qtools.gemspec +33 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6ed2d64dbe14a964bbedfff825b1f7fcf878e900
|
4
|
+
data.tar.gz: e6cfa1e6905e2ef6f0302e7d8c7472bf368e3a6b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9b2ba9c5e1cbfccd2bbf941e0efed436812845e9b4649436810270983b9726d3e4d7ab151ad4cc0441c72cb2405862593afb9e70e12b6069c2c1ff3e5d22c65f
|
7
|
+
data.tar.gz: 274544a27219e7aa73cbc4fe5b696cfcf2831288e01c4d93a5af52cd722721045d78dad1f8f150fed7c42b0247c5946f2a6bbc2318c2cb94d4562b48907e0766
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Daniel
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# qtools
|
2
|
+
|
3
|
+
`qtools` offers the shortcuts for some common procedures when working with the Open Grid Scheduler.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Install `qtools` using `gem`:
|
9
|
+
|
10
|
+
$ gem install qtools
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
- `qqsub` to submit a script or a compiled executable
|
15
|
+
- `qwatch` to see the running jobs for the current user
|
16
|
+
- `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
|
+
|
19
|
+
### qqsub
|
20
|
+
|
21
|
+
Usage:
|
22
|
+
|
23
|
+
$ qqsub 'python3 my_script.py -i input.txt -v' -n my_name -m 8gb
|
24
|
+
|
25
|
+
The command above will create a shell script file with the corresponding content and submit a job which will feature the name `my_name` and require `8gb` of memory.
|
26
|
+
|
27
|
+
### qwatch
|
28
|
+
|
29
|
+
Usage:
|
30
|
+
|
31
|
+
$ qwatch
|
32
|
+
|
33
|
+
The command above is equivalent to running `watch -n1 -d "qstat -u $USER"`.
|
34
|
+
|
35
|
+
Flags:
|
36
|
+
|
37
|
+
- `-n`, `--nodes` to show information on nodes too (`qstat -n1 -u $USER`)
|
38
|
+
|
39
|
+
### qclean
|
40
|
+
|
41
|
+
Usage:
|
42
|
+
|
43
|
+
$ qclean
|
44
|
+
|
45
|
+
The command above will run `rm *.[eo][0-9]*` in the current directory (if such files exist).
|
46
|
+
|
47
|
+
### qcount
|
48
|
+
|
49
|
+
Usage:
|
50
|
+
|
51
|
+
$ qcount
|
52
|
+
|
53
|
+
Count the number of jobs for the `$USER`. Running `qcount -a` will output the number of jobs for all the users.
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/kerkomen/qtools).
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
62
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "qtools"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/qclean
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'qtools'
|
4
|
+
|
5
|
+
files = `ls *.[eo][0-9]* 2> /dev/null`
|
6
|
+
|
7
|
+
unless files.empty?
|
8
|
+
puts "-- The following files will be removed:"
|
9
|
+
puts files
|
10
|
+
puts "-- Continue? [y/n]"
|
11
|
+
|
12
|
+
answer = gets.strip.downcase
|
13
|
+
if answer == 'y' or answer == 'yes'
|
14
|
+
system("rm *.[eo][0-9]*")
|
15
|
+
puts "-- Ok, master. The files are removed!"
|
16
|
+
else
|
17
|
+
puts "-- Ok, master. No means no."
|
18
|
+
end
|
19
|
+
else
|
20
|
+
puts "-- It's pretty clean in this folder... No files to be removed."
|
21
|
+
end
|
data/bin/qcount
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'qtools'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
OptionParser.new do |opts|
|
8
|
+
opts.banner = "Usage: qwatch [options]"
|
9
|
+
|
10
|
+
opts.on("-a", "--all", "Count jobs for all users") do |n|
|
11
|
+
options[:all] = n
|
12
|
+
end
|
13
|
+
end.parse!
|
14
|
+
|
15
|
+
flags = []
|
16
|
+
flags << '-u $USER' unless options[:all]
|
17
|
+
flags_str = flags.join(' ')
|
18
|
+
|
19
|
+
puts `qstat #{flags_str} | grep -c ^[0-9]`
|
data/bin/qqsub
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'qtools'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
Options = Struct.new(:name, :mem)
|
7
|
+
|
8
|
+
args = Options.new(:name, :mem)
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: qtools 'python3 my_script.py ...' [options]"
|
11
|
+
|
12
|
+
opts.on("-n", "--name NAME", "Name for the job") do |n|
|
13
|
+
args.name = n
|
14
|
+
end
|
15
|
+
opts.on("-m", "--memory MEMORY", "Memory for the job (e.g., 80gb)") do |m|
|
16
|
+
args.mem = m
|
17
|
+
end
|
18
|
+
end.parse!
|
19
|
+
|
20
|
+
command = ARGV
|
21
|
+
|
22
|
+
if command.empty?
|
23
|
+
fail "Usage: qtools 'python3 my_script.py ...' [options]"
|
24
|
+
end
|
25
|
+
|
26
|
+
header_sge = <<-HEADER
|
27
|
+
#!/bin/bash
|
28
|
+
|
29
|
+
#$ -V
|
30
|
+
#$ -cwd
|
31
|
+
HEADER
|
32
|
+
|
33
|
+
header_shell = "#!/bin/bash\n"
|
34
|
+
|
35
|
+
header_pbs_tree = {}
|
36
|
+
header_pbs_tree[:l] = ['walltime=24:00:00']
|
37
|
+
header_pbs_tree[:d] = ['.']
|
38
|
+
|
39
|
+
unless args.name.is_a? Symbol
|
40
|
+
header_pbs_tree[:N] = [args.name]
|
41
|
+
end
|
42
|
+
|
43
|
+
unless args.mem.is_a? Symbol
|
44
|
+
header_pbs_tree[:l] << "mem=#{args.mem}"
|
45
|
+
end
|
46
|
+
|
47
|
+
header_pbs = header_pbs_tree.map { |k, v| "#PBS -#{k} #{v.join(',')}" }.join("\n")
|
48
|
+
|
49
|
+
sh_name = command[0].split[1].match(/(.*)\.(.*?)/)[1] + '.sh'
|
50
|
+
|
51
|
+
File.write(sh_name, [header_shell, header_pbs, "", command[0]].join("\n"))
|
52
|
+
|
53
|
+
puts "-- Submit #{sh_name} for execution? [y/n]"
|
54
|
+
answer = STDIN.gets.strip.downcase
|
55
|
+
if answer == 'y' or answer == 'yes'
|
56
|
+
system("qsub #{sh_name}")
|
57
|
+
puts "-- Ok, master, #{sh_name} is submitted."
|
58
|
+
else
|
59
|
+
puts "-- Ok, master. No means no."
|
60
|
+
end
|
data/bin/qwatch
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'qtools'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
OptionParser.new do |opts|
|
8
|
+
opts.banner = "Usage: qwatch [options]"
|
9
|
+
|
10
|
+
opts.on("-n", "--nodes", "Show nodes") do |n|
|
11
|
+
options[:nodes] = n
|
12
|
+
end
|
13
|
+
end.parse!
|
14
|
+
|
15
|
+
flags = []
|
16
|
+
flags << '-n1' if options[:nodes]
|
17
|
+
flags_str = flags.join(' ')
|
18
|
+
|
19
|
+
system("watch -n1 -d \"qstat #{flags_str} -u $USER\"")
|
data/bin/setup
ADDED
data/lib/qtools.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
help_string = <<-HELP
|
4
|
+
|
5
|
+
-- qtools:
|
6
|
+
- qqsub to submit a script or a compiled executable
|
7
|
+
- qwatch to see the running jobs for the current user
|
8
|
+
- qclean to remove .e* and .o* run files in the current directory
|
9
|
+
|
10
|
+
HELP
|
11
|
+
|
12
|
+
|
13
|
+
def help
|
14
|
+
puts help_string
|
15
|
+
end
|
data/qtools.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'qtools/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "qtools"
|
8
|
+
spec.version = Qtools::VERSION
|
9
|
+
spec.authors = ["Daniel"]
|
10
|
+
spec.email = ["@"]
|
11
|
+
|
12
|
+
spec.summary = %q{ Shortcuts for the Open Grid Scheduler }
|
13
|
+
spec.description = %q{ Make the most common Sun Grid Engine programs more effective. }
|
14
|
+
spec.homepage = "https://github.com/kerkomen/qtools"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
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}
|
27
|
+
spec.bindir = "bin"
|
28
|
+
spec.executables = ["qwatch", "qclean", "qqsub", "qcount"]
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
32
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: qtools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: " Make the most common Sun Grid Engine programs more effective. "
|
42
|
+
email:
|
43
|
+
- "@"
|
44
|
+
executables:
|
45
|
+
- qwatch
|
46
|
+
- qclean
|
47
|
+
- qqsub
|
48
|
+
- qcount
|
49
|
+
extensions: []
|
50
|
+
extra_rdoc_files: []
|
51
|
+
files:
|
52
|
+
- ".gitignore"
|
53
|
+
- ".travis.yml"
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- bin/console
|
59
|
+
- bin/qclean
|
60
|
+
- bin/qcount
|
61
|
+
- bin/qqsub
|
62
|
+
- bin/qwatch
|
63
|
+
- bin/setup
|
64
|
+
- lib/qtools.rb
|
65
|
+
- lib/qtools/version.rb
|
66
|
+
- qtools.gemspec
|
67
|
+
homepage: https://github.com/kerkomen/qtools
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata:
|
71
|
+
allowed_push_host: https://rubygems.org
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.5.1
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: Shortcuts for the Open Grid Scheduler
|
92
|
+
test_files: []
|