cpee 2.1.104 → 2.1.108

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.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/js/wfadaptor.js +8 -8
  3. data/cockpit/themes/base.js +2 -2
  4. data/cockpit/themes/control/rngs/alternative.rng +4 -1
  5. data/cockpit/themes/control/rngs/call.rng +1 -1
  6. data/cockpit/themes/control/rngs/callmanipulate.rng +1 -1
  7. data/cockpit/themes/control/rngs/choose.rng +3 -0
  8. data/cockpit/themes/control/rngs/critical.rng +4 -1
  9. data/cockpit/themes/control/rngs/escape.rng +5 -1
  10. data/cockpit/themes/control/rngs/loop.rng +3 -0
  11. data/cockpit/themes/control/rngs/manipulate.rng +1 -1
  12. data/cockpit/themes/control/rngs/otherwise.rng +4 -1
  13. data/cockpit/themes/control/rngs/parallel.rng +3 -0
  14. data/cockpit/themes/control/rngs/parallel_branch.rng +3 -0
  15. data/cockpit/themes/control/rngs/stop.rng +2 -2
  16. data/cockpit/themes/control/rngs/terminate.rng +5 -1
  17. data/cockpit/themes/control/rngs/wait_for_signal.rng +1 -1
  18. data/cockpit/themes/dataflow/rngs/alternative.rng +4 -1
  19. data/cockpit/themes/dataflow/rngs/call.rng +1 -1
  20. data/cockpit/themes/dataflow/rngs/callmanipulate.rng +1 -1
  21. data/cockpit/themes/dataflow/rngs/choose.rng +3 -0
  22. data/cockpit/themes/dataflow/rngs/critical.rng +4 -1
  23. data/cockpit/themes/dataflow/rngs/escape.rng +5 -1
  24. data/cockpit/themes/dataflow/rngs/loop.rng +3 -0
  25. data/cockpit/themes/dataflow/rngs/manipulate.rng +1 -1
  26. data/cockpit/themes/dataflow/rngs/otherwise.rng +4 -1
  27. data/cockpit/themes/dataflow/rngs/parallel.rng +3 -0
  28. data/cockpit/themes/dataflow/rngs/parallel_branch.rng +3 -0
  29. data/cockpit/themes/dataflow/rngs/stop.rng +2 -2
  30. data/cockpit/themes/dataflow/rngs/terminate.rng +5 -1
  31. data/cockpit/themes/dataflow/rngs/wait_for_signal.rng +1 -1
  32. data/cockpit/themes/default/rngs/alternative.rng +4 -1
  33. data/cockpit/themes/default/rngs/call.rng +1 -1
  34. data/cockpit/themes/default/rngs/callmanipulate.rng +1 -1
  35. data/cockpit/themes/default/rngs/choose.rng +3 -0
  36. data/cockpit/themes/default/rngs/critical.rng +4 -1
  37. data/cockpit/themes/default/rngs/escape.rng +5 -1
  38. data/cockpit/themes/default/rngs/loop.rng +3 -0
  39. data/cockpit/themes/default/rngs/manipulate.rng +1 -1
  40. data/cockpit/themes/default/rngs/otherwise.rng +4 -1
  41. data/cockpit/themes/default/rngs/parallel.rng +3 -0
  42. data/cockpit/themes/default/rngs/parallel_branch.rng +3 -0
  43. data/cockpit/themes/default/rngs/stop.rng +2 -2
  44. data/cockpit/themes/default/rngs/terminate.rng +5 -1
  45. data/cockpit/themes/default/rngs/wait_for_signal.rng +1 -1
  46. data/cockpit/themes/extended/rngs/alternative.rng +4 -1
  47. data/cockpit/themes/extended/rngs/call.rng +1 -1
  48. data/cockpit/themes/extended/rngs/callmanipulate.rng +1 -1
  49. data/cockpit/themes/extended/rngs/choose.rng +3 -0
  50. data/cockpit/themes/extended/rngs/critical.rng +4 -1
  51. data/cockpit/themes/extended/rngs/escape.rng +5 -1
  52. data/cockpit/themes/extended/rngs/loop.rng +3 -0
  53. data/cockpit/themes/extended/rngs/manipulate.rng +1 -1
  54. data/cockpit/themes/extended/rngs/otherwise.rng +4 -1
  55. data/cockpit/themes/extended/rngs/parallel.rng +3 -0
  56. data/cockpit/themes/extended/rngs/parallel_branch.rng +3 -0
  57. data/cockpit/themes/extended/rngs/stop.rng +2 -2
  58. data/cockpit/themes/extended/rngs/terminate.rng +5 -1
  59. data/cockpit/themes/extended/rngs/wait_for_signal.rng +1 -1
  60. data/cockpit/themes/felix/rngs/call.rng +1 -1
  61. data/cockpit/themes/felix/rngs/callmanipulate.rng +1 -1
  62. data/cockpit/themes/felix/rngs/manipulate.rng +1 -1
  63. data/cockpit/themes/felix/rngs/stop.rng +2 -2
  64. data/cockpit/themes/model/rngs/call.rng +1 -1
  65. data/cockpit/themes/model/rngs/callmanipulate.rng +1 -1
  66. data/cockpit/themes/packed/rngs/alternative.rng +4 -1
  67. data/cockpit/themes/packed/rngs/call.rng +1 -1
  68. data/cockpit/themes/packed/rngs/callmanipulate.rng +1 -1
  69. data/cockpit/themes/packed/rngs/choose.rng +3 -0
  70. data/cockpit/themes/packed/rngs/critical.rng +4 -1
  71. data/cockpit/themes/packed/rngs/escape.rng +5 -1
  72. data/cockpit/themes/packed/rngs/loop.rng +3 -0
  73. data/cockpit/themes/packed/rngs/manipulate.rng +1 -1
  74. data/cockpit/themes/packed/rngs/otherwise.rng +4 -1
  75. data/cockpit/themes/packed/rngs/parallel.rng +3 -0
  76. data/cockpit/themes/packed/rngs/parallel_branch.rng +3 -0
  77. data/cockpit/themes/packed/rngs/stop.rng +2 -2
  78. data/cockpit/themes/packed/rngs/terminate.rng +5 -1
  79. data/cockpit/themes/packed/rngs/wait_for_signal.rng +1 -1
  80. data/cockpit/themes/preset/rngs/alternative.rng +4 -1
  81. data/cockpit/themes/preset/rngs/call.rng +1 -1
  82. data/cockpit/themes/preset/rngs/callmanipulate.rng +1 -1
  83. data/cockpit/themes/preset/rngs/choose.rng +3 -0
  84. data/cockpit/themes/preset/rngs/critical.rng +4 -1
  85. data/cockpit/themes/preset/rngs/escape.rng +5 -1
  86. data/cockpit/themes/preset/rngs/loop.rng +3 -0
  87. data/cockpit/themes/preset/rngs/manipulate.rng +1 -1
  88. data/cockpit/themes/preset/rngs/otherwise.rng +4 -1
  89. data/cockpit/themes/preset/rngs/parallel.rng +3 -0
  90. data/cockpit/themes/preset/rngs/parallel_branch.rng +3 -0
  91. data/cockpit/themes/preset/rngs/stop.rng +2 -2
  92. data/cockpit/themes/preset/rngs/terminate.rng +5 -1
  93. data/cockpit/themes/preset/rngs/wait_for_signal.rng +1 -1
  94. data/cockpit/themes/presetaltid/rngs/alternative.rng +4 -1
  95. data/cockpit/themes/presetaltid/rngs/call.rng +1 -1
  96. data/cockpit/themes/presetaltid/rngs/callmanipulate.rng +1 -1
  97. data/cockpit/themes/presetaltid/rngs/choose.rng +3 -0
  98. data/cockpit/themes/presetaltid/rngs/critical.rng +4 -1
  99. data/cockpit/themes/presetaltid/rngs/escape.rng +5 -1
  100. data/cockpit/themes/presetaltid/rngs/loop.rng +3 -0
  101. data/cockpit/themes/presetaltid/rngs/manipulate.rng +1 -1
  102. data/cockpit/themes/presetaltid/rngs/otherwise.rng +4 -1
  103. data/cockpit/themes/presetaltid/rngs/parallel.rng +3 -0
  104. data/cockpit/themes/presetaltid/rngs/parallel_branch.rng +3 -0
  105. data/cockpit/themes/presetaltid/rngs/stop.rng +2 -2
  106. data/cockpit/themes/presetaltid/rngs/terminate.rng +5 -1
  107. data/cockpit/themes/presetaltid/rngs/wait_for_signal.rng +1 -1
  108. data/cockpit/themes/presetid/rngs/alternative.rng +4 -1
  109. data/cockpit/themes/presetid/rngs/call.rng +1 -1
  110. data/cockpit/themes/presetid/rngs/callmanipulate.rng +1 -1
  111. data/cockpit/themes/presetid/rngs/choose.rng +3 -0
  112. data/cockpit/themes/presetid/rngs/critical.rng +4 -1
  113. data/cockpit/themes/presetid/rngs/escape.rng +5 -1
  114. data/cockpit/themes/presetid/rngs/loop.rng +3 -0
  115. data/cockpit/themes/presetid/rngs/manipulate.rng +1 -1
  116. data/cockpit/themes/presetid/rngs/otherwise.rng +4 -1
  117. data/cockpit/themes/presetid/rngs/parallel.rng +3 -0
  118. data/cockpit/themes/presetid/rngs/parallel_branch.rng +3 -0
  119. data/cockpit/themes/presetid/rngs/stop.rng +2 -2
  120. data/cockpit/themes/presetid/rngs/terminate.rng +5 -1
  121. data/cockpit/themes/presetid/rngs/wait_for_signal.rng +1 -1
  122. data/cockpit/themes/reduced/rngs/alternative.rng +4 -1
  123. data/cockpit/themes/reduced/rngs/call.rng +1 -1
  124. data/cockpit/themes/reduced/rngs/callmanipulate.rng +1 -1
  125. data/cockpit/themes/reduced/rngs/choose.rng +3 -0
  126. data/cockpit/themes/reduced/rngs/critical.rng +4 -1
  127. data/cockpit/themes/reduced/rngs/escape.rng +5 -1
  128. data/cockpit/themes/reduced/rngs/loop.rng +3 -0
  129. data/cockpit/themes/reduced/rngs/manipulate.rng +1 -1
  130. data/cockpit/themes/reduced/rngs/otherwise.rng +4 -1
  131. data/cockpit/themes/reduced/rngs/parallel.rng +3 -0
  132. data/cockpit/themes/reduced/rngs/parallel_branch.rng +3 -0
  133. data/cockpit/themes/reduced/rngs/stop.rng +2 -2
  134. data/cockpit/themes/reduced/rngs/terminate.rng +5 -1
  135. data/cockpit/themes/reduced/rngs/wait_for_signal.rng +1 -1
  136. data/cpee.gemspec +5 -3
  137. data/server/executionhandlers/eval/backend/run.rb +10 -14
  138. data/server/executionhandlers/eval/connection.rb +23 -26
  139. data/server/executionhandlers/eval/dsl_to_dslx.xsl +134 -16
  140. data/server/executionhandlers/eval/execution.rb +51 -15
  141. data/server/executionhandlers/ruby/connection.rb +21 -21
  142. data/server/executionhandlers/ruby/dsl_to_dslx.xsl +135 -31
  143. data/server/executionhandlers/ruby/execution.rb +31 -14
  144. data/server/routing/end.pid +1 -1
  145. data/server/routing/forward-events-00.pid +1 -1
  146. data/server/routing/forward-votes.pid +1 -1
  147. data/server/routing/persist.pid +1 -1
  148. metadata +33 -5
