pione 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/History.txt +9 -0
  2. data/Rakefile +13 -0
  3. data/bin/pione +5 -0
  4. data/bin/pione-compiler +5 -0
  5. data/example/ScoreAggregation/ScoreAggregation.pione +2 -0
  6. data/example/ScoreAggregation/bin/apply-template.rb +1 -1
  7. data/example/ScoreAggregation/bin/mean-summary.rb +1 -1
  8. data/example/ScoreAggregation/bin/total-mean.rb +1 -1
  9. data/example/ScoreAggregation/bin/total-statistics.rb +3 -3
  10. data/example/ScoreAggregation/pione-package.json +21 -0
  11. data/example/ScoreAggregation/scenario/case1/Scenario.pione +1 -0
  12. data/example/ScoreAggregation/scenario/case1/pione-scenario.json +36 -0
  13. data/lib/pione.rb +15 -2
  14. data/lib/pione/agent/basic-agent.rb +0 -1
  15. data/lib/pione/agent/job-terminator.rb +8 -3
  16. data/lib/pione/agent/task-worker.rb +9 -2
  17. data/lib/pione/command.rb +2 -0
  18. data/lib/pione/command/basic-command.rb +4 -0
  19. data/lib/pione/command/option.rb +4 -1
  20. data/lib/pione/command/pione-clean.rb +104 -17
  21. data/lib/pione/command/pione-client.rb +16 -3
  22. data/lib/pione/command/pione-command.rb +45 -0
  23. data/lib/pione/command/pione-compiler.rb +39 -0
  24. data/lib/pione/command/pione-log.rb +1 -0
  25. data/lib/pione/command/pione-task-worker.rb +6 -2
  26. data/lib/pione/command/pione-val.rb +1 -0
  27. data/lib/pione/front.rb +1 -0
  28. data/lib/pione/front/basic-front.rb +1 -1
  29. data/lib/pione/front/front-exception.rb +5 -1
  30. data/lib/pione/global.rb +3 -118
  31. data/lib/pione/global/broker-variable.rb +21 -8
  32. data/lib/pione/global/client-variable.rb +16 -8
  33. data/lib/pione/{system → global}/config.rb +2 -2
  34. data/lib/pione/global/global-exception.rb +40 -0
  35. data/lib/pione/global/input-generator-variable.rb +4 -1
  36. data/lib/pione/global/item.rb +168 -0
  37. data/lib/pione/global/log-variable.rb +64 -13
  38. data/lib/pione/global/network-variable.rb +4 -1
  39. data/lib/pione/global/package-variable.rb +25 -10
  40. data/lib/pione/global/path-variable.rb +62 -26
  41. data/lib/pione/global/relay-variable.rb +101 -36
  42. data/lib/pione/global/system-variable.rb +26 -9
  43. data/lib/pione/global/task-worker-variable.rb +19 -7
  44. data/lib/pione/global/tuple-space-notifier-variable.rb +60 -20
  45. data/lib/pione/lang.rb +0 -2
  46. data/lib/pione/lang/data-expr.rb +8 -0
  47. data/lib/pione/package/package-exception.rb +1 -1
  48. data/lib/pione/rule-engine/action-handler.rb +14 -12
  49. data/lib/pione/rule-engine/engine-exception.rb +11 -0
  50. data/lib/pione/rule-engine/flow-handler.rb +20 -11
  51. data/lib/pione/system.rb +1 -1
  52. data/lib/pione/system/file-cache.rb +1 -1
  53. data/lib/pione/system/init.rb +13 -15
  54. data/lib/pione/system/status.rb +30 -0
  55. data/lib/pione/system/system-exception.rb +0 -24
  56. data/lib/pione/test-helper.rb +8 -1
  57. data/lib/pione/test-helper/command-helper.rb +42 -15
  58. data/lib/pione/util.rb +1 -0
  59. data/lib/pione/util/embeded-expr-expander.rb +5 -11
  60. data/lib/pione/util/pnml-compiler.rb +97 -0
  61. data/lib/pione/util/profiler.rb +107 -0
  62. data/lib/pione/version.rb +1 -1
  63. data/man/pione-clean.1 +76 -0
  64. data/pione.gemspec +5 -2
  65. data/test/agent/spec_job-terminator.rb +41 -3
  66. data/test/command/data/pione-client/ActionError.pione +5 -0
  67. data/test/command/data/pione-compiler/Sequence.pnml +137 -0
  68. data/test/command/spec_pione-clean.rb +250 -5
  69. data/test/command/spec_pione-client.rb +57 -46
  70. data/test/command/spec_pione-command.rb +18 -0
  71. data/test/command/spec_pione-compiler.rb +13 -0
  72. data/test/global/spec_item.rb +77 -0
  73. data/test/lang/data/data-expr.yml +5 -0
  74. data/test/rule-engine/{spec_action-handler.pione → data/action-handler/BasicAction.pione} +0 -0
  75. data/test/rule-engine/data/action-handler/UsePackageScript.pione +17 -0
  76. data/test/rule-engine/spec_action-handler.rb +143 -80
  77. data/test/system/spec_status.rb +13 -0
  78. data/test/{tuple → tuple-space}/spec_basic-tuple.rb +0 -0
  79. data/test/{tuple → tuple-space}/spec_data-tuple.rb +0 -0
  80. data/test/{tuple → tuple-space}/spec_finished-tuple.rb +0 -0
  81. data/test/{tuple → tuple-space}/spec_message-tuple.rb +0 -0
  82. data/test/{tuple → tuple-space}/spec_task-tuple.rb +0 -0
  83. data/test/{tuple → tuple-space}/spec_touch-tuple.rb +0 -0
  84. data/test/{tuple → tuple-space}/spec_working-tuple.rb +0 -0
  85. data/test/{tuple → tuple-space}/tuple-behavior.rb +0 -0
  86. data/test/util/data/pnml/Sequence.pnml +137 -0
  87. data/test/util/spec_pnml-compiler.rb +21 -0
  88. data/test/util/spec_profiler.rb +53 -0
  89. metadata +75 -32
  90. data/example/ScoreAggregation/package.yml +0 -5
  91. data/example/ScoreAggregation/scenario/case1/scenario.yml +0 -29
  92. data/lib/pione/lang/interpolator-parser.rb +0 -44
  93. data/lib/pione/lang/interpolator-transformer.rb +0 -13
  94. data/test/lang/spec_interpolator-parser.rb +0 -5
  95. data/test/lang/spec_interpolator-transformer.rb +0 -15
