rflow 1.3.1 → 1.3.2

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
- SHA1:
3
- metadata.gz: a854e3c0cf56feae660eb061c29d9cbaad028a34
4
- data.tar.gz: ac21f337ed623cb7a0a96c8612dc17f5e1e63bd2
2
+ SHA256:
3
+ metadata.gz: 5206f9445f15732c6d46b1c08ab99abf54fbae0bc30b151418b3b950624d041a
4
+ data.tar.gz: 4db080a15115b86926acd0ebf78b74532fd4c22f79454eda00372236701550f7
5
5
  SHA512:
6
- metadata.gz: d580e43a06b900a9cfcb8cd7372d933b698f5dc28c40909a1a2ed4211c342af497829f44e3699b520499dfd7007e70fc6925c88b8354a63278d6402cd504f5bc
7
- data.tar.gz: b5d50e712d85913f0052e3a3c3cd5d2c73a4e69280af1cc0d3f92aa1fcc8917181db8a7d5288b1cab17787161543945023f6b170a47cc9d883428197d35173a0
6
+ metadata.gz: 0de374d5901f28cb15b320b455a8c09a4f191f71b8f8d8695d56ba74987dbc9ef86d5207bacda72d062ca7848c3860853eee8373d471c8aa769aed59e7bdbdf4
7
+ data.tar.gz: f273b7870a878b1672857d0b2e33fb49885e29945cc3b3e6748bbbd559ce4e9b6cf044029a2f5fe5b1278d6b0c8904d4d0668f57d6a57153ae754656688cf187
@@ -1 +1 @@
1
- ruby-2.3.1
1
+ ruby-2.5.3
@@ -6,6 +6,8 @@ rvm:
6
6
  - 2.1.0
7
7
  - 2.2.0
8
8
  - 2.3.0
9
+ - 2.4.2
10
+ - 2.5.3
9
11
 
10
12
  before_install:
11
13
  - sudo apt-get install libtool autoconf automake uuid-dev build-essential
data/bin/rflow CHANGED
@@ -86,6 +86,13 @@ end
86
86
  # things, like the config database. We want those log messages to go to the
87
87
  # startup log when setting up. The running log will transition to what is
88
88
  # specified in the config database.
89
+ if options[:startup_log_file_path] &&
90
+ File.exist?(options[:startup_log_file_path]) &&
91
+ !File.writable?(options[:startup_log_file_path])
92
+ STDERR.puts "Startup log file '#{options[:startup_log_file_path]}' not writable"
93
+ exit 1
94
+ end
95
+
89
96
  RFlow.logger.reconfigure({'rflow.application_name' => 'startup',
90
97
  'rflow.log_level' => options[:startup_log_level].to_s,
91
98
  'rflow.log_file_path' => options[:startup_log_file_path]}, true)
@@ -101,6 +108,11 @@ if options[:config_file_path] && command != 'load'
101
108
  exit 1
102
109
  end
103
110
 
111
+ if !options[:config_file_path] && command == 'load'
112
+ RFlow.logger.fatal "Config file required for 'load' command"
113
+ exit 1
114
+ end
115
+
104
116
  unless options[:config_database_path]
105
117
  RFlow.logger.warn "Config database not specified, using default 'config.sqlite'"
106
118
  options[:config_database_path] = File.expand_path(File.join(Dir.getwd, 'config.sqlite'))
@@ -110,19 +122,18 @@ case command
110
122
  when 'load'
111
123
  # Load the database with the config file, if it exists. Will
112
124
  # otherwise default values (not very useful)
113
- if options[:config_file_path]
114
- unless File.exist? options[:config_file_path]
115
- RFlow.logger.fatal "Config file '#{options[:config_file_path]}' not found\n#{option_parser.help}"
116
- exit 1
117
- end
118
125
 
119
- unless File.readable? options[:config_file_path]
120
- RFlow.logger.fatal "Config file '#{options[:config_file_path]}' not readable\n#{option_parser.help}"
121
- exit 1
122
- end
126
+ unless File.exist? options[:config_file_path]
127
+ RFlow.logger.fatal "Config file '#{options[:config_file_path]}' not found"
128
+ exit 1
129
+ end
130
+
131
+ unless File.readable? options[:config_file_path]
132
+ RFlow.logger.fatal "Config file '#{options[:config_file_path]}' not readable"
133
+ exit 1
123
134
  end
124
135
 
