cpee-logging-xes-yaml 1.3.7 → 1.3.19

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: 5aae51b9195c2048f4aa6bffe2e166ff929ff769060b17abd40fbe05e8c360f2
4
- data.tar.gz: 9f1f40663b2f867e9d5663f1b1205c03af5357f072aaee202d46a3222e84591d
3
+ metadata.gz: 76b88a4c9745d8814402e6363cc334463ae162b38e005b93f524efcbf34553b6
4
+ data.tar.gz: 6e97d237e71d98b54f98e2e378f03f036dad8baf317a63b9913d221450eb1ce5
5
5
  SHA512:
6
- metadata.gz: 204d3006b767ca4a40adf8076f63f6c176fbc054c22eb3599f1e929210f8e150f060aee7dda49853b5bd02fac5ae7f32f796037f0a2b2ba72ff5caed3f61ce0c
7
- data.tar.gz: 5e6557309512c4e1ab3159ac79dc232308163f70a74b8693712da02edbfda67cc8294fc2a89f3b86c75fee4684c3f848bf165a12201bd67dad871c3cf44cad39
6
+ metadata.gz: 6d005ee24f4854122c4f9807caccd76916edda4c6c054fd900442c96a20f23770f1a765ea2d72cd9b55b07ab5f6661672469cc952f03e97c4f2687aec2576126
7
+ data.tar.gz: 0fde138a76c29754a22aabb1302bbdcd011e010bdc29a5297ffe89e343c26df5b4c23b9ac39f83e272f3806ce5e4102cd7c6cc4fb2ec7bd821df891ce09aacac
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-logging-xes-yaml"
3
- s.version = "1.3.7"
3
+ s.version = "1.3.19"
4
4
  s.platform = Gem::Platform::RUBY
5
- s.license = "LGPL-3.0"
5
+ s.license = "LGPL-3.0-or-later"
6
6
  s.summary = "Logging for the cloud process execution engine (cpee.org)"
7
7
 
8
8
  s.description = "see http://cpee.org"
9
9
 
10
- s.files = Dir['{server/**/*,tools/**/*,lib/**/*}'] + %w(LICENSE Rakefile cpee-logging-xes-yaml.gemspec README.md AUTHORS)
10
+ s.files = Dir['{server/**/*,tools/*,lib/**/*}'] + %w(LICENSE Rakefile cpee-logging-xes-yaml.gemspec README.md AUTHORS)
11
11
  s.require_path = 'lib'
12
12
  s.extra_rdoc_files = ['README.md']
13
13
  s.bindir = 'tools'
@@ -22,5 +22,6 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.add_runtime_dependency 'riddl', '~> 1.0'
24
24
  s.add_runtime_dependency 'json', '~> 2.1'
25
- s.add_runtime_dependency 'cpee', '~> 2.1', '>= 2.1.4'
25
+ s.add_runtime_dependency 'cpee', '~> 2.1', '>= 2.1.86'
26
+ s.add_runtime_dependency 'msgpack', '~> 1.7', '>= 1.7.2'
26
27
  end
@@ -35,6 +35,21 @@ module CPEE
35
35
  topic = @p[1].value
36
36
  event_name = @p[2].value
37
37
  payload = @p[3].value.read
38
+
39
+ unless File.exist? File.join(opts[:log_dir],@h['CPEE_INSTANCE_UUID'] + '.xes.yaml')
40
+ notification = JSON.parse(payload)
41
+ log = YAML::load(File.read(opts[:template]))
42
+ log['log']['trace']['concept:name'] ||= notification['instance']
43
+ log['log']['trace']['cpee:name'] ||= notification['instance-name'] if notification['instance-name']
44
+ log['log']['trace']['cpee:instance'] ||= notification['instance-uuid']
45
+ log['log']['trace']['cpee:parent_instance'] ||= notification.dig('content','attributes','parent_instance').to_i if notification.dig('content','attributes','parent_instance')
46
+ log['log']['trace']['cpee:parent_instance_uuid'] ||= notification.dig('content','attributes','parent_instance_uuid') if notification.dig('content','attributes','parent_instance_uuid')
47
+ log['log']['trace']['cpee:parent_instance_model'] ||= notification.dig('content','attributes','parent_instance_model') if notification.dig('content','attributes','parent_instance_model')
48
+ log['log']['trace']['cpee:parent_instance_task_id'] ||= notification.dig('content','attributes','parent_instance_task_id') if notification.dig('content','attributes','parent_instance_task_id')
49
+ log['log']['trace']['cpee:parent_instance_task_label'] ||= notification.dig('content','attributes','parent_instance_task_label') if notification.dig('content','attributes','parent_instance_task_label')
50
+ File.open(File.join(opts[:log_dir],@h['CPEE_INSTANCE_UUID']+'.xes.yaml'),'w'){|f| f.puts log.to_yaml}
51
+ end
52
+
38
53
  EM.defer do
