eco-helpers 2.0.49 → 2.0.50
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -3
- data/lib/eco/api/session/batch/jobs.rb +9 -1
- data/lib/eco/api/session/batch/jobs_groups.rb +7 -2
- data/lib/eco/api/session/config.rb +12 -0
- data/lib/eco/api/usecases/default_cases/create_tag_paths_case.rb +25 -0
- data/lib/eco/api/usecases/default_cases.rb +1 -0
- data/lib/eco/cli/config/default/usecases.rb +3 -0
- data/lib/eco/cli/config/default/workflow.rb +1 -1
- data/lib/eco/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c8f3ba10e4524d33de8f1339a48fa9c48c86a7e1b0650e29710d05083b6ed82
|
4
|
+
data.tar.gz: f68a0adda4ccebff9552e652bc47bc25cbc72129fe025e5c31b9c542b83ed9f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 215c64f98db5f29daad59fad9b4f559e0c7e2a136671d87ab9e37a6e2403cafb123948fbb8cd852ddb3155f35e4b52545d9d948df638402f7c3a63797a397690
|
7
|
+
data.tar.gz: 8a6119977b69ef6aa699ed718142d377866c1c5f379027b9b5713655525f578f837cf543df70be3dbeee1868cd6328f12ee782b1ba743f1aa87ce4cc592bc2cb
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,28 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.0.
|
4
|
+
## [2.0.50] - 2022-02-xx
|
5
5
|
|
6
6
|
### Added
|
7
|
-
-
|
8
|
-
|
7
|
+
- Ability to configure delay between jobs and job groups
|
8
|
+
- `Eco::API::Session::Batch::Jobs`, `#delay_between_jobs`
|
9
|
+
- `Eco::API::Session::Batch::JobsGroups`, `#delay_between_groups`
|
10
|
+
- `Eco::API::Session::Config`, added methods `#delay_between_jobs` and `#delay_between_job_groups`
|
11
|
+
- New use case `Eco::API::UseCases::DefaultCases::TagPaths` to create a `csv` with all `tag` paths
|
12
|
+
- Its purpose is to ease the build of tag remaps
|
13
|
+
- Ideally, after remapping the tags of an org, you would want to fix the tag paths based on the current tagtree
|
9
14
|
|
10
15
|
### Changed
|
16
|
+
- `workflow`, when no operation specified it logs as `info`, rather than `warn`
|
17
|
+
|
11
18
|
### Fixed
|
12
19
|
|
20
|
+
## [2.0.49] - 2022-02-14
|
21
|
+
|
22
|
+
### Added
|
23
|
+
- `Eco::API::Session::Batch::RequestStats#message` now it shows which details have changed
|
24
|
+
- `Eco::API::UseCases::DefaultCases::ReinviteTransCase` the option `-force` will also send an invite to users that have accepted the invitation
|
25
|
+
|
13
26
|
## [2.0.48] - 2022-02-04
|
14
27
|
|
15
28
|
### Changed
|
@@ -3,6 +3,8 @@ module Eco
|
|
3
3
|
class Session
|
4
4
|
class Batch
|
5
5
|
class Jobs < API::Common::Session::BaseSession
|
6
|
+
DELAY_BETWEEN_JOBS = 0.3
|
7
|
+
|
6
8
|
include Enumerable
|
7
9
|
attr_reader :name
|
8
10
|
|
@@ -87,11 +89,12 @@ module Eco
|
|
87
89
|
# - if there was post-launch callback for a `Batch::Job`, it calls it.
|
88
90
|
# @return [Hash<Eco::API::Session::Batch::Job, Eco::API::Session::Batch::Status>]
|
89
91
|
def launch(simulate: false)
|
90
|
-
|
92
|
+
each_with_index do |job, idx|
|
91
93
|
if job.pending?
|
92
94
|
status[job] = job_status = job.launch(simulate: simulate)
|
93
95
|
callback = @callbacks[job]
|
94
96
|
callback.call(job, job_status) if callback
|
97
|
+
Eco::API::Session::Batch::JobsGroups.counter(delay_between_jobs) if !simulate && idx < self.length - 1
|
95
98
|
end
|
96
99
|
end
|
97
100
|
launch(simulate: simulate) if pending?
|
@@ -125,6 +128,11 @@ module Eco
|
|
125
128
|
end.join("\n")
|
126
129
|
end
|
127
130
|
|
131
|
+
private
|
132
|
+
|
133
|
+
def delay_between_jobs
|
134
|
+
config.delay_between_jobs || DELAY_BETWEEN_JOBS
|
135
|
+
end
|
128
136
|
end
|
129
137
|
end
|
130
138
|
end
|
@@ -93,10 +93,10 @@ module Eco
|
|
93
93
|
status[group] = group_status = group.launch(simulate: simulate)
|
94
94
|
callback = @callbacks[group]
|
95
95
|
callback.call(group, group_status) if callback
|
96
|
-
self.class.counter(
|
96
|
+
self.class.counter(delay_between_groups) if !simulate && idx < @order.length - 1
|
97
97
|
end
|
98
98
|
end
|
99
|
-
launch(simulate: simulate) if pending?
|
99
|
+
launch(simulate: simulate) if pending?
|
100
100
|
return status
|
101
101
|
end
|
102
102
|
|
@@ -127,6 +127,11 @@ module Eco
|
|
127
127
|
end.join("\n")
|
128
128
|
end
|
129
129
|
|
130
|
+
private
|
131
|
+
|
132
|
+
def delay_between_groups
|
133
|
+
config.delay_between_job_groups || DELAY_BETWEEN_GROUPS
|
134
|
+
end
|
130
135
|
end
|
131
136
|
end
|
132
137
|
end
|
@@ -363,6 +363,18 @@ module Eco
|
|
363
363
|
yield(wf) if block_given?
|
364
364
|
end
|
365
365
|
end
|
366
|
+
|
367
|
+
# @return [nil, Interger] seconds between jobs
|
368
|
+
def delay_between_jobs(seconds = nil)
|
369
|
+
self["delay_between_jobs"] = seconds if seconds
|
370
|
+
self["delay_between_jobs"]
|
371
|
+
end
|
372
|
+
|
373
|
+
# @return [nil, Interger] seconds between job groups
|
374
|
+
def delay_between_job_groups(seconds = nil)
|
375
|
+
self["delay_between_job_groups"] = seconds if seconds
|
376
|
+
self["delay_between_job_groups"]
|
377
|
+
end
|
366
378
|
# @!endgroup
|
367
379
|
|
368
380
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class Eco::API::UseCases::DefaultCases::TagPaths < Eco::API::Common::Loaders::UseCase
|
2
|
+
name "create-tag-paths"
|
3
|
+
type :other
|
4
|
+
|
5
|
+
def main(session, options, usecase)
|
6
|
+
CSV.open("tag_paths.csv", "w") do |csv|
|
7
|
+
csv << ["Tag", "Path"]
|
8
|
+
tag_paths.each do |values|
|
9
|
+
csv << values
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def tag_paths
|
17
|
+
@tag_paths ||= tagtree.tags.map do |tag|
|
18
|
+
[tag, tagtree.path(tag).join("|")]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def tagtree
|
23
|
+
session.tagtree
|
24
|
+
end
|
25
|
+
end
|
@@ -19,6 +19,7 @@ require_relative 'default_cases/codes_to_tags_case'
|
|
19
19
|
require_relative 'default_cases/create_case'
|
20
20
|
require_relative 'default_cases/create_details_case'
|
21
21
|
require_relative 'default_cases/create_details_with_supervisor_case'
|
22
|
+
require_relative 'default_cases/create_tag_paths_case'
|
22
23
|
require_relative 'default_cases/delete_trans_case'
|
23
24
|
require_relative 'default_cases/delete_sync_case'
|
24
25
|
require_relative 'default_cases/email_as_id_case'
|
@@ -87,6 +87,9 @@ ASSETS.cli.config do |cnf|
|
|
87
87
|
options.deep_merge!(other: {file: {codes_column: col_codes}})
|
88
88
|
end
|
89
89
|
|
90
|
+
desc = "Creates a CSV with the paths to each tag"
|
91
|
+
cases.add("-create-tag-paths", :other, desc, case_name: "create-tag-paths")
|
92
|
+
|
90
93
|
desc = "Cleans from filter_tags those tags that are not present in the tagtree (as per tagtree.json file)."
|
91
94
|
desc += " It will preserve standard register tags of most common registers (i.e. EVENT, RISK)."
|
92
95
|
cases.add("-clean-unknown-tags", :transform, desc, case_name: "clean-unknown-tags")
|
data/lib/eco/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eco-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.50
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -530,6 +530,7 @@ files:
|
|
530
530
|
- lib/eco/api/usecases/default_cases/create_case.rb
|
531
531
|
- lib/eco/api/usecases/default_cases/create_details_case.rb
|
532
532
|
- lib/eco/api/usecases/default_cases/create_details_with_supervisor_case.rb
|
533
|
+
- lib/eco/api/usecases/default_cases/create_tag_paths_case.rb
|
533
534
|
- lib/eco/api/usecases/default_cases/delete_sync_case.rb
|
534
535
|
- lib/eco/api/usecases/default_cases/delete_trans_case.rb
|
535
536
|
- lib/eco/api/usecases/default_cases/email_as_id_case.rb
|