125
- if File.exist? options[:config_database_path]
136
+ if File.exist?(options[:config_database_path]) && File.size(options[:config_database_path]) > 0
126
137
  RFlow.logger.fatal "Config database '#{options[:config_database_path]}' exists, exiting to prevent accidental overwrite from config file '#{options[:config_file_path]}'"
127
138
  exit 1
128
139
  end
@@ -131,11 +142,11 @@ when 'load'
131
142
  begin
132
143
  config = RFlow::Configuration::initialize_database(options[:config_database_path], options[:config_file_path])
133
144
  rescue Exception => e
134
- RFlow.logger.fatal "Error initializing configuration database: #{e.message}: #{e.backtrace.join "\n"}"
145
+ RFlow.logger.fatal "Error initializing configuration database #{options[:config_database_path]}: #{e.message}: #{e.backtrace.join "\n"}"
135
146
  exit 1
136
147
  end
137
148
 
138
- RFlow.logger.warn "Successfully initialized database '#{options[:config_database_path]}' with '#{options[:config_file_path]}'"
149
+ RFlow.logger.info "Successfully initialized database '#{options[:config_database_path]}' with '#{options[:config_file_path]}'"
139
150
  RFlow.logger.debug config.to_s
140
151
  exit 0
141
152
  end
@@ -144,7 +155,11 @@ end
144
155
  begin
145
156
  config = RFlow::Configuration.new(options[:config_database_path])
146
157
  rescue Exception => e
147
- RFlow.logger.fatal "Error loading config database: #{e.class} - #{e.message}"
158
+ if e.is_a?(ArgumentError) && e.message =~ /Invalid schema in configuration database/
159
+ RFlow.logger.fatal "RFlow configuration database #{options[:config_database_path]} appears to be empty or missing. Perhaps you need to run 'rflow load -c <config file> -d #{options[:config_database_path]}'? (#{e.message})"
160
+ else
161
+ RFlow.logger.fatal "Error loading config database: #{e.class} - #{e.message}"
162
+ end
148
163
  exit 1
149
164
  end
150
165
 
@@ -191,13 +206,17 @@ end
191
206
  options[:extensions_file_paths].each do |extensions_file_path|
192
207
  RFlow.logger.info "Loading #{extensions_file_path}"
193
208
  unless File.readable? extensions_file_path
194
- RFlow.logger.fatal "Extensions file ('#{Dir.getwd}') '#{extensions_file_path}' not readable\n#{option_parser.help}"
209
+ RFlow.logger.fatal "Extensions file ('#{Dir.getwd}') '#{extensions_file_path}' not readable"
195
210
  exit 1
196
211
  end
197
212
  begin
198
213
  load extensions_file_path
199
214
  rescue Exception => e
200
- RFlow.logger.fatal "Error running rflow: #{e.class}: #{e.message}, because: #{e.backtrace}"
215
+ if e.is_a?(ActiveRecord::RecordInvalid)
216
+ RFlow.logger.fatal "Error running rflow: It appears you may have passed a Ruby RFlow DSL file instead of an extensions file (which loads your application code) to rflow start -e #{extensions_file_path}. Please recheck your command arguments. (#{e.class}: #{e.message})"
217
+ else
218
+ RFlow.logger.fatal "Error running rflow: #{e.class}: #{e.message}, because: #{e.backtrace}"
219
+ end
201
220
  exit 1
202
221
  end
203
222
  end
@@ -103,7 +103,7 @@ class RFlow
103
103
  def handle_signals
104
104
  Signal.trap 'SIGCHLD', 'DEFAULT' # make sure child process can run subshells
105
105
 
106
- ['SIGTERM', 'SIGINT', 'SIGQUIT'].each do |signal|
106
+ ['SIGTERM', 'SIGINT', 'SIGQUIT', 'SIGHUP'].each do |signal|
107
107
  trap_signal(signal) do
108
108
  shutdown! signal
109
109
  exit! 0
@@ -124,7 +124,7 @@ class RFlow
124
124
  end
125
125
 
126
126
  def unhandle_signals
127
- ['SIGTERM', 'SIGINT', 'SIGQUIT', 'SIGCHLD', 'SIGUSR1', 'SIGUSR2', SIGINFO].each do |signal|
127
+ ['SIGTERM', 'SIGINT', 'SIGQUIT', 'SIGHUP', 'SIGCHLD', 'SIGUSR1', 'SIGUSR2', SIGINFO].each do |signal|
128
128
  Signal.trap signal, 'DEFAULT'