@@ -1,86 +1,151 @@
1
1
  module Pione
2
2
  module Global
3
3
  # relay user database path
4
- define_external_item(:relay_client_db_path) do
5
- Global.dot_pione_dir + "relay-client.db"
4
+ define_internal_item(:relay_client_db_path) do |item|
5
+ item.desc = "relay client database path"
6
+ item.define_updater {Global.dot_pione_dir + "relay-client.db"}
6
7
  end
7
8
 
8
9
  # relay client database object
9
- define_internal_item(:relay_client_db) do
10
- Relay::RelayClientDB.new(Global.relay_client_db_path)
10
+ define_computed_item(:relay_client_db, [:relay_client_db_path]) do |item|
11
+ item.desc = "relay client database object"
12
+ item.define_updater do
13
+ Relay::RelayClientDB.new(Global.relay_client_db_path)
14
+ end
11
15
  end
12
16
 
13
17
  # relay account database path
14
- define_external_item(:relay_account_db_path) do
15
- Global.dot_pione_dir + "relay-account.db"
18
+ define_external_item(:relay_account_db_path) do |item|
19
+ item.desc = "relay account database path"
20
+ item.define_updater do
21
+ Global.dot_pione_dir + "relay-account.db"
22
+ end
16
23
  end
17
24
 
