workflow_manager 0.4.8 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/wfm_job_list +16 -1
- data/bin/workflow_manager +2 -0
- data/config/environments/production.rb +1 -0
- data/config/environments/redis.conf +9 -0
- data/lib/workflow_manager/server.rb +79 -15
- data/lib/workflow_manager/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8d2b5478dda4da2f42ca05754e19e446faa4cab
|
4
|
+
data.tar.gz: f039f6cfbb00dd6c3a8a911b5d417ed24b413809
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1ab900a8327e7778e715ba909bf583bb2ad621058123523c41a280bbee55d5148591a70641b3aa8d4aa8df7aeccbca477d92673ea2f735a37cedd4696763cbd
|
7
|
+
data.tar.gz: eb034e572721c32a6e9b1858b8ca69899a1fd7705494430e4f9590844dc4b2f0e79dfd0dcf05478d75cdf4f2a324d50b74dec9d8b9b415669b02df121d316260
|
data/bin/wfm_job_list
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
3
|
# 20121112 masa workflow manager client
|
4
|
-
Version = '
|
4
|
+
Version = '20200324-134935'
|
5
5
|
|
6
6
|
require 'drb/drb'
|
7
7
|
require 'workflow_manager/optparse_ex'
|
@@ -13,6 +13,21 @@ class PStore
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
+
require 'redis'
|
17
|
+
class Redis
|
18
|
+
def [](key)
|
19
|
+
self.get(key)
|
20
|
+
end
|
21
|
+
def []=(key, value)
|
22
|
+
self.set(key, value)
|
23
|
+
end
|
24
|
+
def each
|
25
|
+
self.scan_each do |key|
|
26
|
+
value = self.get(key)
|
27
|
+
yield([key, value])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
16
31
|
|
17
32
|
#require File.join((File.expand_path('../../lib',__FILE__)), 'optparse_ex.rb')
|
18
33
|
|
data/bin/workflow_manager
CHANGED
@@ -32,6 +32,8 @@ if opt.mode
|
|
32
32
|
default_config_dir = File.join(app_dir, "../config/environments")
|
33
33
|
default_config_file = File.join(default_config_dir, opt.mode+".rb")
|
34
34
|
if File.exist?(default_config_file)
|
35
|
+
default_redis_config_file = File.join(default_config_dir, "redis.conf")
|
36
|
+
FileUtils.cp(default_redis_config_file, config_dir)
|
35
37
|
FileUtils.cp(default_config_file, config_file)
|
36
38
|
else
|
37
39
|
raise "Configure file does not exist: #{config_file}"
|
@@ -6,17 +6,36 @@ require 'fileutils'
|
|
6
6
|
require 'csv'
|
7
7
|
begin
|
8
8
|
require 'kyotocabinet'
|
9
|
-
|
9
|
+
DB_MODE = "KyotoCabinet"
|
10
10
|
rescue LoadError
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
begin
|
12
|
+
require 'redis'
|
13
|
+
DB_MODE = "Redis"
|
14
|
+
class Redis
|
15
|
+
def [](key)
|
16
|
+
self.get(key)
|
17
|
+
end
|
18
|
+
def []=(key, value)
|
19
|
+
self.set(key, value)
|
20
|
+
end
|
21
|
+
def each
|
22
|
+
self.scan_each do |key|
|
23
|
+
value = self.get(key)
|
24
|
+
yield([key, value])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
rescue LoadError
|
29
|
+
require 'pstore'
|
30
|
+
DB_MODE = "PStore"
|
31
|
+
class PStore
|
32
|
+
def each
|
33
|
+
self.roots.each do |key|
|
34
|
+
yield(key, self[key])
|
35
|
+
end
|
16
36
|
end
|
17
37
|
end
|
18
38
|
end
|
19
|
-
NO_KYOTO = true
|
20
39
|
end
|
21
40
|
|
22
41
|
module WorkflowManager
|
@@ -34,6 +53,7 @@ module WorkflowManager
|
|
34
53
|
attr_accessor :interval
|
35
54
|
attr_accessor :resubmit
|
36
55
|
attr_accessor :cluster
|
56
|
+
attr_accessor :redis_conf
|
37
57
|
end
|
38
58
|
def self.config=(config)
|
39
59
|
@@config = config
|
@@ -79,12 +99,40 @@ module WorkflowManager
|
|
79
99
|
end
|
80
100
|
end
|
81
101
|
end
|
102
|
+
class RedisDB
|
103
|
+
def run_redis_server(redis_conf)
|
104
|
+
@pid = fork do
|
105
|
+
exec("redis-server #{redis_conf}")
|
106
|
+
end
|
107
|
+
@redis_thread = Thread.new do
|
108
|
+
Process.waitpid @pid
|
109
|
+
end
|
110
|
+
end
|
111
|
+
def initialize(db_no=0, redis_conf=nil)
|
112
|
+
if db_no==0
|
113
|
+
run_redis_server(redis_conf)
|
114
|
+
end
|
115
|
+
@db = Redis.new(db: db_no)
|
116
|
+
end
|
117
|
+
def transaction
|
118
|
+
#@db.multi do
|
119
|
+
yield(@db)
|
120
|
+
#end
|
121
|
+
end
|
122
|
+
end
|
82
123
|
|
83
124
|
def initialize
|
84
125
|
@interval = config.interval
|
85
126
|
@resubmit = config.resubmit
|
86
|
-
extension =
|
87
|
-
|
127
|
+
extension = case DB_MODE
|
128
|
+
when "PStore"
|
129
|
+
'.pstore'
|
130
|
+
when "KyotoCabinet"
|
131
|
+
'.kch'
|
132
|
+
when "Redis"
|
133
|
+
@redis_conf = config.redis_conf
|
134
|
+
'.rdb'
|
135
|
+
end
|
88
136
|
@db_stat = File.join(config.db_dir, 'statuses'+extension)
|
89
137
|
@db_logs = File.join(config.db_dir, 'logs'+extension)
|
90
138
|
|
@@ -92,16 +140,32 @@ module WorkflowManager
|
|
92
140
|
@db_dir = File.expand_path(config.db_dir)
|
93
141
|
FileUtils.mkdir_p @log_dir unless File.exist?(@log_dir)
|
94
142
|
FileUtils.mkdir_p @db_dir unless File.exist?(@db_dir)
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
143
|
+
@statuses = case DB_MODE
|
144
|
+
when "PStore"
|
145
|
+
PStoreDB.new(@db_stat)
|
146
|
+
when "KyotoCabinet"
|
147
|
+
KyotoDB.new(@db_stat)
|
148
|
+
when "Redis"
|
149
|
+
RedisDB.new(0, @redis_conf)
|
150
|
+
end
|
151
|
+
@logs = case DB_MODE
|
152
|
+
when "PStore"
|
153
|
+
PStoreDB.new(@db_logs)
|
154
|
+
when "KyotoCabinet"
|
155
|
+
KyotoDB.new(@db_logs)
|
156
|
+
when "Redis"
|
157
|
+
RedisDB.new(1)
|
158
|
+
end
|
159
|
+
|
99
160
|
@system_log = File.join(@log_dir, "system.log")
|
100
161
|
@mutex = Mutex.new
|
101
162
|
@cluster = config.cluster
|
102
|
-
puts("DB = #{
|
163
|
+
puts("DB = #{DB_MODE}")
|
164
|
+
if DB_MODE == "Redis"
|
165
|
+
puts("Redis conf = #{config.redis_conf}")
|
166
|
+
end
|
103
167
|
puts("Cluster = #{@cluster.name}")
|
104
|
-
log_puts("DB = #{
|
168
|
+
log_puts("DB = #{DB_MODE}")
|
105
169
|
log_puts("Cluster = #{@cluster.name}")
|
106
170
|
log_puts("Server starts")
|
107
171
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workflow_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Functional Genomics Center Zurich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- bin/workflow_manager
|
76
76
|
- config/environments/development.rb
|
77
77
|
- config/environments/production.rb
|
78
|
+
- config/environments/redis.conf
|
78
79
|
- lib/workflow_manager.rb
|
79
80
|
- lib/workflow_manager/cluster.rb
|
80
81
|
- lib/workflow_manager/optparse_ex.rb
|