pione 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -13
- data/.travis.yml +1 -1
- data/History.txt +11 -0
- data/Rakefile +13 -0
- data/bin/pione-package +5 -0
- data/example/AbstractRule/package.yml +6 -0
- data/example/AbstractRule/scenario/a/output/message.txt +1 -0
- data/example/AbstractRule/scenario/a/scenario.yml +4 -0
- data/example/AbstractRule/scenario/b/output/message.txt +1 -0
- data/example/AbstractRule/scenario/b/scenario.yml +4 -0
- data/example/AbstractRule/scenario/c/output/message.txt +1 -0
- data/example/AbstractRule/scenario/c/scenario.yml +4 -0
- data/example/HelloWorld/package.yml +5 -1
- data/example/HelloWorld/scenario/scenario.yml +2 -1
- data/example/LoopByTouch/package.yml +4 -1
- data/example/MakePair/package.yml +6 -0
- data/example/MakePair/scenario/{input → case1/input}/1.i +0 -0
- data/example/MakePair/scenario/{input → case1/input}/2.i +0 -0
- data/example/MakePair/scenario/{input → case1/input}/3.i +0 -0
- data/example/MakePair/scenario/{input → case1/input}/4.i +0 -0
- data/example/MakePair/scenario/{input → case1/input}/5.i +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-1-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-1-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-1-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-1-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-2-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-2-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-2-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-3-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-3-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/comb-4-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-1-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-1-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-1-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-1-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-2-1.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-2-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-2-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-2-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-3-1.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-3-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-3-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-3-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-4-1.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-4-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-4-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-4-5.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-5-1.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-5-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-5-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/perm-5-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/succ-1-2.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/succ-2-3.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/succ-3-4.pair +0 -0
- data/example/MakePair/scenario/{output → case1/output}/succ-4-5.pair +0 -0
- data/example/MakePair/scenario/case1/scenario.yml +42 -0
- data/example/MakePair/scenario/case2/input/10.i +0 -0
- data/example/MakePair/scenario/case2/input/11.i +0 -0
- data/example/MakePair/scenario/case2/input/9.i +0 -0
- data/example/MakePair/scenario/case2/output/comb-10-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/comb-9-10.pair +0 -0
- data/example/MakePair/scenario/case2/output/comb-9-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-10-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-10-9.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-11-10.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-11-9.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-9-10.pair +0 -0
- data/example/MakePair/scenario/case2/output/perm-9-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/succ-10-11.pair +0 -0
- data/example/MakePair/scenario/case2/output/succ-9-10.pair +0 -0
- data/example/MakePair/scenario/case2/scenario.yml +17 -0
- data/example/MakePair/scenario/case3/input/1.i +0 -0
- data/example/MakePair/scenario/case3/input/3.i +0 -0
- data/example/MakePair/scenario/case3/input/5.i +0 -0
- data/example/MakePair/scenario/case3/input/7.i +0 -0
- data/example/MakePair/scenario/case3/input/9.i +0 -0
- data/example/MakePair/scenario/case3/output/comb-1-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-1-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-1-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-1-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-3-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-3-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-3-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-5-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-5-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/comb-7-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-1-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-1-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-1-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-1-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-3-1.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-3-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-3-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-3-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-5-1.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-5-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-5-7.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-5-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-7-1.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-7-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-7-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-7-9.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-9-1.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-9-3.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-9-5.pair +0 -0
- data/example/MakePair/scenario/case3/output/perm-9-7.pair +0 -0
- data/example/MakePair/scenario/case3/scenario.yml +39 -0
- data/example/PegasusWMS/Merge/Merge.pione +21 -0
- data/example/PegasusWMS/Merge/package.yml +2 -0
- data/example/PegasusWMS/Pipeline/Pipeline.pione +20 -0
- data/example/PegasusWMS/Pipeline/package.yml +2 -0
- data/example/PegasusWMS/Split/Split.pione +27 -0
- data/example/PegasusWMS/Split/package.yml +2 -0
- data/example/ScoreAggregation/package.yml +4 -0
- data/example/ScoreAggregation/scenario/case1/scenario.yml +27 -1
- data/example/SerialProcessing/package.yml +5 -1
- data/example/SerialProcessing/scenario/scenario.yml +10 -0
- data/lib/pione.rb +20 -71
- data/lib/pione/agent.rb +17 -0
- data/lib/pione/agent/basic-agent.rb +2 -4
- data/lib/pione/command.rb +1 -0
- data/lib/pione/command/option.rb +4 -1
- data/lib/pione/command/pione-package.rb +97 -0
- data/lib/pione/command/pione-task-worker.rb +11 -7
- data/lib/pione/component.rb +5 -0
- data/lib/pione/component/document.rb +22 -5
- data/lib/pione/component/package-archiver.rb +92 -0
- data/lib/pione/component/package-expander.rb +37 -0
- data/lib/pione/component/package-filename.rb +38 -0
- data/lib/pione/component/package-reader.rb +276 -0
- data/lib/pione/component/package.rb +50 -162
- data/lib/pione/front.rb +14 -0
- data/lib/pione/location.rb +5 -0
- data/lib/pione/location/basic-location.rb +47 -274
- data/lib/pione/location/data-location.rb +328 -0
- data/lib/pione/location/dropbox-location.rb +30 -7
- data/lib/pione/location/exception.rb +38 -0
- data/lib/pione/location/ftp-location.rb +24 -13
- data/lib/pione/location/git-repository-location.rb +153 -0
- data/lib/pione/location/http-location.rb +65 -0
- data/lib/pione/location/https-location.rb +37 -0
- data/lib/pione/location/local-location.rb +24 -5
- data/lib/pione/parser.rb +14 -0
- data/lib/pione/patch.rb +10 -0
- data/lib/pione/patch/drb-patch.rb +2 -2
- data/lib/pione/relay.rb +11 -0
- data/lib/pione/system/file-cache.rb +1 -1
- data/lib/pione/system/global.rb +15 -0
- data/lib/pione/tuple-space.rb +11 -0
- data/lib/pione/tuple-space/tuple-space-server.rb +1 -1
- data/lib/pione/util.rb +1 -0
- data/lib/pione/util/error-report.rb +7 -0
- data/lib/pione/util/misc.rb +2 -2
- data/lib/pione/util/zip.rb +60 -0
- data/lib/pione/version.rb +1 -1
- data/pione.gemspec +5 -1
- data/test/agent/spec_rule-provider.rb +2 -2
- data/test/command/spec_pione-package.rb +15 -0
- data/test/component/spec_document.rb +2 -2
- data/test/component/spec_package-archiver.rb +27 -0
- data/test/component/spec_package-expander.rb +11 -0
- data/test/component/spec_package-filename.rb +79 -0
- data/test/component/spec_package-reader.rb +100 -0
- data/test/component/spec_package.rb +50 -33
- data/test/location/http-behavior.rb +59 -0
- data/test/location/location-behavior.rb +8 -0
- data/test/location/spec_basic-location.rb +5 -1
- data/test/location/spec_git-repository-location.rb +143 -0
- data/test/location/spec_http-location.rb +28 -0
- data/test/location/spec_http-location/a.txt +1 -0
- data/test/location/spec_http-location/b.txt +1 -0
- data/test/location/spec_http-location/c.txt +1 -0
- data/test/location/spec_http-location/dir/d.txt +1 -0
- data/test/location/spec_https-location.rb +37 -0
- data/test/rule-handler/spec_flow-handler.rb +1 -1
- data/test/rule-handler/spec_update-criteria.rb +1 -1
- data/test/test-data/package/HelloWorld+v0.1.0.ppg +0 -0
- data/test/test-data/package/HelloWorld-gitrepos.zip +0 -0
- data/test/test-data/package/HelloWorld/HelloWorld.pione +5 -0
- data/test/test-data/package/HelloWorld/package.yml +6 -0
- data/test/test-data/package/HelloWorld/scenario/output/message.txt +1 -0
- data/test/test-data/package/HelloWorld/scenario/scenario.yml +3 -0
- data/test/test-data/package/TestPackage1+v0.1.0.ppg +0 -0
- data/test/{component/spec_package/TestPackage → test-data/package/TestPackage1}/Test.pione +3 -1
- data/test/test-data/package/TestPackage1/bin/count +11 -0
- data/test/test-data/package/TestPackage1/package.yml +9 -0
- data/test/{component/spec_package/TestPackage → test-data/package/TestPackage1}/scenario/case1/input/1.txt +0 -0
- data/test/test-data/package/TestPackage1/scenario/case1/output/1.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case1/scenario.yml +6 -0
- data/test/test-data/package/TestPackage1/scenario/case2/input/1.txt +2 -0
- data/test/test-data/package/TestPackage1/scenario/case2/input/2.txt +1 -0
- data/test/test-data/package/TestPackage1/scenario/case2/input/3.txt +3 -0
- data/test/test-data/package/TestPackage1/scenario/case2/output/1.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case2/output/2.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case2/output/3.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case2/scenario.yml +10 -0
- data/test/test-data/package/TestPackage1/scenario/case3/input/a.txt +1 -0
- data/test/test-data/package/TestPackage1/scenario/case3/input/b.txt +1 -0
- data/test/test-data/package/TestPackage1/scenario/case3/output/a.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case3/output/b.count +1 -0
- data/test/test-data/package/TestPackage1/scenario/case3/scenario.yml +8 -0
- data/test/test-util.rb +10 -146
- data/test/test-util/command.rb +53 -0
- data/test/test-util/package.rb +9 -0
- data/test/test-util/parser.rb +45 -0
- data/test/test-util/transformer.rb +50 -0
- data/test/test-util/webserver.rb +43 -0
- data/test/util/spec_error-report.rb +12 -3
- data/test/util/spec_zip.rb +36 -0
- metadata +282 -54
- data/example/MakePair/scenario/scenario.yml +0 -1
- data/test/component/spec_package/TestPackage/bin/count +0 -3
- data/test/component/spec_package/TestPackage/package.yml +0 -7
- data/test/component/spec_package/TestPackage/scenario/case1/scenario.yml +0 -1
@@ -0,0 +1,21 @@
|
|
1
|
+
Rule Main
|
2
|
+
output 'binaries.txt'
|
3
|
+
Flow
|
4
|
+
rule List
|
5
|
+
rule Join
|
6
|
+
End
|
7
|
+
|
8
|
+
Rule List
|
9
|
+
output 'bin_{$INDEX}.txt'
|
10
|
+
param $INDEX := 0.upto(2)
|
11
|
+
param $DIRS := ("/bin" | "/usr/bin" | "/usr/local/bin").all
|
12
|
+
Action
|
13
|
+
ls -l {$DIRS[$INDEX+1]} > {$O[1]}
|
14
|
+
End
|
15
|
+
|
16
|
+
Rule Join
|
17
|
+
input 'bin_*.txt'.all
|
18
|
+
output 'binaries.txt'
|
19
|
+
Action
|
20
|
+
cat {$I[1].as_string.join(" ")} > {$O[1]}
|
21
|
+
End
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Rule Main
|
2
|
+
output 'count.txt'
|
3
|
+
Flow
|
4
|
+
rule GetHTML
|
5
|
+
rule Count
|
6
|
+
End
|
7
|
+
|
8
|
+
Rule GetHTML
|
9
|
+
output 'pegasus.html'
|
10
|
+
Action
|
11
|
+
curl -o {$O[1]} "http://pegasus.isi.edu"
|
12
|
+
End
|
13
|
+
|
14
|
+
Rule Count
|
15
|
+
input 'pegasus.html'
|
16
|
+
output 'count.txt'
|
17
|
+
Action
|
18
|
+
wc {$I[1]} > {$O[1]}
|
19
|
+
End
|
20
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Rule Main
|
2
|
+
output 'count.txt.*'.all
|
3
|
+
Flow
|
4
|
+
rule GetHTML
|
5
|
+
rule Split
|
6
|
+
rule Count
|
7
|
+
End
|
8
|
+
|
9
|
+
Rule GetHTML
|
10
|
+
output 'pegasus.html'
|
11
|
+
Action
|
12
|
+
curl -o {$O[1]} "http://pegasus.isi.edu"
|
13
|
+
End
|
14
|
+
|
15
|
+
Rule Split
|
16
|
+
input 'pegasus.html'
|
17
|
+
output 'part.*'.all
|
18
|
+
Action
|
19
|
+
split -l 100 -a 1 "{$I[1]}" part.
|
20
|
+
End
|
21
|
+
|
22
|
+
Rule Count
|
23
|
+
input 'part.*'
|
24
|
+
output 'count.txt.{$*}'
|
25
|
+
Action
|
26
|
+
wc {$I[1]} > {$O[1]}
|
27
|
+
End
|
@@ -1,3 +1,29 @@
|
|
1
1
|
ScenarioName: case1
|
2
|
-
|
2
|
+
Inputs:
|
3
|
+
- "A.score"
|
4
|
+
- "B.score"
|
5
|
+
- "C.score"
|
6
|
+
- "D.score"
|
7
|
+
- "E.score"
|
8
|
+
- "F.score"
|
9
|
+
- "G.score"
|
10
|
+
- "H.score"
|
11
|
+
- "I.score"
|
12
|
+
- "J.score"
|
13
|
+
- "K.score"
|
14
|
+
- "L.score"
|
15
|
+
- "M.score"
|
16
|
+
- "N.score"
|
17
|
+
- "O.score"
|
18
|
+
- "P.score"
|
19
|
+
- "Q.score"
|
20
|
+
- "R.score"
|
21
|
+
- "S.score"
|
22
|
+
- "T.score"
|
23
|
+
- "U.score"
|
24
|
+
- "V.score"
|
25
|
+
- "W.score"
|
26
|
+
- "X.score"
|
27
|
+
- "Y.score"
|
28
|
+
- "Z.score"
|
3
29
|
|
data/lib/pione.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
#
|
2
2
|
# load libraries
|
3
3
|
#
|
4
|
+
|
5
|
+
# bundler
|
4
6
|
require 'bundler/setup'
|
7
|
+
|
8
|
+
# standard
|
5
9
|
require 'set'
|
6
10
|
require 'socket'
|
7
11
|
require 'digest'
|
@@ -24,11 +28,13 @@ require 'etc'
|
|
24
28
|
require 'json'
|
25
29
|
require 'rexml/document'
|
26
30
|
require 'logger'
|
31
|
+
require 'ostruct'
|
32
|
+
require 'net/ftp'
|
33
|
+
require 'net/http'
|
27
34
|
|
35
|
+
# gems
|
28
36
|
require 'uuidtools'
|
29
37
|
require 'parslet'
|
30
|
-
require 'ostruct'
|
31
|
-
require 'net/ftp'
|
32
38
|
require 'highline'
|
33
39
|
require 'dropbox_sdk'
|
34
40
|
require 'hamster'
|
@@ -39,10 +45,15 @@ require 'sys/uname'
|
|
39
45
|
require 'simple-identity'
|
40
46
|
require 'rainbow'
|
41
47
|
require 'em-ftpd'
|
42
|
-
require 'pione/patch/em-ftpd-patch'
|
48
|
+
require 'pione/patch/em-ftpd-patch' # patch
|
43
49
|
require 'sys/cpu'
|
44
50
|
require 'structx'
|
45
51
|
require 'syslog-logger'
|
52
|
+
require 'zipruby'
|
53
|
+
require 'retriable'
|
54
|
+
require 'childprocess'
|
55
|
+
|
56
|
+
ChildProcess.posix_spawn = true
|
46
57
|
|
47
58
|
#
|
48
59
|
# load pione
|
@@ -50,14 +61,7 @@ require 'syslog-logger'
|
|
50
61
|
|
51
62
|
require 'pione/version'
|
52
63
|
require 'pione/util'
|
53
|
-
|
54
|
-
# patch
|
55
|
-
require 'pione/patch/array-patch'
|
56
|
-
require 'pione/patch/drb-patch'
|
57
|
-
require 'pione/patch/rinda-patch'
|
58
|
-
require 'pione/patch/uri-patch'
|
59
|
-
require 'pione/patch/monitor-patch'
|
60
|
-
|
64
|
+
require 'pione/patch'
|
61
65
|
require 'pione/uri-scheme'
|
62
66
|
require 'pione/location'
|
63
67
|
require 'pione/log'
|
@@ -66,71 +70,16 @@ require 'pione/system'
|
|
66
70
|
Pione.module_exec {const_set(:PioneObject, Pione::System::PioneObject)}
|
67
71
|
Pione.module_exec {const_set(:Global, Pione::System::Global)}
|
68
72
|
|
69
|
-
|
70
|
-
require 'pione/
|
71
|
-
require 'pione/relay/trampoline'
|
72
|
-
require 'pione/relay/receiver-socket'
|
73
|
-
require 'pione/relay/relay-socket'
|
74
|
-
require 'pione/relay/relay-client-db'
|
75
|
-
require 'pione/relay/relay-account-db'
|
76
|
-
|
77
|
-
# tuple-space
|
78
|
-
require 'pione/tuple-space/tuple-space-server-interface'
|
79
|
-
require 'pione/tuple-space/presence-notifier'
|
80
|
-
require 'pione/tuple-space/tuple-space-server'
|
81
|
-
require 'pione/tuple-space/tuple-space-receiver'
|
82
|
-
require 'pione/tuple-space/tuple-space-provider'
|
83
|
-
require 'pione/tuple-space/data-finder'
|
84
|
-
|
85
|
-
# rule-handler
|
73
|
+
require 'pione/relay'
|
74
|
+
require 'pione/tuple-space'
|
86
75
|
require 'pione/rule-handler.rb'
|
87
|
-
|
88
76
|
require 'pione/model'
|
89
77
|
require 'pione/component'
|
90
|
-
|
91
|
-
# tuple
|
92
78
|
require 'pione/tuple'
|
93
|
-
|
94
|
-
# parser
|
95
|
-
require 'pione/parser/parslet-extension'
|
96
|
-
require 'pione/parser/common-parser'
|
97
|
-
require 'pione/parser/literal-parser'
|
98
|
-
require 'pione/parser/feature-expr-parser'
|
99
|
-
require 'pione/parser/expr-parser'
|
100
|
-
require 'pione/parser/flow-element-parser'
|
101
|
-
require 'pione/parser/block-parser'
|
102
|
-
require 'pione/parser/rule-definition-parser'
|
103
|
-
require 'pione/parser/document-parser'
|
104
|
-
|
105
|
-
# transformer
|
79
|
+
require 'pione/parser'
|
106
80
|
require 'pione/transformer'
|
107
|
-
|
108
|
-
|
109
|
-
require 'pione/agent/basic-agent'
|
110
|
-
require 'pione/agent/tuple-space-client'
|
111
|
-
require 'pione/agent/command-listener'
|
112
|
-
require 'pione/agent/task-worker'
|
113
|
-
require 'pione/agent/input-generator'
|
114
|
-
require 'pione/agent/rule-provider'
|
115
|
-
require 'pione/agent/logger'
|
116
|
-
require 'pione/agent/broker'
|
117
|
-
require 'pione/agent/process-manager'
|
118
|
-
require 'pione/agent/trivial-routine-worker'
|
119
|
-
require 'pione/agent/tuple-space-server-client-life-checker'
|
120
|
-
require 'pione/agent/messenger'
|
121
|
-
|
122
|
-
# front
|
123
|
-
require 'pione/front/basic-front'
|
124
|
-
require 'pione/front/task-worker-owner'
|
125
|
-
require 'pione/front/tuple-space-provider-owner'
|
126
|
-
require 'pione/front/client-front'
|
127
|
-
require 'pione/front/broker-front'
|
128
|
-
require 'pione/front/task-worker-front'
|
129
|
-
require 'pione/front/tuple-space-provider-front'
|
130
|
-
require 'pione/front/tuple-space-receiver-front'
|
131
|
-
require 'pione/front/relay-front'
|
132
|
-
|
133
|
-
# command
|
81
|
+
require 'pione/agent'
|
82
|
+
require 'pione/front'
|
134
83
|
require 'pione/command'
|
135
84
|
|
136
85
|
#
|
data/lib/pione/agent.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Pione
|
2
|
+
# Agent is a namespace for agents.
|
3
|
+
module Agent; end
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'pione/agent/basic-agent'
|
7
|
+
require 'pione/agent/tuple-space-client'
|
8
|
+
require 'pione/agent/command-listener'
|
9
|
+
require 'pione/agent/task-worker'
|
10
|
+
require 'pione/agent/input-generator'
|
11
|
+
require 'pione/agent/rule-provider'
|
12
|
+
require 'pione/agent/logger'
|
13
|
+
require 'pione/agent/broker'
|
14
|
+
require 'pione/agent/process-manager'
|
15
|
+
require 'pione/agent/trivial-routine-worker'
|
16
|
+
require 'pione/agent/tuple-space-server-client-life-checker'
|
17
|
+
require 'pione/agent/messenger'
|
@@ -216,12 +216,10 @@ module Pione
|
|
216
216
|
|
217
217
|
# Terminate to transit.
|
218
218
|
def terminate
|
219
|
-
# abort the agent when called by other thread
|
220
|
-
abort unless @running_thread == Thread.current
|
221
|
-
# transit to terminated
|
222
219
|
begin
|
223
220
|
res = call_transition_method(:terminated)
|
224
|
-
rescue DRb::DRbConnError, DRb::ReplyReaderThreadError
|
221
|
+
rescue DRb::DRbConnError, DRb::ReplyReaderThreadError => e
|
222
|
+
Util::ErrorReport.warn("raised a connection error when we terminated", self, e, __FILE__, __LINE__)
|
225
223
|
end
|
226
224
|
# set agent state
|
227
225
|
set_current_state(:terminated)
|
data/lib/pione/command.rb
CHANGED
data/lib/pione/command/option.rb
CHANGED
@@ -140,8 +140,11 @@ module Pione
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def setup_item_value(opt, item, defs)
|
143
|
-
|
143
|
+
case item.value
|
144
|
+
when Proc
|
144
145
|
opt.on(*defs, Proc.new{|*args| @option[item.name] = self.instance_exec(*args, &item.value)})
|
146
|
+
when :as_is
|
147
|
+
opt.on(*defs, Proc.new{|*args| @option[item.name] = args.first})
|
145
148
|
end
|
146
149
|
end
|
147
150
|
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module Pione
|
2
|
+
module Command
|
3
|
+
class PionePackage < BasicCommand
|
4
|
+
define_info do
|
5
|
+
set_name "pione-package"
|
6
|
+
set_banner "PIONE package utility."
|
7
|
+
end
|
8
|
+
|
9
|
+
define_option do
|
10
|
+
use :color
|
11
|
+
use :debug
|
12
|
+
|
13
|
+
default :output, Location["./"]
|
14
|
+
|
15
|
+
define(:build) do |item|
|
16
|
+
item.long = '--build'
|
17
|
+
item.desc = 'build PIONE archive file(*.ppg)'
|
18
|
+
item.action = lambda do |option, location|
|
19
|
+
option[:action] = :build
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
define(:output) do |item|
|
24
|
+
item.short = "-o"
|
25
|
+
item.long = "--output=LOCATION"
|
26
|
+
item.desc = "output file or directory location"
|
27
|
+
item.value = lambda {|val| Location[val]}
|
28
|
+
end
|
29
|
+
|
30
|
+
define(:tag) do |item|
|
31
|
+
item.long = "--tag=NAME"
|
32
|
+
item.desc = "specify tag name"
|
33
|
+
item.value = :as_is
|
34
|
+
end
|
35
|
+
|
36
|
+
define(:tag) do |item|
|
37
|
+
item.long = "--branch=NAME"
|
38
|
+
item.desc = "specify branch name"
|
39
|
+
item.value = :as_is
|
40
|
+
end
|
41
|
+
|
42
|
+
define(:hash_id) do |item|
|
43
|
+
item.long = "--hash-id=HASH"
|
44
|
+
item.desc = "specify git hash id"
|
45
|
+
item.value = :as_is
|
46
|
+
end
|
47
|
+
|
48
|
+
validate do |option|
|
49
|
+
unless option[:output].directory?
|
50
|
+
abort("output location should be a directory: %s" % option[:output])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
start do
|
56
|
+
if option[:action] == :build
|
57
|
+
# package is not found
|
58
|
+
if @argv.first.nil?
|
59
|
+
abort("There are no PIONE documents or packages.")
|
60
|
+
end
|
61
|
+
|
62
|
+
# archive
|
63
|
+
if ppg = try_to_archive(Location[git: @argv.first], Location[data: @argv.first])
|
64
|
+
puts "suceeded: %s" % ppg.address
|
65
|
+
else
|
66
|
+
abort("Faild to archive.")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def archive_from_directory_package
|
74
|
+
archiver = Component::PackageArchiver.new(Location[@argv.first])
|
75
|
+
end
|
76
|
+
|
77
|
+
def try_to_archive(*locations)
|
78
|
+
locations.each do |location|
|
79
|
+
begin
|
80
|
+
# make archiver
|
81
|
+
archiver_option = {tag: option[:tag], branch: option[:branch], hash_id: option[:hash_id]}
|
82
|
+
if location.location_type == :data
|
83
|
+
archiver_option[:tag] = Time.now.strftime("%Y%m%d%H%M")
|
84
|
+
end
|
85
|
+
archiver = Component::PackageArchiver.new(location, archiver_option)
|
86
|
+
|
87
|
+
# archive
|
88
|
+
return archiver.archive(option[:output])
|
89
|
+
rescue => e
|
90
|
+
Util::ErrorReport.warn("archiver faild: %s" % location, self, e, __FILE__, __LINE__)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
return false
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -115,28 +115,32 @@ BANNER
|
|
115
115
|
terminate do
|
116
116
|
Global.monitor.synchronize do
|
117
117
|
begin
|
118
|
+
# flag
|
118
119
|
return if @terminated
|
120
|
+
@terminated = true
|
119
121
|
|
120
122
|
# terminate the agent
|
121
123
|
if @agent
|
122
124
|
@agent.terminate
|
123
125
|
|
124
|
-
|
125
|
-
|
126
|
-
|
126
|
+
Timeout.timeout(5) do
|
127
|
+
while true
|
128
|
+
break if @agent.terminated? and @agent.running_thread and @agent.running_thread.stop?
|
129
|
+
sleep 1
|
130
|
+
end
|
127
131
|
end
|
128
132
|
end
|
129
133
|
|
130
134
|
# disconnect parent front
|
131
135
|
option[:parent_front].remove_task_worker_front(self, option[:connection_id])
|
132
136
|
|
133
|
-
# flag
|
134
|
-
@terminated = true
|
135
137
|
rescue DRb::DRbConnError, DRb::ReplyReaderThreadError => e
|
136
|
-
ErrorReport.warn("Disconnected in termination process of task worker agent.", self, e, __FILE__, __LINE__)
|
138
|
+
Util::ErrorReport.warn("Disconnected in termination process of task worker agent.", self, e, __FILE__, __LINE__)
|
137
139
|
rescue ThreadError => e
|
138
140
|
# tuple space may be closed
|
139
|
-
ErrorReport.warn("Failed in termination process of task worker agent.", self, e, __FILE__, __LINE__)
|
141
|
+
Util::ErrorReport.warn("Failed in termination process of task worker agent.", self, e, __FILE__, __LINE__)
|
142
|
+
rescue Timeout::Error => e
|
143
|
+
Util::ErrorReport.warn("Timeouted in termination of pione-task-worker.", self, e, __FILE__, __LINE__)
|
140
144
|
end
|
141
145
|
end
|
142
146
|
end
|