cpee-logging-xes-yaml 1.0 → 1.0.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 +4 -4
- data/README.md +10 -2
- data/cpee-logging-xes-yaml.gemspec +3 -3
- data/lib/cpee-logging-xes-yaml/logging.rb +2 -0
- data/tools/cpee-logging-xes-yaml +75 -11
- metadata +11 -11
- data/tools/sic.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2a0520ca3fb6ff780ca51eebf84811e8c9fd4df9a111fed58b09ebe63ac747f
|
4
|
+
data.tar.gz: 4aa2bb2e70e7944cb41155983dc39651b599ee263c7e2c8d2176b1fa40586741
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e403723fe26acf2b0588db4ecb18e7577cbb57572b2ca38224e0c8bdec7b753ef366142b1b9ae599921c15ab53e8d73cb36d822af2b112054249538cd3781b7
|
7
|
+
data.tar.gz: e681120976fbe6308dafbc824eb0fc5787219f071666fe10291d27f98318bed20c584aab4a408f4a23811f4411f08192f4a955ca0ca4f20ccc500628abb1afba
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ or many of the following yaml keys:
|
|
20
20
|
:log_dir: /var/log/cpee
|
21
21
|
```
|
22
22
|
|
23
|
-
To
|
23
|
+
To connect the cpee to the log, one of two things can be done: (1) add a handler to
|
24
24
|
a testset/template:
|
25
25
|
|
26
26
|
```xml
|
@@ -31,6 +31,8 @@ a testset/template:
|
|
31
31
|
<events topic="endpoints">change</events>
|
32
32
|
<events topic="attributes">change</events>
|
33
33
|
<events topic="task">instantiation</events>
|
34
|
+
<events topic="description">change</events>
|
35
|
+
<events topic="state">change</events>
|
34
36
|
</handler>
|
35
37
|
</handlers>
|
36
38
|
```
|
@@ -46,7 +48,7 @@ Riddl::Server.new(CPEE::SERVER, options) do
|
|
46
48
|
end.loop!
|
47
49
|
```
|
48
50
|
|
49
|
-
to the server (or alternatively to a
|
51
|
+
to the server (or alternatively to a cpee.conf with :notification_init
|
50
52
|
beeing a top-level yaml key). Then add a subscription file to
|
51
53
|
notifications/logging/subscription.xml
|
52
54
|
|
@@ -66,6 +68,12 @@ notifications/logging/subscription.xml
|
|
66
68
|
<topic id="attributes">
|
67
69
|
<event>change</event>
|
68
70
|
</topic>
|
71
|
+
<topic id="description">
|
72
|
+
<event>change</event>
|
73
|
+
</topic>
|
74
|
+
<topic id="state">
|
75
|
+
<event>change</event>
|
76
|
+
</topic>
|
69
77
|
<topic id="task">
|
70
78
|
<event>instantiation</event>
|
71
79
|
</topic>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cpee-logging-xes-yaml"
|
3
|
-
s.version = "1.0"
|
3
|
+
s.version = "1.0.4"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.license = "LGPL-3.0"
|
6
6
|
s.summary = "Logging for the cloud process execution engine (cpee.org)"
|
@@ -15,12 +15,12 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.required_ruby_version = '>=2.4.0'
|
17
17
|
|
18
|
-
s.authors = ['Juergen eTM Mangler']
|
18
|
+
s.authors = ['Juergen eTM Mangler','Florian Stertz']
|
19
19
|
|
20
20
|
s.email = 'juergen.mangler@gmail.com'
|
21
21
|
s.homepage = 'http://cpee.org/'
|
22
22
|
|
23
23
|
s.add_runtime_dependency 'riddl', '~> 0.99'
|
24
24
|
s.add_runtime_dependency 'json', '~> 2.1'
|
25
|
-
s.add_runtime_dependency 'cpee', '~> 1', '>= 1.
|
25
|
+
s.add_runtime_dependency 'cpee', '~> 2.1', '>= 2.1.4'
|
26
26
|
end
|
@@ -61,6 +61,8 @@ module CPEE
|
|
61
61
|
event["lifecycle:transition"] = "start"
|
62
62
|
end
|
63
63
|
event["cpee:lifecycle:transition"] = "#{topic}/#{event_name}"
|
64
|
+
event["cpee:state"] = content['state'] if content['state']
|
65
|
+
event["cpee:description"] = content['dslx'] if content['dslx']
|
64
66
|
data_send = ((parameters["arguments"].nil? ? [] : parameters["arguments"]) rescue [])
|
65
67
|
event["data"] = {"data_send" => data_send} unless data_send.empty?
|
66
68
|
if content['changed']&.any?
|
data/tools/cpee-logging-xes-yaml
CHANGED
@@ -4,15 +4,18 @@ require 'rubygems'
|
|
4
4
|
require 'optparse'
|
5
5
|
require 'fileutils'
|
6
6
|
require 'xml/smart'
|
7
|
+
require 'yaml'
|
8
|
+
require 'typhoeus'
|
9
|
+
require 'stringio'
|
7
10
|
|
8
|
-
def wrap(s, width=78, indent=18)
|
11
|
+
def wrap(s, width=78, indent=18, extra_indent=4)
|
9
12
|
lines = []
|
10
13
|
line, s = s[0..indent-2], s[indent..-1]
|
11
14
|
s.split(/\n/).each do |ss|
|
12
15
|
ss.split(/[ \t]+/).each do |word|
|
13
16
|
if line.size + word.size >= width
|
14
17
|
lines << line
|
15
|
-
line = (" " * (indent)) + word
|
18
|
+
line = (" " * (indent + extra_indent)) + word
|
16
19
|
else
|
17
20
|
line << " " << word
|
18
21
|
end
|
@@ -23,27 +26,88 @@ def wrap(s, width=78, indent=18)
|
|
23
26
|
return lines.join "\n"
|
24
27
|
end
|
25
28
|
|
29
|
+
def follow(fname,io,copy,deep=0)
|
30
|
+
if copy
|
31
|
+
File.write(File.basename(fname,'.xes.yaml') + '.xes.yaml',io.read)
|
32
|
+
io.rewind
|
33
|
+
end
|
34
|
+
YAML.load_stream(io) do |e|
|
35
|
+
if name = e.dig('log','trace','cpee:name')
|
36
|
+
puts " " * deep + name + " (#{File.basename(fname,'.xes.yaml')}) - #{e.dig('log','trace','concept:name')}"
|
37
|
+
end
|
38
|
+
if e.dig('event','concept:endpoint') == 'https://centurio.work/flow/start/url/' && e.dig('event','cpee:lifecycle:transition') == 'task/instantiation'
|
39
|
+
base = e.dig('event','data','data_receiver')
|
40
|
+
val = base.dig('CPEE-INSTANCE') rescue nil
|
41
|
+
if val.nil?
|
42
|
+
val = File.basename(base)
|
43
|
+
end
|
44
|
+
uuid = base.dig('CPEE-INSTANCE-UUID') rescue nil
|
45
|
+
unless uuid
|
46
|
+
res = Typhoeus.get(File.join('https://centurio.work/flow/engine/',val,'/properties/values/attributes/uuid/'))
|
47
|
+
if res.success?
|
48
|
+
uuid = XML::Smart.string(res.body).find('string(/*)')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
react File.dirname(fname) + "/#{uuid}.xes.yaml",copy,deep + 2
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def react(name,copy=false,deep=0)
|
57
|
+
if name.nil?
|
58
|
+
help
|
59
|
+
elsif name =~ /^https?:\/\//
|
60
|
+
res = Typhoeus.get(name)
|
61
|
+
if res.success?
|
62
|
+
file = Tempfile.new('sic')
|
63
|
+
file.write(res.body)
|
64
|
+
file.rewind
|
65
|
+
follow name, file, copy, deep
|
66
|
+
file.close
|
67
|
+
file.unlink
|
68
|
+
end
|
69
|
+
elsif File.exists? name
|
70
|
+
follow name, File.open(name), copy, deep
|
71
|
+
else
|
72
|
+
help
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
exname = File.basename($0)
|
77
|
+
|
26
78
|
ARGV.options { |opt|
|
27
79
|
opt.summary_indent = ' ' * 2
|
28
80
|
opt.summary_width = 15
|
29
|
-
opt.banner = "Usage:\n#{opt.summary_indent}#{
|
81
|
+
opt.banner = "Usage:\n#{opt.summary_indent}#{exname} new [DIR] | view [URI] | copy [URI]\n"
|
30
82
|
opt.on("Options:")
|
31
83
|
opt.on("--help", "-h", "This text") { puts opt; exit }
|
32
84
|
opt.on("")
|
33
|
-
opt.on(wrap("[DIR]
|
85
|
+
opt.on(wrap("new [DIR] scaffolds a sample logging service. Add a handler to a cpee instance to experience the pleasure.",78,18,0))
|
86
|
+
opt.on("")
|
87
|
+
opt.on(wrap("view [DIR] view the dependencies between processes and subprocesses.\nWorks for local and remote logs. Examples:\n#{exname} view https://cpee.org/log/123.xes.yaml\n#{exname} view https://cpee.org/log/a.xes.yaml > index.txt\n#{exname} view ~/log/logs/456.xes.yaml"))
|
88
|
+
opt.on("")
|
89
|
+
opt.on(wrap("copy [DIR] copy dependent processes and subprocesses to the current\ndirectory. Works for local and remote logs. Examples:\n#{exname} copy https://cpee.org/log/123.xes.yaml\n#{exname} copy ~/log/logs/456.xes.yaml"))
|
34
90
|
opt.parse!
|
35
91
|
}
|
36
|
-
if (ARGV.length !=
|
92
|
+
if (ARGV.length != 2)
|
37
93
|
puts ARGV.options
|
38
94
|
exit
|
39
95
|
else
|
40
|
-
|
96
|
+
command = ARGV[0]
|
97
|
+
dir = ARGV[1]
|
41
98
|
end
|
42
99
|
|
43
|
-
if
|
44
|
-
|
45
|
-
|
46
|
-
|
100
|
+
if command == 'new'
|
101
|
+
if !File.exists?(dir)
|
102
|
+
FileUtils.cp_r(File.join(curpath,'..','server'),dir)
|
103
|
+
FileUtils.mkdir(File.join(dir,'logs')) rescue nil
|
104
|
+
else
|
105
|
+
puts 'Directory already exists.'
|
106
|
+
end
|
107
|
+
elsif command == 'view'
|
108
|
+
react dir, false
|
109
|
+
elsif command == 'copy'
|
110
|
+
react dir, true
|
47
111
|
else
|
48
|
-
puts
|
112
|
+
puts ARGV.options
|
49
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cpee-logging-xes-yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
|
-
|
8
|
+
- Florian Stertz
|
9
|
+
autorequire:
|
9
10
|
bindir: tools
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-11-03 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: riddl
|
@@ -44,20 +45,20 @@ dependencies:
|
|
44
45
|
requirements:
|
45
46
|
- - "~>"
|
46
47
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1'
|
48
|
+
version: '2.1'
|
48
49
|
- - ">="
|
49
50
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
51
|
+
version: 2.1.4
|
51
52
|
type: :runtime
|
52
53
|
prerelease: false
|
53
54
|
version_requirements: !ruby/object:Gem::Requirement
|
54
55
|
requirements:
|
55
56
|
- - "~>"
|
56
57
|
- !ruby/object:Gem::Version
|
57
|
-
version: '1'
|
58
|
+
version: '2.1'
|
58
59
|
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
61
|
+
version: 2.1.4
|
61
62
|
description: see http://cpee.org
|
62
63
|
email: juergen.mangler@gmail.com
|
63
64
|
executables:
|
@@ -76,12 +77,11 @@ files:
|
|
76
77
|
- lib/cpee-logging-xes-yaml/template.xes_yaml
|
77
78
|
- server/log
|
78
79
|
- tools/cpee-logging-xes-yaml
|
79
|
-
- tools/sic.rb
|
80
80
|
homepage: http://cpee.org/
|
81
81
|
licenses:
|
82
82
|
- LGPL-3.0
|
83
83
|
metadata: {}
|
84
|
-
post_install_message:
|
84
|
+
post_install_message:
|
85
85
|
rdoc_options: []
|
86
86
|
require_paths:
|
87
87
|
- lib
|
@@ -96,8 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
100
|
-
signing_key:
|
99
|
+
rubygems_version: 3.2.22
|
100
|
+
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Logging for the cloud process execution engine (cpee.org)
|
103
103
|
test_files: []
|
data/tools/sic.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
require 'yaml'
|
3
|
-
require 'typhoeus'
|
4
|
-
require 'stringio'
|
5
|
-
require 'xml/smart'
|
6
|
-
|
7
|
-
def follow(fname,io,deep=0)
|
8
|
-
if ARGV[1] == 'copy'
|
9
|
-
File.write(File.basename(fname,'.xes.yaml') + '.xes.yaml',io.read)
|
10
|
-
io.rewind
|
11
|
-
end
|
12
|
-
YAML.load_stream(io) do |e|
|
13
|
-
if name = e.dig('log','trace','cpee:name')
|
14
|
-
puts " " * deep + name + " (#{File.basename(fname,'.xes.yaml')}) - #{e.dig('log','trace','concept:name')}"
|
15
|
-
end
|
16
|
-
if e.dig('event','concept:endpoint') == 'https://centurio.work/flow/start/url/' && e.dig('event','cpee:lifecycle:transition') == 'task/instantiation'
|
17
|
-
base = e.dig('event','data','data_receiver')
|
18
|
-
val = base.dig('CPEE-INSTANCE') rescue nil
|
19
|
-
if val.nil?
|
20
|
-
val = File.basename(base)
|
21
|
-
end
|
22
|
-
uuid = base.dig('CPEE-INSTANCE-UUID') rescue nil
|
23
|
-
unless uuid
|
24
|
-
res = Typhoeus.get(File.join('https://centurio.work/flow/engine/',val,'/properties/values/attributes/uuid/'))
|
25
|
-
if res.success?
|
26
|
-
uuid = XML::Smart.string(res.body).find('string(/*)')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
react File.dirname(fname) + "/#{uuid}.xes.yaml",deep + 2
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def react(name,deep=0)
|
35
|
-
if name.nil?
|
36
|
-
help
|
37
|
-
elsif name =~ /^https?:\/\//
|
38
|
-
res = Typhoeus.get(name)
|
39
|
-
if res.success?
|
40
|
-
file = Tempfile.new('sic')
|
41
|
-
file.write(res.body)
|
42
|
-
file.rewind
|
43
|
-
follow name, file, deep
|
44
|
-
file.close
|
45
|
-
file.unlink
|
46
|
-
end
|
47
|
-
elsif File.exists? name
|
48
|
-
follow name, File.open(name), deep
|
49
|
-
else
|
50
|
-
help
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def help
|
55
|
-
puts 'Views or copies log file trees to current directory.'
|
56
|
-
puts
|
57
|
-
puts ' View: sic.rb https://centurio.work/log/865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml'
|
58
|
-
puts ' Copy: sic.rb https://centurio.work/log/865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml copy'
|
59
|
-
puts ' Copy: sic.rb ~/Projects/cpee/log/logs/865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml copy'
|
60
|
-
puts ' View: sic.rb 865916c6-2b18-4e9d-81d4-0fab0df248f4.xes.yaml'
|
61
|
-
true
|
62
|
-
end
|
63
|
-
|
64
|
-
react(ARGV[0]) || help
|