Exemple #1
0
 def __init__(self, name, maxsize=0, docode=False):
     self.added = False
     self.name = name
     self.inprog = 0
     self.maxsize = maxsize
     self.queue = Queue.Queue(maxsize)
     self.cobraname = cobra.shareObject(self)
     if docode: dcode.enableDcodeServer()
Exemple #2
0
 def __init__(self, name, maxsize=0, docode=False):
     self.added = False
     self.name = name
     self.inprog = 0
     self.maxsize = maxsize
     self.queue = Queue.Queue(maxsize)
     self.cobraname = cobra.shareObject(self)
     if docode: dcode.enableDcodeServer()
    def __init__(self,
                 name,
                 maxsize=None,
                 docode=False,
                 bindsrc="",
                 cobrad=None):
        """
        The cluster server is the core of the code that manages work units.

        Arguments:
            maxsize - How big should the work queue be before add blocks
            docode  - Should we also be a dcode server?
            bindsrc - Should we bind a src IP for our multicast announcements?
            cobrad  - Should we use an existing cobra daemon to share our objects?
        """
        self.go = True
        self.name = name
        self.queens = []
        self.nextwid = 0
        self.inprog = {}
        self.sharedfiles = {}
        self.maxsize = maxsize
        self.queue = collections.deque()
        self.qcond = threading.Condition()
        self.widiter = iter(xrange(999999999))

        # Initialize a cobra daemon if needed
        if cobrad == None:
            cobrad = cobra.CobraDaemon(host="", port=0)
        self.cobrad = cobrad
        self.cobraname = self.cobrad.shareObject(self)

        # Setup our transmission socket
        self.sendsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sendsock.bind((bindsrc, 0))

        # Set this to a ClusterCallback extension if
        # you want notifications.
        self.callback = None

        if docode:
            dcode.enableDcodeServer(daemon=self.cobrad)

        # Fire the timeout monitor thread...
        thr = threading.Thread(target=self.timerThread)
        thr.setDaemon(True)
        thr.start()
Exemple #4
0
    def __init__(self, name, maxsize=None, docode=False, bindsrc="", cobrad=None):
        """
        The cluster server is the core of the code that manages work units.

        Arguments:
            maxsize - How big should the work queue be before add blocks
            docode  - Should we also be a dcode server?
            bindsrc - Should we bind a src IP for our multicast announcements?
            cobrad  - Should we use an existing cobra daemon to share our objects?
        """
        self.go = True
        self.name = name
        self.queens = []
        self.nextwid = 0
        self.inprog = {}
        self.sharedfiles = {}
        self.maxsize = maxsize
        self.queue = collections.deque()
        self.qcond = threading.Condition()
        self.widiter = iter(xrange(999999999))

        # Initialize a cobra daemon if needed
        if cobrad == None:
            cobrad = cobra.CobraDaemon(host="", port=0)
        self.cobrad = cobrad
        self.cobraname = self.cobrad.shareObject(self)

        # Setup our transmission socket
        self.sendsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sendsock.bind((bindsrc, 0))

        # Set this to a ClusterCallback extension if
        # you want notifications.
        self.callback = None

        if docode:
            dcode.enableDcodeServer(daemon=self.cobrad)

        # Fire the timeout monitor thread...
        thr = threading.Thread(target=self.timerThread)
        thr.setDaemon(True)
        thr.start()