floe 0.2.0 → 0.2.1
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/CHANGELOG.md +12 -1
- data/exe/floe +1 -1
- data/lib/floe/version.rb +1 -1
- data/lib/floe/workflow/context.rb +4 -0
- data/lib/floe/workflow.rb +17 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6602a2b11185c6d720b8be59bc69f0e5b115af19e23f64a0e8718fdc8828321
|
4
|
+
data.tar.gz: cf88494cf2e4e3ae9227a5f0e7a19cf91c6e7d20f691fc36643b870e10255afd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1ffab71c8fc58a0190aa6e2a7db223f7b9968bb78d8cb08fadfcbd3b8edcac2f155aa92125f92e259f3c1423fe98ac61508cec71ee6aaca52b2135e819e9b26
|
7
|
+
data.tar.gz: 500f7734ecd0e6731d0324db59eecb50f1f0b99efbb33e6a0acc0e9dfbdde6f6c18a3a2b074c271f16b8dd64971aec4ae42e2810819eb9765c39e8c2b6ce0c1b
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [0.2.1] - 2023-07-12
|
8
|
+
### Fixed
|
9
|
+
- Fix State EnteredTime and FinishedTime (#59)
|
10
|
+
|
11
|
+
### Added
|
12
|
+
- Add workflow output (#57)
|
13
|
+
|
7
14
|
## [0.2.0] - 2023-07-05
|
8
15
|
### Added
|
9
16
|
- Add ability to pass options to `Floe::Workflow::Runner` (#48)
|
@@ -23,4 +30,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
23
30
|
### Added
|
24
31
|
- Initial release
|
25
32
|
|
26
|
-
[Unreleased]: https://github.com/ManageIQ/floe/compare/v0.1
|
33
|
+
[Unreleased]: https://github.com/ManageIQ/floe/compare/v0.2.1...HEAD
|
34
|
+
[0.2.1]: https://github.com/ManageIQ/floe/compare/v0.2.0...v0.2.1
|
35
|
+
[0.2.0]: https://github.com/ManageIQ/floe/compare/v0.1.1...v0.2.0
|
36
|
+
[0.1.1]: https://github.com/ManageIQ/floe/compare/v0.1.0...v0.1.1
|
37
|
+
[0.1.0]: https://github.com/ManageIQ/floe/tree/v0.1.0
|
data/exe/floe
CHANGED
data/lib/floe/version.rb
CHANGED
data/lib/floe/workflow.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "securerandom"
|
3
4
|
require "json"
|
4
5
|
|
5
6
|
module Floe
|
@@ -11,7 +12,7 @@ module Floe
|
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
14
|
-
attr_reader :context, :credentials, :payload, :states, :states_by_name, :current_state, :status
|
15
|
+
attr_reader :context, :credentials, :output, :payload, :states, :states_by_name, :current_state, :status
|
15
16
|
|
16
17
|
def initialize(payload, context = nil, credentials = {})
|
17
18
|
payload = JSON.parse(payload) if payload.kind_of?(String)
|
@@ -27,7 +28,7 @@ module Floe
|
|
27
28
|
@states_by_name = @states.each_with_object({}) { |state, result| result[state.name] = state }
|
28
29
|
start_at = @payload["StartAt"]
|
29
30
|
|
30
|
-
current_state_name =
|
31
|
+
current_state_name = context.state["Name"] || start_at
|
31
32
|
@current_state = @states_by_name[current_state_name]
|
32
33
|
|
33
34
|
@status = current_state_name == start_at ? "pending" : current_state.status
|
@@ -37,26 +38,29 @@ module Floe
|
|
37
38
|
|
38
39
|
def step
|
39
40
|
@status = "running" if @status == "pending"
|
40
|
-
|
41
|
+
context.execution["StartTime"] ||= Time.now.utc
|
41
42
|
|
42
|
-
input =
|
43
|
+
input = context.state["Output"] || context.execution["Input"].dup
|
44
|
+
|
45
|
+
context.state = {
|
46
|
+
"Guid" => SecureRandom.uuid,
|
47
|
+
"EnteredTime" => Time.now.utc,
|
48
|
+
"Input" => input,
|
49
|
+
"Name" => current_state.name
|
50
|
+
}
|
43
51
|
|
44
52
|
tick = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
45
53
|
next_state, output = current_state.run!(input)
|
46
54
|
tock = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
47
55
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
"Duration" => tock - tick,
|
52
|
-
"Output" => output,
|
53
|
-
"Name" => next_state&.name,
|
54
|
-
"Input" => output
|
55
|
-
}
|
56
|
+
context.state["FinishedTime"] = Time.now.utc
|
57
|
+
context.state["Duration"] = (tock - tick) / 1_000_000.0
|
58
|
+
context.state["Output"] = output
|
56
59
|
|
57
|
-
|
60
|
+
context.states << context.state
|
58
61
|
|
59
62
|
@status = current_state.status
|
63
|
+
@output = output if end?
|
60
64
|
|
61
65
|
next_state_name = next_state&.name
|
62
66
|
@current_state = next_state_name && @states_by_name[next_state_name]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: floe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_spawn
|