cpee-logging-xes-yaml 1.3.31 → 1.4.1

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: 84cb7628234c99607565dcf4a9de5131daada8bb1da09f5c04ab81afb599552c
4
- data.tar.gz: 41188414f1a414f86f49d1480648f08b867a81a16277dec1278215eef2faecd0
3
+ metadata.gz: '093abf131db31464c118276deec2c33110a1eada1249b40451fca9eaeee3c38d'
4
+ data.tar.gz: 8ba44738e83d6d5487f33026012d9ee813bd4dada97d0e4d4ffeefa0b04494b5
5
5
  SHA512:
6
- metadata.gz: f725d428357ac622f44da51c4a74321d13dc0be7efa51bfb2134decf298b3438b16b2dcb0f361a18d4fc73f30d08600a4b8fd1288e4a17643bded61bca76451e
7
- data.tar.gz: abff6758b78d981b3efa34a61e9ba8a3ad82b6f31193b414d137eff5f6e454e18bb7c30cb6460a55960313466565b26901d14400d4d83a5a20892b06eacfee77
6
+ metadata.gz: 2b20ebd080a36d9e71ea5e1bf1556d26c2e709fe28e9dd783058111dc4472bd52ecac7562d4e97a1c756a7768e29aec4f7aed4ec9cfeaf1df9e53a40d47e25a8
7
+ data.tar.gz: 958888e149af9efc14c16429830a3c54db0e97ac681826f08072a0e902ec036ae9369df8ae5b33599a8968f75fa70f774520e53f2e4429b8aca0923e90f65911
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-logging-xes-yaml"
3
- s.version = "1.3.31"
3
+ s.version = "1.4.1"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0-or-later"
6
6
  s.summary = "Logging for the cloud process execution engine (cpee.org)"
@@ -36,19 +36,20 @@ module CPEE
36
36
  event_name = @p[2].value
37
37
  payload = @p[3].value.read
38
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
39
+ ### we do not write headers for now. Or else we can only do per instance sharding.
40
+ # unless File.exist? File.join(opts[:log_dir],@h['CPEE_INSTANCE_UUID'] + '.xes.yaml')
41
+ # notification = JSON.parse(payload)
42
+ # log = YAML::load(File.read(opts[:template]))
43
+ # log['log']['trace']['concept:name'] ||= notification['instance']
44
+ # log['log']['trace']['cpee:name'] ||= notification['instance-name'] if notification['instance-name']
45
+ # log['log']['trace']['cpee:instance'] ||= notification['instance-uuid']
46
+ # log['log']['trace']['cpee:parent_instance'] ||= notification.dig('content','attributes','parent_instance').to_i if notification.dig('content','attributes','parent_instance')
47
+ # log['log']['trace']['cpee:parent_instance_uuid'] ||= notification.dig('content','attributes','parent_instance_uuid') if notification.dig('content','attributes','parent_instance_uuid')
48
+ # log['log']['trace']['cpee:parent_instance_model'] ||= notification.dig('content','attributes','parent_instance_model') if notification.dig('content','attributes','parent_instance_model')
49
+ # 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')
50
+ # 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')
51
+ # File.open(File.join(opts[:log_dir],@h['CPEE_INSTANCE_UUID']+'.xes.yaml'),'w'){|f| f.puts log.to_yaml}
52
+ # end
52
53
 
53
54
  EM.defer do
54
55
  CPEE::Logging::forward opts, topic, event_name, payload
@@ -81,13 +81,15 @@ module CPEE
81
81
  opts[:subscriptions].each do |e,urls|
82
82
  if e == topic + '/' + event_name
83
83
  urls.each do |url|
84
- client = Riddl::Client.new(url)
85
- client.post [
86
- Riddl::Parameter::Simple::new('type','event'),
87
- Riddl::Parameter::Simple::new('topic',topic),
88
- Riddl::Parameter::Simple::new('event',event_name),
89
- Riddl::Parameter::Complex::new('notification','application/json',payload)
90
- ]
84
+ EM.defer do
85
+ client = Riddl::Client.new(url)
86
+ client.post [
87
+ Riddl::Parameter::Simple::new('type','event'),
88
+ Riddl::Parameter::Simple::new('topic',topic),
89
+ Riddl::Parameter::Simple::new('event',event_name),
90
+ Riddl::Parameter::Complex::new('notification','application/json',payload)
91
+ ]
92
+ end
91
93
  end
92
94
  end
93
95
  end
@@ -150,7 +152,7 @@ module CPEE
150
152
  ret[tid] = ret[tid][0]
151
153
  end
152
154
  hash = Digest::SHA1.hexdigest(ret[tid])
153
- if !File.exist?(fname) || (File.exist?(fname) && File.read(fname) != hash)
155
+ if !File.exist?(fname) || File.read(fname) != hash
154
156
  File.write(fname,hash)
155
157
  end
156
158
  end
@@ -213,7 +215,7 @@ module CPEE
213
215
  def self::load_values(where)
214
216
  ret = nil
215
217
  File.open(where,'r') do |f|
216
- f.flock(File::LOCK_EX)
218
+ f.flock(File::LOCK_SH)
217
219
  ret = JSON::load(f)
218
220
  f.flock(File::LOCK_UN)
219
221
  end
@@ -223,8 +225,6 @@ module CPEE
223
225
  def self::forward(opts,topic,event_name,payload)
224
226
  if topic == 'state' && event_name == 'change'
225
227
  self::notify(opts,topic,event_name,payload)