@@ -110,6 +110,19 @@
110
110
  </xsl:with-param>
111
111
  </xsl:call-template>
112
112
  <xsl:text>terminate</xsl:text>
113
+ <xsl:choose>
114
+ <xsl:when test="@eid">
115
+ <xsl:text> :</xsl:text>
116
+ <xsl:value-of select="@eid"/>
117
+ </xsl:when>
118
+ <xsl:otherwise>
119
+ <xsl:text> :e</xsl:text>
120
+ <xsl:for-each select="ancestor-or-self::*">
121
+ <xsl:text>_</xsl:text>
122
+ <xsl:value-of select="position()"/>
123
+ </xsl:for-each>
124
+ </xsl:otherwise>
125
+ </xsl:choose>
113
126
  <xsl:call-template name="print-newline"/>
114
127
  </xsl:if>
115
128
  <xsl:if test="name()='stop'">
@@ -145,6 +158,19 @@
145
158
  </xsl:with-param>
146
159
  </xsl:call-template>
147
160
  <xsl:text>escape</xsl:text>
161
+ <xsl:choose>
162
+ <xsl:when test="@eid">
163
+ <xsl:text> :</xsl:text>
164
+ <xsl:value-of select="@eid"/>
165
+ </xsl:when>
166
+ <xsl:otherwise>
167
+ <xsl:text> :e</xsl:text>
168
+ <xsl:for-each select="ancestor-or-self::*">
169
+ <xsl:text>_</xsl:text>
170
+ <xsl:value-of select="position()"/>
171
+ </xsl:for-each>
172
+ </xsl:otherwise>
173
+ </xsl:choose>
148
174
  <xsl:call-template name="print-newline"/>