18
25
  # relay account database object
19
- define_internal_item(:relay_account_db) do
20
- Relay::RelayAccountDB.new(Global.relay_account_db_path)
26
+ define_computed_item(:relay_account_db, [:relay_account_db_path]) do |item|
27
+ item.desc = "relay account database object"
28
+ item.define_updater do
29
+ Relay::RelayAccountDB.new(Global.relay_account_db_path)
30
+ end
21
31
  end
22
32
 
23
33
  # relay server's realm
24
- define_external_item(:relay_realm)
34
+ define_external_item(:relay_realm) do |item|
35
+ item.desc = "relay server's realm"
36
+ end
25
37
 
26
38
  # relay uri
27
- define_internal_item(:relay_uri)
39
+ define_internal_item(:relay_uri) do |item|
40
+ item.desc = "relay URI"
41
+ end
28
42
 
29
43
  # relay port
30
- define_external_item(:relay_port, 56001)
44
+ define_external_item(:relay_port) do |item|
45
+ item.desc = "relay port"
46
+ item.type = :integer
47
+ item.init = 56001
48
+ end
31
49
 
32
50
  # certname for relay server
33
- define_external_item(:relay_ssl_certname, [["CN", "localhost.localhost"]])
51
+ define_internal_item(:relay_ssl_certname) do |item|
52
+ item.desc = "certname for relay server"
53
+ item.init = [["CN", "localhost.localhost"]]
54
+ end
34
55
 
35
56
  # relay-front port range begin
36
- define_external_item(:relay_front_port_range_begin, 44000)
57
+ define_external_item(:relay_front_port_range_begin) do |item|
58
+ item.desc = "start port number of relay front"
59
+ item.type = :integer
60
+ item.init = 44000
61
+ end
37
62
 
38
63
  # relay-front port range end
39
- define_external_item(:relay_front_port_range_end, 44999)
64
+ define_external_item(:relay_front_port_range_end) do |item|
65
+ item.desc = "end port number of relay front"
66
+ item.type = :integer
67
+ item.init = 44999
68
+ end
40
69
 
41
70
  # relay-front port range
42
- define_internal_item(:relay_front_port_range) do
43
- Range.new(
44
- Global.relay_front_port_range_begin,
45
- Global.relay_front_port_range_end
46
- )
71
+ define_computed_item(:relay_front_port_range,
72
+ [:relay_front_port_range_begin, :relay_front_port_range_end]) do |item|
73
+ item.desc = "port range of relay front"
74
+ item.define_updater do
75
+ Range.new(
76
+ Global.relay_front_port_range_begin,
77
+ Global.relay_front_port_range_end
78
+ )
79
+ end
47
80
  end
48
81
 
49
82
  # relay-proxy port range begin
50
- define_external_item(:relay_proxy_port_range_begin, 45000)
83
+ define_external_item(:relay_proxy_port_range_begin) do |item|
84
+ item.desc = "start port number of relay proxy"
85
+ item.type = :integer
86
+ item.init = 45000
87
+ end
51
88
 
52
89
  # relay-proxy port range end
53
- define_external_item(:relay_proxy_port_range_end, 45999)
90
+ define_external_item(:relay_proxy_port_range_end) do |item|
91
+ item.desc = "end port number of relay proxy"
92
+ item.type = :integer
93
+ item.init = 45999
94
+ end
54
95
 
55
96
  # relay-proxy port range
56
- define_internal_item(:relay_proxy_port_range) do
57
- Range.new(
58
- Global.relay_proxy_port_range_begin,
59
- Global.relay_proxy_port_range_end
60
- )
97
+ define_computed_item(:relay_proxy_port_range,
98
+ [:relay_proxy_port_range_begin, :relay_proxy_port_range_end]) do |item|
99
+ item.desc = "port range of relay proxy"
100
+ item.define_updater do
101
+ Range.new(
102
+ Global.relay_proxy_port_range_begin,
103
+ Global.relay_proxy_port_range_end
104
+ )
105
+ end
61
106
  end
