Skip to content

Commit 8e287c3

Browse files
committed
log messages about dashr's choice of auto cwd
1 parent 757d5dd commit 8e287c3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

dash/testing/application_runners.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def start(self, app, start_timeout=2, cwd=None):
257257
# app is already a file in a dir - use that as cwd
258258
if not cwd:
259259
cwd = os.path.dirname(app)
260+
logger.info("RRunner inferred cwd from app path: %s", cwd)
260261
else:
261262
path = (
262263
"/tmp/app_{}.R".format(uuid.uuid4().hex)
@@ -281,6 +282,18 @@ def start(self, app, start_timeout=2, cwd=None):
281282
if "/dash/testing/" not in entry[1].replace("\\", "/"):
282283
cwd = os.path.dirname(os.path.realpath(entry[1]))
283284
break
285+
if cwd:
286+
logger.info(
287+
"RRunner inferred cwd from the Python call stack: %s",
288+
cwd
289+
)
290+
else:
291+
logger.warning(
292+
"RRunner found no cwd in the Python call stack. "
293+
"You may wish to specify an explicit working directory "
294+
"using something like: "
295+
"dashr.run_server(app, cwd=os.path.dirname(__file__))"
296+
)
284297

285298
logger.info("Run dashR app with Rscript => %s", app)
286299
args = shlex.split(

0 commit comments

Comments
 (0)