示例#1
0
from twisted.spread import pb
from twisted.internet import reactor
from twisted.application import service, internet


import os
from subprocess import Popen
import platform, dbus, avahi
from pydra_server.cluster.auth.rsa_auth import load_crypto
from pydra_server.cluster.auth.master_avatar import MasterAvatar


# init logging
import settings
from pydra_server.logging.logger import init_logging
logger = init_logging(settings.LOG_FILENAME_NODE)

class ZeroconfService:
    """A simple class to publish a network service with zeroconf using
    avahi.

    Shamelessly stolen from http://stackp.online.fr/?p=35 
    """

    def __init__(self, name, port, stype="_http._tcp",
                 domain="", host="", text=""):
        self.name = name
        self.stype = stype
        self.domain = domain
        self.host = host
        self.port = port
示例#2
0
import settings
import dbus, avahi
from dbus.mainloop.glib import DBusGMainLoop

from pydra_server.models import Node, TaskInstance, pydraSettings
from pydra_server.cluster.constants import *
from pydra_server.cluster.tasks.task_manager import TaskManager
from pydra_server.cluster.tasks import STATUS_STOPPED, STATUS_RUNNING, STATUS_COMPLETE, STATUS_CANCELLED, STATUS_FAILED
from pydra_server.cluster.auth.rsa_auth import RSAClient, load_crypto
from pydra_server.cluster.auth.worker_avatar import WorkerAvatar
from pydra_server.cluster.amf.interface import AMFInterface


# init logging
from pydra_server.logging.logger import init_logging
logger = init_logging(settings.LOG_FILENAME_MASTER)


class NodeClientFactory(pb.PBClientFactory):
    """
    Subclassing of PBClientFactory to add auto-reconnect via Master's reconnection code.
    This factory is specific to the master acting as a client of a Node.
    """

    node = None

    def __init__(self, node, master):
        self.node = node
        self.master = master
        pb.PBClientFactory.__init__(self)