cpee-worklist 1.0.17 → 1.0.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: 5bf102e677abb150275c9f4b01ce89eb120053ba7d3dd49e5b8f76f5a97fdee8
4
- data.tar.gz: cec0662273259461355d533c9d3a5a15976369adf30fd6817f40b7d01e2141fa
3
+ metadata.gz: 06b0d5dfd91cdcb6096eb347897b655c2aaabc38401e90d3df063ef52c26f8dd
4
+ data.tar.gz: dbdb4b029ba6efe558f402518058e605cc556f1a19f46e519f495c7961029174
5
5
  SHA512:
6
- metadata.gz: 471180152239ec324890cfd1a8175c1400f2ec132c509070ea698a4f1ef0d4ffcadc0c692c1d223dc32652d6d82ccfce0a0c77807ef499ea21a98cf4fd37e215
7
- data.tar.gz: 5cfdf1e5abac3546f527526ee21d42c796b4db1576c78f6922baf7e69da4188d0e47316c037745ccee9dd1c4446cdbafdf6df997a74449354ed093b3a8770924
6
+ metadata.gz: 7bdee2fb8c40d77622c5c5d08845b51f7e7e4bb659ff2384447c5807baa48504605ed788bdac675b1281b17cc79c1537aba8c603fe82b601c0b38f94b34ebe51
7
+ data.tar.gz: e234e10ea4a283d5806006d43c284c65be71665c5497588db430b07d852228407af8a139e47e807d88fb92d4c8e4c86936da8337b00a463fc0fed0c103710fb4
data/AUTHORS CHANGED
@@ -1,3 +1,4 @@
1
1
  Jürgen 'eTM' Mangler <juergen.mangler@univie.ac.at>
2
2
  Florian 'Triarier' Stertz <florian.stertz@gmail.com>
3
3
  Patrik 'The King' Koenig
4
+ Nathaliia 'com-pot' Klievtsova
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-worklist"
3
- s.version = "1.0.17"
3
+ s.version = "1.0.19"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0-or-later"
6
6
  s.summary = "Worklist for the cloud process execution engine (cpee.org)"
@@ -15,13 +15,13 @@ 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', 'Patrik Koenig']
18
+ s.authors = ['Juergen eTM Mangler','Florian Stertz', 'Patrik Koenig', 'Nataliia Klievtsova']
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', '~> 1.0'
24
24
  s.add_runtime_dependency 'json', '~> 2.1'
25
- s.add_runtime_dependency 'cpee', '~> 2.1', '>= 2.1.56'
25
+ s.add_runtime_dependency 'cpee', '~> 2.1', '>= 2.1.88'
26
26
  s.add_runtime_dependency 'chronic_duration', '~> 0.10', '>= 0.10.6'
27
27
  end
@@ -25,6 +25,7 @@ require 'riddl/utils/fileserve'
25
25
  require 'cpee/redis'
26
26
  require 'cpee/message'
27
27
  require 'cpee/persistence'
28
+ require 'cpee/statemachine'
28
29
  require 'cpee/attributes_helper'
29
30
  require 'cpee/implementation_notifications'
30
31
  require 'cpee/implementation_callbacks'
@@ -91,7 +92,7 @@ module CPEE
91
92
  activity['deadline'] = @p.first.name == 'deadline' ? ((Time.now + ChronicDuration.parse(@p.shift.value)) rescue nil): nil
92
93
  activity['restrictions'] = []
93
94
  rests = JSON::parse(@p.shift.value) rescue nil
94
- activity['restrictions'] << rests unless rests.nil?
95
+ activity['restrictions'] += rests unless rests.nil?
95
96
  if @p.first.name == 'prioritization'
96
97
  val = @p.shift.value
