sidekiq-hierarchy 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 207932da2b55a42c996a64475325af922be4c036
4
- data.tar.gz: 7d544e96ac3849b5df2791cddcdf3fd320dfc4f9
3
+ metadata.gz: 9f9e018911b28e3e2676fe129484f15e109a68f7
4
+ data.tar.gz: 920d077b333de9929a2319f714c74137dd63fc29
5
5
  SHA512:
6
- metadata.gz: c491a5c80b0a32e1707b34acf4977affcf924e89eb58f6d8b4f91d7be1b05e144ec7532cf911e417fff5bd0db42b9fa5bcc14dd96ce1cf2bce44ab7fdf35df70
7
- data.tar.gz: 809a71fc2054b185bed9100f60d88b19aa6ac65892eb77ebe0da2eeb85ece11a8942b37470cd882d4daf0c657f22235fa3ed85ef516a25dcf836eb6aadfc6121
6
+ metadata.gz: 566190836db128a3a3e86d166eb43b4fba29412e35f9c6103751e8460d2cfb982621a9ba3acf98d4253b18935982b42536c6de0ec98fd462c3a51f31d36191ca
7
+ data.tar.gz: ce89fe04d64f1785e8af2a305b41b1e870dfc7e02d44152f802ff6621175e2e92ab318d1535e8d563d9f37c491c934da5aa0d7ed9275d3fe7571e48c38485332
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  .sw?
11
+ /demo_app
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [0.1.3] - 2015-11-19
6
+ ### Changed
7
+ - Fixed workflow-enabled jobs spawned by untracked jobs, which should therefore be considered roots on their own
8
+ - Modified web view to display total size of each workflow set
9
+
5
10
  ## [0.1.2] - 2015-11-17
6
11
  ### Changed
7
12
  - Fixed compatibility with older Sidekiq/middleware versions that don't support alternate redis pools
@@ -6,8 +6,10 @@ module Sidekiq
6
6
  module Faraday
7
7
  class Middleware < ::Faraday::Middleware
8
8
  def call(env)
9
- env[:request_headers][Sidekiq::Hierarchy::Http::JID_HEADER] = Sidekiq::Hierarchy.current_jid if Sidekiq::Hierarchy.current_jid
10
- env[:request_headers][Sidekiq::Hierarchy::Http::WORKFLOW_HEADER] = Sidekiq::Hierarchy.current_workflow.jid if Sidekiq::Hierarchy.current_workflow
9
+ if Sidekiq::Hierarchy.current_workflow && Sidekiq::Hierarchy.current_jid
10
+ env[:request_headers][Sidekiq::Hierarchy::Http::JID_HEADER] = Sidekiq::Hierarchy.current_jid
11
+ env[:request_headers][Sidekiq::Hierarchy::Http::WORKFLOW_HEADER] = Sidekiq::Hierarchy.current_workflow.jid
12
+ end
11
13
  @app.call(env)
12
14
  end
13
15
  end
@@ -14,8 +14,10 @@ module Sidekiq
14
14
  end
15
15
 
16
16
  def call(env)
17
- Sidekiq::Hierarchy.current_jid = env[JID_HEADER_KEY]
18
- Sidekiq::Hierarchy.current_workflow = Workflow.find_by_jid(env[WORKFLOW_HEADER_KEY]) if env[WORKFLOW_HEADER_KEY]
17
+ if env[WORKFLOW_HEADER_KEY] && env[JID_HEADER_KEY]
18
+ Sidekiq::Hierarchy.current_jid = env[JID_HEADER_KEY]
19
+ Sidekiq::Hierarchy.current_workflow = Workflow.find_by_jid(env[WORKFLOW_HEADER_KEY])
20
+ end
19
21
  @app.call(env)
20
22
  ensure
21
23
  Sidekiq::Hierarchy.current_workflow = nil
@@ -14,10 +14,11 @@ module Sidekiq
14
14
  def call(worker, msg, queue)
15
15
  if msg['workflow'] == true # root job -- start of a new workflow
