ductwork 0.11.2 → 0.13.0

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.
@@ -0,0 +1,49 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Ductwork Dashboard</title>
5
+
6
+ <meta name="viewport" content="width=device-width,initial-scale=1">
7
+ <meta name="apple-mobile-web-app-capable" content="yes">
8
+ <meta name="application-name" content="Ductwork">
9
+ <meta name="mobile-web-app-capable" content="yes">
10
+
11
+ <%= csrf_meta_tags %>
12
+ <%= csp_meta_tag %>
13
+
14
+ <%= stylesheet_link_tag "ductwork/vendor/pico.min.css" %>
15
+ <%= stylesheet_link_tag "ductwork/vendor/flexboxgrid.min.css" %>
16
+ <%= stylesheet_link_tag "ductwork/application.css" %>
17
+
18
+ <%= javascript_include_tag "ductwork/application.js", type: "module" %>
19
+
20
+ <link rel="icon" href="<%= image_url("ductwork/logo.png") %>" type="image/png">
21
+ <link rel="apple-touch-icon" href="<%= image_url("ductwork/logo.png") %>" type="image/png">
22
+ </head>
23
+
24
+ <body>
25
+ <header class="sticky-header">
26
+ <nav class="container separate-content">
27
+ <ul>
28
+ <%= link_to(dashboard_path, class: "stealthy-link") do %>
29
+ <li><%= image_tag("ductwork/logo.png", class: "logo") %></li>
30
+ <li><h6 class="title">Ductwork</h6></li>
31
+ <% end %>
32
+ </ul>
33
+
34
+ <div>
35
+ <label>
36
+ Version
37
+ </label>
38
+ <div style="color: var(--pico-color);">
39
+ <%= Ductwork::VERSION %>
40
+ </div>
41
+ </div>
42
+ </nav>
43
+ </header>
44
+
45
+ <main class="container">
46
+ <%= yield %>
47
+ </main>
48
+ </body>
49
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ Ductwork::Engine.routes.draw do
4
+ root "dashboards#show", as: :dashboard
5
+
6
+ resources :pipelines, only: %w[index show]
7
+ resources :step_errors, only: %w[index]
8
+ end
data/lib/ductwork/cli.rb CHANGED
@@ -16,6 +16,7 @@ module Ductwork
16
16
  def start!
17
17
  option_parser.parse!(args)
18
18
  auto_configure
19
+ puts banner
19
20
  supervisor_runner.start!
20
21
  end
21
22
 
@@ -53,6 +54,24 @@ module Ductwork
53
54
  Ductwork.logger.level = Ductwork.configuration.logger_level
54
55
  end
55
56
 
