cpee 2.1.103 → 2.1.104

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: 89afb8a2610ae012039da0f247086f5512de982659d2b1c71321add823a28235
4
- data.tar.gz: deb4fb653b1ca9323d017c2777d5206765d5334b318383331388e1eee54f6bd0
3
+ metadata.gz: 8f641a0e013ea34d5fcde9985698e424b88fc1083da2fa409a7ff49961e6ee7d
4
+ data.tar.gz: 49b128e338257b1929c5bf7898479702542ee2612fc25aa447692480a1a72796
5
5
  SHA512:
6
- metadata.gz: fe1c1382d75a729659f646dae9c0de4a2a8296578f16e64d964ee0813a33cefb8964e823a306138a4f4473b70f0f81043c28a036f18d6dc2fdc21a7089591975
7
- data.tar.gz: 7b9cb494d6b622fa1d4f3e56c2aba7190803188a83bfb75468d292d05055d449deb6de0ea8e2906a036d9f8eb50a8276966df6004e338da1510e2d8884b2e4be
6
+ metadata.gz: 26e968160d080857bf4931dec48692c9dc049ee5c30eb72a9c555cc7eaae7cd9d72cb84a50284a75fcdb028dfe4b5634d1d7c5214a08d880b0ef31a47bf2a20a
7
+ data.tar.gz: dc955cbfec7ac4d81a6528dd31c15eced6c07d34044551a8bcd3f0e8cce4e6289aaefd11928b7011e55789f06b9705aca8248f03c005179a0a43120c98805aa7
data/cpee.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "2.1.103"
3
+ s.version = "2.1.104"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0-or-later"
6
6
  s.summary = "The cloud process execution engine (cpee.org). If you just need workflow execution, without a rest service exposing it, then use WEEL."
@@ -0,0 +1,18 @@
1
+ # This file is part of CPEE.
2
+ #
3
+ # CPEE is free software: you can redistribute it and/or modify it under the terms
4
+ # of the GNU General Public License as published by the Free Software Foundation,
5
+ # either version 3 of the License, or (at your option) any later version.
6
+ #
7
+ # CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
8
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9
+ # PARTICULAR PURPOSE. See the GNU General Public License for more details.
10
+ #
11
+ # You should have received a copy of the GNU General Public License along with
12
+ # CPEE (file COPYING in the main directory). If not, see
13
+ # <http://www.gnu.org/licenses/>.
14
+
15
+ module CPEE
16
+ LIBPATH = __dir__
17
+ GLOBAL_EXECUTIONHANDLERS = File.expand_path(File.join(__dir__,'..','..','server','executionhandlers'))
18
+ end
@@ -24,6 +24,7 @@ require_relative 'statemachine'
24
24
  require_relative 'implementation_properties'
25
25
  require_relative 'implementation_notifications'
26
26
  require_relative 'implementation_callbacks'
27
+ require_relative 'constants'
27
28
 
28
29
  module CPEE
29
30
 
@@ -94,6 +95,9 @@ module CPEE
94
95
  opts[:libs_preloader] ||= '~/bin/by-server'
95
96
  opts[:libs_preloaderrun] ||= '~/bin/by'
96
97
 
98
+ ### for remote deployment (attribute remote)
99
+ opts[:ssh_key] ||= '~/.ssh/dist.key'
100
+
97
101
  CPEE::redis_connect opts, 'Server Main'
98
102
 
99
103
  ### start by server
@@ -1,22 +1,18 @@
1
+ require 'cpee/constants'
1
2
  require 'yaml'
2
3
  opts = YAML::load_file(File.join(__dir__,'opts.yaml'))
3
4
  opts[:pidf] = __FILE__ + '.pid'
4
5
  opts[:pid] = Process.pid
5
6
 
6
- global_controller = File.join(opts[:global_executionhandlers],opts[:executionhandler],'controller.rb')
7
- controller = File.join(opts[:executionhandlers], opts[:executionhandler],'controller.rb')
8
- if File.exist? global_controller
9
- require global_controller
10
- elsif File.exist? controller
11
- require controller
12
- end
13
-
14
- global_connectionhandler = File.join(opts[:global_executionhandlers],opts[:executionhandler],'connection.rb')
15
- connectionhandler = File.join(opts[:executionhandlers], opts[:executionhandler],'connection.rb')
16
- if File.exist? global_connectionhandler
17
- require global_connectionhandler
18
- elsif File.exist? connectionhandler
19
- require connectionhandler
7
+ opts[:global_executionhandlers] = CPEE::GLOBAL_EXECUTIONHANDLERS unless opts[:global_executionhandlers]
8
+ ['controller.rb','connection.rb'].each do |f|
9
+ global_thing = File.join(opts[:global_executionhandlers],opts[:executionhandler],f)
10
+ thing = File.join(opts[:executionhandlers], opts[:executionhandler],f)
11
+ if File.exist? global_thing
12
+ require global_thing
13
+ elsif File.exist? thing
14
+ require thing
15
+ end
20
16
  end
