rukawa 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13b76e6a6b3bab23573723fee0d2c9049d1b5052
4
- data.tar.gz: f39e1766871bd26e710edd2868edf39c625f1a0f
3
+ metadata.gz: ef694d2105bd3b75de436eede093ba3319bec085
4
+ data.tar.gz: ba02c37e5fa934b2eff3ae26079f3a5f6819bae5
5
5
  SHA512:
6
- metadata.gz: 9037f65f1a2c502a52cd53b3abc2758f2dcbb9deb43595f67687325c09924a298da2a7b79505a34bed2638128a278a8c5997efe07c4c4ee1884fb8f70620e19c
7
- data.tar.gz: 42bb250a6a17de86a9d23f2343352d26426185a176313fdef7befcd4117aa4bac846be2d93393fac3e7970d1d18b115c2dadd87936a0512cb59ace0675b91d28
6
+ metadata.gz: c028cc8c8d6dd8caf3341f5d637034a17a56e2e6a61775d32003b385bc3484586081cb18629cec53f7ca1ed653b056cc1ceca830c52c5f4adb17f5f8fccb628f
7
+ data.tar.gz: 6414396c4ceee37a8d2f8e0eea69867f30197ab826ce1f1ea1329ab666e44a31ed573c3e5df86a5b232d27157500ccb77cfa22b32ca15c38e5e45cec2eec4f9c
data/lib/rukawa/cli.rb CHANGED
@@ -6,6 +6,7 @@ module Rukawa
6
6
  class Cli < Thor
7
7
  desc "run JOB_NET_NAME [JOB_NAME] [JOB_NAME] ...", "Run jobnet. If JOB_NET is set, resume from JOB_NAME"
8
8
  map "run" => "_run"
9
+ map %w[version -v] => "__print_version"
9
10
  method_option :concurrency, aliases: "-c", type: :numeric, default: nil, desc: "Default: cpu count"
10
11
  method_option :variables, type: :hash, default: {}
11
12
  method_option :config, type: :string, default: nil, desc: "If this options is not set, try to load ./rukawa.rb"
@@ -15,6 +16,7 @@ module Rukawa
15
16
  method_option :stdout, type: :boolean, default: false, desc: "Output log to stdout"
16
17
  method_option :syslog, type: :boolean, default: false, desc: "Output log to syslog"
17
18
  method_option :dot, aliases: "-d", type: :string, default: nil, desc: "Output job status by dot format"
19
+ method_option :format, aliases: "-f", type: :string, desc: "Output job status format: png, svg, pdf, ... etc"
18
20
  method_option :refresh_interval, aliases: "-r", type: :numeric, default: 3, desc: "Refresh interval for running status information"
19
21
  def _run(job_net_name, *job_name)
20
22
  load_config
@@ -28,7 +30,7 @@ module Rukawa
28
30
  result = Runner.run(job_net, options[:batch], options[:refresh_interval])
29
31
 
30
32
  if options[:dot]
31
- job_net.output_dot(options[:dot])
33
+ job_net.output_dot(options[:dot], format: options[:format])
32
34
  end
33
35
 
34
36
  exit 1 unless result
@@ -38,6 +40,7 @@ module Rukawa
38
40
  method_option :config, type: :string, default: nil, desc: "If this options is not set, try to load ./rukawa.rb"
39
41
  method_option :job_dirs, type: :array, default: []
40
42
  method_option :output, aliases: "-o", type: :string, required: true
43
+ method_option :format, aliases: "-f", type: :string
41
44
  def graph(job_net_name, *job_name)
42
45
  load_config
43
46
  load_job_definitions
@@ -45,7 +48,7 @@ module Rukawa
45
48
  job_net_class = get_class(job_net_name)
46
49
  job_classes = job_name.map { |name| get_class(name) }
47
50
  job_net = job_net_class.new(nil, *job_classes)
48
- job_net.output_dot(options[:output])
51
+ job_net.output_dot(options[:output], format: options[:format])
49
52
  end
50
53
 
51
54
  desc "run_job JOB_NAME [JOB_NAME] ...", "Run specific jobs."
@@ -95,6 +98,11 @@ module Rukawa
95
98
  Rukawa::Overview.list_job
96
99
  end
97
100
 
101
+ desc "version(-v)", "Print the version"
102
+ def __print_version
103
+ puts "rukawa #{Rukawa::VERSION}"
104
+ end
105
+
98
106
  private
99
107
 
100
108
  def load_config
@@ -10,7 +10,8 @@ module Rukawa
10
10
 
11
11
  def initialize
12
12
  @config = OpenStruct.new(
13
- concurrency: Concurrent.processor_count
13
+ concurrency: Concurrent.processor_count,
14
+ dot_command: "dot"
14
15
  )
15
16
  @config.graph = GraphConfig.new.tap { |c| c.rankdir = "LR" }
16
17
  end
data/lib/rukawa/job.rb CHANGED
@@ -62,12 +62,12 @@ module Rukawa
62
62
 
63
63
  private def do_run(*results)
64
64
  @started_at = Time.now
65
- check_dependencies(results)
66
65
 
67
66
  if skip?
68
67
  Rukawa.logger.info("Skip #{self.class}")
69
68
  set_state(:skipped)
70
69
  else
70
+ check_dependencies(results)
71
71
  Rukawa.logger.info("Start #{self.class}")
72
72
  set_state(:running)
73
73
  run
@@ -58,8 +58,14 @@ module Rukawa
58
58
  end
59
59
  end
60
60
 
61
- def output_dot(filename)
62
- File.open(filename, 'w') { |f| f.write(to_dot) }
61
+ def output_dot(filename, format: nil)
62
+ if format && format != "dot"
63
+ io = IO.popen(["#{Rukawa.config.dot_command}", "-T#{format}", "-o", filename], "w")
64
+ io.write(to_dot)
65
+ io.close
66
+ else
67
+ File.open(filename, 'w') { |f| f.write(to_dot) }
68
+ end
63
69
  end
64
70
 
65
71
  def to_dot(subgraph = false)
@@ -1,3 +1,3 @@
1
1
  module Rukawa
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rukawa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - joker1007
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-10 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport