Skip to content

Commit

Permalink
Merge pull request #2011 from martin-mat/hr_task_runtime
Browse files Browse the repository at this point in the history
Fix human readable task_runtime
  • Loading branch information
HashNuke authored May 7, 2024
2 parents 29a1528 + f79985c commit 7b21100
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/tasks/utils/points.cr
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,9 @@ module CNFManager
cmd = "#{Process.executable_path} #{ARGV.join(" ")}"
Log.info {"cmd: #{cmd}"}
end_time = Time.utc
# task_runtime = (end_time - start_time).milliseconds
task_runtime = (end_time - start_time)
task_runtime_human = "#{task_runtime.hours} hours, #{task_runtime.minutes} minutes, and #{task_runtime.seconds} seconds"

Log.for("#{task}").info { "task_runtime=#{task_runtime_human}; start_time=#{start_time}; end_time:#{end_time}" }
Log.for("#{task}").info { "task_runtime=#{task_runtime}; start_time=#{start_time}; end_time:#{end_time}" }

# The task result info has to be appeneded to an array of YAML::Any
# So encode it into YAML and parse it back again to assign it.
Expand All @@ -439,7 +437,7 @@ module CNFManager
points: points,
start_time: start_time,
end_time: end_time,
task_runtime: task_runtime_human
task_runtime: "#{task_runtime}"
}
result_items << YAML.parse(task_result_info.to_yaml)
else
Expand All @@ -462,7 +460,7 @@ module CNFManager
exit_code: results["exit_code"],
items: result_items}, f)
end
Log.info { "upsert_task: task: #{task} has status: #{status} and is awarded: #{points} points. Runtime: #{task_runtime_human} seconds" }
Log.info { "upsert_task: task: #{task} has status: #{status} and is awarded: #{points} points. Runtime: #{task_runtime}" }
end

def self.failed_task(task, msg)
Expand Down

0 comments on commit 7b21100

Please sign in to comment.