Python Config.Config() Examples
The following are 15
code examples of Config.Config().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
Config
, or try the search function
.
Example #1
Source File: Tbon.py From pcocc with GNU General Public License v3.0 | 8 votes |
def __init__(self, connect_info): self._vmid = connect_info[0] self._host = connect_info[1] self._port = connect_info[2] self._stub = None self._channel = None client_cert = Config().batch.client_cert credential = grpc.ssl_channel_credentials( root_certificates=client_cert.ca_cert, private_key=client_cert.key, certificate_chain=client_cert.cert ) self._channel = grpc.secure_channel( self._host + ":" + self._port, credential) self._stub = agent_pb2_grpc.pcoccNodeStub(self._channel)
Example #2
Source File: Tbon.py From pcocc with GNU General Public License v3.0 | 6 votes |
def __init__(self, vmid=0, tree_width=16): self._vmid = vmid self._tree_width = tree_width self._tree_size = Config().batch.vm_count() self._parent_id = -1 self._children_ids = [] self._parent_chan = None self._children_chans = {} self._parent_stub = None self._children_stubs = {} self._routes = {} self._endpoints = {} self._endpoints_lock = threading.Lock() self._gen_children_list() self._connect() logging.debug("Rank %d: routes: %s",self._vmid, str(self._routes))
Example #3
Source File: WSDL.py From p2pool-n with GNU General Public License v3.0 | 6 votes |
def __init__(self, wsdlsource, config=Config, **kw ): reader = wstools.WSDLTools.WSDLReader() self.wsdl = None # From Mark Pilgrim's "Dive Into Python" toolkit.py--open anything. if self.wsdl is None and hasattr(wsdlsource, "read"): print 'stream:', wsdlsource try: self.wsdl = reader.loadFromStream(wsdlsource) except xml.parsers.expat.ExpatError, e: newstream = urllib.URLopener(key_file=config.SSL.key_file, cert_file=config.SSL.cert_file).open(wsdlsource) buf = newstream.readlines() raise Error, "Unable to parse WSDL file at %s: \n\t%s" % \ (wsdlsource, "\t".join(buf)) # NOT TESTED (as of April 17, 2003) #if self.wsdl is None and wsdlsource == '-': # import sys # self.wsdl = reader.loadFromStream(sys.stdin) # print 'stdin'
Example #4
Source File: Tools.py From gofed with GNU General Public License v2.0 | 6 votes |
def runPhase(self, phase): if phase == STEP_SCRATCH_BUILD: return self.mc.scratchBuildBranches(self.branches) if phase == STEP_PUSH: return self.mc.pushBranches(self.branches) if phase == STEP_BUILD: return self.mc.buildBranches(self.branches) if phase == STEP_UPDATE: branches = Config().getUpdates() branches = list(set(branches) & set(self.branches)) return self.mc.updateBuilds(branches, self.new) if phase == STEP_OVERRIDE: branches = Config().getUpdates() branches = list(set(branches) & set(self.branches)) return self.mc.overrideBuilds(branches) return 1
Example #5
Source File: Tbon.py From pcocc with GNU General Public License v3.0 | 5 votes |
def _get_endpoint(self, target): self._endpoints_lock.acquire() if not target in self._endpoints: endp = Config().batch.read_key( "cluster/user", "hostagent/vms/{0}".format(target), blocking=True) self._endpoints[target]= endp.split(":") self._endpoints_lock.release() return self._endpoints[target]
Example #6
Source File: Tbon.py From pcocc with GNU General Public License v3.0 | 5 votes |
def _connect(self): me = self._vmid parent_id = (me + self._tree_width - 1) // self._tree_width - 1 children_ids = [] for i in range(self._tree_width): child = me * self._tree_width + i + 1 if child < self._tree_size: children_ids.append(child) self._parent_id = parent_id self._children_ids = children_ids client_cert = Config().batch.ca_cert credential = grpc.ssl_channel_credentials( root_certificates=client_cert.ca_cert, private_key=client_cert.key, certificate_chain=client_cert.cert ) if parent_id >= 0: pinfo = self._get_endpoint(parent_id) self._parent_chan = grpc.secure_channel(pinfo[1] + ":" + pinfo[2], credential) self._parent_stub = agent_pb2_grpc.pcoccNodeStub(self._parent_chan) for child in children_ids: pinfo = self._get_endpoint(child) self._children_chans[child] = grpc.secure_channel(pinfo[1] + ":" + pinfo[2], credential) self._children_stubs[child] = agent_pb2_grpc.pcoccNodeStub(self._children_chans[child])
Example #7
Source File: ETL.py From AIOPS_PLATFORM with MIT License | 5 votes |
def __init__(self): ## set priviate values self.config = Config(workpath) self.pid = os.getpid() self.pname = 'ETL.py' ## logger initial self.loggerInit() ## lock initial self.lockObj = Lock( self.pname, self.pid, self.config.LOCK_DIR, self.config.LOCK_FILE, self.logger) ## debug output self.logger.debug('ETL Initial Start') self.logger.debug('[SYS_BUFFER_SIZE][%s]' % (self.config.SYS_BUFFER_SIZE)) self.logger.debug('[SYS_BUFFER_WAIT][%s]' % (self.config.SYS_BUFFER_WAIT)) self.logger.debug('[MQ_SERVER][%s]' % (self.config.MQ_SERVER)) self.logger.debug('[MQ_PORT][%s]' % (self.config.MQ_PORT)) self.logger.debug('[MQ_QUEUE][%s]' % (self.config.MQ_QUEUE)) self.logger.debug('[MARIADB_HOST][%s]' % (self.config.MARIADB_HOST)) self.logger.debug('[MARIADB_PORT][%s]' % (self.config.MARIADB_PORT)) self.logger.debug('[MARIADB_USER][%s]' % (self.config.MARIADB_USER)) self.logger.debug('[MARIADB_PASSWORD][%s]' % (self.config.MARIADB_PASSWORD)) self.logger.debug('[MARIADB_DATABASE][%s]' % (self.config.MARIADB_DATABASE)) self.logger.debug('[LOCK_DIR][%s]' % (self.config.LOCK_DIR)) self.logger.debug('[LOCK_FILE][%s]' % (self.config.LOCK_FILE)) self.logger.debug('[LOG_DIR][%s]' % (self.config.LOG_DIR)) self.logger.debug('[LOG_FILE][%s]' % (self.config.LOG_FILE)) self.logger.debug('[LOG_LEVEL][%s]' % (self.config.LOG_LEVEL)) self.logger.debug('[LOG_MAX_SIZE][%s]' % (self.config.LOG_MAX_SIZE)) self.logger.debug( '[LOG_BACKUP_COUNT][%s]' % (self.config.LOG_BACKUP_COUNT)) self.logger.debug('ETL Initial Done') ## initial logger
Example #8
Source File: Asset.py From AIOPS_PLATFORM with MIT License | 5 votes |
def __init__(self): ## set priviate values self.config = Config(workpath) self.pid = os.getpid() self.pname = 'Asset.py' ## logger initial self.loggerInit() ## lock initial self.lockObj = Lock( self.pname, self.pid, self.config.LOCK_DIR, self.config.LOCK_FILE, self.logger) ## debug output self.logger.debug('Asset Initial Start') self.logger.debug('[SYS_CIS][%s]' % (self.config.SYS_CIS)) self.logger.debug('[SYS_SAVE_CSV][%s]' % (self.config.SYS_SAVE_CSV)) self.logger.debug('[SYS_CSV_DIR][%s]' % (self.config.SYS_CSV_DIR)) self.logger.debug('[MQ_SERVERS][%s]' % (self.config.MQ_SERVERS)) self.logger.debug('[MQ_PORT][%s]' % (self.config.MQ_PORT)) self.logger.debug('[MQ_QUEUE][%s]' % (self.config.MQ_QUEUE)) self.logger.debug('[SUBPROC_SCRIPTSDIR][%s]' % (self.config.SUBPROC_SCRIPTSDIR)) self.logger.debug('[SUBPROC_TIMEOUT][%s]' % (self.config.SUBPROC_TIMEOUT)) self.logger.debug('[LOCK_DIR][%s]' % (self.config.LOCK_DIR)) self.logger.debug('[LOCK_FILE][%s]' % (self.config.LOCK_FILE)) self.logger.debug('[LOG_DIR][%s]' % (self.config.LOG_DIR)) self.logger.debug('[LOG_FILE][%s]' % (self.config.LOG_FILE)) self.logger.debug('[LOG_LEVEL][%s]' % (self.config.LOG_LEVEL)) self.logger.debug('[LOG_MAX_SIZE][%s]' % (self.config.LOG_MAX_SIZE)) self.logger.debug( '[LOG_BACKUP_COUNT][%s]' % (self.config.LOG_BACKUP_COUNT)) self.logger.debug('Asset Initial Done') ## initial logger
Example #9
Source File: Scheduler.py From AIOPS_PLATFORM with MIT License | 5 votes |
def __init__(self): ## set priviate values self.config = Config(workpath) self.pid = os.getpid() self.pname = 'Scheduler.py' ## logger initial self.loggerInit() ## lock initial self.lockObj = Lock( self.pname, self.pid, self.config.LOCK_DIR, self.config.LOCK_FILE, self.logger) ## debug output self.logger.debug('Scheduler Initial Start') self.logger.debug('[SYS_CFG_DIR][%s]' % (self.config.SYS_CFG_DIR)) self.logger.debug('[LOCK_DIR][%s]' % (self.config.LOCK_DIR)) self.logger.debug('[LOCK_FILE][%s]' % (self.config.LOCK_FILE)) self.logger.debug('[LOG_DIR][%s]' % (self.config.LOG_DIR)) self.logger.debug('[LOG_FILE][%s]' % (self.config.LOG_FILE)) self.logger.debug('[LOG_LEVEL][%s]' % (self.config.LOG_LEVEL)) self.logger.debug('[LOG_MAX_SIZE][%s]' % (self.config.LOG_MAX_SIZE)) self.logger.debug( '[LOG_BACKUP_COUNT][%s]' % (self.config.LOG_BACKUP_COUNT)) self.logger.debug('Scheduler Initial Done') ## initial logger
Example #10
Source File: ProviderPrefixes.py From gofed with GNU General Public License v2.0 | 5 votes |
def loadCommonProviderPrefixes(self): golang_mapping_path = Config().getGolangCommonProviderPrefixes() try: with open(golang_mapping_path, 'r') as file: prefixes = [] content = file.read() for line in content.split('\n'): if line == "" or line[0] == '#': continue prefixes.append( line.strip() ) return True, prefixes except IOError, e: self.err = "Unable to read from %s: %s" % (golang_mapping_path, e)
Example #11
Source File: Tools.py From gofed with GNU General Public License v2.0 | 5 votes |
def __init__(self, dry=False, debug=False, new=False): self.phase = STEP_END self.endphase = STEP_END self.mc = MultiCommand(dry=dry, debug=debug) self.branches = Config().getBranches() self.new = new
Example #12
Source File: RentCrawler.py From RentCrawer with MIT License | 5 votes |
def __init__(self): this_file_dir = os.path.split(os.path.realpath(__file__))[0] config_file_path = os.path.join(this_file_dir, 'config.ini') self.config = Config.Config(config_file_path)
Example #13
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Start(self): from Tasks import TASKS self.tasks = [task(self) for task in TASKS] from Config import Config self.config = Config(self, join(self.outputDir, "Build.ini")) for task in self.tasks: task.Setup() (self.appVersion, self.appVersionInfo) = GetVersion(self) if self.showGui: import Gui Gui.Main(self) else: builder.Tasks.Main(self)
Example #14
Source File: Tbon.py From pcocc with GNU General Public License v3.0 | 4 votes |
def __init__(self, vmid, handler, stream_init_handler, port=0): self._relay = None self._vmid = int(vmid) self._port = port self._handler = handler self._stream_init_handler = stream_init_handler self._server = grpc.server(futures.ThreadPoolExecutor(max_workers=25)) self._ready = threading.Event() agent_pb2_grpc.add_pcoccNodeServicer_to_server(self, self._server) server_cert = Config().batch.ca_cert.gen_cert(socket.gethostname()) credential = grpc.ssl_server_credentials( ((server_cert.key, server_cert.cert), ), server_cert.ca_cert, True ) self._port = self._server.add_secure_port( "[::]:{0}".format(port), credential ) self._server.start() logging.debug("Tree node listening on port %s", self._port) Config().batch.write_key('cluster/user', "hostagent/vms/{0}".format(self._vmid), "{0}:{1}:{2}".format( self._vmid, socket.gethostname(), self._port)) # Establish connections to adjacent nodes in the tree for relaying # messages self._relay = TreeNodeRelay(self._vmid) self._ready.set()
Example #15
Source File: generate_tfrecords.py From self_driving_pi_car with MIT License | 4 votes |
def records_generator(height, width, channels, data_path, label_path, name, flip=False, augmentation=False, gray=False, green=False, binary=False): """ Generates tfrecords. :param height: image height :type heights: int :param width: image width :type width: int :param channels: image channels :type channels: int :param data_path: path to load data np.array :type data_path: str :param record_path: path to load labels np.array :type label_path: str :param name: path to save tfrecord :type name: str :param flip: param to control if the data will be flipped :type flip: boolean :param augmentation: param to control if the data will augmented :type augmentation: boolean :param gray: param to control if the data will be grayscale images :type gray: boolean :param green: param to control if the data will use only the green channel :type green: boolean :param binary: param to control if the data will be binarized :type binary: boolean """ config = Config(height=height, width=width, channels=channels) data = DataHolder(config, data_path=data_path, label_path=label_path, record_path=name, flip=flip, augmentation=augmentation, gray=gray, green=green, binary=binary, records=None) data.create_records()