lib/bio/pipengine/job.rb
# add all the command lines for a given step
add all the command lines for a given step
add all the command lines for a given step
def add_step(step,sample)	
				working_dir = ""	
				if self.local 
					working_dir = self.local+"/"+self.name
				else
					working_dir = self.output
					if step.is_multi?	
						folder = (self.custom_output) ? self.custom_output : @shortname 
						working_dir += "/#{folder}"
					else
						folder =
						if self.custom_output 
							self.custom_output
						elsif self.custom_name
							self.custom_name
						else
							step.name
						end
						working_dir += "/#{sample.name}/#{folder}"
					end
				end
				self.cpus = step.cpus if step.cpus > self.cpus
				self.nodes = (step.nodes) ? step.nodes : @nodes
				self.mem = step.mem
				unless step.name.start_with? "_"
					self.command_line << "if [ ! -f #{working_dir}/checkpoint ]"
					self.command_line << "then"
					self.command_line << logger(step, "start")
					self.command_line << "\nmkdir -p #{working_dir}"
					self.command_line << "cd #{working_dir}"
				end
				if step.run.kind_of? Array
					step.run.each_with_index do |cmd, i|
						command = generate_cmd_line(cmd,sample,step)
						self.command_line << "#{command} || { #{logger(step, "FAILED #{i}" )}; exit 1; }"
					end
				else
					command = generate_cmd_line(step.run,sample,step)
					self.command_line << "#{command} || { #{logger(step, "FAILED" )}; exit 1; }"
				end
				self.command_line << logger(step, "finished")
                self.command_line << "touch #{working_dir}/checkpoint"
				self.command_line << "else"
				self.command_line << logger(step, "already executed, skipping this step")
				self.command_line << "fi"
				if self.local
					final_output = ""
					if step.is_multi?	
						folder = (self.custom_output) ? self.custom_output : @shortname 
						final_output = self.output+"/#{folder}"	 
					else
						folder = (self.custom_output) ? self.custom_output : step.name
						final_output = self.output+"/#{sample.name}/#{folder}"
					end
					self.command_line << "mkdir -p #{final_output}"
					self.command_line << "cp -r #{working_dir}/* #{final_output}"
					self.command_line << "rm -fr #{working_dir}"
				end
			end
def add_step ( step , sample ) working_dir = "" if self . local working_dir = self . local + "/" + self . name else working_dir = self . output if step . is_multi? folder = ( self . custom_output ) ? self . custom_output : @shortname working_dir += "/#{folder}" else folder = if self . custom_output self . custom_output elsif self . custom_name self . custom_name else step . name end working_dir += "/#{sample.name}/#{folder}" end end self . cpus = step . cpus if step . cpus > self . cpus self . nodes = ( step . nodes ) ? step . nodes : @nodes self . mem = step . mem unless step . name . start_with? "_" self . command_line << "if [ ! -f #{working_dir}/checkpoint ]" self . command_line << "then" self . command_line << logger ( step , "start" ) self . command_line << "\nmkdir -p #{working_dir}" self . command_line << "cd #{working_dir}" end if step . run . kind_of? Array step . run . each_with_index do | cmd , i | command = generate_cmd_line ( cmd , sample , step ) self . command_line << "#{command} || { #{logger(step, "FAILED #{i}" )}; exit 1; }" end else command = generate_cmd_line ( step . run , sample , step ) self . command_line << "#{command} || { #{logger(step, "FAILED" )}; exit 1; }" end self . command_line << logger ( step , "finished" ) self . command_line << "touch #{working_dir}/checkpoint" self . command_line << "else" self . command_line << logger ( step , "already executed, skipping this step" ) self . command_line << "fi" if self . local final_output = "" if step . is_multi? folder = ( self . custom_output ) ? self . custom_output : @shortname final_output = self . output + "/#{folder}" else folder = ( self . custom_output ) ? self . custom_output : step . name final_output = self . output + "/#{sample.name}/#{folder}" end self . command_line << "mkdir -p #{final_output}" self . command_line << "cp -r #{working_dir}/* #{final_output}" self . command_line << "rm -fr #{working_dir}" end end
add all the command lines for a given step
add all the command lines for a given step
# setting job working directory # set job cpus number to the higher step cpus (this in case of multiple steps) # set number of nodes for job # set the memory used # adding job working directory # generate command lines for this step # TODO verify that logger works in this case # self.command_line << "#{command} || { echo \"FAILED `date`: #{step.name}:#{i}\" ; exit 1; }" # TODO verify that logger works in this case # self.command_line << "#{command} || { echo \"FAILED `date`: #{step.name} \" ; exit 1; }" # check if a temporary (i.e. different from 'output') directory is set
step
<not_specific>
sample
<not_specific>