persistence-providers 0.0.2.3 → 0.0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ef2d4539ee594c0fb786be1ee20ceb0a9a2b79743ee6f02702b2c28f49b3fd2
4
- data.tar.gz: 43347f89e40adb8701fc82ae6f214cf34c37c058b8692e6707efad399f34bb8a
3
+ metadata.gz: 660dab58980e91237fcf7f0d6ce5bb54a7ce6dd7e9fa3cebc7863a7313007bba
4
+ data.tar.gz: 2c88433473a7bcf024a18819d8027f2ff21dfabb3ccb98db5093ed42f7e6747d
5
5
  SHA512:
6
- metadata.gz: 19d06a2a39e86b386a991f2157db68ffdc228a2ca3ecd8f25da6eed429b9a058c3e12613bbb83bc6feb899d00c17cd9b08e04157d52835198073cba45adae97f
7
- data.tar.gz: 81390b3e8c7ba7579b39f0e0d16826f93e0e9f6d5965a984e9973c037b298adfa967ebb2b8d6b6fa043eb1927a07f3c93c99f44f218f296c50184bf1d644d4b5
6
+ metadata.gz: '0081a8eb82ab1c9aa999c8dbf34ac4b54835e712f51a9bcc8ba7d2b17579f6334b9bb25f0faf1d9831c7bc551367f6dfd9f87c4cdfe8eec6f5af137204ec95d0'
7
+ data.tar.gz: 772e78be6305a28ff88719dbd9bc8d4d40c5f7a20687cfe87c2a983e01399760715e805532487c84a76099d64b633d5626fe8fd67845db0bfba7f2f0297052da
@@ -5,5 +5,6 @@ module DTK
5
5
  require_relative 'state/component'
6
6
  require_relative 'state/component_def'
7
7
  require_relative 'state/executable_action'
8
+ require_relative 'state/workflow_instance'
8
9
  end
9
10
  end
@@ -2,12 +2,12 @@ module DTK::State
2
2
  class Component
3
3
  require_relative 'component/attribute'
4
4
 
5
- attr_reader :name, :parent, :module_refs, :component_def
5
+ attr_reader :name, :parent, :component_def
6
6
 
7
7
  def initialize(name, component_content, parent, opts = {})
8
8
  @name = name
9
9
  # @parent = parent
10
- @module_refs = parent.module_refs
10
+ @component_defs = parent.references.component_def
11
11
  @component_def = get_component_def(opts)
12
12
 
13
13
  @attribute_objs = Attribute.create_from_kube_hash(component_content[:attributes])# convert_to_attribute_objects(component_content[:attributes])
@@ -56,16 +56,16 @@ module DTK::State
56
56
 
57
57
  def get_component_def(opts = {})
58
58
  destructured_component = destructure_component_full_name
59
- module_ref = @module_refs.find { |module_ref| module_ref[:name] == destructured_component[:module_name] }
60
- ComponentDef.get(module_ref[:namespace], destructured_component[:component_def_name], opts)
59
+ component_def = @component_defs.find { |component_def| component_def[:name] == destructured_component[:component_def_name] }
60
+ # module_ref = @module_refs.find { |module_ref| module_ref[:name] == destructured_component[:module_name] }
61
+ ComponentDef.get(component_def[:namespace], destructured_component[:component_def_name], opts)
61
62
  end
62
63
 
63
64
  def destructure_component_full_name
64
- regex = /(.*)::(.*)\[(.*)\]/
65
- module_name, component_def_name, component_name = @name.match(regex).captures
65
+ regex = /(.*)\[(.*)\]/
66
+ component_def_name, component_name = @name.match(regex).captures
66
67
  {
67
- module_name: module_name,
68
- component_def_name: "#{module_name}-#{component_def_name}",
68
+ component_def_name: "#{component_def_name}",
69
69
  component_name: component_name
70
70
  }
71
71
  end
@@ -1,18 +1,18 @@
1
1
  module DTK::State
2
2
  class CrdComponent
3
- attr_reader :name, :namespace, :crd_content, :components, :module_refs
3
+ attr_reader :name, :namespace, :crd_content, :components, :references
4
4
 
5
5
  def initialize(namespace, name, crd_content)
6
6
  @name = name
7
7
  @namespace = namespace
8
8
  @crd_content = crd_content
9
+ @references = crd_content.references
9
10
  @components = crd_content[:spec][:components]
10
- @module_refs = crd_content[:references][:module_refs]
11
11
  end
12
12
 
13
13
  def self.get(namespace, name, opts = {})
14
14
  # crd_component = ::DTK::CrdClient.instance.kubeclient.get_component(name, namespace)
15
- crd_component = ::DTK::CrdClient.get_kubeclient(opts).get_component(name, namespace)
15
+ crd_component = ::DTK::CrdClient.get_kubeclient(opts).get_assembly(name, namespace)
16
16
  CrdComponent.new(namespace, name, crd_component)
17
17
  end
18
18
 
@@ -0,0 +1,27 @@
1
+ module DTK::State
2
+ class WorkflowInstance
3
+ attr_reader :name, :namespace, :assembly, :workflow_template, :attributes, :workflow
4
+
5
+ def initialize(namespace, name, crd_content)
6
+ @name = name
7
+ @namespace = namespace
8
+ # @crd_content = crd_content
9
+ # @references = crd_content.references
10
+ @assembly = crd_content.references.assembly
11
+ @workflow_template = crd_content.references.workflow
12
+ @attributes = crd_content.spec.attributes
13
+ @workflow = crd_content.spec.workflow
14
+ end
15
+
16
+ def self.get(namespace, name, opts = {})
17
+ workflow_instance = ::DTK::CrdClient.get_kubeclient(opts).get_workflow_instance(name, namespace)
18
+ WorkflowInstance.new(namespace, name, workflow_instance)
19
+ end
20
+
21
+ def self.get_attributes(namespace, name, opts = {})
22
+ workflow_instance = get(namespace, name, opts)
23
+ # workflow_instance.attributes.to_h
24
+ workflow_instance.attributes.map{ |attr| attr.to_hash }
25
+ end
26
+ end
27
+ end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'persistence-providers'
3
- spec.version = '0.0.2.3'
3
+ spec.version = '0.0.2.4'
4
4
  spec.author = 'Reactor8'
5
5
  spec.email = 'support@reactor8.com'
6
6
  spec.description = %q{Persistence providers plugin}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: persistence-providers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.3
4
+ version: 0.0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reactor8
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-03 00:00:00.000000000 Z
11
+ date: 2020-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kubeclient
@@ -75,6 +75,7 @@ files:
75
75
  - lib/state/component_def/attribute_type_info.rb
76
76
  - lib/state/crd_component.rb
77
77
  - lib/state/executable_action.rb
78
+ - lib/state/workflow_instance.rb
78
79
  - persistence-providers.gemspec
79
80
  - test-destroy-influxdb.rb
80
81
  - test-influxdb.rb
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  - !ruby/object:Gem::Version
99
100
  version: '0'
100
101
  requirements: []
101
- rubygems_version: 3.0.8
102
+ rubygems_version: 3.0.6
102
103
  signing_key:
103
104
  specification_version: 4
104
105
  summary: Persistence providers plugin