226
- elsif topic == 'state' && event_name == 'change'
227
- self::notify(opts,topic,event_name,payload)
228
228
  elsif topic == 'gateway' && event_name == 'join'
229
229
  self::notify(opts,topic,event_name,payload)
230
230
  end
@@ -236,7 +236,6 @@ module CPEE
236
236
  return unless instance
237
237
 
238
238
  log_dir = opts[:log_dir]
239
- template = opts[:template]
240
239
 
241
240
  instancenr = notification['instance']
242
241
  content = notification['content']
@@ -250,7 +249,7 @@ module CPEE
250
249
  if content['dslx']
251
250
  CPEE::Logging::extract_probes(File.join(log_dir,instance),content['dslx'])
252
251
  CPEE::Logging::extract_annotations(File.join(log_dir,instance),content['dslx']).each do |k,v|
253
- so = Marshal.load(Marshal.dump(notification))
252
+ so = JSON.parse(notification.to_json)
254
253
  so['content'].delete('dslx')
255
254
  so['content'].delete('dsl')
256
255
  so['content'].delete('description')
@@ -324,11 +323,17 @@ module CPEE
324
323
  end
325
324
  end
326
325
  if event['stream:datastream'] && event['stream:datastream'].any?
327
- notification['datastream'] = event['stream:datastream']
328
326
  EM.defer do
329
- notification['topic'] = 'stream'
330
- notification['name'] = 'extraction'
331
- self::notify(opts,'stream','extraction',notification.to_json)
327
+ self::notify(
328
+ opts,
329
+ 'stream',
330
+ 'extraction',
331
+ notification.merge(
332
+ 'topic'=>'stream',
333
+ 'name'=>'extraction',
334
+ 'datastream'=>event['stream:datastream']
335
+ ).to_json
336
+ )
332
337
  end
333
338
  end
334
339
  end
@@ -362,11 +367,17 @@ module CPEE
362
367
  File.open(File.join(log_dir,instance+'.xes.yaml'),'a') do |f|
363
368
  f << {'event' => te}.to_yaml
364
369
  end
365
- notification['datastream'] = te['stream:datastream']
366
370
  EM.defer do
367
- notification['topic'] = 'stream'
368
- notification['name'] = 'extraction'
369
- self::notify(opts,'stream','extraction',notification.to_json)
371
+ self::notify(
372
+ opts,
373
+ 'stream',
374
+ 'extraction',
375
+ notification.merge(
376
+ 'topic'=>'stream',
377
+ 'name'=>'extraction',
378
+ 'datastream'=>te['stream:datastream']
379
+ ).to_json
380
+ )
370
381
  end
371
382
  end
372
383
  end
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # This file is part of CPEE-LOGGING-XES-YAML.
4
+ #
5
+ # CPEE-LOGGING-XES-YAML is free software: you can redistribute it and/or modify it
6
+ # under the terms of the GNU Lesser General Public License as published by the Free
7
+ # Software Foundation, either version 3 of the License, or (at your option) any
8
+ # later version.
9
+ #
10
+ # CPEE-LOGGING-XES-YAML is distributed in the hope that it will be useful, but
11
+ # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
13
+ # more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public License along with
16
+ # CPEE-LOGGING-XES-YAML (file LICENSE in the main directory). If not, see
17
+ # <http://www.gnu.org/licenses/>.
18
+
19
+ path = ARGV.shift()
20
+ lookup_lines = ARGV.shift().to_i()
21
+ regexes = ARGV
22
+ regexes.map!() { |el| el.gsub("\\n","\n") }
23
+
24
+ dir = Dir.open(File.join(path))
25
+ children = dir.children()
26
+ #pp children.length()
27
+ #pp children.filter() { |el| el.include?('.xes.yaml') }.length()
28
+ #pp children.filter() { |el| el.include?('.xes.shift.yaml') }.length()
29
+ #pp children.filter() { |el| el.include?('data.json') }.length()
30
+ #pp children.filter() { |el| el.include?('.anno') }.length()
31
+ #pp children.filter() { |el| el.include?('.probe') }.length()
32
+ #pp children.filter() { |el| el.include?('.branches.json') }.length()
33
+ #pp children.filter() { |el| el.include?('.shift.json') }.length()
34
+ children.filter!() { |el| el.end_with?('.xes.yaml') }
35
+ children.each() { |filename|
36
+ begin
37
+ file = File.open(File.join(path,filename))
38
+ lookup_lines.times() {
39
+ line = file.readline()
40
+ regexes.each() { |regex|
41
+ #pp regex
42
+ if(line.include?(regex)) then
43
+ puts "#{filename} matches '#{regex.gsub("\n","\\n")}' in line '#{line.gsub("\n","\\n")}' (file last modified: #{file.stat().mtime()})"
44
+ break
45
+ end
46
+ }
47
+ }
48
+ rescue Exception => e
49
+ #pp "Problem opening or reading file: #{e} -> go to next file"
50
+ #pp filename
51
+ next
52
+ ensure
53
+ file.close()
54
+ end
55
+ }
56
+ dir.close()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-logging-xes-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.31
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -112,6 +112,7 @@ files:
112
112
  - lib/cpee-logging-xes-yaml/topics.xml
113
113
  - server/log
114
114
  - tools/cpee-logging-xes-yaml
115
+ - tools/cpee-logging-xes-yaml-finder
115
116
  homepage: http://cpee.org/
116
117
  licenses:
117
118
  - LGPL-3.0-or-later