149
175
  </xsl:if>
150
176
  <xsl:if test="name()='parallel'">
@@ -155,8 +181,21 @@
155
181
  </xsl:with-param>
156
182
  </xsl:call-template>
157
183
  <xsl:text>parallel</xsl:text>
184
+ <xsl:choose>
185
+ <xsl:when test="@eid">
186
+ <xsl:text> :</xsl:text>
187
+ <xsl:value-of select="@eid"/>
188
+ </xsl:when>
189
+ <xsl:otherwise>
190
+ <xsl:text> :e</xsl:text>
191
+ <xsl:for-each select="ancestor-or-self::*">
192
+ <xsl:text>_</xsl:text>
193
+ <xsl:value-of select="position()"/>
194
+ </xsl:for-each>
195
+ </xsl:otherwise>
196
+ </xsl:choose>
158
197
  <xsl:if test="@wait">
159
- <xsl:text> :wait =&gt; </xsl:text>
198
+ <xsl:text>, :wait =&gt; </xsl:text>
160
199
  <xsl:value-of select="@wait"/>
161
200
  <xsl:if test="@cancel">
162
201
  <xsl:text>, :cancel =&gt; :</xsl:text>
@@ -186,16 +225,29 @@
186
225
  <xsl:value-of select="$myspace+$myspacemultiplier"/>
