Ticket #11679: 11679.patch

File 11679.patch, 4.1 KB (added by jdemeyer, 8 years ago)
  • sagenb/interfaces/expect.py

    commit 96dc1dacddb47e6d4abd41c1081f5d834d9893e0
    Author: Jeroen Demeyer <jdemeyer@cage.ugent.be>
    Date:   Mon Dec 2 11:48:57 2013 +0100
    
        Allow different directory for server_pool communication
    
    diff --git a/sagenb/interfaces/expect.py b/sagenb/interfaces/expect.py
    index 3ef3f6b..ef24433 100644
    a b class WorksheetProcess_RemoteExpectImplementation(WorksheetProcess_ExpectImpleme 
    331331          .ssh/authorized_keys.  You must make the permissions of
    332332          files and directories right.
    333333         
    334         - ``local_directory`` -- name of a directory on the local
    335           computer that the notebook server can write to, which the
    336           remote computer also has read/write access to, e.g., /tmp/
     334        - ``local_directory`` -- (default: None) name of a directory on
     335          the local computer that the notebook server can write to,
     336          which the remote computer also has read/write access to.  If
     337          set to None, then first try the environment variable
     338          :envvar:`SAGENB_TMPDIR` if it exists, then :envvar:`TMPDIR`.
     339          Otherwise, fall back to ``/tmp``.
    337340
    338341        - ``remote_directory`` -- (default: None) if the local_directory is
    339342          mounted on the remote machine as a different directory name,
    class WorksheetProcess_RemoteExpectImplementation(WorksheetProcess_ExpectImpleme 
    345348    def __init__(self,
    346349                 user_at_host,
    347350                 remote_python,
    348                  local_directory = os.path.sep + 'tmp',
     351                 local_directory = None,
    349352                 remote_directory = None,
    350353                 process_limits = None,
    351354                 timeout = 0.05):
    352355        WorksheetProcess_ExpectImplementation.__init__(self, process_limits, timeout=timeout)
    353356        self._user_at_host = user_at_host
     357
     358        if local_directory is None:
     359            try:
     360                local_directory = os.environ["SAGENB_TMPDIR"]
     361            except KeyError:
     362                pass
     363        if local_directory is None:
     364            try:
     365                local_directory = os.environ["TMPDIR"]
     366            except KeyError:
     367                pass
     368        if local_directory is None:
     369            local_directory = os.path.sep + 'tmp'
    354370        self._local_directory = local_directory
     371       
    355372        if remote_directory is None:
    356373            remote_directory = local_directory
    357374        self._remote_directory = remote_directory
     375
    358376        self._remote_python = remote_python
    359377
    360378    def command(self):
  • sagenb/notebook/notebook_object.py

    diff --git a/sagenb/notebook/notebook_object.py b/sagenb/notebook/notebook_object.py
    index 431b187..d31f4f4 100644
    a b class NotebookObject: 
    174174
    175175          logs in without requiring a password, e.g., by typing
    176176          ``ssh-keygen`` as the notebook server user, then putting
    177           ``~/.ssh/id_rsa.pub`` as the file
    178           ``.ssh/authorized_keys``. Note: you have to get the
    179           permissions of files and directories just right -- see `this
    180           Sage wiki page`_ for more details.  Also, every user in the
    181           server pool must share the same ``/tmp`` directory right
    182           now, so if the machines are separate the server machine must
    183           NSF export ``/tmp``.
     177          ``~/.ssh/id_rsa.pub`` as the file ``.ssh/authorized_keys``.
     178          Note: you have to get the permissions of files and
     179          directories just right -- see `this Sage wiki page`_ for
     180          more details.
     181         
     182          Files between the main Sage process and the ``server_pool``
     183          workers are transferred through ``/tmp`` by default.  If the
     184          environment variable :envvar:`SAGENB_TMPDIR` or
     185          :envvar:`TMPDIR` exists, that directory is used instead.  This
     186          directory must be shared, so if the machines are separate the
     187          server machine must NFS-export ``/tmp`` or
     188          :envvar:`SAGENB_TMPDIR`.
    184189
    185190        - ``server`` -- string ("twistd" (default) or "flask").  The server
    186191          to use to server content.