Class: MyWorkerManagerEst

Inherits:
ScbiMapreduce::WorkManager show all
Defined in:
lib/full_lengther_next/my_worker_manager_EST.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ScbiMapreduce::WorkManager

#send_next_work

Class Method Details

.end_work_managerObject

close files



23
24
25
# File 'lib/full_lengther_next/my_worker_manager_EST.rb', line 23

def self.end_work_manager
	#VOID
end

.get_array_seqsObject

CUSTOM FUNCTIONS



65
66
67
# File 'lib/full_lengther_next/my_worker_manager_EST.rb', line 65

def self.get_array_seqs
	return @@match, @@unmatch
end

.init_work_manager(putative_seqs, options, blast_path) ⇒ Object

MANAGER INITIALIZATION

open files and prepare global data



9
10
11
12
13
14
15
16
# File 'lib/full_lengther_next/my_worker_manager_EST.rb', line 9

def self.init_work_manager(putative_seqs, options, blast_path)
	@@blast_path = blast_path
	@@options = options
	@@putative_seqs = putative_seqs
	@@match = []
	@@unmatch = []
	@@num_seqs = 0
end

Instance Method Details

#error_received(worker_error, obj) ⇒ Object



49
50
51
# File 'lib/full_lengther_next/my_worker_manager_EST.rb', line 49

def error_received(worker_error, obj)
	puts "Error while processing object #{obj.inspect}\n" + worker_error.original_exception.message + ":\n" +worker_error.original_exception.backtrace.join("\n")
end

#next_workObject

this method is called every time a worker needs new data to work. This method is executed many times like the chunk size says. Return the work data or nil if no more data is available



33
34
35
36
37
38
39
40
41
# File 'lib/full_lengther_next/my_worker_manager_EST.rb', line 33

def next_work #Manage INput's worker
	if @@num_seqs == @@putative_seqs.length-1
		return nil
	else
		seq = @@putative_seqs[@@num_seqs]
		@@num_seqs += 1
		return seq
	end
end

#too_many_errors_receivedObject



53
54
55
# File 'lib/full_lengther_next/my_worker_manager_EST.rb', line 53

def too_many_errors_received
	$LOG.error "Too many errors: #{@@error_count} errors on #{@@count} executed sequences, exiting before finishing"
end

#work_received(match_and_unmatch_array) ⇒ Object

this method is ejecuted each time an obj is finished



44
45
46
47
# File 'lib/full_lengther_next/my_worker_manager_EST.rb', line 44

def work_received(match_and_unmatch_array) #Manage OUTput's worker
	@@match.concat(match_and_unmatch_array.first)
	@@unmatch.concat(match_and_unmatch_array.last)
end

#worker_initial_configObject

send initial config



58
59
60
# File 'lib/full_lengther_next/my_worker_manager_EST.rb', line 58

def worker_initial_config
	return [@@options, @@blast_path]
end