22import os
33import shutil
44import signal
5+ import socket
56import subprocess
67from collections import Counter
78from psycopg2 .sql import SQL
@@ -317,7 +318,7 @@ def _check_locks(self, changetype, datafile=None, suffix=""):
317318 super ()._check_locks (changetype , datafile = datafile , suffix = suffix )
318319 if self ._db .config .postgresql_options ["user" ] != "editor" :
319320 raise RuntimeError ("You must be logged in as editor to make data changes" )
320- if changetype in _nolog_changetypes :
321+ if changetype in _nolog_changetypes or socket . gethostname () == "proddb" :
321322 return
322323
323324 # The following is the definition of run_diskfree used below to find the available space on grace
@@ -511,8 +512,9 @@ def log_db_change(self, operation, tablename=None, logid=None, aborted=False, **
511512 - ``**data`` -- any additional information to install in the logging table (will be stored as a json dictionary)
512513 """
513514 if aborted :
514- deleter = SQL ("DELETE FROM userdb.ongoing_operations WHERE logid = %s" )
515- self ._execute (deleter , [logid ])
515+ if socket .gethostname () != "proddb" :
516+ deleter = SQL ("DELETE FROM userdb.ongoing_operations WHERE logid = %s" )
517+ self ._execute (deleter , [logid ])
516518 else :
517519 from lmfdb .utils .datetime_utils import utc_now_naive
518520 uid = self .login ()
@@ -522,7 +524,7 @@ def log_db_change(self, operation, tablename=None, logid=None, aborted=False, **
522524 "VALUES (%s, %s, %s, %s, %s, %s)"
523525 )
524526 self ._execute (inserter , [uid , utc_now_naive (), tablename , logid , operation , data ])
525- if operation not in _nolog_changetypes :
527+ if operation not in _nolog_changetypes and socket . gethostname () != "proddb" :
526528 # This table is used by _check_locks to determine if there is enough space to execute an upload
527529 inserter = SQL (
528530 "INSERT INTO userdb.ongoing_operations (logid, finishing, time, tablename, operation, username) "
0 commit comments