cpee 2.1.71 → 2.1.74

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.
@@ -1,84 +0,0 @@
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
-
17
- module ExecutionHandler
18
-
19
- module Rust
20
- BACKEND_INSTANCE = 'instance.rs'
21
- BACKEND_OPTS = 'opts.yaml'
22
- BACKEND_COMPILE = File.expand_path(File.join(__dir__,'backend','compile.sh'))
23
- BACKEND_RUN = File.expand_path(File.join(__dir__,'backend','run'))
24
-
25
- def self::dslx_to_dsl(dslx) # transpile
26
- 'hello world'
27
- end
28
-
29
- def self::prepare(id,opts) # write result to disk
30
- Dir.mkdir(File.join(opts[:instances],id.to_s)) rescue nil
31
- FileUtils.copy(ExecutionHandler::Rust::BACKEND_COMPILE,File.join(opts[:instances],id.to_s))
32
- dsl = CPEE::Persistence::extract_item(id,opts,'dsl')
33
- hw = CPEE::Persistence::extract_item(id,opts,'executionhandler')
34
- endpoints = CPEE::Persistence::extract_list(id,opts,'endpoints').to_h
35
- dataelements = CPEE::Persistence::extract_list(id,opts,'dataelements').to_h
36
- attributes = CPEE::Persistence::extract_list(id,opts,'attributes').to_h
37
- positions = CPEE::Persistence::extract_set(id,opts,'positions')
38
- positions.map! do |k, v|
39
- [ k, v, CPEE::Persistence::extract_item(id,opts,File.join('positions',k,'@passthrough')) ]
40
- end
41
- File.open(File.join(opts[:instances],id.to_s,ExecutionHandler::Rust::BACKEND_OPTS),'w') do |f|
42
- YAML::dump({
43
- :host => opts[:host],
44
- :url => opts[:url],
45
- :redis_url => opts[:redis_url],
46
- :redis_path => File.join(opts[:basepath],opts[:redis_path]),
47
- :redis_db => opts[:redis_db],
48
- :workers => opts[:workers],
49
- :global_executionhandlers => opts[:global_executionhandlers],
50
- :executionhandlers => opts[:executionhandlers],
51
- :executionhandler => hw,
52
- :endpoints => endpoints,
53
- :dataelements => dataelements,
54
- :positions => positions,
55
- :attributes => attributes
56
- },f)
57
- end
58
- File.write(File.join(opts[:instances],id.to_s,ExecutionHandler::Rust::BACKEND_INSTANCE),dsl)
59
- `#{File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Rust::BACKEND_COMPILE))}`
60
- end
61
-
62
- def self::run(id,opts)
63
- exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Rust::BACKEND_RUN))
64
- pid = Kernel.spawn(exe , :pgroup => true, :in => '/dev/null', :out => exe + '.out', :err => exe + '.err')
65
- Process.detach pid
66
- File.write(exe + '.pid',pid)
67
- end
68
-
69
- def self::stop(id,opts) ### return: bool to tell if manually changing redis is necessary
70
- exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Rust::BACKEND_RUN))
71
- pid = File.read(exe + '.pid') rescue nil
72
- if pid && (Process.kill(0, pid.to_i) rescue false)
73
- Process.kill('HUP', pid.to_i) rescue nil
74
- false
75
- else # its not running, so clean up
76
- File.unlink(exe + '.pid') rescue nil
77
- true
78
- end
79
- end
80
- end
81
-
82
- end
83
-
84
- end
@@ -1 +0,0 @@
1
- 570906
@@ -1 +0,0 @@
1
- 570924
@@ -1 +0,0 @@
1
- 570918
@@ -1 +0,0 @@
1
- 570912