62
107
 
63
108
  # relay-client authentication timeout second
64
- define_external_item(:relay_client_auth_timeout_sec, 5)
109
+ define_external_item(:relay_client_auth_timeout_sec) do |item|
110
+ item.desc = "relay-client authentication timeout second"
111
+ item.type = :integer
112
+ item.init = 5
113
+ end
65
114
 
66
115
  # relay tuple space server
67
- define_internal_item(:relay_tuple_space_server)
116
+ define_internal_item(:relay_tuple_space_server) do |item|
117
+ item.desc = "relay tuple space server"
118
+ end
68
119
 
69
120
  # relay-transmitter proxy side port range begin
70
- define_external_item(:relay_transmitter_proxy_side_port_begin, 46000)
121
+ define_external_item(:relay_transmitter_proxy_side_port_begin) do |item|
122
+ item.desc = "start port number of relay transmitter"
123
+ item.type = :integer
124
+ item.init = 46000
125
+ end
71
126
 
72
127
  # relay-transmitter proxy side port range end
73
- define_external_item(:relay_transmitter_proxy_side_port_end, 46999)
128
+ define_external_item(:relay_transmitter_proxy_side_port_end) do |item|
129
+ item.desc = "end port number of relay transmitter"
130
+ item.type = :integer
131
+ item.init = 46999
132
+ end
74
133
 
75
134
  # relay-transmitter proxy side port range
76
- define_internal_item(:relay_transmitter_proxy_side_port_range) do
77
- Range.new(
78
- Global.relay_transmitter_proxy_side_port_begin,
79
- Global.relay_transmitter_proxy_side_port_end
80
- )
135
+ define_computed_item(:relay_transmitter_proxy_side_port_range,
136
+ [:relay_transmitter_proxy_side_port_begin, :relay_transmitter_proxy_side_port_end]) do |item|
137
+ item.desc = "port range of relay transmitter"
138
+ item.define_updater do
139
+ Range.new(
140
+ Global.relay_transmitter_proxy_side_port_begin,
141
+ Global.relay_transmitter_proxy_side_port_end
142
+ )
143
+ end
81
144
  end
82
145
 
83
146
  # relay-receiver
84
- define_internal_item(:relay_receiver)
147
+ define_internal_item(:relay_receiver) do |item|
148
+ item.desc = "realy receiver"
149
+ end
85
150
  end
86
151
  end
@@ -5,35 +5,52 @@ module Pione
5
5
  #
6
6
 
7
7
  # This is global lock for PIONE system.
8
- define_internal_item(:monitor, Monitor.new)
8
+ define_internal_item(:monitor) do |item|
9
+ item.desc = "global lock for PIONE system"
10
+ item.init = Monitor.new
11
+ end
9
12
 
10
13
  #
11
14
  # PIONE's process model
12
15
  #
13
16
 
14
17
  # This is the command object of this process.
15
- define_internal_item(:command)
18
+ define_internal_item(:command) do |item|
19
+ item.desc = "command object of this process"
20
+ end
16
21
 
17
22
  # This is the front server of this process.
18
- define_internal_item(:front)
23
+ define_internal_item(:front) do |item|
24
+ item.desc = "front object of this process"
25
+ end
19
26
 
20
27
  # This process exits with this status.
21
- define_internal_item(:exit_status, true)
28
+ define_internal_item(:exit_status) do |item|
29
+ item.desc = "exit status of this process"
30
+ item.init = true
31
+ end
22
32
 
23
33
  #
24
34
  # user interface
25
35
  #
26
36
 
