| 1 |
# -*- mode:python -*- |
|---|
| 2 |
# |
|---|
| 3 |
# AsynCluster |
|---|
| 4 |
# A cluster management server based on Twisted's Perspective Broker and a Node |
|---|
| 5 |
# Display Manager (NDM) client. The server dispatches cluster jobs and |
|---|
| 6 |
# regulates when and how much each user can use his account on any of the |
|---|
| 7 |
# cluster node workstations. |
|---|
| 8 |
# |
|---|
| 9 |
# Copyright (C) 2006-2007 by Edwin A. Suominen, http://www.eepatents.com |
|---|
| 10 |
# |
|---|
| 11 |
# This program is free software; you can redistribute it and/or modify it under |
|---|
| 12 |
# the terms of the GNU General Public License as published by the Free Software |
|---|
| 13 |
# Foundation; either version 2 of the License, or (at your option) any later |
|---|
| 14 |
# version. |
|---|
| 15 |
# |
|---|
| 16 |
# This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 17 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|---|
| 18 |
# FOR A PARTICULAR PURPOSE. See the file COPYING for more details. |
|---|
| 19 |
# |
|---|
| 20 |
# You should have received a copy of the GNU General Public License along with |
|---|
| 21 |
# this program; if not, write to the Free Software Foundation, Inc., 51 |
|---|
| 22 |
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|---|
| 23 |
|
|---|
| 24 |
import configobj |
|---|
| 25 |
from twisted.spread import pb |
|---|
| 26 |
from twisted.application import internet, service |
|---|
| 27 |
|
|---|
| 28 |
from asyncluster.master import nodes, control |
|---|
| 29 |
|
|---|
| 30 |
# The NDM configuration file |
|---|
| 31 |
configFile = '/etc/asyncluster.conf' |
|---|
| 32 |
config = configobj.ConfigObj(configFile) |
|---|
| 33 |
|
|---|
| 34 |
# Everything runs under the oversight and direction of a Controller object |
|---|
| 35 |
ctl = control.Controller(config) |
|---|
| 36 |
|
|---|
| 37 |
# Set up the service collection with: |
|---|
| 38 |
application = service.Application("ASYNCLUSTER") |
|---|
| 39 |
serviceCollection = service.IServiceCollection(application) |
|---|
| 40 |
|
|---|
| 41 |
# (1) a node-master PB server, via TCP, and |
|---|
| 42 |
nmFactory = nodes.ServerFactory(ctl) |
|---|
| 43 |
port = int(config['common']['tcp port']) |
|---|
| 44 |
nmServer = internet.TCPServer(port, nmFactory) |
|---|
| 45 |
nmServer.setServiceParent(serviceCollection) |
|---|
| 46 |
|
|---|
| 47 |
# (2) a cluster master control PB server, via a UNIX socket |
|---|
| 48 |
mcRoot = control.Root(ctl) |
|---|
| 49 |
mcFactory = pb.PBServerFactory(mcRoot) |
|---|
| 50 |
mcServer = internet.UNIXServer(config['common']['socket'], mcFactory) |
|---|
| 51 |
mcServer.setServiceParent(serviceCollection) |
|---|