97
98
  activity['prioritization'] = (JSON::parse(val) rescue val.gsub(/[\[\]()<>"']/,'').split(/\s*[,;]\s*/))
@@ -163,7 +164,7 @@ module CPEE
163
164
  activity = @a[0].activities[index]
164
165
  if !force && activity['collected'] && (activity['collected'] + 1) < activity['collect_max']
165
166
  activity['collected'] += 1
166
- activity['restrictions'] << { "restriction" => { "mode" => "prohibit", "id" => @r[-3] } }
167
+ activity['restrictions'] << { "mode" => "prohibit", "id" => @r[-3] }
167
168
  @a[0].activities.serialize
168
169
  @a[0].notify('user/finish', :callback_id => activity['id'], :user => @r[-3], :role => activity['role'], :instance_uuid => activity['uuid'], :cpee_callback => activity['url'], :cpee_instance => activity['cpee_instance'], :cpee_base => activity['cpee_base'], :cpee_label => activity['label'], :cpee_activity => activity['cpee_activity_id'], :orgmodel => activity['orgmodel'])
169
170
  elsif !force && activity['handling'] == 'always'
@@ -237,7 +238,8 @@ module CPEE
237
238
  @a[0].activities.each do |activity|
238
239
  restrict = false
239
240
  activity['restrictions'].each do |restriction|
240
- restrict = true if restriction['restriction']['mode'] == 'prohibit' && restriction['restriction']['id'] == @r[-2]
241
+ restriction = restriction[0] if restriction.is_a? Array
242
+ restrict = true if restriction['mode'] == 'prohibit' && restriction['id'] == @r[-2]
241
243
  end
242
244
  if (
243
245
  activity['role']=='*' ||
@@ -381,6 +383,8 @@ module CPEE
381
383
  opts[:sse_keepalive_frequency] ||= 10
382
384
  opts[:sse_connections] = {}
383
385
 
386
+ opts[:statemachine] = CPEE::DummyStateMachine.new
387
+
384
388
  opts[:finalize_frequency] ||= 10
385
389
 
386
390
  CPEE::Message::set_workers(1)
@@ -41,7 +41,7 @@ Daemonite.new do |opts|
41
41
  on.pmessage do |pat, what, message|
42
42
  _, worker, key = what.split(':',3)
43
43
  index = message.index(' ')
44
- instance = message[0...index]
44
+ instance, uuid = message[0...index].split(',')
45
45
  opts[:redis].multi do |multi|
46
46
  multi.srem("worklist:#{instance}/callbacks",key)
47
47
  multi.del("worklist:#{instance}/callback/#{key}/uuid")
@@ -41,7 +41,7 @@ Daemonite.new do |opts|
41
41
  on.pmessage do |pat, what, message|
42
42
  index = message.index(' ')
43
43
  mess = message[index+1..-1]
44
- instance = message[0...index]
44
+ instance, uuid = message[0...index].split(',')
45
45
  type, worker, event = what.split(':',3)
46
46
  topic = ::File::dirname(event)
47
47
  name = ::File::basename(event)
@@ -67,7 +67,7 @@ Daemonite.new do |opts|
67
67
  on.pmessage do |pat, what, message|
68
68
  index = message.index(' ')
69
69
  mess = message[index+1..-1]
70
- instance = message[0...index]
70
+ instance, uuid = message[0...index].split(',')
71
71
  type, worker, event = what.split(':',3)
72
72
  topic = ::File::dirname(event)
73
73
  name = ::File::basename(event)
data/tools/cpee-worklist CHANGED
@@ -58,11 +58,21 @@ ARGV.options { |opt|
58
58
  opt.on(wrap("[cpui DIR] scaffolds a sample html client. New versions might require manual merging if you changed something."))
59
59
  opt.on("")
60
60
  opt.on(wrap("[new DIR] scaffolds a sample instantiation service. Post a testset to a model to keep going in one operation."))
61
+ opt.on("")
62
+ opt.on(wrap("[filter URL key] return all tasks that match a certain filter criterion."))
63
+ opt.on("")
64
+ opt.on(wrap("[filter_a URL] return all tasks that point to abandoned instances."))
65
+ opt.on("")
66
+ opt.on(wrap("[delete_a URL] delete all tasks that point to abandoned instances."))
67
+ opt.on("")
68
+ opt.on(wrap("[delete_f URL] delete all tasks that match a certain filter criterion."))
61
69
  opt.parse!
62
70
  }
71
+
63
72
  if (ARGV.length < 2) ||
64
- (ARGV.length == 2 && !(%w(cpui new).include?(ARGV[0]))) ||
65
- (ARGV.length > 2)
73
+ (ARGV.length == 2 && !(%w(cpui new filter_a delete_a).include?(ARGV[0]))) ||
74
+ (ARGV.length == 3 && !(%w(filter delete_f).include?(ARGV[0]))) ||
75
+ (ARGV.length > 3)
66
76
  puts ARGV.options
67
77
  exit
68
78
  end
@@ -78,6 +88,76 @@ if command == 'new'
78
88
  FileUtils.cp_r(Dir.glob(File.join(insta,'*')).delete_if{|e| e =~ /\.conf/ },p1,remove_destination: true)
79
89
  puts 'Directory already exists, updating ...'
80
90
  end
91
+ elsif command == 'filter'
92
+ if p1 !~ /^http/ || ARGV[2] !~ /^\w+=/
93
+ puts ARGV.options
94
+ exit
95
+ end
96
+ res = Typhoeus.get(File.join(p1,'/'))
97
+ pname, pkey = ARGV[2].split('=',2)
98
+ if res.success?
99
+ doc = XML::Smart.string(res.body)
100
+ doc.find("/tasks/task[@#{pname}=\"#{pkey}\"]").each do |ele|
101
+ puts "#{ele.attributes['callback_id']}; #{ele.attributes['cpee_label']}; #{ele.attributes['cpee_instance']}"
102
+ end
103
+ end
104
+ elsif command == 'delete_f'
105
+ if p1 !~ /^http/ || ARGV[2] !~ /^\w+=/
106
+ puts ARGV.options
107
+ exit
108
+ end
109
+ wl = File.join(p1,'/')
110
+ res = Typhoeus.get(wl)
111
+ pname, pkey = ARGV[2].split('=',2)
112
+ if res.success?
113
+ doc = XML::Smart.string(res.body)
114
+ doc.find("/tasks/task[@#{pname}=\"#{pkey}\"]").each do |ele|
115
+ Typhoeus.delete File.join(wl,'tasks',ele.attributes['callback_id'])
116
+ end
117
+ end
118
+ elsif command == 'filter_a'
119
+ if p1 !~ /^http/
120
+ puts ARGV.options
121
+ exit
122
+ end
123
+ res = Typhoeus.get(File.join(p1,'/'))
124
+ if res.success?
125
+ doc = XML::Smart.string(res.body)
126
+ doc.find("/tasks/task").each do |ele|
127
+ res = Typhoeus.get(File.join(ele.attributes['cpee_base'],ele.attributes['cpee_instance'],'properties','attributes','uuid','/'))
128
+ if res.success?
129
+ if res.body != ele.attributes['instance_uuid']
130
+ puts "#{ele.attributes['callback_id']}; #{ele.attributes['cpee_label']}; #{ele.attributes['cpee_instance']}"
131
+ else
132
+ ### TODO check if abandoned or finished to catch the rest of the the mischiefous tasks
133
+ end
134
+ else
135
+ puts "#{ele.attributes['callback_id']}; #{ele.attributes['cpee_label']}; #{ele.attributes['cpee_instance']}"
136
+ end
137
+ end
138
+ end
139
+ elsif command == 'delete_a'
140
+ if p1 !~ /^http/
141
+ puts ARGV.options
142
+ exit
143
+ end
144
+ wl = File.join(p1,'/')
145
+ res = Typhoeus.get(wl)
146
+ if res.success?
147
+ doc = XML::Smart.string(res.body)
148
+ doc.find("/tasks/task").each do |ele|
149
+ res = Typhoeus.get(File.join(ele.attributes['cpee_base'],ele.attributes['cpee_instance'],'properties','attributes','uuid','/'))
150
+ if res.success?
151
+ if res.body != ele.attributes['instance_uuid']
152
+ Typhoeus.delete File.join(wl,'tasks',ele.attributes['callback_id'])
153
+ else
154
+ ### TODO check if abandoned or finished to catch the rest of the the mischiefous tasks
155
+ end
156
+ else
157
+ Typhoeus.delete File.join(wl,'tasks',ele.attributes['callback_id'])
158
+ end
159
+ end
160
+ end
81
161
  elsif command == 'cpui'
82
162
  insta = "#{curpath}/../ui/"
83
163
  if !File.exist?(p1)
data/ui/container.html CHANGED
@@ -35,6 +35,51 @@
35
35
  <script type="text/javascript" src="/js_libs/jquery.cookie.js"></script>
36
36
  <script type="text/javascript" src="/js_libs/marked.min.js"></script>
37
37
 
38
+ <script>
39
+ function load_script(src) {
40
+ // Initialize scripts queue
41
+ if (load_script.scripts === undefined) {
42
+ load_script.scripts = [];
43
+ load_script.index = -1;
44
+ load_script.loading = false;
45
+ load_script.next = function() {
46
+ if (load_script.loading) return;
47
+
48
+ // Load the next queue item
49
+ load_script.loading = true;
50
+ var item = load_script.scripts[++load_script.index];
51
+ var head = document.getElementsByTagName('head')[0];
52
+ var script = document.createElement('script');
53
+ script.type = 'text/javascript';
54
+ script.src = item.src;
55
+ // When complete, start next item in queue and resolve this item's promise
56
+ script.onload = () => {
57
+ load_script.loading = false;
58
+ if( load_script.index < load_script.scripts.length - 1 ) load_script.next();
59
+ item.resolve();
60
+ };
61
+ head.appendChild(script);
62
+ };
63
+ };
64
+
65
+ // Adding a script to the queue
66
+ if (src) {
67
+ // Check if already added
68
+ for (var i=0; i < load_script.scripts.length; i++) {
69
+ if( load_script.scripts[i].src == src ) return load_script.scripts[i].promise;
70
+ }
71
+ // Add to the queue
72
+ var item = { src: src };
73
+ item.promise = new Promise(resolve => {item.resolve = resolve;});
74
+ load_script.scripts.push(item);
75
+ load_script.next();
76
+ }
77
+
78
+ // Return the promise of the last queue item
79
+ return load_script.scripts[ load_script.scripts.length - 1 ].promise;
80
+ };
81
+ </script>
82
+
38
83
  <link rel="stylesheet" href="css/container.css" type="text/css"/>
39
84
  </head>
40
85
  <body is='x-ui-'></body>
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee-worklist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  - Florian Stertz
9
9
  - Patrik Koenig
10
+ - Nataliia Klievtsova
10
11
  bindir: tools
11
12
  cert_chain: []
12
- date: 2025-04-17 00:00:00.000000000 Z
13
+ date: 2025-07-08 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: riddl
@@ -48,7 +49,7 @@ dependencies:
48
49
  version: '2.1'
49
50
  - - ">="
50
51
  - !ruby/object:Gem::Version
51
- version: 2.1.56
52
+ version: 2.1.88
52
53
  type: :runtime
53
54
  prerelease: false
54
55
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +59,7 @@ dependencies:
58
59
  version: '2.1'
59
60
  - - ">="
60
61
  - !ruby/object:Gem::Version
61
- version: 2.1.56
62
+ version: 2.1.88
62
63
  - !ruby/object:Gem::Dependency
63
64
  name: chronic_duration
64
65
  requirement: !ruby/object:Gem::Requirement