27
- define_external_item(:color_enabled, true)
37
+ define_external_item(:color_enabled) do |item|
38
+ item.desc = "availability of color mode"
39
+ item.init = true
40
+ end
28
41
 
29
42
  #
30
43
  # misc
31
44
  #
32
45
 
33
- define_external_item(:features, "*")
46
+ define_external_item(:features) do |item|
47
+ item.desc = "string of features for this system"
48
+ item.init = "*"
49
+ end
34
50
 
35
- define_internal_item(:expressional_features) {
36
- Util.parse_features(Global.features)
37
- }
51
+ define_computed_item(:expressional_features, [:features]) do |item|
52
+ item.desc = "expression of features for this system"
53
+ item.define_updater {Util.parse_features(Global.features)}
54
+ end
38
55
  end
39
56
  end
@@ -1,17 +1,29 @@
1
1
  module Pione
2
2
  module Global
3
3
  # This is a begin number of task-worker-front port range.
4
- define_external_item(:task_worker_front_port_range_begin, 50000)
4
+ define_external_item(:task_worker_front_port_range_begin) do |item|
5
+ item.desc = "start port number of task worker front"
6
+ item.type = :integer
7
+ item.init = 50000
8
+ end
5
9
 
6
10
  # This is an end number of task-worker-front port range.
7
- define_external_item(:task_worker_front_port_range_end, 54999)
11
+ define_external_item(:task_worker_front_port_range_end) do |item|
12
+ item.desc = "start port number of task worker front"
13
+ item.type = :integer
14
+ item.init = 50999
15
+ end
8
16
 
9
17
  # This is task-worker-front port range.
10
- define_internal_item(:task_worker_front_port_range) do
11
- Range.new(
12
- Global.task_worker_front_port_range_begin,
13
- Global.task_worker_front_port_range_end
14
- )
18
+ define_computed_item(:task_worker_front_port_range,
19
+ [:task_worker_front_port_range_begin, :task_worker_front_port_range_end]) do |item|
20
+ item.desc = "port range of task worker front"
21
+ item.define_updater do
22
+ Range.new(
23
+ Global.task_worker_front_port_range_begin,
24
+ Global.task_worker_front_port_range_end
25
+ )
26
+ end
15
27
  end
16
28
  end
17
29
  end
@@ -5,32 +5,54 @@ module Pione
5
5
  #
6
6
 
7
7
  # presence port
8
- define_external_item(:presence_port, 56000)
8
+ define_external_item(:presence_port) do |item|
9
+ item.desc = "presence port number"
10
+ item.type = :integer
11
+ item.init = 56000
12
+ end
9
13
 
10
14
  #
11
15
  # pione-tuple-space-provider
12
16
  #
13
17
 
14
18
  # tuple space provider uri
15
- define_internal_item(:tuple_space_provider_uri)
19
+ define_internal_item(:tuple_space_provider_uri) do |item|
20
+ item.desc = "URI of uple space provider"
21
+ end
16
22
 
17
23
  # provider-front port range begin
18
- define_external_item(:tuple_space_provider_front_port_range_begin, 42000)
24
+ define_external_item(:tuple_space_provider_front_port_range_begin) do |item|
25
+ item.desc = "start port number of tuple space provider front"
26
+ item.type = :integer
27
+ item.init = 42000
28
+ end
19
29
 
20
30
  # provider-front port range end
21
- define_external_item(:tuple_space_provider_front_port_range_end, 42999)
31
+ define_external_item(:tuple_space_provider_front_port_range_end) do |item|
32
+ item.desc = "start port number of tuple space provider front"
33
+ item.type = :integer
34
+ item.init = 42099
35
+ end
22
36
 
23
37
  # provider-front port range
