#20388: Fix the Magma interface to work with remote installations
-------------------------------------+-------------------------------------
       Reporter:  mmasdeu            |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-7.2
      Component:  interfaces:        |   Resolution:
  optional                           |    Merged in:
       Keywords:  magma, remote      |    Reviewers:
        Authors:  Marc Masdeu        |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  u/mmasdeu/20388    |  da0c8a128c83b89f9cc6f42b3dfcdcac3f8fce24
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Replying to [comment:10 mmasdeu]:
 > I have addressed Nils' two concerns above. About the "magma = Magma()"
 and the configuration parameters, I don't have a quick solution yet.
 There's a bunch of places in the schemes/ folder that import magma
 depending on the algorithm chosen. One easy way to fix this is to provide
 a get_magma_session() and set_magma_session() functions so that something
 like this would work:
 > {{{
 > sage: set_magma_session(Magma(server = 'remote', command =
 'magma_custom'))
 > sage: function_using_magma(algorithm = 'magma')
 > }}}
 >
 > This would only involve changing the calls that look like:
 > {{{
 > from sage.interfaces.magma import magma
 > magma.eval('complicated stuff')
 > }}}
 > to
 > {{{
 > from sage.interfaces.magma import get_magma_session
 > magma = get_magma_session()
 > magma.eval('complicated stuff')
 > }}}
 >
 > Do you think that this is a good enough solution? If so, I would quickly
 implement it...

 I do not like it so much. It would involve a lot of changes in the
 schemes/ folder (that people have maybe already copy/paste in their
 personal code). And, more importantly, it would be different from any
 other interface in Sage. What about environment variable?
 {{{
 $ SAGE_MAGMA_COMMAND = "module load magma/2.11.13; magma"
 $ SAGE_MAGMA_SERVER = "plafrim"
 $ export SAGE_MAGMA_COMMAND SAGE_MAGMA_SERVER
 $ sage
 ...
 }}}

 One just needs in the constructor of `Magma` something like
 {{{
 class Magma(Interface):
     def __init__(self, server=None, command=None, ...):
         import os
         if server is None:
             server = os.getenv('SAGE_MAGMA_SERVER')
         if command is None:
             command = os.getenv('SAGE_MAGMA_COMMAND')
 }}}

 A solution based on `init.sage` would not work since it is loaded after
 anything else.

--
Ticket URL: <http://trac.sagemath.org/ticket/20388#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to