39
54
  CPEE::Logging::forward opts, topic, event_name, payload
40
55
  end if type == 'event'
@@ -47,7 +62,7 @@ module CPEE
47
62
 
48
63
  class Overview < Riddl::Implementation #{{{
49
64
  def response
50
- Riddl::Parameter::Complex.new("overview","text/xml") do
65
+ Riddl::Parameter::Complex.new('overview','text/xml') do
51
66
  <<-END
52
67
  <overview xmlns='http://riddl.org/ns/common-patterns/notifications-producer/2.0'>
53
68
  <topics/>
@@ -16,14 +16,14 @@ log:
16
16
  stream: https://cpee.org/datastream/datastream.xesext
17
17
  global:
18
18
  trace:
19
- concept:name: __INVALID__
20
- cpee:name: __INVALID__
19
+ concept:name: __NOTSPECIFIED__
20
+ cpee:name: __NOTSPECIFIED__
21
21
  event:
22
22
  concept:instance: -1
23
- concept:name: __INVALID__
24
- concept:endpoint: ''
25
- id:id: ''
26
- cpee:uuid: ''
23
+ concept:name: __NOTSPECIFIED__
24
+ concept:endpoint: __NOTSPECIFIED__
25
+ id:id: __NOTSPECIFIED__
26
+ cpee:uuid: __NOTSPECIFIED__
27
27
  lifecycle:transition: complete
28
28
  cpee:lifecycle:transition: activity/calling
29
29
  time:timestamp: ''
@@ -227,6 +227,7 @@ module CPEE
227
227
  template = opts[:template]
228
228
 
229
229
  instancenr = notification['instance']
230
+
230
231
  content = notification['content']
231
232
  activity = content['activity']
232
233
  parameters = content['parameters']
@@ -255,11 +256,6 @@ module CPEE
255
256
  end
256
257
  end
257
258
 
258
- log = YAML::load(File.read(template))
259
- log["log"]["trace"]["concept:name"] ||= instancenr
260
- log["log"]["trace"]["cpee:name"] ||= notification['instance-name'] if notification['instance-name']
261
- log["log"]["trace"]["cpee:instance"] ||= instance
262
- File.open(File.join(log_dir,instance+'.xes.yaml'),'w'){|f| f.puts log.to_yaml} unless File.exist? File.join(log_dir,instance+'.xes.yaml')
263
259
  event = {}
264
260
  event["concept:instance"] = instancenr
265
261
  event["concept:name"] = content["label"] if content["label"]
@@ -271,16 +267,18 @@ module CPEE
271
267
  event["cpee:activity_uuid"] = content['activity-uuid'] if content['activity-uuid']
272
268
  event["cpee:instance"] = instance
273
269
  case event_name
274
- when 'receiving', 'change', 'instantiation'
275
- event["lifecycle:transition"] = "unknown"
270
+ when 'calling'
271
+ event["lifecycle:transition"] = "start"
276
272
  when 'done'
277
273
  event["lifecycle:transition"] = "complete"
278
274
  else
279
- event["lifecycle:transition"] = "start"
275
+ event["lifecycle:transition"] = "unknown"
280
276
  end
281
277
  event["cpee:lifecycle:transition"] = "#{topic}/#{event_name}"
282
278
  event["cpee:state"] = content['state'] if content['state']
283
279
  event["cpee:description"] = content['dslx'] if content['dslx']
280
+ event["cpee:change_uuid"] = content['change_uuid'] if content['change_uuid']
281
+ event["cpee:exposition"] = content['exposition'] if content['exposition']
284
282
  unless parameters["arguments"]&.nil?
285
283
  event["data"] = parameters["arguments"]
286
284
  end if parameters
@@ -346,9 +344,9 @@ module CPEE
346
344
  end
347
345
  end
348
346
  if receiving && !receiving.empty?
349
- event["raw"] = receiving
347
+ event["data"] = receiving
350
348
  end
351
- event["time:timestamp"]= notification['timestamp'] || Time.now.strftime("%Y-%m-%dT%H:%M:%S.%L%:z")
349
+ event["time:timestamp"]= notification['timestamp'] || Time.now.xmlschema(4)
352
350
  File.open(File.join(log_dir,instance+'.xes.yaml'),'a') do |f|