24
- define_internal_item(:tuple_space_provider_front_port_range) do
25
- Range.new(
26
- Global.tuple_space_provider_front_port_range_begin,
27
- Global.tuple_space_provider_front_port_range_end
28
- )
38
+ define_internal_item(:tuple_space_provider_front_port_range,
39
+ [:tuple_space_provider_front_port_range_begin, :tuple_space_provider_front_port_range_end]) do |item|
40
+ item.desc = "port range of tuple space provider"
41
+ item.define_updater do
42
+ Range.new(
43
+ Global.tuple_space_provider_front_port_range_begin,
44
+ Global.tuple_space_provider_front_port_range_end
45
+ )
46
+ end
29
47
  end
30
48
 
31
49
  # presence notification address
32
- define_external_item(:presence_notification_addresses) do
33
- [URI.parse("broadcast://%s:%s" % ["255.255.255.255", Global.presence_port])]
50
+ define_external_item(:presence_notification_addresses) do |item|
51
+ item.desc = "presence notification addresses"
52
+ item.init = ["255.255.255.255:56000"]
53
+ item.define_updater do |vals|
54
+ vals.map {|val| URI.parse("broadcast://%s" % val)}
55
+ end
34
56
  end
35
57
 
36
58
  #
@@ -38,23 +60,41 @@ module Pione
38
60
  #
39
61
 
40
62
  # tuple space receiver uri
41
- define_internal_item(:tuple_space_receiver_uri)
63
+ define_internal_item(:tuple_space_receiver_uri) do |item|
64
+ item.desc = "URI of tuple space receiver"
65
+ end
42
66
 
43
67
  # receiver-front port range begin
44
- define_external_item(:tuple_space_receiver_front_port_range_begin, 43000)
68
+ define_external_item(:tuple_space_receiver_front_port_range_begin) do |item|
69
+ item.desc = "start port number of tuple space receiver front"
70
+ item.type = :integer
71
+ item.init = 43000
72
+ end
45
73
 
46
74
  # receiver-front port range end
47
- define_external_item(:tuple_space_receiver_front_port_range_end, 43999)
75
+ define_external_item(:tuple_space_receiver_front_port_range_end) do |item|
76
+ item.desc = "end port number of tuple space receiver front"
77
+ item.type = :integer
78
+ item.init = 43999
79
+ end
48
80
 
49
81
  # receiver-front port range
50
- define_internal_item(:tuple_space_receiver_front_port_range) do
51
- Range.new(
52
- Global.tuple_space_receiver_front_port_range_begin,
53
- Global.tuple_space_receiver_front_port_range_end
54
- )
82
+ define_computed_item(:tuple_space_receiver_front_port_range,
83
+ [:tuple_space_receiver_front_port_range_begin, :tuple_space_receiver_front_port_range_end]) do |item|
84
+ item.desc = "port range of tuple space receiver front"
85
+ item.define_updater do
86
+ Range.new(
87
+ Global.tuple_space_receiver_front_port_range_begin,
88
+ Global.tuple_space_receiver_front_port_range_end
89
+ )
90
+ end
55
91
  end
56
92
 
57
93
  # disconnect time for tuple space receiver
58
- define_external_item(:tuple_space_receiver_disconnect_time, 180)
94
+ define_internal_item(:tuple_space_receiver_disconnect_time) do |item|
95
+ item.desc = "tuple space receiver disconnect time"
96
+ item.type = :integer
97
+ item.init = 180
98
+ end
59
99
  end
60
100
  end
data/lib/pione/lang.rb CHANGED
@@ -43,7 +43,6 @@ require 'pione/lang/context-parser' # context parser
43
43
  require 'pione/lang/conditional-branch-parser' # conditional branch parser
44
44
  require 'pione/lang/declaration-parser' # declaration parser
45
45
  require 'pione/lang/document-parser' # document parser
46
- require 'pione/lang/interpolator-parser' # interpolator parser
47
46
 
48
47
  # inner model transformer
49
48
  require 'pione/lang/literal-transformer' # literal transformer
@@ -52,4 +51,3 @@ require 'pione/lang/context-transformer' # context transformer
52
51
  require 'pione/lang/declaration-transformer' # declaration transformer