187
226
  </xsl:with-param>
188
227
  </xsl:call-template>
189
- <xsl:text>loop </xsl:text>
228
+ <xsl:text>loop</xsl:text>
229
+ <xsl:choose>
230
+ <xsl:when test="@eid">
231
+ <xsl:text> :</xsl:text>
232
+ <xsl:value-of select="@eid"/>
233
+ </xsl:when>
234
+ <xsl:otherwise>
235
+ <xsl:text> :e</xsl:text>
236
+ <xsl:for-each select="ancestor-or-self::*">
237
+ <xsl:text>_</xsl:text>
238
+ <xsl:value-of select="position()"/>
239
+ </xsl:for-each>
240
+ </xsl:otherwise>
241
+ </xsl:choose>
190
242
  <xsl:if test="@mode='pre_test'">
191
243
  <xsl:choose>
192
244
  <xsl:when test="@language='application/x-ruby'">
193
- <xsl:text>pre_test{</xsl:text>
245
+ <xsl:text>, pre_test{</xsl:text>
194
246
  <xsl:value-of select="@condition"/>
195
247
  <xsl:text>} </xsl:text>
196
248
  </xsl:when>
197
249
  <xsl:otherwise>
198
- <xsl:text>pre_test("</xsl:text>
250
+ <xsl:text>, pre_test("</xsl:text>
199
251
  <xsl:value-of select="str:replace(str:replace(@condition,'\','\\'),'&quot;','\&quot;')"/>
200
252
  <xsl:text>")</xsl:text>
201
253
  </xsl:otherwise>
@@ -204,12 +256,12 @@
204
256
  <xsl:if test="@mode='post_test'">
205
257
  <xsl:choose>
206
258
  <xsl:when test="@language='application/x-ruby'">
207
- <xsl:text>post_test{</xsl:text>
259
+ <xsl:text>, post_test{</xsl:text>
208
260
  <xsl:value-of select="@condition"/>
209
261
  <xsl:text>} </xsl:text>
210
262
  </xsl:when>
211
263
  <xsl:otherwise>
212
- <xsl:text>post_test("</xsl:text>
264
+ <xsl:text>, post_test("</xsl:text>
213
265
  <xsl:value-of select="str:replace(str:replace(@condition,'\','\\'),'&quot;','\&quot;')"/>
214
266
  <xsl:text>")</xsl:text>
215
267
  </xsl:otherwise>
@@ -306,13 +358,26 @@
306
358
  <xsl:value-of select="$myspace+$myspacemultiplier"/>
307
359
  </xsl:with-param>
308
360
  </xsl:call-template>
309
- <xsl:text>choose </xsl:text>
361
+ <xsl:text>choose</xsl:text>
362
+ <xsl:choose>
363
+ <xsl:when test="@eid">
364
+ <xsl:text> :</xsl:text>
365
+ <xsl:value-of select="@eid"/>
366
+ </xsl:when>
367
+ <xsl:otherwise>
368
+ <xsl:text> :e</xsl:text>
369
+ <xsl:for-each select="ancestor-or-self::*">
370
+ <xsl:text>_</xsl:text>
371
+ <xsl:value-of select="position()"/>
372
+ </xsl:for-each>
373
+ </xsl:otherwise>
374
+ </xsl:choose>
310
375
  <xsl:choose>
311
376
  <xsl:when test="@mode='exclusive'">
312
- <xsl:text>:exclusive</xsl:text>
377
+ <xsl:text>, :exclusive</xsl:text>
313
378
  </xsl:when>
314
379
  <xsl:otherwise>
315
- <xsl:text>:inclusive</xsl:text>
380
+ <xsl:text>, :inclusive</xsl:text>
316
381
  </xsl:otherwise>
317
382
  </xsl:choose>
318
383
  <xsl:text> do</xsl:text>
@@ -346,7 +411,21 @@
346
411
  <xsl:value-of select="$myspace+$myspacemultiplier"/>
347
412
  </xsl:with-param>
348
413
  </xsl:call-template>
349
- <xsl:text>critical :</xsl:text>
414
+ <xsl:text>critical</xsl:text>
415
+ <xsl:choose>
416
+ <xsl:when test="@eid">
417
+ <xsl:text> :</xsl:text>
418
+ <xsl:value-of select="@eid"/>
419
+ </xsl:when>
420
+ <xsl:otherwise>
421
+ <xsl:text> :e</xsl:text>
422
+ <xsl:for-each select="ancestor-or-self::*">
423
+ <xsl:text>_</xsl:text>
424
+ <xsl:value-of select="position()"/>
425
+ </xsl:for-each>
426
+ </xsl:otherwise>
427
+ </xsl:choose>
428
+ <xsl:text>, :</xsl:text>
350
429
  <xsl:value-of select="@sid"/>
351
430
  <xsl:text> do</xsl:text>
352
431
  <xsl:call-template name="print-newline"/>
@@ -373,15 +452,28 @@
373
452
  <xsl:value-of select="$myspace+$myspacemultiplier"/>
374
453
  </xsl:with-param>
375
454
  </xsl:call-template>
376
- <xsl:text>alternative </xsl:text>
455
+ <xsl:text>alternative</xsl:text>
456
+ <xsl:choose>
457
+ <xsl:when test="@eid">
458
+ <xsl:text> :</xsl:text>
459
+ <xsl:value-of select="@eid"/>
460
+ </xsl:when>
461
+ <xsl:otherwise>
462
+ <xsl:text> :e</xsl:text>
463
+ <xsl:for-each select="ancestor-or-self::*">
464
+ <xsl:text>_</xsl:text>
465
+ <xsl:value-of select="position()"/>
466
+ </xsl:for-each>
467
+ </xsl:otherwise>
468
+ </xsl:choose>
377
469
  <xsl:choose>
378
470
  <xsl:when test="@language='application/x-ruby'">
379
- <xsl:text>test{</xsl:text>
471
+ <xsl:text>, test{</xsl:text>
380
472
  <xsl:value-of select="@condition"/>
381
473
  <xsl:text>}</xsl:text>
382
474
  </xsl:when>
383
475
  <xsl:otherwise>
384
- <xsl:text>test("</xsl:text>
476
+ <xsl:text>, test("</xsl:text>
385
477
  <xsl:value-of select="str:replace(str:replace(@condition,'\','\\'),'&quot;','\&quot;')"/>
386
478
  <xsl:text>")</xsl:text>
387
479
  </xsl:otherwise>
@@ -418,7 +510,20 @@
418
510
  <xsl:value-of select="$myspace+$myspacemultiplier"/>
419
511
  </xsl:with-param>
420
512
  </xsl:call-template>
421
- <xsl:text>otherwise </xsl:text>
513
+ <xsl:text>otherwise</xsl:text>
514
+ <xsl:choose>
515
+ <xsl:when test="@eid">
516
+ <xsl:text> :</xsl:text>
517
+ <xsl:value-of select="@eid"/>
518
+ </xsl:when>
519
+ <xsl:otherwise>
520
+ <xsl:text> :e</xsl:text>
521
+ <xsl:for-each select="ancestor-or-self::*">
522
+ <xsl:text>_</xsl:text>
523
+ <xsl:value-of select="position()"/>
524
+ </xsl:for-each>
525
+ </xsl:otherwise>
526
+ </xsl:choose>
422
527
  <xsl:for-each select="@*[not(name()='language' or name()='condition' or name()='svg-label')]">
423
528
  <xsl:if test="position() &gt;1">, </xsl:if>
424
529
  <xsl:text>:</xsl:text>
@@ -452,7 +557,21 @@
452
557
  <xsl:value-of select="$myspace+$myspacemultiplier"/>
453
558
  </xsl:with-param>
454
559
  </xsl:call-template>
455
- <xsl:text>parallel_branch do |local|</xsl:text>
560
+ <xsl:text>parallel_branch</xsl:text>
561
+ <xsl:choose>
562
+ <xsl:when test="@eid">
563
+ <xsl:text> :</xsl:text>
564
+ <xsl:value-of select="@eid"/>
565
+ </xsl:when>
566
+ <xsl:otherwise>
567
+ <xsl:text> :e</xsl:text>
568
+ <xsl:for-each select="ancestor-or-self::*">
569
+ <xsl:text>_</xsl:text>
570
+ <xsl:value-of select="position()"/>
571
+ </xsl:for-each>
572
+ </xsl:otherwise>
573
+ </xsl:choose>
574
+ <xsl:text> do |local|</xsl:text>
456
575
  <xsl:call-template name="print-newline"/>
457
576
  <xsl:apply-templates>
458
577
  <xsl:with-param name="myspace">
@@ -494,7 +613,6 @@
494
613
  <xsl:text>:</xsl:text>
495
614
  <xsl:value-of select="name()"/>
496
615
  <xsl:text> =&gt; </xsl:text>
497
-
498
616
  <xsl:choose>
499
617
  <xsl:when test="count(*) &gt; 0 and name()='arguments'">
500
618
  <xsl:text>[</xsl:text>
@@ -35,7 +35,7 @@ module CPEE
35
35
  hw = CPEE::Persistence::extract_item(id,opts,'executionhandler')
36
36
  endpoints = CPEE::Persistence::extract_list(id,opts,'endpoints')
37
37
  dataelements = CPEE::Persistence::extract_list(id,opts,'dataelements')
38
- attributes = CPEE::Persistence::extract_list(id,opts,'attributes')
38
+ attributes = CPEE::Persistence::extract_list(id,opts,'attributes').to_h
39
39
  positions = CPEE::Persistence::extract_set(id,opts,'positions')
40
40
  positions.map! do |k, v|
41
41
  [ k, v, CPEE::Persistence::extract_item(id,opts,File.join('positions',k,'@passthrough')) ]
@@ -46,9 +46,14 @@ module CPEE
46
46
  iopts[:redis_url] = opts[:redis_url]
47
47
  iopts[:redis_db] = opts[:redis_db]
48
48
  iopts[:workers] = opts[:workers]
49
- iopts[:global_executionhandlers] = opts[:global_executionhandlers]
50
- iopts[:executionhandlers] = opts[:executionhandlers]
51
49
  iopts[:executionhandler] = hw
50
+ if attributes.has_key?('remote')
51
+ uri = URI::parse(attributes['remote'])
52
+ iopts[:executionhandlers] = File.join(uri.path,File.basename(opts[:executionhandlers]))
53
+ else
54
+ iopts[:executionhandlers] = opts[:executionhandlers]
55
+ iopts[:global_executionhandlers] = opts[:global_executionhandlers]
56
+ end
52
57
 
53
58
  File.open(File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_OPTS)),'w') do |f|
54
59
  YAML::dump(iopts,f)
@@ -56,24 +61,55 @@ module CPEE
56
61
  template = ERB.new(File.read(ExecutionHandler::Eval::BACKEND_TEMPLATE), trim_mode: '-')
57
62
  res = template.result_with_hash(dsl: dsl, dataelements: dataelements, endpoints: endpoints, positions: positions)
58
63
  File.write(File.join(opts[:instances],id.to_s,ExecutionHandler::Eval::BACKEND_INSTANCE),res)
64
+ if attributes.has_key?('remote')
65
+ uri = URI::parse(attributes['remote'])
66
+ Net::SSH.start(uri.host,uri.user,:keys => [ opts[:ssh_key] ] ) do |ssh|
67
+ ssh.exec!("rm -rf #{File.join(uri.path,id.to_s,'*')}")
68
+ ssh.scp.upload!(File.join(opts[:instances],id.to_s),uri.path,:recursive=>true)
69
+ end
70
+ File.write(File.join(opts[:instances],id.to_s,'.remote'),attributes['remote'])
71
+ end
59
72
  end
60
73
 
61
74
  def self::run(id,opts)
62
- exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_RUN))
63
- pid = Kernel.spawn(opts[:libs_preloaderrun] + ' ' + exe , :pgroup => true, :in => '/dev/null', :out => exe + '.out', :err => exe + '.err')
64
- Process.detach pid
65
- File.write(exe + '.pid',pid)
75
+ if File.exist? File.join(opts[:instances],id.to_s,'.remote')
76
+ uri = URI::parse(File.read(File.join(opts[:instances],id.to_s,'.remote')))
77
+ exe = File.join(uri.path,id.to_s,File.basename(BACKEND_RUN))
78
+ Net::SSH.start(uri.host,uri.user,:keys => [ opts[:ssh_key] ] ) do |ssh|
79
+ ssh.exec!("ruby #{exe} >#{exe}.out 2>#{exe}.err &")
80
+ end
81
+ else
82
+ exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_RUN))
83
+ pid = Kernel.spawn(opts[:libs_preloaderrun] + ' ' + exe , :pgroup => true, :in => '/dev/null', :out => exe + '.out', :err => exe + '.err')
84
+ Process.detach pid
85
+ File.write(exe + '.pid',pid)
86
+ end
66
87
  end
67
88
 
68
89
  def self::stop(id,opts) ### return: bool to tell if manually changing redis is necessary
69
- exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_RUN))
70
- pid = File.read(exe + '.pid') rescue nil
71
- if pid && (Process.kill(0, pid.to_i) rescue false)
72
- Process.kill('HUP', pid.to_i) rescue nil
73
- false
74
- else # its not running, so clean up
75
- File.unlink(exe + '.pid') rescue nil
76
- true
90
+ if File.exist? File.join(opts[:instances],id.to_s,'.remote')
91
+ uri = URI::parse(File.read(File.join(opts[:instances],id.to_s,'.remote')))
92
+ exe = File.join(uri.path,id.to_s,File.basename(BACKEND_RUN))
93
+ Net::SSH.start(uri.host,uri.user,:keys => [ opts[:ssh_key] ] ) do |ssh|
94
+ pid = ssh.exec!("cat #{exe}.pid 2>/dev/null")
95
+ if pid != '' && ssh.exec!("kill -0 #{pid} >/dev/null 2>&1; echo $?").strip == '0'
96
+ ssh.exec!("kill -SIGHUP #{pid}")
97
+ false
98
+ else
99
+ ssh.exec!("rm #{exe}.pid")
100
+ true
101
+ end
102
+ end
103
+ else
104
+ exe = File.join(opts[:instances],id.to_s,File.basename(ExecutionHandler::Eval::BACKEND_RUN))
105
+ pid = File.read(exe + '.pid') rescue nil
106
+ if pid && (Process.kill(0, pid.to_i) rescue false)
107
+ Process.kill('HUP', pid.to_i) rescue nil
108
+ false
109
+ else # its not running, so clean up
110
+ File.unlink(exe + '.pid') rescue nil
111
+ true
112
+ end
77
113
  end
78
114
  end
79
115
  end
@@ -60,7 +60,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
60
60
  end # }}}
61
61
  def self::inform_activity_minimal(arguments,what,uuid,label,position) # {{{
62
62
  controller = arguments[0]
63
- controller.notify("activity/#{what}", :ecid => Thread.current.__id__, :'activity-uuid' => uuid, :label => label, :activity => position)
63
+ controller.notify("activity/#{what}", :'activity-uuid' => uuid, :label => label, :activity => position)
64
64
  end # }}}
65
65
 
66
66
  def initialize(arguments,position=nil,continue=nil) # {{{
@@ -201,10 +201,10 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
201
201
  callback result, headers
202
202
  elsif headers['CPEE_CALLBACK'] && headers['CPEE_CALLBACK'] == 'true' && result.empty?
203
203
  if headers['CPEE_INSTANTIATION']
204
- @controller.notify("task/instantiation", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(headers['CPEE_INSTANTIATION']))
204
+ @controller.notify("task/instantiation", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(headers['CPEE_INSTANTIATION']))
205
205
  end
206
206
  if headers['CPEE_EVENT']
207
- @controller.notify("task/#{headers['CPEE_EVENT'].gsub(/[^\w_-]/,'')}", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint)
207
+ @controller.notify("task/#{headers['CPEE_EVENT'].gsub(/[^\w_-]/,'')}", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint)
208
208
  end
209
209
  # do nothing, later on things will happend
210
210
  else
@@ -217,8 +217,8 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
217
217
  raise "Wrong endpoint" if @handler_endpoint.nil? || @handler_endpoint.empty?
218
218
  @label = parameters[:label]
219
219
  @anno = parameters.delete(:annotations) rescue nil
220
- @controller.notify("activity/calling", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters)
221
- @controller.notify("activity/annotation", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :annotations => @anno)
220
+ @controller.notify("activity/calling", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :passthrough => passthrough, :endpoint => @handler_endpoint, :parameters => parameters)
221
+ @controller.notify("activity/annotation", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :annotations => @anno)
222
222
  if passthrough.to_s.empty?
223
223
  proto_curl parameters
224
224
  else
@@ -229,7 +229,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
229
229
  def activity_manipulate_handle(parameters) #{{{
230
230
  @label = parameters[:label]
231
231
  @anno = parameters.delete(:annotations) rescue nil
232
- @controller.notify("activity/annotation", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :annotations => @anno)
232
+ @controller.notify("activity/annotation", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :annotations => @anno)
233
233
  end #}}}
234
234
 
235
235
  def activity_stop # {{{
@@ -250,17 +250,17 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
250
250
  end #}}}
251
251
 
252
252
  def inform_activity_done # {{{
253
- @controller.notify("activity/done", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position)
253
+ @controller.notify("activity/done", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position)
254
254
  end # }}}
255
255
  def inform_activity_manipulate # {{{
256
- @controller.notify("activity/manipulating", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position)
256
+ @controller.notify("activity/manipulating", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position)
257
257
  end # }}}
258
258
  def inform_activity_failed(err) # {{{
259
- @controller.notify("activity/failed", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :message => err.backtrace[0].match(/(.*?):(\d+):\s(.*)/)[3], :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1])
259
+ @controller.notify("activity/failed", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :message => err.backtrace[0].match(/(.*?):(\d+):\s(.*)/)[3], :line => err.backtrace[0].match(/(.*?):(\d+):/)[2], :where => err.backtrace[0].match(/(.*?):(\d+):/)[1])
260
260
  end # }}}
261
261
  def inform_manipulate_change(status,changed_dataelements,changed_endpoints,dataelements,endpoints) # {{{
262
262
  unless status.nil?
263
- @controller.notify("status/change", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :data => { :id => status.id, :message => status.message } )
263
+ @controller.notify("status/change", :'activity-uuid' => @handler_activity_uuid, :endpoint => @handler_endpoint, :label => @label, :activity => @handler_position, :data => { :id => status.id, :message => status.message } )
264
264
  end
265
265
  unless changed_dataelements.nil? || changed_dataelements.empty?
266
266
  de = dataelements.slice(*changed_dataelements).transform_values { |v| enc = CPEE::EvalRuby::Translation::detect_encoding(v); (enc == 'OTHER' ? v : (v.encode('UTF-8',enc) rescue CPEE::EvalRuby::Translation::convert_to_base64(v))) }
@@ -286,19 +286,19 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
286
286
  nil
287
287
  end
288
288
 
289
- @controller.notify("activity/receiving", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => recv)
289
+ @controller.notify("activity/receiving", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => recv)
290
290
 
291
291
  @guard_files += result
292
292
  @guard_files += ret
293
293
 
294
294
  if options['CPEE_INSTANTIATION']
295
- @controller.notify("task/instantiation", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(options['CPEE_INSTANTIATION']))
295
+ @controller.notify("task/instantiation", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => CPEE::ValueHelper.parse(options['CPEE_INSTANTIATION']))
296
296
  end
297
297
  if options['CPEE_EVENT']
298
- @controller.notify("task/#{options['CPEE_EVENT'].gsub(/[^\w_-]/,'')}", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => recv)
298
+ @controller.notify("task/#{options['CPEE_EVENT'].gsub(/[^\w_-]/,'')}", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :received => recv)
299
299
  end
300
300
  if options['CPEE_STATUS']
301
- @controller.notify("activity/status", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_STATUS'])
301
+ @controller.notify("activity/status", :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :endpoint => @handler_endpoint, :status => options['CPEE_STATUS'])
302
302
  end
303
303
 
304
304
  if options['CPEE_STATUS'] || options['CPEE_EVENT']
@@ -404,7 +404,7 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
404
404
  end
405
405
  params
406
406
  end #}}}
407
- def test_condition(dataelements,endpoints,local,additional,code,args={}) #{{{
407
+ def test_condition(eid,dataelements,endpoints,local,additional,code,args={}) #{{{
408
408
  send = []
409
409
  send.push Riddl::Parameter::Simple::new('code',code)
410
410
  send.push Riddl::Parameter::Complex::new('dataelements','application/json', JSON::generate(dataelements))
@@ -421,8 +421,8 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
421
421
  recv = 'false' unless recv
422
422
  recv = (recv == 'false' || recv == 'null' || recv == 'nil' || recv == false ? false : true)
423
423
 
424
- @controller.notify("gateway/decide", :ecid => Thread.current.__id__, :instance_uuid => @controller.uuid, :code => code, :condition => recv)
425
- @controller.notify("gateway/annotation", :ecid => Thread.current.__id__, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :annotations => {})
424
+ @controller.notify("gateway/decide", :eid => eid, :instance_uuid => @controller.uuid, :code => code, :condition => recv)
425
+ @controller.notify("gateway/annotation", :eid => eid, :'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position, :annotations => {})
426
426
  recv
427
427
  end #}}}
428
428
  def manipulate(readonly,lock,dataelements,endpoints,status,local,additional,code,where,result=nil,options=nil) #{{{
@@ -461,13 +461,13 @@ class ConnectionWrapper < WEEL::ConnectionWrapperBase
461
461
  end
462
462
  end #}}}
463
463
 
464
- def split_branches(id, branches = []) # factual, so for inclusive or [[a],[b],[c,d,e]] {{{
465
- payload = { :instance_uuid => @controller.uuid, :ecid => id.to_s }
464
+ def split_branches(eid, branches = []) # factual, so for inclusive or [[a],[b],[c,d,e]] {{{
465
+ payload = { :instance_uuid => @controller.uuid, :eid => eid.to_s }
466
466
  payload[:branches] = branches.length if branches.length > 0
467
467
  @controller.notify("gateway/split", payload )
468
468
  end #}}}
469
- def join_branches(id, branches = []) # factual, so for inclusive or [[a],[b],[c,d,e]] {{{
470
- payload = { :instance_uuid => @controller.uuid, :ecid => id.to_s }
469
+ def join_branches(eid, branches = []) # factual, so for inclusive or [[a],[b],[c,d,e]] {{{
470
+ payload = { :instance_uuid => @controller.uuid, :eid => eid.to_s }
471
471
  payload[:branches] = branches if branches.length > 0
472
472
  payload[:branches_length] = branches.length if branches.length > 0
473
473
  @controller.notify("gateway/join", payload )