Skip to content

Commit f290b7e

Browse files
committed
enh: use platform.node instead of getfqdn to improve DNS resolution times
1 parent 5b0e74c commit f290b7e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

nipype/interfaces/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import os
2323
import re
2424
import platform
25-
from socket import getfqdn
2625
from string import Template
2726
import select
2827
import subprocess
@@ -1079,7 +1078,7 @@ def run(self, **inputs):
10791078
startTime=dt.isoformat(dt.utcnow()),
10801079
endTime=None,
10811080
platform=platform.platform(),
1082-
hostname=getfqdn(),
1081+
hostname=platform.node(),
10831082
version=self.version)
10841083
try:
10851084
runtime = self._run_wrapper(runtime)

nipype/utils/provenance.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pickle import dumps
1212
import os
1313
import getpass
14-
from socket import getfqdn
14+
import platform
1515
from uuid import uuid1
1616
import simplejson as json
1717

@@ -133,7 +133,9 @@ def safe_encode(x, as_literal=True):
133133
if isinstance(x, bytes):
134134
x = str(x, 'utf-8')
135135
if os.path.exists(x):
136-
value = 'file://{}{}'.format(getfqdn(), x)
136+
if x[0] != os.pathsep:
137+
x = os.path.abspath(x)
138+
value = 'file://{}{}'.format(platform.node().lower(), x)
137139
if not as_literal:
138140
return value
139141
try:

0 commit comments

Comments
 (0)