21
17
 
22
18
  require_relative 'instance'
@@ -12,6 +12,9 @@
12
12
  # CPEE (file COPYING in the main directory). If not, see
13
13
  # <http://www.gnu.org/licenses/>.
14
14
 
15
+ require 'net/ssh'
16
+ require 'net/scp'
17
+
15
18
  module CPEE
16
19
 
17
20
  module ExecutionHandler
@@ -29,13 +32,14 @@ module CPEE
29
32
  end
30
33
 
31
34
  def self::prepare(id,opts) # write result to disk
35
+ FileUtils.rm_rf(Dir.glob(File.join(opts[:instances],id.to_s,'*')) + Dir.glob(File.join(opts[:instances],id.to_s,'.remote')))
32
36
  Dir.mkdir(File.join(opts[:instances],id.to_s)) rescue nil
33
37
  FileUtils.copy(ExecutionHandler::Ruby::BACKEND_RUN,File.join(opts[:instances],id.to_s))
34
38
  dsl = CPEE::Persistence::extract_item(id,opts,'dsl')
35
39
  hw = CPEE::Persistence::extract_item(id,opts,'executionhandler')
36
40
  endpoints = CPEE::Persistence::extract_list(id,opts,'endpoints')
37
41
  dataelements = CPEE::Persistence::extract_list(id,opts,'dataelements')
38
- attributes = CPEE::Persistence::extract_list(id,opts,'attributes')
42
+ attributes = CPEE::Persistence::extract_list(id,opts,'attributes').to_h
39
43
  positions = CPEE::Persistence::extract_set(id,opts,'positions')
40
44
  positions.map! do |k, v|
41
45
  [ k, v, CPEE::Persistence::extract_item(id,opts,File.join('positions',k,'@passthrough')) ]
@@ -46,9 +50,14 @@ module CPEE
46
50
  iopts[:redis_url] = opts[:redis_url]
47
51
  iopts[:redis_db] = opts[:redis_db]
48
52
  iopts[:workers] = opts[:workers]
49
- iopts[:global_executionhandlers] = opts[:global_executionhandlers]
50
- iopts[:executionhandlers] = opts[:executionhandlers]
51
53
  iopts[:executionhandler] = hw
54
+ if attributes.has_key?('remote')
55
+ uri = URI::parse(attributes['remote'])
56
+ iopts[:executionhandlers] = File.join(uri.path,File.basename(opts[:executionhandlers]))
57
+ else
58
+ iopts[:executionhandlers] = opts[:executionhandlers]
59
+ iopts[:global_executionhandlers] = opts[:global_executionhandlers]
60
+ end
52
61
 
53
62
  File.open(File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Ruby::BACKEND_OPTS)),'w') do |f|
54
63
  YAML::dump(iopts,f)
@@ -56,10 +65,14 @@ module CPEE
56
65
  template = ERB.new(File.read(ExecutionHandler::Ruby::BACKEND_TEMPLATE), trim_mode: '-')
57
66
  res = template.result_with_hash(dsl: dsl, dataelements: dataelements, endpoints: endpoints, positions: positions)
58
67
  File.write(File.join(opts[:instances],id.to_s,ExecutionHandler::Ruby::BACKEND_INSTANCE),res)
59
- # if attributes['remote']
60
- # ### scp instance files to the remote server under run (under instance id)
61
- # ### touch local .remote with connection details
62
- # end
68
+ if attributes.has_key?('remote')
69
+ uri = URI::parse(attributes['remote'])
70
+ Net::SSH.start(uri.host,uri.user,:keys => [ opts[:ssh_key] ] ) do |ssh|
71
+ ssh.exec!("rm -rf #{File.join(uri.path,id.to_s,'*')}")
72
+ ssh.scp.upload!(File.join(opts[:instances],id.to_s),uri.path,:recursive=>true)
73
+ end
74
+ File.write(File.join(opts[:instances],id.to_s,'.remote'),attributes['remote'])
75
+ end
63
76
  end
64
77
 
65
78
  def self::run(id,opts)
@@ -1 +1 @@
1
- 383733
1
+ 577032
@@ -1 +1 @@
1
- 383775
1
+ 577074
@@ -1 +1 @@
1
- 383761
1
+ 577060
@@ -1 +1 @@
1
- 383747
1
+ 577046
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.103
4
+ version: 2.1.104
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -986,6 +986,7 @@ files:
986
986
  - lib/callbacks/callbacks.rng
987
987
  - lib/cpee.xml
988
988
  - lib/cpee/attributes_helper.rb
989
+ - lib/cpee/constants.rb
989
990
  - lib/cpee/fail.rb
990
991
  - lib/cpee/implementation.rb
991
992
  - lib/cpee/implementation_callbacks.rb