Exemple #1
0
    def __init__(self):
        for path in (config.pendingqueue, config.runqueues):
            if not os.path.exists(path):
                os.makedirs(path)
            else:
                if not os.path.isdir(path):
                    raise RuntimeError("%s is not a directory" % path)

        self.runners = dict()
        self.pipes = dict()
        self.pendingtasks = list()
        self.events = EventService.instance()

        for que in filter(lambda q: os.path.isdir(os.path.join(config.slavequeues, q)), os.listdir(config.slavequeues)):
            self.cleanup(int(que))

        self.notifier = FSNotifier()
        self.notifier.watch(config.masterqueue, IN_CREATE, self.assign)
        self.notifier.watch(config.runqueues, IN_CREATE, self.enslave)
Exemple #2
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
import sys
import os
import pty
from tastypy.core import config as coreconfig
from tastypy.core.logger import debug
from tastypy.core.events import EventObject, EventService, EVREAD
import copy
print("spawner %s " % ','.join(sys.argv[1:]))

# childcount = coreconfig.numcpus
childcount = 1
pmap = dict()
evsv = EventService.instance()

program = sys.argv[1]
cf_mod = "tastypy.programs.%s.configurations.spawner" % program
try:
    cf = __import__(cf_mod)
except ImportError:
    childcount = coreconfig.numcpus


class ChildPipe(EventObject):

    def __init__(self, fd, pid_):
        self.pid = pid_
        self.fd = fd
        # self.fh = os.fdopen(fd)