class Bricolage::RootJobNet
Represents “first” jobnet given by command line (e.g. bricolage-jobnet some.jobnet)
Attributes
start_jobnet[R]
Public Class Methods
load(ctx, path)
click to toggle source
# File lib/bricolage/jobnet.rb, line 17 def RootJobNet.load(ctx, path) root = new(JobNet::FileLoader.new(ctx), JobNet.load(path), path) root.load_recursive root.fix root end
load_auto(ctx, pathes)
click to toggle source
# File lib/bricolage/jobnet.rb, line 8 def RootJobNet.load_auto(ctx, pathes) pathes = Array(pathes) if pathes.size == 1 and pathes.first.extname == '.jobnet' load(ctx, pathes.first) else load_multiple_jobs(ctx, pathes) end end
load_multiple_jobs(ctx, pathes)
click to toggle source
# File lib/bricolage/jobnet.rb, line 28 def RootJobNet.load_multiple_jobs(ctx, pathes) root = new(JobNet::FileLoader.new(ctx), JobNet.load_multiple_jobs(pathes), pathes.first) root.load_recursive root.fix root end
load_single_job(ctx, path)
click to toggle source
# File lib/bricolage/jobnet.rb, line 24 def RootJobNet.load_single_job(ctx, path) load_multiple_jobs(ctx, [path]) end
new(jobnet_loader, start_jobnet, path = nil)
click to toggle source
# File lib/bricolage/jobnet.rb, line 35 def initialize(jobnet_loader, start_jobnet, path = nil) @jobnet_loader = jobnet_loader @start_jobnet = start_jobnet @path = path @jobnets = {start_jobnet.ref => start_jobnet} @graph = nil end
Public Instance Methods
each_jobnet(&block)
click to toggle source
# File lib/bricolage/jobnet.rb, line 54 def each_jobnet(&block) @jobnets.each_value(&block) end
fix()
click to toggle source
# File lib/bricolage/jobnet.rb, line 81 def fix each_jobnet do |net| net.fix end @jobnets.freeze @dag = JobDAG.build(jobnets) end
id()
click to toggle source
# File lib/bricolage/jobnet.rb, line 43 def id return nil unless @path @id ||= begin subsys = @path.dirname.basename base = @path.basename.to_s.sub(/\..*\z/, '') "#{subsys}/#{base}" end end
jobnets()
click to toggle source
# File lib/bricolage/jobnet.rb, line 58 def jobnets @jobnets.values end
load_recursive()
click to toggle source
# File lib/bricolage/jobnet.rb, line 62 def load_recursive unresolved = [@start_jobnet] until unresolved.empty? loaded = [] unresolved.each do |net| net.net_refs.each do |ref| next if ref.jobnet unless net = @jobnets[ref] net = @jobnet_loader.load(ref) @jobnets[ref] = net loaded.push net end ref.jobnet = net end end unresolved = loaded end end
sequential_jobs()
click to toggle source
# File lib/bricolage/jobnet.rb, line 89 def sequential_jobs @dag.sequential_jobs end