lex-tasker 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +39 -0
- data/.rubocop.yml +34 -0
- data/Dockerfile +9 -0
- data/Gemfile +0 -3
- data/Gemfile.lock +69 -0
- data/README.md +1 -37
- data/bitbucket-pipelines.yml +19 -0
- data/docker_deploy.rb +13 -0
- data/lex-tasker.gemspec +33 -0
- data/lib/legion/extensions/tasker.rb +5 -70
- data/lib/legion/extensions/tasker/actors/check_subtask.rb +21 -0
- data/lib/legion/extensions/tasker/actors/fetch_delayed.rb +25 -0
- data/lib/legion/extensions/tasker/actors/fetch_delayed_push.rb +29 -0
- data/lib/legion/extensions/tasker/actors/log.rb +13 -0
- data/lib/legion/extensions/tasker/actors/task_manager.rb +21 -0
- data/lib/legion/extensions/tasker/actors/updater.rb +21 -0
- data/lib/legion/extensions/tasker/helpers/base.rb +11 -0
- data/lib/legion/extensions/tasker/helpers/fetch_delayed.rb +66 -0
- data/lib/legion/extensions/tasker/helpers/find_subtask.rb +49 -0
- data/lib/legion/extensions/tasker/runners/check_subtask.rb +97 -0
- data/lib/legion/extensions/tasker/runners/fetch_delayed.rb +71 -0
- data/lib/legion/extensions/tasker/runners/log.rb +50 -0
- data/lib/legion/extensions/tasker/runners/task_manager.rb +28 -0
- data/lib/legion/extensions/tasker/runners/updater.rb +31 -0
- data/lib/legion/extensions/tasker/transport.rb +30 -0
- data/lib/legion/extensions/tasker/transport/exchanges/task.rb +8 -0
- data/lib/legion/extensions/tasker/transport/messages/fetch_delayed.rb +11 -0
- data/lib/legion/extensions/tasker/transport/queues/check_subtask.rb +18 -0
- data/lib/legion/extensions/tasker/transport/queues/fetch_delayed.rb +21 -0
- data/lib/legion/extensions/tasker/transport/queues/lex_register.rb +15 -0
- data/lib/legion/extensions/tasker/transport/queues/subtask.rb +11 -0
- data/lib/legion/extensions/tasker/transport/queues/task_log.rb +11 -0
- data/lib/legion/extensions/tasker/transport/queues/task_mananger.rb +15 -0
- data/lib/legion/extensions/tasker/transport/queues/updater.rb +11 -0
- data/lib/legion/extensions/tasker/version.rb +1 -1
- metadata +77 -23
- data/.idea/encodings.xml +0 -4
- data/.idea/legion-extensions-tasker.iml +0 -8
- data/.idea/misc.xml +0 -7
- data/.idea/modules.xml +0 -8
- data/.idea/workspace.xml +0 -7
- data/.travis.yml +0 -7
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/legion-extensions-tasker.gemspec +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 629167fdc22f492d3458b37b1414c66c1f89d61ba843d787126901a36653fc42
|
4
|
+
data.tar.gz: 8962a825f8fe27b0abd990b12d94e540fba3103bce7fb73a3dd0190a5701610d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55dbbe3d90fa1e06a04321cc36d9f18d44266112dff7956e0e5a46513d350486a65b4000f210b7822c540efc71b5dd2bc1c737160265f48e0316fb983ab60e6a
|
7
|
+
data.tar.gz: e2ddca1cf4926788cecc1d6a6b3953d0bbf718d6aeaa2be442f51d6e7e222c0614e78fbdaa402b5f0d5716af5b5f09759cf5cb9a315d7b539d95c122510549b2
|
@@ -0,0 +1,39 @@
|
|
1
|
+
version: 2.1
|
2
|
+
orbs:
|
3
|
+
ruby: circleci/ruby@0.2.1
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
"rubocop":
|
7
|
+
docker:
|
8
|
+
- image: circleci/ruby:2.7
|
9
|
+
steps:
|
10
|
+
- checkout
|
11
|
+
- ruby/load-cache
|
12
|
+
- ruby/install-deps
|
13
|
+
- run:
|
14
|
+
name: Update bundler
|
15
|
+
command: gem update bundler
|
16
|
+
- run:
|
17
|
+
name: Run Rubocop
|
18
|
+
command: bundle exec rubocop
|
19
|
+
- ruby/save-cache
|
20
|
+
"rspec":
|
21
|
+
docker:
|
22
|
+
- image: circleci/ruby:2.7
|
23
|
+
steps:
|
24
|
+
- checkout
|
25
|
+
- ruby/load-cache
|
26
|
+
- ruby/install-deps
|
27
|
+
- run:
|
28
|
+
name: Update bundler
|
29
|
+
command: gem update bundler
|
30
|
+
- ruby/run-tests
|
31
|
+
- ruby/save-cache
|
32
|
+
workflows:
|
33
|
+
version: 2
|
34
|
+
rubocop-rspec:
|
35
|
+
jobs:
|
36
|
+
- rubocop
|
37
|
+
- rspec:
|
38
|
+
requires:
|
39
|
+
- rubocop
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
Layout/LineLength:
|
2
|
+
Max: 120
|
3
|
+
Metrics/MethodLength:
|
4
|
+
Max: 100
|
5
|
+
Metrics/ClassLength:
|
6
|
+
Max: 1500
|
7
|
+
Metrics/BlockLength:
|
8
|
+
Max: 50
|
9
|
+
Metrics/CyclomaticComplexity:
|
10
|
+
Max: 20
|
11
|
+
Metrics/AbcSize:
|
12
|
+
Max: 100
|
13
|
+
Metrics/PerceivedComplexity:
|
14
|
+
Max: 50
|
15
|
+
Metrics/ParameterLists:
|
16
|
+
Max: 20
|
17
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
18
|
+
EnforcedStyle: space
|
19
|
+
Style/SymbolArray:
|
20
|
+
Enabled: true
|
21
|
+
Layout/HashAlignment:
|
22
|
+
EnforcedHashRocketStyle: table
|
23
|
+
EnforcedColonStyle: table
|
24
|
+
Style/Documentation:
|
25
|
+
Enabled: false
|
26
|
+
AllCops:
|
27
|
+
TargetRubyVersion: 2.5
|
28
|
+
NewCops: enable
|
29
|
+
Style/FrozenStringLiteralComment:
|
30
|
+
Enabled: false
|
31
|
+
Naming/FileName:
|
32
|
+
Enabled: false
|
33
|
+
Style/ClassAndModuleChildren:
|
34
|
+
Enabled: false
|
data/Dockerfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
FROM legionio/legion:latest
|
2
|
+
LABEL maintainer="Matthew Iverson <matthewdiverson@gmail.com>"
|
3
|
+
|
4
|
+
RUN mkdir /etc/legionio
|
5
|
+
RUN apk update && apk add build-base tzdata postgresql-dev mysql-client mariadb-dev tzdata gcc git
|
6
|
+
|
7
|
+
COPY . ./
|
8
|
+
RUN gem install lex-tasker legion-data --no-document --no-prerelease
|
9
|
+
CMD ruby $(which legionio)
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
lex-tasker (0.2.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.1)
|
10
|
+
codecov (0.2.12)
|
11
|
+
json
|
12
|
+
simplecov
|
13
|
+
diff-lcs (1.4.4)
|
14
|
+
docile (1.3.2)
|
15
|
+
json (2.3.1)
|
16
|
+
parallel (1.19.2)
|
17
|
+
parser (2.7.2.0)
|
18
|
+
ast (~> 2.4.1)
|
19
|
+
rainbow (3.0.0)
|
20
|
+
rake (13.0.1)
|
21
|
+
regexp_parser (1.8.2)
|
22
|
+
rexml (3.2.4)
|
23
|
+
rspec (3.10.0)
|
24
|
+
rspec-core (~> 3.10.0)
|
25
|
+
rspec-expectations (~> 3.10.0)
|
26
|
+
rspec-mocks (~> 3.10.0)
|
27
|
+
rspec-core (3.10.0)
|
28
|
+
rspec-support (~> 3.10.0)
|
29
|
+
rspec-expectations (3.10.0)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.10.0)
|
32
|
+
rspec-mocks (3.10.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.10.0)
|
35
|
+
rspec-support (3.10.0)
|
36
|
+
rspec_junit_formatter (0.4.1)
|
37
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
38
|
+
rubocop (1.1.0)
|
39
|
+
parallel (~> 1.10)
|
40
|
+
parser (>= 2.7.1.5)
|
41
|
+
rainbow (>= 2.2.2, < 4.0)
|
42
|
+
regexp_parser (>= 1.8)
|
43
|
+
rexml
|
44
|
+
rubocop-ast (>= 1.0.1)
|
45
|
+
ruby-progressbar (~> 1.7)
|
46
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
47
|
+
rubocop-ast (1.1.0)
|
48
|
+
parser (>= 2.7.1.5)
|
49
|
+
ruby-progressbar (1.10.1)
|
50
|
+
simplecov (0.19.1)
|
51
|
+
docile (~> 1.1)
|
52
|
+
simplecov-html (~> 0.11)
|
53
|
+
simplecov-html (0.12.3)
|
54
|
+
unicode-display_width (1.7.0)
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
ruby
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
bundler (>= 2)
|
61
|
+
codecov
|
62
|
+
lex-tasker!
|
63
|
+
rake
|
64
|
+
rspec
|
65
|
+
rspec_junit_formatter
|
66
|
+
rubocop
|
67
|
+
|
68
|
+
BUNDLED WITH
|
69
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,39 +1,3 @@
|
|
1
1
|
# Legion::Extensions::Tasker
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'legion-extensions-tasker'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install legion-extensions-tasker
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/legion-extensions-tasker.
|
36
|
-
|
37
|
-
## License
|
38
|
-
|
39
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
3
|
+
A core LEX
|
@@ -0,0 +1,19 @@
|
|
1
|
+
image: ruby:2.7
|
2
|
+
|
3
|
+
pipelines:
|
4
|
+
tags:
|
5
|
+
"v*":
|
6
|
+
- step:
|
7
|
+
name: Push to RubyGems
|
8
|
+
deployment: RubyGems
|
9
|
+
script:
|
10
|
+
- gem install gem-release
|
11
|
+
- (umask 077 ; echo $gem_creds | base64 --decode > ~/.gem/credentials)
|
12
|
+
- gem release
|
13
|
+
artifacts:
|
14
|
+
- pkg/**
|
15
|
+
- step:
|
16
|
+
name: Push to Docker
|
17
|
+
deployment: Docker
|
18
|
+
script:
|
19
|
+
- './docker_deploy.rb'
|
data/docker_deploy.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
name = 'tasker'
|
4
|
+
require "./lib/legion/extensions/#{name}/version"
|
5
|
+
version = Legion::Extensions::Tasker::VERSION
|
6
|
+
|
7
|
+
puts "Building docker image for Legion v#{version}"
|
8
|
+
system("docker build --tag legionio/lex-#{name}:v#{version} .")
|
9
|
+
puts 'Pushing to hub.docker.com'
|
10
|
+
system("docker push legionio/lex-#{name}:v#{version}")
|
11
|
+
system("docker tag legionio/lex-#{name}:v#{version} legionio/lex-#{name}:latest")
|
12
|
+
system("docker push legionio/lex-#{name}:latest")
|
13
|
+
puts 'completed'
|
data/lex-tasker.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'legion/extensions/tasker/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'lex-tasker'
|
7
|
+
spec.version = Legion::Extensions::Tasker::VERSION
|
8
|
+
spec.authors = ['Esity']
|
9
|
+
spec.email = ['matthewdiverson@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'LEX::Tasker manages tasks status from Legion'
|
12
|
+
spec.description = 'This LEX keeps track of tasks and their status'
|
13
|
+
spec.homepage = 'https://bitbucket.org/legion-io/lex-tasker'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
16
|
+
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-tasker/src'
|
22
|
+
spec.metadata['documentation_uri'] = 'https://legionio.atlassian.net/wiki/spaces/LEX/pages/7733408'
|
23
|
+
spec.metadata['changelog_uri'] = 'https://legionio.atlassian.net/wiki/spaces/LEX/pages/12156936'
|
24
|
+
spec.metadata['bug_tracker_uri'] = 'https://bitbucket.org/legion-io/lex-tasker/issues'
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '>= 2'
|
28
|
+
spec.add_development_dependency 'codecov'
|
29
|
+
spec.add_development_dependency 'rake'
|
30
|
+
spec.add_development_dependency 'rspec'
|
31
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
32
|
+
spec.add_development_dependency 'rubocop'
|
33
|
+
end
|
@@ -1,82 +1,17 @@
|
|
1
1
|
require 'legion/extensions/tasker/version'
|
2
|
-
require 'legion/extensions'
|
3
|
-
require 'legion/extensions/tasker/actors/task_update'
|
4
|
-
require 'legion/extensions/tasker/actors/task_log'
|
5
|
-
require 'legion/extensions/tasker/actors/lex_register'
|
6
|
-
require 'legion/extensions/tasker/actors/task_subtask'
|
7
|
-
require 'legion/extensions/tasker/actors/task_check_subtask'
|
8
2
|
|
9
3
|
module Legion
|
10
4
|
module Extensions
|
11
5
|
module Tasker
|
12
|
-
extend Legion::Extensions::
|
13
|
-
attr_reader :actors, :requirements, :default_settings, :autobuild
|
14
|
-
def self.actors
|
15
|
-
[
|
16
|
-
{
|
17
|
-
path: path + 'actors/task_update',
|
18
|
-
class: klass::Actor::TaskUpdater,
|
19
|
-
group_name: 'taskupdater'
|
20
|
-
},
|
21
|
-
{
|
22
|
-
path: path + 'actors/task_log',
|
23
|
-
class: klass::Actor::TaskLog,
|
24
|
-
group_name: 'task_logger'
|
25
|
-
}, {
|
26
|
-
path: path + 'actors/lex_register',
|
27
|
-
class: klass::Actor::LexRegister,
|
28
|
-
group_name: 'lex_register'
|
29
|
-
}, {
|
30
|
-
path: path + 'actors/task_check_subtask',
|
31
|
-
class: klass::Actor::TaskCheckSubtask,
|
32
|
-
group_name: 'task_check_subtask'
|
33
|
-
}
|
34
|
-
]
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.lex_methods
|
38
|
-
[{
|
39
|
-
namespace: 'legion::extensions::tasker::runners::tasklog',
|
40
|
-
queue: 'task.log',
|
41
|
-
uri: 'task_log',
|
42
|
-
class_methods: {
|
43
|
-
add_log: {},
|
44
|
-
delete_log: {},
|
45
|
-
delete_all_task_logs: {}
|
46
|
-
}
|
47
|
-
}, {
|
48
|
-
namespace: 'legion::extensions::tasker::runners::taskupdater',
|
49
|
-
queue: 'task',
|
50
|
-
uri: 'task',
|
51
|
-
class_methods: {
|
52
|
-
update_status: {}
|
53
|
-
}
|
54
|
-
}, {
|
55
|
-
namespace: 'legion::extensions::tasker::runners::lexregister',
|
56
|
-
queue: 'lex.register',
|
57
|
-
uri: 'lex_register',
|
58
|
-
class_methods: {
|
59
|
-
save: {},
|
60
|
-
save_namespace: {},
|
61
|
-
save_funciton: {}
|
62
|
-
}
|
63
|
-
}]
|
64
|
-
end
|
6
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
|
65
7
|
|
66
|
-
def self.
|
67
|
-
|
68
|
-
['legion-transport']
|
8
|
+
def self.data_required?
|
9
|
+
true
|
69
10
|
end
|
70
11
|
|
71
|
-
def
|
72
|
-
|
12
|
+
def data_required?
|
13
|
+
true
|
73
14
|
end
|
74
|
-
|
75
|
-
def self.path
|
76
|
-
'legion/extensions/tasker/'
|
77
|
-
end
|
78
|
-
|
79
|
-
module_function
|
80
15
|
end
|
81
16
|
end
|
82
17
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Legion::Extensions::Tasker
|
2
|
+
module Actor
|
3
|
+
class CheckSubtask < Legion::Extensions::Actors::Subscription
|
4
|
+
def runner_function
|
5
|
+
'check_subtasks'
|
6
|
+
end
|
7
|
+
|
8
|
+
def check_subtask?
|
9
|
+
false
|
10
|
+
end
|
11
|
+
|
12
|
+
def use_runner?
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
def generate_task?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Legion::Extensions::Tasker
|
2
|
+
module Actor
|
3
|
+
class FetchDelayed < Legion::Extensions::Actors::Subscription
|
4
|
+
def runner_function
|
5
|
+
'fetch'
|
6
|
+
end
|
7
|
+
|
8
|
+
def runner_class
|
9
|
+
Legion::Extensions::Tasker::Runners::FetchDelayed
|
10
|
+
end
|
11
|
+
|
12
|
+
def use_runner?
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
def check_subtask?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
def generate_task?
|
21
|
+
false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Legion::Extensions::Tasker
|
2
|
+
module Actor
|
3
|
+
class FetchDelayedPush < Legion::Extensions::Actors::Every
|
4
|
+
def runner_function
|
5
|
+
'push'
|
6
|
+
end
|
7
|
+
|
8
|
+
def runner_class
|
9
|
+
Legion::Extensions::Tasker::Runners::FetchDelayed
|
10
|
+
end
|
11
|
+
|
12
|
+
def check_subtask?
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
def generate_task?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
def use_runner?
|
21
|
+
false
|
22
|
+
end
|
23
|
+
|
24
|
+
def time
|
25
|
+
1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|