sidekiq-tool 0.0.2 → 0.0.3

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
  SHA256:
3
- metadata.gz: 3c4ac9cae16fe1f82eb99c7ac0a5cef5665bd674a4427ea300b12ae87ab95949
4
- data.tar.gz: 2df092ce21c716affe3fcd3fcbe029b7b2a26b88620d831e5484ff332de356e3
3
+ metadata.gz: ffdeb6586c2b5a444a8a5de99a04749fd4c6008596660ba21bdb7ce56a63fc28
4
+ data.tar.gz: e9aacdc874d53fc18b07600acfccd1177bcdba67a706a094025130dfe761e170
5
5
  SHA512:
6
- metadata.gz: 587dd1162e05777f0d6e9bf4edb10f8468b4fd4ab5384d20c81d1634effcb2ee973f2c3ba58a448eae1ad5e630a7179f3179c2f11c91f5810ce281f33a0ccf1b
7
- data.tar.gz: 987d08471d7d55d38ebffe80b33b093a78ccd8e137818cf9fd70253bda9aaf9c30648df8b26810bb9355336eaee9dabde62686759b3e957b1e5d58403b08f459
6
+ metadata.gz: 7b8a68f8924fede629c26c34f91ad3b6b95d591e0ed0a33753fbd0ab28d9e655513cfe78bc8025f4543b18f06baca47b7ba5fc3db43faf9a505a276dbce63f92
7
+ data.tar.gz: 17bcf75c93f047c06192cc06ec2414164b8dd1eaecd1f188f2020ccad3bddaaeba35ecb96e31286ca495e2ea896426178c4d848d7d33bd8707f7f117dc945895
data/README.md CHANGED
@@ -1,37 +1,36 @@
1
- # Sidekiq::Tool
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sidekiq/tool`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Install the gem and add to the application's Gemfile by executing:
10
-
11
- $ bundle add sidekiq-tool
12
-
13
- If bundler is not being used to manage dependencies, install the gem by executing:
14
-
15
- $ gem install sidekiq-tool
16
-
17
- ## Usage
18
-
19
- TODO: Write usage instructions here
20
-
21
- ## Development
22
-
23
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
-
25
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
-
27
- ## Contributing
28
-
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/zed-0xff/sidekiq-tool. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/zed-0xff/sidekiq-tool/blob/master/CODE_OF_CONDUCT.md).
30
-
31
- ## License
32
-
33
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
34
-
35
- ## Code of Conduct
36
-
37
- Everyone interacting in the Sidekiq::Tool project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/zed-0xff/sidekiq-tool/blob/master/CODE_OF_CONDUCT.md).
1
+ # sidekiq-tool
2
+
3
+ ```
4
+ Usage: sidekiq-tool [options]
5
+ -u URL Redis URL (default: from REDIS_URL env var)
6
+ -q, --queue QUEUE apply next commands to specified queue
7
+ --jid JID (alias for --job-id)
8
+ --job-id JID (can be used multiple times)
9
+ --job-class CLASS (can be used multiple times)
10
+
11
+ -l, --list list queues (default)
12
+ -s, --show [RANGE] show contents of queue
13
+ see https://redis.io/commands/lrange/
14
+ -S, --schedule show scheduled jobs (respects queue parameter)
15
+ -P, --processes show processes (respects queue parameter)
16
+ -R, --running-jobs show currently running jobs (respects queue/jid/job-class)
17
+
18
+ --import-jobs add jobs from STDIN into queue
19
+ --move-jobs [N] atomically move jobs to another queue
20
+ -Q, --dst-queue QUEUE destination queue
21
+
22
+ Destructive commands: (require confirmations)
23
+ --delete-jobs [N] N limits number of jobs to delete, 0 (default) = delete all
24
+ respects --job-id and --job-class parameters
25
+ --export-jobs [N] same as delete, but job data is written to STDOUT beforehead
26
+ --delete-queue deletes ALL jobs from queue
27
+
28
+ --confirm-delete-jobs jobs will not be deleted without this option
29
+ --confirm-export-jobs
30
+ --confirm-queue-delete queue will not be deleted without this option
31
+
32
+ -W, --omit-weight Omit weight from schedule output (easier to parse)
33
+ -v, --[no-]verbose Run verbosely
34
+ -k Bypass SSL verification (for debug/dev)
35
+
36
+ ```
data/Rakefile CHANGED
@@ -5,4 +5,16 @@ require "rubocop/rake_task"
5
5
 
6
6
  RuboCop::RakeTask.new
7
7
 
8
- task default: :rubocop
8
+ task default: %i[readme rubocop]
9
+
10
+ desc "update readme"
11
+ task :readme do
12
+ data = []
13
+ data << "# sidekiq-tool"
14
+ data << ""
15
+ data << "```"
16
+ data << `./exe/sidekiq-tool`
17
+ data << "```"
18
+
19
+ File.write "README.md", data.join("\n")
20
+ end
data/exe/sidekiq-tool CHANGED
@@ -47,13 +47,16 @@ optparse = OptionParser.new do |opts|
47
47
  @commands << [:show, v || "0..-1"]