16
16
  Sidekiq::Hierarchy.current_workflow = Workflow.find_by_jid(worker.jid)
17
+ Sidekiq::Hierarchy.current_jid = worker.jid
17
18
  elsif msg['workflow'].is_a?(String) # child job -- inherit parent's workflow
18
19
  Sidekiq::Hierarchy.current_workflow = Workflow.find_by_jid(msg['workflow'])
20
+ Sidekiq::Hierarchy.current_jid = worker.jid
19
21
  end
20
- Sidekiq::Hierarchy.current_jid = worker.jid
21
22
 
22
23
  Sidekiq::Hierarchy.record_job_running
23
24
  ret = yield
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Hierarchy
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
@@ -61,13 +61,13 @@ module Sidekiq
61
61
  end
62
62
 
63
63
  app.get '/hierarchy/?' do
64
- running_set = RunningSet.new
65
- complete_set = CompleteSet.new
66
- failed_set = FailedSet.new
64
+ @running_set = RunningSet.new
65
+ @complete_set = CompleteSet.new
66
+ @failed_set = FailedSet.new
67
67
 
68
- @running = running_set.each.take(PER_PAGE)
69
- @complete = complete_set.each.take(PER_PAGE)
70
- @failed = failed_set.each.take(PER_PAGE)
68
+ @running = @running_set.each.take(PER_PAGE)
69
+ @complete = @complete_set.each.take(PER_PAGE)
70
+ @failed = @failed_set.each.take(PER_PAGE)
71
71
 
72
72
  erb sidekiq_hierarchy_template(:status)
73
73
  end
@@ -79,8 +79,8 @@ module Sidekiq
79
79
 
80
80
  app.get '/hierarchy/workflow_sets/:status' do |status|
81
81
  @status = status.to_sym
82
- if workflow_set = WorkflowSet.for_status(@status)
83
- @workflows = workflow_set.each.take(PER_PAGE)
82
+ if @workflow_set = WorkflowSet.for_status(@status)
83
+ @workflows = @workflow_set.each.take(PER_PAGE)
84
84
  erb sidekiq_hierarchy_template(:workflow_set)
85
85
  else
86
86
  halt 404
data/web/views/status.erb CHANGED
@@ -6,7 +6,8 @@
6
6
  <div class="panel panel-info">
7
7
  <div class="panel-heading">
8
8
  <a href="<%= workflow_set_url(:running) %>">
9
- <h4>Running Workflows</h4>
9
+ <h4 style="display:inline">Running Workflows</h4>
10
+ (<%= @running_set.size %> total, displaying <%= @running.size %> newest)
10
11
  </a>
11
12
  </div>
12
13
 
@@ -42,7 +43,8 @@
42
43
  <div class="panel panel-success">
43
44
  <div class="panel-heading">
44
45
  <a href="<%= workflow_set_url(:complete) %>">
45
- <h4>Complete Workflows</h4>
46
+ <h4 style="display:inline">Complete Workflows</h4>
47
+ (<%= @complete_set.size %> total, displaying <%= @complete.size %> newest)
46
48
  </a>
47
49
  </div>
48
50
 
@@ -82,7 +84,8 @@
82
84
  <div class="panel panel-danger">
83
85
  <div class="panel-heading">
84
86
  <a href="<%= workflow_set_url(:failed) %>">
85
- <h4>Failed Workflows</h4>
87
+ <h4 style="display:inline">Failed Workflows</h4>
88
+ (<%= @failed_set.size %> total, displaying <%= @failed.size %> newest)
86
89
  </a>
87
90
  </div>
88
91
 
@@ -1,3 +1,5 @@
1
1
  <h3><%= @status.to_s.capitalize %> Workflows</h3>
2
2
 
3
3
  <%= erb sidekiq_hierarchy_template(:_workflow_table), locals: {workflows: @workflows} %>
4
+
5
+ Displaying <%= @workflows.size %> newest of <%= @workflow_set.size %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-hierarchy
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
  - Anuj Das
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-17 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement