Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix human readable task_runtime #2011

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/tasks/utils/points.cr
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,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 @@ -454,7 +452,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 @@ -477,7 +475,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
Loading