16.2 Distributed Sage

Module: sage.dsage.dsage

Distributed Sage

Distributed Sage dsage is a distributed computing framework suitable for coarse distributed compuatations.

Module-level Functions

spawn( cmd, [verbose=True], [stdout=None], [stdin=None])

Spawns a process and registers it with the SAGE.

Class: DistributedSage

class DistributedSage
Distributed SAGE allows you to do distributed computing in SAGE.

To get up and running quickly, run dsage.setup() to run the configuration utility.

Note that configuration files will be stored in the directory $DOT_SAGE/dsage.

QUICK-START

1. Launch sage 2. Run

sage: dsage.setup()

For a really quick start, just hit ENTER on all questions. This will create all the necessary supporting files to get **DSAGE** running. It will create the databases, set up a private/public key for authentication and create a SSL certificate for the server. 3. Launch a server, monitor and get a connection to the server:

sage: D = dsage.start_all()

This will start 2 workers by default. You can change it by passing in the ``workers=N`` argument where ``N`` is the number of workers you want. 4. To do a computation, use D just like any other SAGE interface. For example:

sage: j = D('2+2') sage: j.wait() sage: j 4

Functions: kill_all,$ \,$ kill_server,$ \,$ kill_worker,$ \,$ server,$ \,$ setup,$ \,$ setup_client,$ \,$ setup_server,$ \,$ setup_worker,$ \,$ start_all,$ \,$ worker

kill_all( self)

Kills the server and worker.

server( self, [blocking=True], [port=None], [log_level=0], [ssl=True], [db_file=/home2/sage/.sage/dsage/db/dsage.db], [log_file=/home2/sage/.sage/dsage/server.log], [privkey=/home2/sage/.sage/dsage/cacert.pem], [cert=/home2/sage/.sage/dsage/pubcert.pem], [authenticated_logins=False], [failure_threshold=3], [verbose=True], [testing=False], [profile=False])

Run the Distributed SAGE server.

Doing dsage.server() will spawn a server process which listens by default on port 8081.

setup( self, [template=None])

This is the setup utility which helps you configure dsage.

Type dsage.setup() to run the configuration for the server, worker and client. Alternatively, if you want to run the configuration for just one parts, you can launch dsage.setup_server(), dsage.setup_worker() or dsage.setup().

setup_client( self)

This method runs the configuration utility for the client.

setup_server( self)

This method runs the configuration utility for the server.

setup_worker( self)

This method runs the configuration utility for the worker.

start_all( self, [port=None], [workers=2], [log_level=0], [poll=1.0], [authenticate=False], [failure_threshold=3], [verbose=True], [testing=False])

Start the server and worker and returns a connection to the server.

worker( self, [server=localhost], [port=8081], [workers=2], [poll=1.0], [username=sage], [blocking=True], [ssl=True], [log_level=0], [authenticate=True], [priority=20], [privkey=/home2/sage/.sage/dsage/dsage_key], [pubkey=/home2/sage/.sage/dsage/dsage_key.pub], [log_file=/home2/sage/.sage/dsage/worker.log], [verbose=True])

Run the Distributed SAGE worker.

Typing sage.worker() will launch a worker which by default connects to localhost on port 8081 to fetch jobs.

See About this document... for information on suggesting changes.