353
351
  f << {'event' => event}.to_yaml
354
352
  end
@@ -58,24 +58,24 @@ TEMPLATE_XES_XML = <<-END
58
58
  <extension name="CPEE" prefix="cpee" uri="http://cpee.org/cpee.xesext"/>
59
59
  <extension name="stream" prefix="stream" uri="https://cpee.org/datastream/datastream.xesext"/>
60
60
  <global scope="trace">
61
- <string key="concept:name" value="__INVALID__"/>
62
- <string key="cpee:name" value="__INVALID__"/>
61
+ <string key="concept:name" value="__NOTSPECIFIED__"/>
62
+ <string key="cpee:name" value="__NOTSPECIFIED__"/>
63
63
  </global>
64
64
  <global scope="event">
65
- <string key="concept:name" value="__INVALID__"/>
65
+ <string key="concept:name" value="__NOTSPECIFIED__"/>
66
66
  <string key="concept:instance" value="-1"/>
67
- <string key="concept:endpoint" value=""/>
68
- <string key="id:id" value=""/>
67
+ <string key="concept:endpoint" value="__NOTSPECIFIED__"/>
68
+ <string key="id:id" value="__NOTSPECIFIED__"/>
69
69
  <string key="lifecycle:transition" value="complete" />
70
70
  <string key="cpee:lifecycle:transition" value="activity/calling"/>
71
- <date key="time:timestamp" value=""/>
71
+ <date key="time:timestamp" value="__NOTSPECIFIED__"/>
72
72
  </global>
73
73
  <trace/>
74
74
  </log>
75
75
  END
76
76
 
77
77
  def rec_type(it)
78
- if (Time.parse(it) rescue nil)
78
+ if it.is_a?(String) && it =~ /^[\dT:+.-]+$/ && (Time.parse(it) rescue nil)
79
79
  'x:date'
80
80
  elsif it.is_a? Float
81
81
  'x:float'
@@ -89,14 +89,13 @@ end
89
89
  def rec_a_insert(event,node,level=0)
90
90
  event.each do |i|
91
91
  tnode = node
92
- # tnode = node.add('x:string', 'key' => 'item')
93
92
  case i
94
93
  when Hash
95
94
  rec_insert(i,tnode,level+1)
96
95
  when Array
97
96
  rec_a_insert(i,tnode,level+1)
98
97
  when String
99
- node.add(rec_type(i), 'key' => i, 'value' => i)
98
+ node.add(rec_type(i), 'key' => i, 'value' => (i.empty? ? "__UNSPECIFIED__" : i))
100
99
  end
101
100
  end
102
101
  end
@@ -105,12 +104,16 @@ def rec_insert(event,node,level=0)
105
104
  event.each do |k,v|
106
105
  case v
107
106
  when String
107
+ node.add(rec_type(v), 'key' => k, 'value' => (v.empty? ? "__UNSPECIFIED__" : v))
108
+ when Integer
109
+ node.add(rec_type(v), 'key' => k, 'value' => v)
110
+ when Float
108
111
  node.add(rec_type(v), 'key' => k, 'value' => v)
109
112
  when Array
110
113
  tnode = node.add('x:list', 'key' => k)
111
114
  rec_a_insert(v,tnode,level+1)
112
115
  when Hash
113
- tnode = node.add('x:string', 'key' => k)
116
+ tnode = node.add('x:list', 'key' => k)
114
117
  rec_insert(v,tnode)
115
118
  end
116
119
  end
@@ -131,7 +134,7 @@ def follow(fname,io,copy,deep=0,index=nil)
131
134
  index.write " " * deep + name + " (#{tname}) - #{e.dig('log','trace','concept:name')}\n"
132
135
  end
133
136
  if e.dig('event','cpee:lifecycle:transition') == 'task/instantiation'
134
- base = e.dig('event','raw')
137
+ base = e.dig('event','data')
135
138
  val = base.dig('CPEE-INSTANCE') rescue nil
136
139
  if val.nil?
137
140
  val = File.basename(base)
@@ -145,7 +148,7 @@ def follow(fname,io,copy,deep=0,index=nil)
145
148
  end
146
149
 
147
150
  def react(name,copy=false,deep=0,index=nil)
148
- index ||= File.open('index.txt','w')
151
+ index ||= File.open('index.txt','a')
149
152
  if name.nil?
150
153
  help
151
154
  elsif name =~ /^https?:\/\//
