-
Notifications
You must be signed in to change notification settings - Fork 291
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
Replace deprecated datetime.utcnow() calls #1977
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import datetime | ||
import logging | ||
import os | ||
import subprocess | ||
|
@@ -6,7 +7,6 @@ | |
import requests | ||
|
||
from urllib.parse import urljoin | ||
from datetime import datetime | ||
|
||
from teuthology import exporter, kill, report, safepath | ||
from teuthology.config import config as teuth_config | ||
|
@@ -275,7 +275,7 @@ def unlock_targets(job_config): | |
|
||
|
||
def run_with_watchdog(process, job_config): | ||
job_start_time = datetime.utcnow() | ||
job_start_time = datetime.datetime.now(datetime.timezone.utc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks gut, I know it must be the same to use shorter form
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because they didn't make it available as |
||
|
||
# Only push the information that's relevant to the watchdog, to save db | ||
# load | ||
|
@@ -289,7 +289,7 @@ def run_with_watchdog(process, job_config): | |
hit_max_timeout = False | ||
while process.poll() is None: | ||
# Kill jobs that have been running longer than the global max | ||
run_time = datetime.utcnow() - job_start_time | ||
run_time = datetime.datetime.now(datetime.timezone.utc) - job_start_time | ||
total_seconds = run_time.days * 60 * 60 * 24 + run_time.seconds | ||
if total_seconds > teuth_config.max_job_time: | ||
hit_max_timeout = True | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it