57
+ def banner
58
+ <<-BANNER
59
+ \e[1;37m
60
+ ██████╗ ██╗ ██╗ ██████╗████████╗██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗
61
+ ██╔══██╗██║ ██║██╔════╝╚══██╔══╝██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝
62
+ ██║ ██║██║ ██║██║ ██║ ██║ █╗ ██║██║ ██║██████╔╝█████╔╝
63
+ ██║ ██║██║ ██║██║ ██║ ██║███╗██║██║ ██║██╔══██╗██╔═██╗
64
+ ██████╔╝╚██████╔╝╚██████╗ ██║ ╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗
65
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
66
+ ▒▒▓ ▒ ░▒▓▒ ▒ ▒ ░ ░▒ ▒ ░ ▒ ░░ ░ ▓░▒ ▒ ░ ▒░▒░▒░ ░ ▒▓ ░▒▓░▒ ▒▒ ▓▒
67
+ ░ ▒ ▒ ░░▒░ ░ ░ ░ ▒ ░ ▒ ░ ░ ░ ▒ ▒░ ░▒ ░ ▒░░ ░▒ ▒░
68
+ ░ ░ ░ ░░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░░ ░
69
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
70
+ ░ ░
71
+ \e[0m
72
+ BANNER
73
+ end
74
+
56
75
  def supervisor_runner
57
76
  Ductwork::Processes::SupervisorRunner
58
77
  end
@@ -2,10 +2,23 @@
2
2
 
3
3
  module Ductwork
4
4
  class Engine < ::Rails::Engine
5
+ isolate_namespace Ductwork
6
+
5
7
  initializer "ductwork.app_executor", before: :run_prepare_callbacks do |app|
6
8
  Ductwork.app_executor = app.executor
7
9
  end
8
10
 
11
+ initializer "ductwork.assets.precompile" do |app|
12
+ if app.config.respond_to?(:assets)
13
+ app.config.assets.precompile += %w[
14
+ ductwork/vendor/pico.min.css
15
+ ductwork/vendor/flexboxgrid.min.css
16
+ ductwork/application.css
17
+ ductwork/application.js
18
+ ]
19
+ end
20
+ end
21
+
9
22
  initializer "ductwork.configure" do
10
23
  Ductwork.configuration ||= Ductwork::Configuration.new
11
24
  Ductwork.logger ||= Ductwork::Configuration::DEFAULT_LOGGER
@@ -178,7 +178,7 @@ module Ductwork
178
178
  halted = true
179
179
 
180
180
  step.update!(status: :failed)
181
- pipeline.halted!
181
+ pipeline.halt!
182
182
  end
183
183
  end
184
184
 
@@ -114,6 +114,26 @@ module Ductwork
114
114
  @parsed_definition ||= JSON.parse(definition).with_indifferent_access
115
115
  end
116
116
 
117
+ def complete!
118
+ update!(status: :completed, completed_at: Time.current)
119
+
120
+ Ductwork.logger.info(
121
+ msg: "Pipeline completed",
122
+ pipeline_id: id,
123
+ role: :pipeline_advancer
124
+ )
125
+ end
126
+
127
+ def halt!
128
+ update!(status: :halted, halted_at: Time.current)
129
+
130
+ Ductwork.logger.info(
131
+ msg: "Pipeline halted",
132
+ pipeline_id: id,
133
+ pipeline_klass: klass
134
+ )
135
+ end
136
+
117
137
  private
118
138
 
119
139
  def create_step_and_enqueue_job(edge:, input_arg:, node: nil)
@@ -148,13 +168,7 @@ module Ductwork
148
168
  .exists?
149
169
 
150
170
  if !remaining
151
- update!(status: :completed, completed_at: Time.current)
152
-
153
- Ductwork.logger.info(
154
- msg: "Pipeline completed",
155
- pipeline_id: id,
156
- role: :pipeline_advancer
157
- )
171
+ complete!
158
172
  end
159
173
  end
160
174
 
@@ -205,7 +219,7 @@ module Ductwork
205
219
  end
206
220
 
207
221
  if too_many
208
- halted!
222
+ halt!
209
223
  else
210
224
  edge[:to].each do |node|
211
225
  input_arg = Ductwork::Job.find_by(step_id:).return_value
@@ -251,7 +265,7 @@ module Ductwork
251
265
  max_depth = Ductwork.configuration.steps_max_depth(pipeline: klass, step: next_klass)
252
266
 
253
267
  if max_depth != -1 && return_value.count > max_depth
254
- halted!
268
+ halt!
255
269
  else
256
270
  Array(return_value).each do |input_arg|
257
271
  create_step_and_enqueue_job(edge:, input_arg:)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ductwork
4
- VERSION = "0.11.2"
4
+ VERSION = "0.13.0"
5
5
  end
data/lib/ductwork.rb CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require "active_record"
4
4
  require "active_support"
5
+ require "action_controller"
6
+ require "action_view"
5
7
  require "logger"
6
8
  require "rails/engine"
7
9
  require "securerandom"
@@ -13,6 +13,8 @@ module Ductwork
13
13
  template "config/ductwork.yml"
14
14
  template "bin/ductwork"
15
15
 
16
+ chmod "bin/ductwork", 0o755 & ~File.umask, verbose: false
17
+
16
18
  migration_template "db/create_ductwork_pipelines.rb",
17
19
  "db/migrate/create_ductwork_pipelines.rb"
18
20
  migration_template "db/create_ductwork_steps.rb",
@@ -30,7 +32,10 @@ module Ductwork
30
32
  migration_template "db/create_ductwork_processes.rb",
31
33
  "db/migrate/create_ductwork_processes.rb"
32
34
 
33
- chmod "bin/ductwork", 0o755 & ~File.umask, verbose: false
35
+ route <<~ROUTE
36
+ # This mounts the web dashboard. It is recommended to add authentication around it.
37
+ mount Ductwork::Engine, at: "/ductwork"
38
+ ROUTE
34
39
  end
35
40
  end
36
41
  end
@@ -9,6 +9,7 @@ class CreateDuctworkPipelines < ActiveRecord::Migration[<%= Rails::VERSION::MAJO
9
9
  table.timestamp :triggered_at, null: false
10
10
  table.timestamp :started_at, null: false
11
11
  table.timestamp :completed_at
12
+ table.timestamp :halted_at
12
13
  table.timestamp :claimed_for_advancing_at
13
14
  table.timestamp :last_advanced_at, null: false
14
15
  table.string :status, null: false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ductwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Ewing
@@ -9,6 +9,26 @@ bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: actionpack
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '7.1'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '8.2'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '7.1'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '8.2'
12
32
  - !ruby/object:Gem::Dependency
13
33
  name: activerecord
14
34
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +115,23 @@ files:
95
115
  - LICENSE.txt
96
116
  - README.md
97
117
  - Rakefile
118
+ - app/assets/images/ductwork/logo.png
119
+ - app/assets/images/ductwork/octagon-x.svg
120
+ - app/assets/javascripts/ductwork/application.js
121
+ - app/assets/stylesheets/ductwork/application.css
122
+ - app/assets/stylesheets/ductwork/vendor/flexboxgrid.min.css
123
+ - app/assets/stylesheets/ductwork/vendor/pico.min.css
124
+ - app/controllers/ductwork/application_controller.rb
125
+ - app/controllers/ductwork/dashboards_controller.rb
126
+ - app/controllers/ductwork/pipelines_controller.rb
127
+ - app/controllers/ductwork/step_errors_controller.rb
128
+ - app/helpers/ductwork/application_helper.rb
129
+ - app/views/ductwork/dashboards/show.html.erb
130
+ - app/views/ductwork/pipelines/index.html.erb
131
+ - app/views/ductwork/pipelines/show.html.erb
132
+ - app/views/ductwork/step_errors/index.html.erb
133
+ - app/views/layouts/ductwork/application.html.erb
134
+ - config/routes.rb
98
135
  - lib/ductwork.rb
99
136
  - lib/ductwork/cli.rb
100
137
  - lib/ductwork/configuration.rb