sideq 0.1.2 → 0.1.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
  SHA1:
3
- metadata.gz: 79c47ffba9ca72a096807c49e51f7de86d03d47c
4
- data.tar.gz: 9dc142f6a300e5eb7bdc8875bb2e3b33e4d8658f
3
+ metadata.gz: ac8e57585f3796876a2c8a9185a618576401859a
4
+ data.tar.gz: e32af46894e709bbfaeeab8caf8b106db29d2676
5
5
  SHA512:
6
- metadata.gz: 32ae9c7cd67bbcb578f7107e16864a86812ebbd2ff6c726b03813523322e7b1a1867bbc18ee44272e98d0e97143ed376844f458e18b24e5bba2d42e14e161af2
7
- data.tar.gz: 6c9abb4e714889683e02da490c9cea88ca80623d3b71d68006ffc9ae285438af333239ee150348be35e289c4d21ae7e2d56d2a3a69ac4bc4d708132855447d44
6
+ metadata.gz: 96f593b4dd4c46cc8440e46f2cd9df3728f5c1993f767bd5af9885ae0ca313ed9fa1c7eb9cd7eb0852b71c3467fe8269b1169386c0ef9365738f2acda270dce6
7
+ data.tar.gz: 1ad687b9a531d60f331994376f152e9d79f9a0e691ce9294b8890fc8db31cdd6919a2924da65396d2a095f2077bcfebc79fcd5a499f7dfee86faaec65523f280
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.3
2
+ - Add "retry list csv" and "dead list csv" commands for better parsing in scripts
3
+
1
4
  ## 0.1.2
2
5
  - Bug: Fix job accessor name error
3
6
  - Bug: Fix reported job number when clearing retry set and dead set
data/bin/sideq CHANGED
@@ -19,18 +19,20 @@ class Parser
19
19
  "\n" <<
20
20
  "Commands and subcommands:\n" <<
21
21
  "stats Print sidekiq statistics\n" <<
22
- "queue list List all known queues\n" <<
22
+ "queues list List all known queues\n" <<
23
23
  "queue list name List contents of named queue\n" <<
24
24
  "queue show name jid [jid...] Show details of jobs in named queue\n" <<
25
25
  "queue del name jid [jid...] Delete jobs from the named queue\n" <<
26
26
  "queue clear name Clear all jobs from the named queue\n" <<
27
27
  "retry list List contents of the retry set\n" <<
28
+ "retry list csv List contents of the retry set as CSV\n" <<
28
29
  "retry show jid [jid ...] Show details of entrie sin the retry set\n" <<
29
30
  "retry del jid [jid ...] Delete entries from the retry set\n" <<
30
31
  "retry kill jid [jid ...] Move jobs from the retry set to the dead set\n" <<
31
32
  "retry now jid [jid ...] Retry jobs in the retry set right now\n" <<
32
33
  "retry clear Clears all entries in the retry set\n" <<
33
34
  "dead list List contents of the dead set\n" <<
35
+ "dead list csv List contents of the dead set as CSV\n" <<
34
36
  "dead show jid [jid...] Show details of entries in the dead set\n" <<
35
37
  "dead del jid [jid...] Delete jobs from the dead set\n" <<
36
38
  "dead now jid [jid...] Retry jobs from the dead set right now\n" <<
@@ -104,7 +106,12 @@ case object
104
106
  retries = Sideq::Retries.new
105
107
 
106
108
  case ARGV.shift
107
- when "list" then puts retries
109
+ when "list"
110
+ case ARGV.shift
111
+ when "csv" then puts retries.to_csv
112
+ else puts retries
113
+ end
114
+
108
115
  when "show" then puts retries.details( ARGV )
109
116
  when "del" then retries.delete_entries( ARGV )
110
117
  when "kill" then retries.kill_entries( ARGV )
@@ -117,7 +124,12 @@ case object
117
124
  dead = Sideq::Dead.new
118
125
 
119
126
  case ARGV.shift
120
- when "list" then puts dead
127
+ when "list"
128
+ case ARGV.shift
129
+ when "csv" then puts dead.to_csv
130
+ else puts dead
131
+ end
132
+
121
133
  when "show" then puts dead.details( ARGV )
122
134
  when "del" then dead.delete_entries( ARGV )
123
135
  when "now" then dead.retry_entries( ARGV )
data/lib/sideq/dead.rb CHANGED
@@ -22,6 +22,25 @@ module Sideq
22
22
  end.join( "\n" )
23
23
  end
24
24
 
25
+ def to_csv
26
+ require "csv"
27
+ CSV.generate( :encoding => "UTF-8", :headers => true ) do |csv|
28
+ csv << [ "JobID", "Created at", "Class", "Error Class", "Enqueued at", "Failed at", "Retry count", "Retried at", "Error" ]
29
+ dead_set.each do |job|
30
+ csv << [ job.jid,
31
+ job.created_at.strftime( "%F %T" ),
32
+ job.display_class,
33
+ job["error_class"],
34
+ job.enqueued_at.strftime( "%F %T" ),
35
+ Time.at( job["failed_at"] ).strftime( "%F %T" ),
36
+ job["retry_count"],
37
+ job["retried_at"] ? Time.at( job["retried_at"] ).strftime( "%F %T" ) : "never",
38
+ job["retry"],
39
+ "#{job["error_class"]}: #{job["error_message"][0,77-job["error_class"].size]}" ]
40
+ end
41
+ end
42
+ end
43
+
25
44
  def details( job_ids )
26
45
  dead_set.each_with_object( [] ) do |job, memo|
27
46
  next unless job_ids.include?( job.jid )
data/lib/sideq/retries.rb CHANGED
@@ -22,6 +22,25 @@ module Sideq
22
22
  end.join( "\n" )
23
23
  end
24
24
 
25
+ def to_csv
26
+ require "csv"
27
+ CSV.generate do |csv|
28
+ csv << [ "JobID", "Created at", "Class", "Error Class", "Enqueued at", "Failed at", "Retry count", "Retried at", "Continue retries", "Error" ]
29
+ retry_set.each do |job|
30
+ csv << [ job.jid,
31
+ job.created_at.strftime( "%F %T" ),
32
+ job.display_class,
33
+ job["error_class"],
34
+ job.enqueued_at.strftime( "%F %T" ),
35
+ Time.at( job["failed_at"] ).strftime( "%F %T" ),
36
+ job["retry_count"],
37
+ job["retried_at"] ? Time.at( job["retried_at"] ).strftime( "%F %T" ) : "never",
38
+ job["retry"],
39
+ "#{job["error_class"]}: #{job["error_message"][0,77-job["error_class"].size]}" ]
40
+ end
41
+ end
42
+ end
43
+
25
44
  def details( job_ids )
26
45
  retry_set.each_with_object( [] ) do |job, memo|
27
46
  next unless job_ids.include?( job.jid )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sideq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Riedel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq