osc-machete 1.2.2 → 2.0.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -65
- data/lib/osc/machete/job.rb +2 -2
- data/lib/osc/machete/process.rb +0 -3
- data/lib/osc/machete/status.rb +29 -50
- data/lib/osc/machete/torque_helper.rb +34 -41
- data/lib/osc/machete/user.rb +0 -3
- data/lib/osc/machete/version.rb +1 -1
- data/test/fixtures/quick.sh +1 -1
- data/test/test_job_dir.rb +1 -1
- data/test/test_location.rb +19 -19
- data/test/test_torque_helper.rb +4 -49
- data/test/test_torque_helper_live.rb +7 -7
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe29b9e8fa7070fd4c9bfa478b099139b3dae53e
|
4
|
+
data.tar.gz: f9f4ebb8a5e5f1c826cee99dd6222a78e4992161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6891917bb5a5642affd5523c63668093a4b5249b9dbc85220d23eda7950465d01872fb982766c918a29345b394a55ea7cc1179f9e383216ed10f11905af9cd87
|
7
|
+
data.tar.gz: 3a0056549f935f4ba18b4b0bbf3ec41ccb8011dc27f3ac35e272f589086c3971bbb7873c8c6a6bf6f62a96d72de8a241847db207979c5a29a6c818749ec9a886
|
data/CHANGELOG.md
CHANGED
@@ -5,64 +5,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
-
## [1.2.2] - 2017-08-04
|
9
|
-
|
10
|
-
### Fixed
|
11
|
-
|
12
|
-
- host name for Ruby Cluster changed
|
13
|
-
|
14
|
-
## [1.2.1] - 2016-12-16
|
15
|
-
|
16
|
-
### Fixed
|
17
|
-
|
18
|
-
- host name for Quick Cluster changed
|
19
|
-
|
20
|
-
## [1.2.0] - 2016-09-06
|
21
|
-
|
22
|
-
### Added
|
23
|
-
|
24
|
-
- TorqueHelper.default= so we can specify a different TorqueHelper
|
25
|
-
- TorqueHelper#pbs to get the PBS::Batch object for the given id, script, or host.
|
26
|
-
This lets us change the TorqueHelper instance used as a default with a
|
27
|
-
different TorqueHelper class or instance that has a different implementation
|
28
|
-
of TorqueHelper#pbs.
|
29
|
-
- (OSC specific) Owens cluster support
|
30
|
-
- (OSC specific) LIB and BIN for specifying torque lib locations
|
31
|
-
|
32
|
-
### Changed
|
33
|
-
|
34
|
-
- Depends on latest version of pbs ruby gem 2.0
|
35
|
-
- TorqueHelper.default returns the same instance every time (which is now
|
36
|
-
memoized) instead of creating a new instance
|
37
|
-
|
38
|
-
### Deprecated
|
39
|
-
|
40
|
-
- `OSC::Machete::User` - use `OodSupport::User` instead
|
41
|
-
- `OSC::Machete::Process` - use `OodSupport::Process` instead
|
42
|
-
|
43
|
-
### Fixed
|
44
|
-
|
45
|
-
- yardoc documentation for OSC::Machete::Status class methods
|
46
|
-
- deprecation warnings by using File.exist? instead of File.exists?
|
47
|
-
|
48
|
-
## [1.1.4] - 2016-08-17
|
49
|
-
|
50
|
-
### Added
|
51
|
-
|
52
|
-
- `Job#host` getter (which should have been there but was accidentally omitted)
|
53
|
-
|
54
|
-
## [1.1.3] - 2016-06-07
|
55
|
-
|
56
|
-
### Fixed
|
57
|
-
|
58
|
-
- README and gemspec docs update for rubygems.org release
|
59
|
-
|
60
|
-
## [1.1.2] - 2016-06-07
|
61
|
-
|
62
|
-
### Fixed
|
63
|
-
|
64
|
-
- Copyright in LICENSE.txt
|
65
|
-
|
66
8
|
## [1.1.1] - 2016-02-24
|
67
9
|
|
68
10
|
### Fixed
|
@@ -137,13 +79,7 @@ lib/osc/machete/torque_helper.rb _(still an internal class right now, not meant
|
|
137
79
|
|
138
80
|
Previous release of osc-machete
|
139
81
|
|
140
|
-
[Unreleased]: https://github.com/AweSim-OSC/osc-machete/compare/v1.
|
141
|
-
[1.2.2]: https://github.com/AweSim-OSC/osc-machete/compare/v1.2.1...v1.2.2
|
142
|
-
[1.2.1]: https://github.com/AweSim-OSC/osc-machete/compare/v1.2.0...v1.2.1
|
143
|
-
[1.2.0]: https://github.com/AweSim-OSC/osc-machete/compare/v1.1.4...v1.2.0
|
144
|
-
[1.1.4]: https://github.com/AweSim-OSC/osc-machete/compare/v1.1.3...v1.1.4
|
145
|
-
[1.1.3]: https://github.com/AweSim-OSC/osc-machete/compare/v1.1.2...v1.1.3
|
146
|
-
[1.1.2]: https://github.com/AweSim-OSC/osc-machete/compare/v1.1.1...v1.1.2
|
82
|
+
[Unreleased]: https://github.com/AweSim-OSC/osc-machete/compare/v1.1.1...master
|
147
83
|
[1.1.1]: https://github.com/AweSim-OSC/osc-machete/compare/v1.1.0...v1.1.1
|
148
84
|
[1.1.0]: https://github.com/AweSim-OSC/osc-machete/compare/v1.0.1...v1.1.0
|
149
85
|
[1.0.1]: https://github.com/AweSim-OSC/osc-machete/compare/v1.0.0...v1.0.1
|
data/lib/osc/machete/job.rb
CHANGED
@@ -56,7 +56,7 @@ require 'pathname'
|
|
56
56
|
# @return [String, nil] path of the job script, or nil if not set
|
57
57
|
#
|
58
58
|
class OSC::Machete::Job
|
59
|
-
attr_reader :pbsid, :script_path, :account_string
|
59
|
+
attr_reader :pbsid, :script_path, :account_string
|
60
60
|
|
61
61
|
class << self
|
62
62
|
# set this to change the billable account that is used by default
|
@@ -205,7 +205,7 @@ class OSC::Machete::Job
|
|
205
205
|
# something if the script name is munged
|
206
206
|
|
207
207
|
# recursively delete the directory after killing the job
|
208
|
-
Pathname.new(path).rmtree if path && rmdir && File.
|
208
|
+
Pathname.new(path).rmtree if path && rmdir && File.exists?(path)
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
data/lib/osc/machete/process.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
# Class that maintains the User and additional methods for the process.
|
2
2
|
# Helper methods provided use the Process module underneath.
|
3
3
|
#
|
4
|
-
# @deprecated Please use {http://www.rubydoc.info/gems/ood_support/OodSupport/Process OodSupport::Process} instead.
|
5
4
|
class OSC::Machete::Process
|
6
5
|
|
7
6
|
def initialize
|
8
7
|
@user = OSC::Machete::User.from_uid(Process.uid)
|
9
|
-
|
10
|
-
warn "[DEPRECATION] `OSC::Machete::Process` is deprecated. Please use `OodSupport::Process` instead (see ood_support gem)."
|
11
8
|
end
|
12
9
|
|
13
10
|
# The system name of the process user
|
data/lib/osc/machete/status.rb
CHANGED
@@ -55,42 +55,27 @@ class OSC::Machete::Status
|
|
55
55
|
end
|
56
56
|
|
57
57
|
|
58
|
-
#
|
59
|
-
#
|
60
|
-
|
61
|
-
#
|
62
|
-
|
63
|
-
#
|
64
|
-
|
65
|
-
#
|
66
|
-
|
67
|
-
#
|
68
|
-
|
58
|
+
# TODO: these methods are previously declared so we can document them easily
|
59
|
+
# if there is a better way to document class methods we'll do that
|
60
|
+
|
61
|
+
# @return [Status]
|
62
|
+
def self.undetermined() end
|
63
|
+
# @return [Status]
|
64
|
+
def self.not_submitted() end
|
65
|
+
# @return [Status]
|
66
|
+
def self.passed() end
|
67
|
+
# @return [Status]
|
68
|
+
def self.failed() end
|
69
|
+
# @return [Status]
|
70
|
+
def self.running() end
|
71
|
+
# @return [Status]
|
72
|
+
def self.queued() end
|
73
|
+
# @return [Status]
|
74
|
+
def self.held() end
|
75
|
+
# @return [Status]
|
76
|
+
def self.suspended() end
|
77
|
+
|
69
78
|
class << self
|
70
|
-
# @!method undetermined
|
71
|
-
# A 'null' special case for Status
|
72
|
-
# @return [Status]
|
73
|
-
#
|
74
|
-
# @!method not_submitted
|
75
|
-
# @return [Status]
|
76
|
-
#
|
77
|
-
# @!method passed
|
78
|
-
# @return [Status]
|
79
|
-
#
|
80
|
-
# @!method failed
|
81
|
-
# @return [Status]
|
82
|
-
#
|
83
|
-
# @!method running
|
84
|
-
# @return [Status]
|
85
|
-
#
|
86
|
-
# @!method queued
|
87
|
-
# @return [Status]
|
88
|
-
#
|
89
|
-
# @!method held
|
90
|
-
# @return [Status]
|
91
|
-
#
|
92
|
-
# @!method suspended
|
93
|
-
# @return [Status]
|
94
79
|
VALUES_HASH.each do |char, name|
|
95
80
|
define_method(name) do
|
96
81
|
OSC::Machete::Status.new(char)
|
@@ -99,28 +84,22 @@ class OSC::Machete::Status
|
|
99
84
|
end
|
100
85
|
|
101
86
|
# @!method undetermined?
|
102
|
-
#
|
103
|
-
|
87
|
+
# the Status value Null object
|
88
|
+
# @return [Boolean] true if undetermined
|
104
89
|
# @!method not_submitted?
|
105
|
-
#
|
106
|
-
|
90
|
+
# @return [Boolean] true if not_submitted
|
107
91
|
# @!method failed?
|
108
|
-
#
|
109
|
-
|
92
|
+
# @return [Boolean] true if failed
|
110
93
|
# @!method passed?
|
111
|
-
#
|
112
|
-
|
94
|
+
# @return [Boolean] true if passed
|
113
95
|
# @!method held?
|
114
|
-
#
|
115
|
-
|
96
|
+
# @return [Boolean] true if held
|
116
97
|
# @!method queued?
|
117
|
-
#
|
118
|
-
|
98
|
+
# @return [Boolean] true if queued
|
119
99
|
# @!method running?
|
120
|
-
#
|
121
|
-
|
100
|
+
# @return [Boolean] true if running
|
122
101
|
# @!method suspended?
|
123
|
-
#
|
102
|
+
# @return [Boolean] true if suspended
|
124
103
|
VALUES_HASH.each do |char, name|
|
125
104
|
define_method("#{name}?") do
|
126
105
|
self == OSC::Machete::Status.new(char)
|
@@ -8,31 +8,24 @@ require 'pbs'
|
|
8
8
|
# == FIXME: This contains no state whatsoever. It should probably be changed into a module.
|
9
9
|
class OSC::Machete::TorqueHelper
|
10
10
|
# FIXME: Use ood_cluster gem
|
11
|
-
|
12
|
-
BIN = ENV['TORQUE_BIN'] || '/opt/torque/bin'
|
11
|
+
PREFIX = '/usr/local/torque/default'
|
13
12
|
HOSTS = {
|
14
13
|
'oakley' => 'oak-batch.osc.edu',
|
15
|
-
'ruby' => 'ruby-batch.
|
16
|
-
'quick' => 'quick-batch.
|
17
|
-
'owens' => 'owens-batch.ten.osc.edu',
|
18
|
-
:default => 'oak-batch.osc.edu'
|
14
|
+
'ruby' => 'ruby-batch.osc.edu',
|
15
|
+
'quick' => 'quick-batch.osc.edu'
|
19
16
|
}
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
attr_writer :default
|
25
|
-
def default
|
26
|
-
@default ||= self::new()
|
27
|
-
end
|
18
|
+
# Alias to initialize a new object.
|
19
|
+
def self.default
|
20
|
+
self::new()
|
28
21
|
end
|
29
22
|
|
30
23
|
# Returns an OSC::Machete::Status ValueObject for a char
|
31
24
|
#
|
32
25
|
# @param [String] char The Torque status char
|
33
26
|
#
|
34
|
-
# @example
|
35
|
-
# status_for_char("C") #=> OSC::Machete::Status.
|
27
|
+
# @example Completed
|
28
|
+
# status_for_char("C") #=> OSC::Machete::Status.completed
|
36
29
|
# @example Queued
|
37
30
|
# status_for_char("W") #=> OSC::Machete::Status.queued
|
38
31
|
#
|
@@ -65,6 +58,15 @@ class OSC::Machete::TorqueHelper
|
|
65
58
|
#
|
66
59
|
# Bills against the project specified by the primary group of the user.
|
67
60
|
def qsub(script, host: nil, depends_on: {}, account_string: nil)
|
61
|
+
# if the script is set to run on Oakley in PBS headers
|
62
|
+
# this is to obviate current torque filter defect in which
|
63
|
+
# a script with PBS header set to specify oak-batch ends
|
64
|
+
# isn't properly handled and the job gets limited to 4GB
|
65
|
+
pbs = PBS::Batch.new(
|
66
|
+
host: HOSTS.fetch( host || host_from_script_pbs_header(script) ),
|
67
|
+
prefix: PREFIX
|
68
|
+
)
|
69
|
+
|
68
70
|
headers = { depend: qsub_dependencies_header(depends_on) }
|
69
71
|
headers.clear if headers[:depend].empty?
|
70
72
|
|
@@ -78,7 +80,7 @@ class OSC::Machete::TorqueHelper
|
|
78
80
|
headers[PBS::ATTR[:A]] = default_account_string
|
79
81
|
end
|
80
82
|
|
81
|
-
pbs
|
83
|
+
pbs.submit_script(script, headers: headers, qsub: true)
|
82
84
|
end
|
83
85
|
|
84
86
|
# convert dependencies hash to a PBS header string
|
@@ -112,7 +114,12 @@ class OSC::Machete::TorqueHelper
|
|
112
114
|
# @return [Status] The job state
|
113
115
|
def qstat(pbsid, host: nil)
|
114
116
|
id = pbsid.to_s
|
115
|
-
|
117
|
+
pbs = PBS::Batch.new(
|
118
|
+
host: HOSTS.fetch( host || host_from_pbsid(id) ),
|
119
|
+
prefix: PREFIX
|
120
|
+
)
|
121
|
+
|
122
|
+
status = pbs.get_job(id, filters: [:job_state])
|
116
123
|
status_for_char status[id][:job_state][0] # get status from status char value
|
117
124
|
rescue PBS::UnkjobidError
|
118
125
|
OSC::Machete::Status.passed
|
@@ -125,30 +132,16 @@ class OSC::Machete::TorqueHelper
|
|
125
132
|
# @return [nil]
|
126
133
|
def qdel(pbsid, host: nil)
|
127
134
|
id = pbsid.to_s
|
128
|
-
pbs
|
135
|
+
pbs = PBS::Batch.new(
|
136
|
+
host: HOSTS.fetch( host || host_from_pbsid(id) ),
|
137
|
+
prefix: PREFIX
|
138
|
+
)
|
139
|
+
|
140
|
+
pbs.delete_job(id)
|
129
141
|
rescue PBS::UnkjobidError
|
130
142
|
# Common use case where trying to delete a job that is no longer in the system.
|
131
143
|
end
|
132
144
|
|
133
|
-
def pbs(host: nil, id: nil, script: nil)
|
134
|
-
if host
|
135
|
-
# actually check if host is "oakley" i.e. a cluster key
|
136
|
-
host = HOSTS.fetch(host.to_s, host.to_s)
|
137
|
-
else
|
138
|
-
# try to determine host
|
139
|
-
key = host_from_pbsid(id) if id
|
140
|
-
key = host_from_script_pbs_header(script) if script && key.nil?
|
141
|
-
|
142
|
-
host = HOSTS.fetch(key, HOSTS.fetch(:default))
|
143
|
-
end
|
144
|
-
|
145
|
-
PBS::Batch.new(
|
146
|
-
host: host,
|
147
|
-
lib: LIB,
|
148
|
-
bin: BIN
|
149
|
-
)
|
150
|
-
end
|
151
|
-
|
152
145
|
private
|
153
146
|
# return the name of the host to use based on the pbs header
|
154
147
|
# TODO: Think of a more efficient way to do this.
|
@@ -159,8 +152,8 @@ class OSC::Machete::TorqueHelper
|
|
159
152
|
"ruby"
|
160
153
|
elsif (File.open(script) { |f| f.read =~ /#PBS -q @quick-batch/ })
|
161
154
|
"quick"
|
162
|
-
|
163
|
-
"
|
155
|
+
else
|
156
|
+
"oakley" # DEFAULT
|
164
157
|
end
|
165
158
|
end
|
166
159
|
|
@@ -172,8 +165,8 @@ class OSC::Machete::TorqueHelper
|
|
172
165
|
"ruby"
|
173
166
|
elsif (pbsid =~ /quick/ )
|
174
167
|
"quick"
|
175
|
-
|
176
|
-
"
|
168
|
+
else
|
169
|
+
"oakley" # DEFAULT
|
177
170
|
end
|
178
171
|
end
|
179
172
|
end
|
data/lib/osc/machete/user.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Class that maintains the name and home identifiers of a User.
|
2
2
|
# Helper methods provided use the Etc module underneath.
|
3
3
|
#
|
4
|
-
# @deprecated Please use {http://www.rubydoc.info/gems/ood_support/OodSupport/User OodSupport::User} instead.
|
5
4
|
class OSC::Machete::User
|
6
5
|
|
7
6
|
attr_reader :name
|
@@ -20,8 +19,6 @@ class OSC::Machete::User
|
|
20
19
|
#
|
21
20
|
def initialize(username = Etc.getpwuid.name)
|
22
21
|
@name = username
|
23
|
-
|
24
|
-
warn "[DEPRECATION] `OSC::Machete::User` is deprecated. Please use `OodSupport::User` instead (see ood_support gem)."
|
25
22
|
end
|
26
23
|
|
27
24
|
# factory method to produce a User from specified uid
|
data/lib/osc/machete/version.rb
CHANGED
data/test/fixtures/quick.sh
CHANGED
data/test/test_job_dir.rb
CHANGED
@@ -34,6 +34,6 @@ class TestJobDir < Minitest::Test
|
|
34
34
|
# Create unique directory
|
35
35
|
new_jobdir = OSC::Machete::JobDir.new(@parent).new_jobdir
|
36
36
|
Dir.mkdir(new_jobdir)
|
37
|
-
assert Dir.
|
37
|
+
assert Dir.exists?("#{@parent}/9"), "Directory was not created: #{@parent}/9"
|
38
38
|
end
|
39
39
|
end
|
data/test/test_location.rb
CHANGED
@@ -24,41 +24,41 @@ class TestLocation < Minitest::Test
|
|
24
24
|
def test_render_default_replace_template
|
25
25
|
setup_render
|
26
26
|
@location1.render("")
|
27
|
-
assert_equal true, File.
|
28
|
-
assert_equal false, File.
|
27
|
+
assert_equal true, File.exists?("#{@dir1}/file.txt")
|
28
|
+
assert_equal false, File.exists?("#{@dir1}/file.txt.mustache")
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_render_user_replace_template
|
32
32
|
setup_render
|
33
33
|
@location1.render("", {replace: true})
|
34
|
-
assert_equal true, File.
|
35
|
-
assert_equal false, File.
|
34
|
+
assert_equal true, File.exists?("#{@dir1}/file.txt")
|
35
|
+
assert_equal false, File.exists?("#{@dir1}/file.txt.mustache")
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_render_user_doesnt_replace_template
|
39
39
|
setup_render
|
40
40
|
@location1.render("", {replace: false})
|
41
|
-
assert_equal true, File.
|
42
|
-
assert_equal true, File.
|
41
|
+
assert_equal true, File.exists?("#{@dir1}/file.txt")
|
42
|
+
assert_equal true, File.exists?("#{@dir1}/file.txt.mustache")
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_copy_to_shouldnt_copy_developer_files
|
46
46
|
setup_copy_to
|
47
47
|
|
48
48
|
@location1.copy_to(@dir2)
|
49
|
-
assert_equal true, Dir.
|
50
|
-
assert_equal false, Dir.
|
51
|
-
assert_equal false, Dir.
|
52
|
-
assert_equal false, Dir.
|
53
|
-
assert_equal true, Dir.
|
54
|
-
assert_equal true, File.
|
55
|
-
assert_equal false, File.
|
56
|
-
assert_equal true, File.
|
57
|
-
assert_equal false, File.
|
58
|
-
assert_equal false, File.
|
59
|
-
assert_equal false, File.
|
60
|
-
assert_equal true, File.
|
61
|
-
assert_equal false, File.
|
49
|
+
assert_equal true, Dir.exists?("#{@dir2}")
|
50
|
+
assert_equal false, Dir.exists?("#{@dir2}/.git")
|
51
|
+
assert_equal false, Dir.exists?("#{@dir2}/.svn")
|
52
|
+
assert_equal false, Dir.exists?("#{@dir2}/test.dir.1")
|
53
|
+
assert_equal true, Dir.exists?("#{@dir2}/test.dir.2")
|
54
|
+
assert_equal true, File.exists?("#{@dir2}/test.1")
|
55
|
+
assert_equal false, File.exists?("#{@dir2}/test.2")
|
56
|
+
assert_equal true, File.exists?("#{@dir2}/test.3")
|
57
|
+
assert_equal false, File.exists?("#{@dir2}/test.4")
|
58
|
+
assert_equal false, File.exists?("#{@dir2}/test.dir.2/test.1")
|
59
|
+
assert_equal false, File.exists?("#{@dir2}/test.dir.2/test.2")
|
60
|
+
assert_equal true, File.exists?("#{@dir2}/test.dir.2/test.4")
|
61
|
+
assert_equal false, File.exists?("#{@dir2}/.gitignore")
|
62
62
|
end
|
63
63
|
|
64
64
|
|
data/test/test_torque_helper.rb
CHANGED
@@ -106,7 +106,7 @@ class TestTorqueHelper < Minitest::Test
|
|
106
106
|
# Test that qdel works for quick batch
|
107
107
|
def test_qdel_quick
|
108
108
|
PBS::Batch.any_instance.stubs(:delete_job).returns(true)
|
109
|
-
assert_equal true, @shell.qdel("123.quick-batch.
|
109
|
+
assert_equal true, @shell.qdel("123.quick-batch.osc.edu")
|
110
110
|
PBS::Batch.any_instance.unstub(:delete_job)
|
111
111
|
end
|
112
112
|
|
@@ -120,18 +120,18 @@ class TestTorqueHelper < Minitest::Test
|
|
120
120
|
# Test that qdel throws exception on PBS exception
|
121
121
|
def test_qdel_throws_exception
|
122
122
|
PBS::Batch.any_instance.stubs(:delete_job).raises(PBS::Error)
|
123
|
-
assert_raises(PBS::Error) { @shell.qdel("123.quick-batch.
|
123
|
+
assert_raises(PBS::Error) { @shell.qdel("123.quick-batch.osc.edu") }
|
124
124
|
PBS::Batch.any_instance.unstub(:delete_job)
|
125
125
|
|
126
126
|
PBS::Batch.any_instance.stubs(:delete_job).raises(PBS::SystemError)
|
127
|
-
assert_raises(PBS::SystemError) { @shell.qdel("123.quick-batch.
|
127
|
+
assert_raises(PBS::SystemError) { @shell.qdel("123.quick-batch.osc.edu") }
|
128
128
|
PBS::Batch.any_instance.unstub(:delete_job)
|
129
129
|
end
|
130
130
|
|
131
131
|
# Test that qdel doesn't throw exception if Unknown Job Id exception
|
132
132
|
def test_qdel_doesnt_throw_exception_on_unknown_job_id
|
133
133
|
PBS::Batch.any_instance.stubs(:delete_job).raises(PBS::UnkjobidError)
|
134
|
-
@shell.qdel("123.quick-batch.
|
134
|
+
@shell.qdel("123.quick-batch.osc.edu")
|
135
135
|
PBS::Batch.any_instance.unstub(:delete_job)
|
136
136
|
end
|
137
137
|
|
@@ -206,49 +206,4 @@ class TestTorqueHelper < Minitest::Test
|
|
206
206
|
PBS::Batch.any_instance.unstub(:submit_script)
|
207
207
|
@shell.unstub(:default_account_string)
|
208
208
|
end
|
209
|
-
|
210
|
-
def test_pbs_default_host
|
211
|
-
s = @shell.pbs
|
212
|
-
assert_equal 'oak-batch.osc.edu', s.host
|
213
|
-
assert_equal OSC::Machete::TorqueHelper::LIB, s.lib.to_s
|
214
|
-
assert_equal OSC::Machete::TorqueHelper::BIN, s.bin.to_s
|
215
|
-
end
|
216
|
-
|
217
|
-
def test_pbs_host_variations
|
218
|
-
# you can use the cluster ids
|
219
|
-
assert_equal 'ruby-batch.ten.osc.edu', @shell.pbs(host: 'ruby').host
|
220
|
-
|
221
|
-
# or you can use the host itself
|
222
|
-
assert_equal 'ruby-batch.osc.edu', @shell.pbs(host: 'ruby-batch.osc.edu').host
|
223
|
-
assert_equal '@ruby-batch', @shell.pbs(host: '@ruby-batch').host
|
224
|
-
|
225
|
-
assert_equal 'ruby-batch.ten.osc.edu', @shell.pbs(id: '4567').host
|
226
|
-
assert_equal 'ruby-batch.ten.osc.edu', @shell.pbs(script: @script_ruby).host
|
227
|
-
assert_equal 'oak-batch.osc.edu', @shell.pbs(script: @script_oakley).host
|
228
|
-
end
|
229
|
-
|
230
|
-
def test_setting_default_torque_helper
|
231
|
-
d = OSC::Machete::TorqueHelper.default
|
232
|
-
|
233
|
-
assert_equal 'oak-batch.osc.edu', OSC::Machete::TorqueHelper.default.pbs.host
|
234
|
-
|
235
|
-
# this is an example of how you can quickly modify the default behavior of
|
236
|
-
# a TorqueHelper instance to provide a new host, id, and script
|
237
|
-
d2 = OSC::Machete::TorqueHelper.new
|
238
|
-
class << d2
|
239
|
-
def pbs(host: nil, id: nil, script: nil)
|
240
|
-
PBS::Batch.new(
|
241
|
-
host: "ruby-batch.osc.edu",
|
242
|
-
lib: LIB,
|
243
|
-
bin: BIN
|
244
|
-
)
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
OSC::Machete::TorqueHelper.default = d2
|
249
|
-
|
250
|
-
assert_equal 'ruby-batch.osc.edu', OSC::Machete::TorqueHelper.default.pbs.host
|
251
|
-
|
252
|
-
OSC::Machete::TorqueHelper.default = d
|
253
|
-
end
|
254
209
|
end
|
@@ -30,7 +30,7 @@ class TestTorqueHelperLive < Minitest::Test
|
|
30
30
|
# This raises an issue mentioning that it is not being submitted on the
|
31
31
|
# correct host, comment out the raise to skip the live tests.
|
32
32
|
# Maybe this would be better accomplished with a separate rake task.
|
33
|
-
@submit_host = "
|
33
|
+
@submit_host = "websvcs08.osc.edu"
|
34
34
|
|
35
35
|
@job_state_queued = OSC::Machete::Status.queued
|
36
36
|
@job_state_completed = OSC::Machete::Status.passed
|
@@ -71,7 +71,7 @@ class TestTorqueHelperLive < Minitest::Test
|
|
71
71
|
|
72
72
|
# Qstat it to make sure it's queued.
|
73
73
|
live_status = torque.qstat(live_job)
|
74
|
-
|
74
|
+
assert_equal @job_state_queued, live_status
|
75
75
|
|
76
76
|
# Delete it and assert true returned.
|
77
77
|
live_delete_status = torque.qdel(live_job)
|
@@ -102,7 +102,7 @@ class TestTorqueHelperLive < Minitest::Test
|
|
102
102
|
|
103
103
|
# Qstat it to make sure it's queued.
|
104
104
|
live_status = torque.qstat(live_job)
|
105
|
-
|
105
|
+
assert_equal @job_state_queued, live_status
|
106
106
|
|
107
107
|
# Delete it and assert true returned.
|
108
108
|
live_delete_status = torque.qdel(live_job)
|
@@ -128,11 +128,11 @@ class TestTorqueHelperLive < Minitest::Test
|
|
128
128
|
if Socket.gethostname == @submit_host
|
129
129
|
# Submit a small job.
|
130
130
|
live_job = torque.qsub(@script_ruby)
|
131
|
-
assert_match
|
131
|
+
assert_match /^\d+$/, live_job
|
132
132
|
|
133
133
|
# Qstat it to make sure it's queued.
|
134
134
|
live_status = torque.qstat(live_job)
|
135
|
-
|
135
|
+
assert_equal @job_state_queued, live_status
|
136
136
|
|
137
137
|
# Delete it and assert true returned.
|
138
138
|
live_delete_status = torque.qdel(live_job)
|
@@ -157,11 +157,11 @@ class TestTorqueHelperLive < Minitest::Test
|
|
157
157
|
if Socket.gethostname == @submit_host
|
158
158
|
# Submit a small job.
|
159
159
|
live_job = torque.qsub(@script_quick, host: 'quick')
|
160
|
-
assert_match
|
160
|
+
assert_match /\d+.quick-batch.osc.edu/, live_job
|
161
161
|
|
162
162
|
# Qstat it to make sure it's queued.
|
163
163
|
live_status = torque.qstat(live_job)
|
164
|
-
|
164
|
+
assert_equal @job_state_queued, live_status
|
165
165
|
|
166
166
|
# Delete it and assert true returned.
|
167
167
|
live_delete_status = torque.qdel(live_job)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osc-machete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Franz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -149,9 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '2.2'
|
150
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
|
-
- - "
|
152
|
+
- - ">"
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
154
|
+
version: 1.3.1
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project:
|
157
157
|
rubygems_version: 2.4.5
|
@@ -175,3 +175,4 @@ test_files:
|
|
175
175
|
- test/test_status.rb
|
176
176
|
- test/test_torque_helper.rb
|
177
177
|
- test/test_torque_helper_live.rb
|
178
|
+
has_rdoc:
|