129
129
  end
130
130
  end
@@ -129,7 +129,7 @@ class RFlow
129
129
  end
130
130
 
131
131
  def handle_signals
132
- ['SIGTERM', 'SIGINT', 'SIGQUIT', 'SIGCHLD'].each do |signal|
132
+ ['SIGTERM', 'SIGINT', 'SIGQUIT', 'SIGHUP', 'SIGCHLD'].each do |signal|
133
133
  trap_signal(signal) do |return_code|
134
134
  exit_status = if signal == 'SIGCHLD'
135
135
  pid, status = Process.wait2
@@ -159,7 +159,7 @@ class RFlow
159
159
  end
160
160
 
161
161
  def unhandle_signals
162
- ['SIGTERM', 'SIGINT', 'SIGQUIT', 'SIGCHLD', 'SIGUSR1', 'SIGUSR2', SIGINFO].each do |signal|
162
+ ['SIGTERM', 'SIGINT', 'SIGQUIT', 'SIGCHLD', 'SIGHUP', 'SIGUSR1', 'SIGUSR2', SIGINFO].each do |signal|
163
163
  Signal.trap signal, 'DEFAULT'
164
164
  end
165
165
  end
@@ -133,7 +133,9 @@ class RFlow
133
133
  begin
134
134
  internal_logger.add FileOutputter.new('rflow.log_file', :filename => log_file_path, :formatter => LOG_PATTERN_FORMATTER)
135
135
  rescue Exception => e
136
- raise ArgumentError, "Log file '#{File.expand_path log_file_path}' problem: #{e.message}\n#{e.backtrace.join("\n")}"
136
+ # at least output the failure to stderr
137
+ internal_logger.add StderrOutputter.new('rflow_stderr', :formatter => LOG_PATTERN_FORMATTER)
138
+ raise ArgumentError, "Log file '#{File.expand_path log_file_path}' problem: #{e.message}"
137
139
  end
138
140
  end
139
141
  end
@@ -1,6 +1,10 @@
1
1
  require 'stringio'
2
2
  require 'time'
3
- require 'avro'
3
+ if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.1')
4
+ require 'avro-patches'
5
+ else
6
+ require 'avro'
7
+ end
4
8
  require 'rflow/configuration'
5
9
 
6
10
  class RFlow
@@ -35,6 +35,10 @@ class RFlow
35
35
  end
36
36
  pid_fp = begin
37
37
  File.open(tmp_path, File::RDWR|File::CREAT|File::EXCL, 0644)
38
+ rescue Errno::ENOENT => e
39
+ RFlow.logger.fatal "Error while writing temp PID file '#{tmp_path}'; containing directory may not exist?"
40
+ RFlow.logger.fatal "Exception #{e.class}: #{e.message}"
41
+ abort
38
42
  rescue Errno::EACCES => e
39
43
  RFlow.logger.fatal "Access error while writing temp PID file '#{tmp_path}'"
40
44
  RFlow.logger.fatal "Exception #{e.class}: #{e.message}"
@@ -1,4 +1,4 @@
1
1
  class RFlow
2
2
  # The gem version.
3
- VERSION = '1.3.1'
3
+ VERSION = '1.3.2'
4
4
  end
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.add_dependency 'activerecord', '~> 4.0'
29
29
 
30
30
  s.add_dependency 'avro', '~> 1.8'
31
+ s.add_dependency 'avro-patches', '~> 0.4' # update patches to official avro
31
32
  s.add_dependency 'em-zeromq', '~> 0.5'
32
33
 
33
34
  s.add_development_dependency 'bundler', '~> 1.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Stoneham
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-03 00:00:00.000000000 Z
12
+ date: 2018-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: uuidtools
@@ -95,6 +95,20 @@ dependencies:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: '1.8'
98
+ - !ruby/object:Gem::Dependency
99
+ name: avro-patches
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '0.4'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '0.4'
98
112
  - !ruby/object:Gem::Dependency
99
113
  name: em-zeromq
100
114
  requirement: !ruby/object:Gem::Requirement
@@ -281,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
295
  version: '0'
282
296
  requirements: []
283
297
  rubyforge_project:
284
- rubygems_version: 2.5.1
298
+ rubygems_version: 2.7.8
285
299
  signing_key:
286
300
  specification_version: 4
287
301
  summary: A Ruby flow-based programming framework