Skip to content

Commit 078978a

Browse files
authored
Introduce OVERRIDE_HOSTNAME in RQD for manually settings a hostname. (#849)
1 parent 97cc88c commit 078978a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

rqd/rqd/rqconstants.py

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
OVERRIDE_PROCS = None # number of physical cpus. ex: None or 2
115115
OVERRIDE_MEMORY = None # in Kb
116116
OVERRIDE_NIMBY = None # True to turn on, False to turn off
117+
OVERRIDE_HOSTNAME = None # Force to use this hostname
117118
ALLOW_GPU = False
118119
ALLOW_PLAYBLAST = False
119120
LOAD_MODIFIER = 0 # amount to add/subtract from load
@@ -175,6 +176,8 @@
175176
CUEBOT_HOSTNAME = config.get(__section, "OVERRIDE_CUEBOT")
176177
if config.has_option(__section, "OVERRIDE_NIMBY"):
177178
OVERRIDE_NIMBY = config.getboolean(__section, "OVERRIDE_NIMBY")
179+
if config.has_option(__section, "OVERRIDE_HOSTNAME"):
180+
OVERRIDE_HOSTNAME = config.get(__section, "OVERRIDE_HOSTNAME")
178181
if config.has_option(__section, "GPU"):
179182
ALLOW_GPU = config.getboolean(__section, "GPU")
180183
if config.has_option(__section, "PLAYBLAST"):

rqd/rqd/rqutil.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def getHostIp():
149149
def getHostname():
150150
"""Returns the machine's fully qualified domain name"""
151151
try:
152-
if rqd.rqconstants.RQD_USE_IP_AS_HOSTNAME:
152+
if rqd.rqconstants.OVERRIDE_HOSTNAME:
153+
return rqd.rqconstants.OVERRIDE_HOSTNAME
154+
elif rqd.rqconstants.RQD_USE_IP_AS_HOSTNAME:
153155
return getHostIp()
154156
else:
155157
return socket.gethostbyaddr(socket.gethostname())[0].split('.')[0]

0 commit comments

Comments
 (0)