53
52
  require 'pione/lang/conditional-branch-transformer' # conditional branch transformer
54
53
  require 'pione/lang/document-transformer' # document transformer
55
- require 'pione/lang/interpolator-transformer' # interpolator transformer
@@ -260,6 +260,14 @@ module Pione
260
260
  end
261
261
  end
262
262
  end
263
+
264
+ define_pione_method("join", [TypeString], TypeString) do |env, rec, sep|
265
+ rec.call_pione_method(env, "str", []).call_pione_method(env, "join", [sep])
266
+ end
267
+
268
+ define_pione_method("join", [], TypeString) do |env, rec, sep|
269
+ rec.call_pione_method(env, "str", []).call_pione_method(env, "join", [])
270
+ end
263
271
  end
264
272
  end
265
273
  end
@@ -23,7 +23,7 @@ module Pione
23
23
  end
24
24
 
25
25
  def message
26
- "invalid package filename \"%s\": %s" % [name, @error.message]
26
+ "invalid package filename \"%s\": %s" % [@name, @error.message]
27
27
  end
28
28
  end
29
29
 
@@ -10,7 +10,7 @@ module Pione
10
10
 
11
11
  def initialize(*args)
12
12
  super(*args)
13
- @working_directory = Location[make_working_directory]
13
+ @working_directory = Location[Global.working_directory_generator.mkdir]
14
14
  @env.variable_set(
15
15
  Lang::Variable.new("__WORKING_DIRECTORY__"),
16
16
  Lang::StringSequence.of(@working_directory.path.to_s)
@@ -34,6 +34,9 @@ module Pione
34
34
  # write other resources
35
35
  write_other_resources
36
36
 
37
+ # clear working directory
38
+ @working_directory.delete
39
+
37
40
  # return tuples
38
41
  return outputs
39
42
  end
@@ -46,14 +49,6 @@ module Pione
46
49
  @variable_table.set(Variable.new("_"), PackageExprSequence.new([PackageExpr.new(@rule.package_name)]))
47
50
  end
48
51
 
49
- # Make a working directory for the action.
50
- #
51
- # @return [Location]
52
- # location of working directory
53
- def make_working_directory
54
- return (Global.working_directory + Util::UUID.generate).tap{|path| path.mkpath}
55
- end
56
-
57
52
  # Synchronize input data into working directory.
58
53
  def setup_working_directory
59
54
  @inputs.flatten.each do |input|
@@ -68,7 +63,7 @@ module Pione
68
63
  end
69
64
 
70
65
  # FIXME: should not copy bin files in the package each time.
71
- bin = @base_location + "package" + @package_id + "bin"
66
+ bin = @base_location + "package" + "bin"
72
67
  if bin.exist?
73
68
  bin.entries.each do |entry|
74
69
  dest = @working_directory + "bin" + entry.basename
@@ -118,12 +113,19 @@ module Pione
118
113
  err = ".stderr"
119
114
 
120
115
  # execute command
121
- `cd #{@working_directory.path}; PATH=./bin/:$PATH ; ./#{scriptname} > #{out} 2> #{err}`
116
+ `cd #{@working_directory.path}; PATH=#{(@working_directory + "bin").path}:$PATH ; ./#{scriptname} > #{out} 2> #{err}`
122
117
 
123
- # delete unneeded files
118
+ # the case the script has errored
119
+ unless $?.success?
120
+ raise ActionError.new(digest, (@working_directory + err).read)
121
+ end
122
+
123
+ # delete .stdout file if it is empty
124
124
  if stdout.nil? and (@working_directory + out).size == 0
125
125
  (@working_directory + out).delete
126
126
  end
127
+
128
+ # delete .stderr file if it is emtpy
127
129
  if (@working_directory + err).size == 0
128
130
  (@working_directory + err).delete
129
131
  end