コード例 #1
0
ファイル: master.py プロジェクト: hif/TwistedBrew
 def send(self, worker_id, data):
     worker = self.lookup_worker(worker_id)
     if worker is None:
         log.warning('Worker {0} not available'.format(worker))
         return
     log.debug('Sending:{0} to {1}'.format(data, worker))
     self.connection.send(data, worker)
コード例 #2
0
ファイル: config.py プロジェクト: hif/TwistedBrew
 def read_config(self, configfile=""):
     try:
         if configfile != "":
             self.file = configfile
         raw = open(self.file, "r")
         data = yaml.load(raw)
         self.communication = CommunicationConfig()
         communication_found = False
         master_found = False
         for name, section in data.items():
             if is_communication(name):
                 if communication_found:
                     log.warning("More than one communication node found, discarding")
                 else:
                     communication_found = True
                     self.communication.set_from_yaml(section)
             elif is_master(name):
                 if master_found:
                     log.warning("More than one master found, discarding")
                 else:
                     master_found = True
                     self.master = MasterConfig()
                     self.master.set_from_yaml(section)
             elif is_workers(name):
                 for worker_node in section:
                     worker = WorkerConfig()
                     worker.set_from_yaml(worker_node[CONFIG_WORKER])
                     self.workers.append(worker)
             else:
                 log.warning("Unknown module found {0}!".format(str(name)))
         if not communication_found:
             log.warning("No communication node found, defaults will be used")
     except Exception as e:
         log.warning("Unable to load config file {0} : {1}".format(self.file, e.args[0]))
コード例 #3
0
 def send(self, worker_id, data):
     worker = self.lookup_worker(worker_id)
     if worker is None:
         log.warning('Worker {0} not available'.format(worker))
         return
     log.debug('Sending:{0} to {1}'.format(data, worker))
     self.connection.send(data, worker)
コード例 #4
0
ファイル: config.py プロジェクト: weldon0405/TwistedBrew
 def read_config(self, configfile=''):
     try:
         if configfile != '':
             self.file = configfile
         raw = open(self.file, 'r')
         data = yaml.load(raw)
         self.communication = CommunicationConfig()
         communication_found = False
         master_found = False
         for name, section in data.items():
             if is_communication(name):
                 if communication_found:
                     log.warning('More than one communication node found, discarding')
                 else:
                     communication_found = True
                     self.communication.set_from_yaml(section)
             elif is_master(name):
                 if master_found:
                     log.warning('More than one master found, discarding')
                 else:
                     master_found = True
                     self.master = MasterConfig()
                     self.master.set_from_yaml(section)
             elif is_workers(name):
                 for worker_node in section:
                     worker = WorkerConfig()
                     worker.set_from_yaml(worker_node[CONFIG_WORKER])
                     self.workers.append(worker)
             else:
                 log.warning('Unknown module found {0}!'.format(str(name)))
         if not communication_found:
             log.warning('No communication node found, defaults will be used')
     except Exception as e:
         log.warning('Unable to load config file {0} : {1}'.format(self.file, e.args[0]))
コード例 #5
0
ファイル: device.py プロジェクト: hif/TwistedBrew
 def check(self):
     if self.simulation:
         return True
     try:
         with open(self.io) as file:
             return True
     except IOError as e:
         log.warning("Unable to find/open \"{0}\"".format(self.io))
         return False
コード例 #6
0
ファイル: device.py プロジェクト: leonardonh/TwistedBrew
 def check(self):
     if self.simulation:
         return True
     try:
         with open(self.io) as file:
             return True
     except IOError as e:
         log.warning("Unable to find/open \"{0}\"".format(self.io))
         return False