cpee-logging-xes-yaml 1.5.3 → 1.5.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/AUTHORS +2 -0
- data/cpee-logging-xes-yaml.gemspec +2 -2
- data/tools/cpee-logging-xes-yaml +50 -5
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 840f6e5d3bf6287284ca354a275258376be5d367a85fe2047888b4c76b484c9c
|
|
4
|
+
data.tar.gz: 4821fdb1a463b36f492c0833daabb9a407dbdf8d61d451429f7008914a23377b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 193ef726d7884d694b156d000732e412ebc7bd4dd74bc4877587252c71e75871e4be6c315bce8c38d684dac5168a748a2f185bc2d9ffbab77da3b1dfd1a6b273
|
|
7
|
+
data.tar.gz: 896fb27beff7796afd1cb4cb240bb022f781be840fd6a1b1610b336b83eb922b0740dcef20daf948fef68c1ead5d9677b63f3b85c0c302f37566dc174522195d
|
data/AUTHORS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "cpee-logging-xes-yaml"
|
|
3
|
-
s.version = "1.5.
|
|
3
|
+
s.version = "1.5.4"
|
|
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)"
|
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
|
15
15
|
|
|
16
16
|
s.required_ruby_version = '>=2.4.0'
|
|
17
17
|
|
|
18
|
-
s.authors = ['Juergen eTM Mangler','Florian Stertz']
|
|
18
|
+
s.authors = ['Juergen eTM Mangler','Florian Stertz','Matthias Ehrendorfer','Dominik Voigt']
|
|
19
19
|
|
|
20
20
|
s.email = 'juergen.mangler@gmail.com'
|
|
21
21
|
s.homepage = 'http://cpee.org/'
|
data/tools/cpee-logging-xes-yaml
CHANGED
|
@@ -190,11 +190,11 @@ def react(name,copy=false,deep=0,index=nil)
|
|
|
190
190
|
end
|
|
191
191
|
end
|
|
192
192
|
|
|
193
|
-
def
|
|
193
|
+
def ropen(path)
|
|
194
194
|
unlink = false
|
|
195
195
|
if path =~ /^http.*/
|
|
196
196
|
unlink = true
|
|
197
|
-
|
|
197
|
+
fhandle = Tempfile.new('extract-model-download')
|
|
198
198
|
request = Typhoeus::Request.new(path)
|
|
199
199
|
request.on_headers do |response|
|
|
200
200
|
if response.code != 200
|
|
@@ -202,15 +202,20 @@ def extract(path)
|
|
|
202
202
|
end
|
|
203
203
|
end
|
|
204
204
|
request.on_body do |chunk|
|
|
205
|
-
|
|
205
|
+
fhandle.write(chunk)
|
|
206
206
|
end
|
|
207
207
|
request.on_complete do |response|
|
|
208
|
-
|
|
208
|
+
fhandle.rewind
|
|
209
209
|
end
|
|
210
210
|
request.run
|
|
211
211
|
else
|
|
212
|
-
|
|
212
|
+
fhandle = File.open(path)
|
|
213
213
|
end
|
|
214
|
+
[fhandle,unlink]
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def extract(path)
|
|
218
|
+
text, unlink = ropen(path)
|
|
214
219
|
yaml = Psych.load_stream(text)
|
|
215
220
|
changes = []
|
|
216
221
|
|
|
@@ -278,6 +283,8 @@ ARGV.options { |opt|
|
|
|
278
283
|
opt.on(wrap("index [LOG] creates an index for a log file, for more efficient parsing. When called without [LOG], indexes all log files in the current directory. Examples:\n#{exname} index https://cpee.org/log/123.xes.yaml\n#{exname} index ~/log/logs/456.xes.yaml"))
|
|
279
284
|
opt.on("")
|
|
280
285
|
opt.on(wrap("to-xes-xml [LOG] convert cpee xes-yaml to xes-xml. Works for local and remote logs. When called without [LOG], all log files in the current directory are converted. Examples:\n#{exname} to-xes-xml https://cpee.org/log/123.xes.yaml\n#{exname} to-xes-xml ~/log/logs/456.xes.yaml"))
|
|
286
|
+
opt.on("")
|
|
287
|
+
opt.on(wrap("sort [LOG] sort a cpee xes-yaml file by time:timestamp. Works for local and remote logs. When called without [LOG], all log files in the current directory are sorted. Examples:\n#{exname} sort https://cpee.org/log/123.xes.yaml\n#{exname} sort ~/log/logs/456.xes.yaml"))
|
|
281
288
|
opt.parse!
|
|
282
289
|
}
|
|
283
290
|
|
|
@@ -461,6 +468,44 @@ elsif command == 'to-xes-xml'
|
|
|
461
468
|
File.write(fname, TEMPLATE_XES_XML_END, mode: 'a')
|
|
462
469
|
puts "#{count}/#{total.to_i} 100% (took #{format_secs(duration)}) \n"
|
|
463
470
|
end
|
|
471
|
+
elsif command == 'sort'
|
|
472
|
+
path = if path
|
|
473
|
+
[path]
|
|
474
|
+
else
|
|
475
|
+
Dir.glob('*.xes.yaml')
|
|
476
|
+
end
|
|
477
|
+
path.each do |f|
|
|
478
|
+
index = []
|
|
479
|
+
write_list = []
|
|
480
|
+
io,unlink = ropen(f)
|
|
481
|
+
while(io.eof?().!())
|
|
482
|
+
start = io.pos()
|
|
483
|
+
docs = io.readline("---\n",chomp: true)
|
|
484
|
+
doc = YAML::load(docs, permitted_classes: [Time])
|
|
485
|
+
if(doc.nil?().!()) then
|
|
486
|
+
ts = doc.dig('event','time:timestamp')
|
|
487
|
+
if(ts.nil?().!())
|
|
488
|
+
index.push({ :ts => ts, :s => start.to_i(), :l => docs.length().to_i() })
|
|
489
|
+
else
|
|
490
|
+
if(index.empty?())
|
|
491
|
+
write_list.push({ :s => start.to_i(), :l => docs.length().to_i() })
|
|
492
|
+
else
|
|
493
|
+
index.last()[:l] = index.last()[:l]+4+docs.length().to_i()
|
|
494
|
+
end
|
|
495
|
+
end
|
|
496
|
+
end
|
|
497
|
+
end
|
|
498
|
+
write_list.concat(index.sort() { |a,b| Time.parse(a[:ts]) <=> Time.parse(b[:ts]) })
|
|
499
|
+
output_file = File.open("#{File.basename(f,'.xes.yaml')}.sorted.xes.yaml", 'w')
|
|
500
|
+
write_list.each() { |el|
|
|
501
|
+
output_file.write("---\n")
|
|
502
|
+
io.seek(el[:s],IO::SEEK_SET)
|
|
503
|
+
output_file.write(io.read(el[:l]))
|
|
504
|
+
}
|
|
505
|
+
output_file.close()
|
|
506
|
+
io.close()
|
|
507
|
+
io.unlink() if unlink
|
|
508
|
+
end
|
|
464
509
|
else
|
|
465
510
|
puts ARGV.options
|
|
466
511
|
end
|
metadata
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cpee-logging-xes-yaml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.5.
|
|
4
|
+
version: 1.5.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juergen eTM Mangler
|
|
8
8
|
- Florian Stertz
|
|
9
|
+
- Matthias Ehrendorfer
|
|
10
|
+
- Dominik Voigt
|
|
9
11
|
bindir: tools
|
|
10
12
|
cert_chain: []
|
|
11
13
|
date: 1980-01-02 00:00:00.000000000 Z
|