fasten 0.7.0 → 0.7.2
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 +4 -4
- data/.gitignore +2 -1
- data/.rubocop.yml +10 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -5
- data/fasten.gemspec +1 -1
- data/lib/fasten.rb +18 -6
- data/lib/fasten/runner.rb +4 -4
- data/lib/fasten/support/ui.rb +1 -1
- data/lib/fasten/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11979aaa284fe109e187356c936bd43c51099e2cd19c2b2376b32bd272026940
|
4
|
+
data.tar.gz: 1a3ac4ff25cf4beaf38e0964adf200a51c9556e3b743fd1074320a29d35eef99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 616e6c45931550b4a9abd0b4484947758e3be7386d5a7ef53532b56f761cee58026978b71752f8631cd8ce8a105251a2736ecda0f0f5c9b3c83cf936669e8919
|
7
|
+
data.tar.gz: bd0f916f1577983c3d5e51527a61c0e2f699c74c10706a94a3848339c65f784e66370fb6233631f4bd4bac1d6adb7171ec4bb0bca5aa9e50f4b12f6aed3c0014
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -10,6 +10,16 @@ Metrics/BlockLength:
|
|
10
10
|
- 'Rakefile'
|
11
11
|
- '**/*.rake'
|
12
12
|
- 'spec/**/*.rb'
|
13
|
+
- 'fasten.gemspec'
|
14
|
+
Metrics:
|
15
|
+
Exclude:
|
16
|
+
- 'lib/fasten/ui/curses.rb'
|
17
|
+
Naming:
|
18
|
+
Exclude:
|
19
|
+
- 'lib/fasten/ui/curses.rb'
|
20
|
+
Style:
|
21
|
+
Exclude:
|
22
|
+
- 'lib/fasten/ui/curses.rb'
|
13
23
|
Metrics/AbcSize:
|
14
24
|
Max: 17
|
15
25
|
Metrics/MethodLength:
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,8 +23,8 @@ It has been released so people can try it and make feature requests, comments an
|
|
23
23
|
- [x] process are preferred on POSIX systems, otherwise threads are used
|
24
24
|
- [x] default number of workers is the # of real cpu cores on the system
|
25
25
|
- [x] in case of task Error or Exception, the whole run will be stopped
|
26
|
-
- [x] runner saves a log file in `$(pwd)
|
27
|
-
- [x] each task saves its STDERR/STDOUT to a log file in `$(pwd)
|
26
|
+
- [x] runner saves a log file in `$(pwd)/fasten/log/runner/*name_of_runner*.log`
|
27
|
+
- [x] each task saves its STDERR/STDOUT to a log file in `$(pwd)/fasten/log/task/*name_of_task*.log`
|
28
28
|
- [x] once finished, statistics are saved in `$HOME/.fasten/stats/*name_of_runner*.csv`, which include: status (DONE, FAIL), duration, average, stdev, error and count
|
29
29
|
- [x] display a summary table of the execution
|
30
30
|
|
@@ -73,7 +73,7 @@ Or install it yourself as:
|
|
73
73
|
|
74
74
|
## Usage
|
75
75
|
|
76
|
-
TODO: Write usage instructions here.
|
76
|
+
TODO: Write usage instructions here. Right now, check spec directory for sample code.
|
77
77
|
|
78
78
|
## Development
|
79
79
|
|
@@ -83,7 +83,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
83
83
|
|
84
84
|
## Contributing
|
85
85
|
|
86
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/a0/fasten. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
86
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/a0/a0-fasten-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
87
87
|
|
88
88
|
## License
|
89
89
|
|
@@ -91,4 +91,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
91
91
|
|
92
92
|
## Code of Conduct
|
93
93
|
|
94
|
-
Everyone interacting in the Fasten project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/a0/fasten/blob/master/CODE_OF_CONDUCT.md).
|
94
|
+
Everyone interacting in the Fasten project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/a0/a0-fasten-ruby/blob/master/CODE_OF_CONDUCT.md).
|
data/fasten.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = 'Fasten your seatbelts! Run jobs in parallel, intelligently.'
|
13
13
|
spec.description = 'Fasten your seatbelts! Run jobs in parallel, intelligently.'
|
14
|
-
spec.homepage = 'https://github.com/a0/fasten/'
|
14
|
+
spec.homepage = 'https://github.com/a0/a0-fasten-ruby/'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
# Specify which files should be added to the gem when it is released.
|
data/lib/fasten.rb
CHANGED
@@ -35,6 +35,10 @@ module Fasten
|
|
35
35
|
runner(**options).register(&block)
|
36
36
|
end
|
37
37
|
|
38
|
+
def default_name
|
39
|
+
File.basename(Dir.getwd)
|
40
|
+
end
|
41
|
+
|
38
42
|
def default_workers
|
39
43
|
Parallel.physical_processor_count
|
40
44
|
end
|
@@ -75,21 +79,29 @@ module Fasten
|
|
75
79
|
return @opt_parser if defined? @opt_parser
|
76
80
|
|
77
81
|
@options = { developer: false }
|
82
|
+
@load_path = []
|
78
83
|
|
79
84
|
@opt_parser = OptionParser.new do |opts|
|
80
|
-
opts.banner = "Usage: #{$PROGRAM_NAME} [options]
|
85
|
+
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
81
86
|
opts.separator ''
|
82
|
-
opts.separator '
|
87
|
+
opts.separator 'Examples:'
|
88
|
+
opts.separator ' fasten # load and run all task from fasten/*_fasten.rb'
|
89
|
+
opts.separator ' fasten -f tasks.rb # load task from ruby script'
|
90
|
+
opts.separator ' fasten -y tasks.yml # load task from yaml file'
|
83
91
|
opts.separator ''
|
84
92
|
opts.separator 'Options:'
|
85
93
|
|
86
|
-
opts.on '-n NAME', '--name=NAME', String,
|
94
|
+
opts.on '-n NAME', '--name=NAME', String, "Change name of this runner (default: #{default_name} from current directory)" do |name|
|
87
95
|
@options[:name] = name
|
88
96
|
end
|
97
|
+
opts.on '-f PATH', '--file=PATH', String, 'File or folder with ruby code' do |path|
|
98
|
+
@load_path << path
|
99
|
+
end
|
89
100
|
opts.on '-w WORKERS', '--workers=WORKERS', Numeric, "Number of processes/threads to use (default: #{default_workers} on this machine)" do |workers|
|
90
101
|
@options[:workers] = workers
|
91
102
|
end
|
92
103
|
opts.on '-s', '--[no-]summary', TrueClass, 'Display summary at the end of execution' do |boolean|
|
104
|
+
puts "SUMMAMRY: #{boolean}"
|
93
105
|
@options[:summary] = boolean
|
94
106
|
end
|
95
107
|
opts.on '--ui=UI', String, "Type of UI: curses, console. (default: #{default_ui_mode} on this machine)" do |ui_mode|
|
@@ -120,10 +132,10 @@ module Fasten
|
|
120
132
|
def invoke
|
121
133
|
opt_parser.parse!
|
122
134
|
|
123
|
-
|
135
|
+
runner @options
|
136
|
+
load_fasten @load_path
|
124
137
|
|
125
|
-
runner
|
126
|
-
load_fasten ARGV
|
138
|
+
show_help if runner.task_list.empty?
|
127
139
|
|
128
140
|
runner.perform
|
129
141
|
end
|
data/lib/fasten/runner.rb
CHANGED
@@ -22,16 +22,16 @@ module Fasten
|
|
22
22
|
|
23
23
|
attr_accessor :name, :workers, :worker_class, :fasten_dir, :developer, :stats, :summary, :ui_mode, :worker_list, :use_threads, :queue
|
24
24
|
|
25
|
-
def initialize(name:
|
25
|
+
def initialize(name: Fasten.default_name,
|
26
26
|
developer: Fasten.default_developer, summary: nil, ui_mode: Fasten.default_ui_mode, workers: Fasten.default_workers,
|
27
|
-
worker_class: Worker, fasten_dir: '
|
27
|
+
worker_class: Worker, fasten_dir: 'fasten', use_threads: !OS.posix?)
|
28
28
|
reconfigure(name: name, developer: developer, summary: summary, ui_mode: ui_mode, workers: workers,
|
29
29
|
worker_class: worker_class, fasten_dir: fasten_dir, use_threads: use_threads)
|
30
30
|
end
|
31
31
|
|
32
32
|
def reconfigure(**options)
|
33
33
|
self.stats = options[:name] && true if options[:name] || options.key?(:stats)
|
34
|
-
self.name = options[:name] || "#{self.class}
|
34
|
+
self.name = options[:name] || "#{self.class.to_s.gsub('::', '-')}-#{$PID}" if options.key?(:name)
|
35
35
|
self.workers = options[:workers] if options.key?(:workers)
|
36
36
|
self.worker_class = options[:worker_class] if options.key?(:worker_class)
|
37
37
|
self.fasten_dir = options[:fasten_dir] if options.key?(:fasten_dir)
|
@@ -225,7 +225,7 @@ module Fasten
|
|
225
225
|
|
226
226
|
unless worker
|
227
227
|
@worker_id = (@worker_id || 0) + 1
|
228
|
-
worker = worker_class.new runner: self, name: "#{worker_class}-#{format '%02X', @worker_id}", use_threads: use_threads
|
228
|
+
worker = worker_class.new runner: self, name: "#{worker_class.to_s.gsub('::', '-')}-#{format '%02X', @worker_id}", use_threads: use_threads
|
229
229
|
worker.start
|
230
230
|
worker_list << worker
|
231
231
|
|
data/lib/fasten/support/ui.rb
CHANGED
data/lib/fasten/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fasten
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aldrin Martoq
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -191,7 +191,7 @@ files:
|
|
191
191
|
- lib/fasten/ui/curses.rb
|
192
192
|
- lib/fasten/version.rb
|
193
193
|
- lib/fasten/worker.rb
|
194
|
-
homepage: https://github.com/a0/fasten/
|
194
|
+
homepage: https://github.com/a0/a0-fasten-ruby/
|
195
195
|
licenses:
|
196
196
|
- MIT
|
197
197
|
metadata:
|