lib/genecrmod/gene.rb in genecrmod-0.1.0 vs lib/genecrmod/gene.rb in genecrmod-0.1.1
- old
+ new
@@ -195,15 +195,38 @@
#p ['id is', id, 'ctd is ', ctd]
#if ctd
#get_global_results
#end
#p ['fusionQ is ', fusionQ]
- #@percent_complete = completed_timesteps.to_f / ntstep.to_f * 100.0
+ @percent_complete = completed_timesteps.to_f / ntimesteps.to_f * 100.0
end
def get_status
- return :Unknown
+ if @running
+ get_completed_timesteps
+ if completed_timesteps == 0
+ @status = :NotStarted
+ else
+ @status = :Incomplete
+ end
+ else
+ get_completed_timesteps
+ if @completed_timesteps == @ntimesteps
+ @status = :Complete
+ else
+ if FileTest.exist?('GENE.finished')
+ @status = :Complete
+ else
+ @status = :Failed
+ end
+ end
+ end
end
+ def get_completed_timesteps
+ Dir.chdir(@directory) do
+ @completed_timesteps = %x[grep '^\\s\\+\\S\\+\\s*$' nrg.dat].split("\n").size
+ end
+ end
@fortran_namelist_source_file_match = /((\.F9[05])|(\.fpp)|COMDAT.inc)$/
@fortran_namelist_source_file_match = /((\.F9[05]))$/