Skip to content

Commit 445bb1e

Browse files
PMax5etejedor
authored andcommitted
swan: Use custom PDFExporter command to reduce PDF export time
Force the PDF exporter command to use the temporary user home, to prevent it touching the user EOS and with that reduce the time it takes for a notebook to be exported to PDF
1 parent bc3b5e3 commit 445bb1e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

swan/python/jupyter_server_config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@
3030
c.ServerApp.default_url = '/lab'
3131
else:
3232
c.ServerApp.default_url = '/projects'
33+
34+
user = os.environ.get('USER')
35+
# Change the HOME environment variable to the local user home instead of EOS
36+
# to prevent xelatex from touching EOS during the PDF conversion and so
37+
# reduce the time it takes to convert a PDF (including preventing timeouts).
38+
c.PDFExporter.latex_command = ['env', f'HOME=/home/{user}' , 'xelatex', '-quiet', '{filename}']

0 commit comments

Comments
 (0)