@@ -170,7 +173,7 @@ def extract(path)
170
173
  if path =~ /^http.*/
171
174
  unlink = true
172
175
  text = Tempfile.new('extract-model-download')
173
- request = Typhoeus::Request.new("www.example.com/huge.iso")
176
+ request = Typhoeus::Request.new(path)
174
177
  request.on_headers do |response|
175
178
  if response.code != 200
176
179
  raise "Request failed"
@@ -192,14 +195,14 @@ def extract(path)
192
195
  info = yaml.shift
193
196
  uuid = info.dig('log','trace','cpee:instance')
194
197
  yaml.each do |el|
195
- if el['event']['id:id'] == 'external' && (el.dig('event','cpee:lifecycle:transition') == 'endpoints/change' || el.dig('event','cpee:lifecycle:transition') == 'dataelements/change'|| el.dig('event','cpee:lifecycle:transition') == 'description/change')
198
+ if el['event']['id:id'] == 'external' && (el.dig('event','cpee:lifecycle:transition') == 'endpoints/change' || el.dig('event','cpee:lifecycle:transition') == 'attributes/change' || el.dig('event','cpee:lifecycle:transition') == 'dataelements/change'|| el.dig('event','cpee:lifecycle:transition') == 'description/change')
196
199
  changes.push(el)
197
200
  end
198
201
  end
199
202
 
200
203
  changes.sort! { |a,b| DateTime.strptime(a.dig('event','time:timestamp'),'%Y-%m-%dT%H:%M:%S.%L%:z') <=> DateTime.strptime(b.dig('event','time:timestamp'),'%Y-%m-%dT%H:%M:%S.%L%:z') }
201
204
 
202
- de = ep = desc = nil
205
+ de = ep = desc = at = nil
203
206
  counter = 0
204
207
  changes.each do |change|
205
208
  if change.dig('event','cpee:lifecycle:transition') == 'dataelements/change'
@@ -208,11 +211,14 @@ def extract(path)
208
211
  if change.dig('event','cpee:lifecycle:transition') == 'endpoints/change'
209
212
  ep = change.dig('event','data')
210
213
  end
214
+ if change.dig('event','cpee:lifecycle:transition') == 'attributes/change'
215
+ at = change.dig('event','data')
216
+ end
211
217
  if change.dig('event','cpee:lifecycle:transition') == 'description/change'
212
218
  desc = change.dig('event','cpee:description')
213
219
  end
214
220
  if change.dig('event','cpee:lifecycle:transition') == 'description/change' || change.dig('event','cpee:lifecycle:transition') == 'endpoints/change'
215
- yield uuid, de, ep, desc, counter if block_given?
221
+ yield uuid, de, ep, desc, at, counter if block_given?
216
222
  counter += 1
217
223
  end
218
224
  end
@@ -220,10 +226,11 @@ def extract(path)
220
226
  text.close
221
227
  text.unlink if unlink
222
228
 
223
- [de, ep, desc]
229
+ [de, ep, desc, at]
224
230
  end
225
231
 
226
232
  exname = File.basename($0)
233
+ attr = {}
227
234
 
