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
1 change: 0 additions & 1 deletion packages/verifier/src/verifier/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
print("ALOHOMORA: 1/1")
13 changes: 11 additions & 2 deletions packages/verifier/src/verifier/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import json
import requests
from verifier.__about__ import __author__, __copyright__, __version__
import fcntl

info_log = logging.getLogger("gpu-verifier-info")
info_log.setLevel(logging.INFO)
Expand All @@ -44,8 +45,16 @@
parent_dir = os.path.dirname(os.path.abspath(__file__))
logger_file_path = os.path.join(os.getcwd(), "verifier.log")

if os.path.exists(logger_file_path):
os.remove(logger_file_path)
# Ensure only one gunicorn worker executes this section of code
lock_file_path = os.path.join(os.getcwd(), "verifier.lock")
with open(lock_file_path, "w") as lock_file:
try:
fcntl.flock(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
if os.path.exists(logger_file_path):
os.remove(logger_file_path)
except BlockingIOError:
# Another worker has the lock, so skip this section
pass

event_log = logging.getLogger("gpu-verifier-event")
event_log.setLevel(logging.DEBUG)
Expand Down
Loading