Module: Fairy::PSingleExportable

Includes:
Enumerable
Included in:
PHere, PLocalInject, PSingleExportFilter, PSingleExportInput, PThere
Defined in:
lib/fairy/node/p-single-exportable.rb

Constant Summary collapse

END_OF_STREAM =
PFilter::END_OF_STREAM
ST_WAIT_EXPORT_FINISH =
:ST_WAIT_EXPORT_FINISH
ST_EXPORT_FINISH =
:ST_EXPORT_FINISH

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exportObject (readonly)

Returns the value of attribute export.



21
22
23
# File 'lib/fairy/node/p-single-exportable.rb', line 21

def export
  @export
end

Instance Method Details

#initialize(id, ntask, bjob, opts = nil, *rests) ⇒ Object



17
18
19
# File 'lib/fairy/node/p-single-exportable.rb', line 17

def initialize(id, ntask, bjob, opts=nil, *rests)
  super
end

#start(&block) ⇒ Object



60
61
62
63
64
65
66
67
68
# File 'lib/fairy/node/p-single-exportable.rb', line 60

def start(&block)
  super do
 	begin
block.call
 	ensure
# 	  @export.push END_OF_STREAM
 	end
  end
end

#start_exportObject

とりあえず

def start(&block)
  super do

begin if @import @export.add_key(@import.key) end block.call ensure @export.push END_OF_STREAM wait_export_finish end

  end
end


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fairy/node/p-single-exportable.rb', line 43

def start_export
  Log::debug(self, "START_EXPORT")

  policy = @opts[:postqueuing_policy]
  @export = Export.new(policy)
  @export.njob_id = @id
  @export.no = @no
  @export.key = @key

  start do
	each{|e| @export.push e}
	@export.push END_OF_STREAM
  end

  @export
end

#terminateObject



70
71
72
73
74
# File 'lib/fairy/node/p-single-exportable.rb', line 70

def terminate
  @wait_cv = @terminate_mon.new_cv
  wait_export_finish
  super
end

#wait_export_finishObject



76
77
78
79
80
# File 'lib/fairy/node/p-single-exportable.rb', line 76

def wait_export_finish
  self.status = ST_WAIT_EXPORT_FINISH
  @export.fib_wait_finish(@wait_cv)
  self.status = ST_EXPORT_FINISH
end