-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related: elastic/elasticsearch#3368 See: http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cluster-pending.html
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
elasticsearch-api/lib/elasticsearch/api/actions/cluster/pending_tasks.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module Elasticsearch | ||
module API | ||
module Cluster | ||
module Actions | ||
|
||
# Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) | ||
# which have not yet been executed and are queued up. | ||
# | ||
# @example Get a list of currently queued up tasks in the cluster | ||
# | ||
# client.cluster.pending_tasks | ||
# | ||
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node | ||
# (default: false) | ||
# @option arguments [Time] :master_timeout Specify timeout for connection to master | ||
# | ||
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cluster-pending.html | ||
# | ||
def pending_tasks(arguments={}) | ||
valid_params = [ | ||
:local, | ||
:master_timeout ] | ||
method = 'GET' | ||
path = "/_cluster/pending_tasks" | ||
params = Utils.__validate_and_extract_params arguments, valid_params | ||
body = nil | ||
|
||
perform_request(method, path, params, body).body | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'test_helper' | ||
|
||
module Elasticsearch | ||
module Test | ||
class ClusterPendingTasksTest < ::Test::Unit::TestCase | ||
|
||
context "Cluster: Pending tasks" do | ||
subject { FakeClient.new } | ||
|
||
should "perform correct request" do | ||
subject.expects(:perform_request).with do |method, url, params, body| | ||
assert_equal 'GET', method | ||
assert_equal '/_cluster/pending_tasks', url | ||
assert_equal Hash.new, params | ||
assert_nil body | ||
true | ||
end.returns(FakeResponse.new) | ||
|
||
subject.cluster.pending_tasks | ||
end | ||
|
||
end | ||
|
||
end | ||
end | ||
end |