Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 4 additions & 6 deletions folding/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
import sqlite3
import requests
from queue import Queue
from typing import Dict, List
from typing import List
from dotenv import load_dotenv

from datetime import timezone
from datetime import datetime

import numpy as np
import pandas as pd

from atom.epistula.epistula import Epistula
Expand Down Expand Up @@ -79,7 +77,7 @@ def get_queue(self, validator_hotkey: str, ready=True) -> Queue:

if ready:
# Calculate the threshold time for ready jobs
now = datetime.utcnow().isoformat()
now = datetime.now(timezone.utc).isoformat()
query = f"""
SELECT * FROM {self.table_name}
WHERE active = 1
Expand Down Expand Up @@ -359,7 +357,7 @@ async def update(self, loss: float, hotkey: str):
self.best_loss = loss
self.best_loss_at = pd.Timestamp.now().floor("s")
self.best_hotkey = hotkey
self.updated_at = datetime.now()
self.updated_at = datetime.now(timezone.utc)


class MockJob(Job):
Expand Down
14 changes: 7 additions & 7 deletions neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import asyncio
import traceback

from datetime import datetime
from datetime import datetime, timezone
from typing import Any, Dict, List

import netaddr
Expand Down Expand Up @@ -104,10 +104,10 @@ def __init__(self, config=None):
self.last_time_checked = (
self.last_time_checked
if hasattr(self, "last_time_checked")
else datetime.now()
else datetime.now(timezone.utc)
)

self.last_time_created_jobs = datetime.now()
self.last_time_created_jobs = datetime.now(timezone.utc)

if not self.config.s3.off:
try:
Expand Down Expand Up @@ -308,7 +308,7 @@ async def add_job(self, job_event: dict[str, Any], protein: Protein = None) -> b
str(spec_version),
job_event["pdb_id"],
self.validator_hotkey_reference,
datetime.now().strftime("%Y-%m-%d_%H-%M-%S"),
datetime.now(timezone.utc).strftime("%Y-%m-%d_%H-%M-%S"),
)
s3_links = {}
for file_type, file_path in files_to_upload.items():
Expand Down Expand Up @@ -350,7 +350,7 @@ async def add_job(self, job_event: dict[str, Any], protein: Protein = None) -> b

logger.success("Job was uploaded successfully!")

self.last_time_created_jobs = datetime.now()
self.last_time_created_jobs = datetime.now(timezone.utc)

# TODO: return job_id
return True
Expand Down Expand Up @@ -501,7 +501,7 @@ async def prepare_event_for_logging(event: Dict):
output_links.append(defaultdict(str))

best_cpt_files = []
output_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
output_time = datetime.now(timezone.utc).strftime("%Y-%m-%d_%H-%M-%S")

for idx, (uid, files) in enumerate(
zip(job.event["processed_uids"], job.event["files"])
Expand Down Expand Up @@ -664,7 +664,7 @@ async def read_and_update_rewards(self):
last_time_checked=self.last_time_checked.strftime("%Y-%m-%dT%H:%M:%S")
)

self.last_time_checked = datetime.now()
self.last_time_checked = datetime.now(timezone.utc)

if inactive_jobs_queue.qsize() == 0:
logger.info("No inactive jobs to update.")
Expand Down