48
48
  end
49
49
 
50
- opts.on("-S", "--schedule", "show scheduled jobs (respects queue parameter)") do
51
- @commands << [:schedule]
52
- end
53
50
  opts.on("-P", "--processes", "show processes (respects queue parameter)") do
54
51
  @commands << [:processes]
55
52
  end
56
- opts.on("-R", "--running-jobs", "show currently running jobs (respects queue/jid/job-class)") do
53
+ opts.on("-R", "--retries", "show retries (respects queue parameter)") do
54
+ @commands << [:retries]
55
+ end
56
+ opts.on("-S", "--scheduled", "show scheduled jobs (respects queue parameter)") do
57
+ @commands << [:scheduled]
58
+ end
59
+ opts.on("-r", "--running-jobs", "show currently running jobs (respects queue/jid/job-class)") do
57
60
  @commands << [:jobs]
58
61
  end
59
62
 
@@ -98,7 +101,7 @@ optparse = OptionParser.new do |opts|
98
101
 
99
102
  opts.separator("")
100
103
 
101
- opts.on("-W", "--omit-weight", "Omit weight from schedule output (easier to parse)") do
104
+ opts.on("-W", "--omit-weight", "Omit weight from schedule/retries output (easier to parse)") do
102
105
  @options[:omit_weight] = true
103
106
  end
104
107
  opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
@@ -205,7 +208,7 @@ def move_jobs(n)
205
208
  end
206
209
 
207
210
  # can optionally accept queue/job_class/jid
208
- def schedule
211
+ def _zscan(zkey)
209
212
  match = []
210
213
  match << %("queue":"#{@options[:queue]}") if @options[:queue]
211
214
  if @options[:job_class].size == 1
@@ -219,7 +222,7 @@ def schedule
219
222
  raise "multiple job ids filter TBD"
220
223
  end
221
224
  match = match.any? ? "*#{match.join("*")}*" : nil
222
- @redis.zscan_each("schedule", count: 1000, match: match).each do |sdata, weight|
225
+ @redis.zscan_each(zkey, count: 1000, match: match).each do |sdata, weight|
223
226
  if @options[:omit_weight]
224
227
  puts sdata
225
228
  else
@@ -228,6 +231,14 @@ def schedule
228
231
  end
229
232
  end
230
233
 
234
+ def scheduled
235
+ _zscan("schedule")
236
+ end
237
+
238
+ def retries
239
+ _zscan("retry")
240
+ end
241
+
231
242
  # slowest!
232
243
  def processes
233
244
  @redis.smembers("processes").each do |pid|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Tool
5
- VERSION = "0.0.2"
5
+ VERSION = "0.0.3"
6
6
  end
7
7
  end
data/sidekiq-tool.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = "sidekiq-tool"
7
7
  spec.version = Sidekiq::Tool::VERSION
8
8
  spec.authors = ["Andrey \"Zed\" Zaikin"]
9
- spec.email = ["andrey.zaikin@every-pay.com"]
9
+ spec.email = ["zed.0xff@gmail.com"]
10
10
 
11
11
  spec.summary = "swiss-army knife for tinkering with sidekiq guts"
12
12
  spec.homepage = "https://github.com/zed-0xff/sidekiq-tool"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey "Zed" Zaikin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2023-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -26,7 +26,7 @@ dependencies:
26
26
  version: '0'
27
27
  description:
28
28
  email:
29
- - andrey.zaikin@every-pay.com
29
+ - zed.0xff@gmail.com
30
30
  executables:
31
31
  - sidekiq-tool
32
32
  extensions: []