228
235
  ARGV.options { |opt|
229
236
  opt.summary_indent = ' ' * 2
@@ -231,6 +238,7 @@ ARGV.options { |opt|
231
238
  opt.banner = "Usage:\n#{opt.summary_indent}#{exname} new [DIR] | view [URI] | copy [URI]\n"
232
239
  opt.on("Options:")
233
240
  opt.on("--help", "-h", "This text") { puts opt; exit }
241
+ opt.on("--add [STRING]", "-a [STRING]", "Add attribute for extract-all and extract-last. Example: -a 'filter=me'") { |a| x,y = a.split('='); attr[x] = y }
234
242
  opt.on("")
235
243
  opt.on(wrap("\"#{exname}\" will be call \"c\" in the examples for each command."))
236
244
  exname = 'c'
@@ -257,7 +265,7 @@ if (ARGV.length < 1 || ARGV.length > 2)
257
265
  elsif ARGV.length == 2
258
266
  command = ARGV[0]
259
267
  path = ARGV[1]
260
- elsif ARGV.length == 1 && %w{index extract-last to-xes-xml}.include?(ARGV[0])
268
+ elsif (ARGV.length == 1 || ARGV.length == 2) && %w{index extract-last to-xes-xml}.include?(ARGV[0])
261
269
  command = ARGV[0]
262
270
  end
263
271
 
@@ -273,11 +281,12 @@ elsif command == 'view'
273
281
  elsif command == 'copy'
274
282
  react path, true
275
283
  elsif command == 'extract-all'
276
- extract(path) do |uuid, de, ep, desc, version|
284
+ extract(path) do |uuid, de, ep, desc, at, version|
277
285
  xml = XML::Smart.string('<testset xmlns="http://cpee.org/ns/properties/2.0"><executionhandler>ruby</executionhandler></testset>')
278
286
  dataelements = xml.root().add('dataelements')
279
287
  endpoints = xml.root().add('endpoints')
280
288
  description = xml.root().add('description').add(XML::Smart.string('<description xmlns="http://cpee.org/ns/description/1.0"/>').root())
289
+ attributes = xml.root().add('attributes')
281
290
  unless de.nil?
282
291
  de.each do |d|
283
292
  dataelements.add(d['name'],d['value'])
@@ -288,6 +297,11 @@ elsif command == 'extract-all'
288
297
  endpoints.add(e['name'],e['value'])
289
298
  end
290
299
  end
300
+ unless at.nil?
301
+ at.each do |e|
302
+ attributes.add(e['name'],e['value'])
303
+ end
304
+ end
291
305
  unless desc.nil?
292
306
  description.replace_by(XML::Smart.string(desc).root())
293
307
  end
@@ -304,12 +318,13 @@ elsif command == 'extract-last'
304
318
  end
305
319
 
306
320
  path.each do |f|
307
- de, ep, desc = extract(f)
321
+ de, ep, desc, at = extract(f)
308
322
 
309
323
  xml = XML::Smart.string('<testset xmlns="http://cpee.org/ns/properties/2.0"><executionhandler>ruby</executionhandler></testset>')
310
324
  dataelements = xml.root().add('dataelements')
311
325
  endpoints = xml.root().add('endpoints')
312
326
  description = xml.root().add('description').add(XML::Smart.string('<description xmlns="http://cpee.org/ns/description/1.0"/>').root())
327
+ attributes = xml.root().add('attributes')
313
328
  unless de.nil?
314
329
  de.each do |d|
315
330
  dataelements.add(d['name'],d['value'])
@@ -323,8 +338,18 @@ elsif command == 'extract-last'
323
338
  unless desc.nil?
324
339
  description.replace_by(XML::Smart.string(desc).root())
325
340
  end
341
+ unless at.nil?
342
+ attr.each do |k,v|
343
+ attributes.add(k,v)
344
+ end
345
+ at.each do |e|
346
+ unless attr.keys.include? e['name']
347
+ attributes.add(e['name'],e['value'])
348
+ end
349
+ end
350
+ end
326
351
 
327
- File.write(f + '.model', xml.to_s)
352
+ File.write(File.basename(f) + '.model', xml.to_s)
328
353
  end
329
354
  elsif command == 'index'
330
355
  path = if path
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-logging-xes-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.3.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  - Florian Stertz
9
- autorequire:
10
9
  bindir: tools
11
10
  cert_chain: []
12
- date: 2024-03-19 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: riddl
@@ -48,7 +47,7 @@ dependencies:
48
47
  version: '2.1'
49
48
  - - ">="
50
49
  - !ruby/object:Gem::Version
51
- version: 2.1.4
50
+ version: 2.1.86
52
51
  type: :runtime
53
52
  prerelease: false
54
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +57,27 @@ dependencies:
58
57
  version: '2.1'
59
58
  - - ">="
60
59
  - !ruby/object:Gem::Version
61
- version: 2.1.4
60
+ version: 2.1.86
61
+ - !ruby/object:Gem::Dependency
62
+ name: msgpack
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.7'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 1.7.2
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.7'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 1.7.2
62
81
  description: see http://cpee.org
63
82
  email: juergen.mangler@gmail.com
64
83
  executables:
@@ -81,9 +100,8 @@ files:
81
100
  - tools/cpee-logging-xes-yaml
82
101
  homepage: http://cpee.org/
83
102
  licenses:
84
- - LGPL-3.0
103
+ - LGPL-3.0-or-later
85
104
  metadata: {}
86
- post_install_message:
87
105
  rdoc_options: []
88
106
  require_paths:
89
107
  - lib
@@ -98,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
116
  - !ruby/object:Gem::Version
99
117
  version: '0'
100
118
  requirements: []
101
- rubygems_version: 3.4.10
102
- signing_key:
119
+ rubygems_version: 3.6.7
103
120
  specification_version: 4
104
121
  summary: Logging for the cloud process execution engine (cpee.org)
105
122
  test_files: []