本文整理匯總了Python中transport.Transport.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python Transport.__init__方法的具體用法?Python Transport.__init__怎麽用?Python Transport.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類transport.Transport
的用法示例。
在下文中一共展示了Transport.__init__方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self, jobname, compute_nodes, replicas): #changed on 12/1/14
# jobname: identifies current asyncRE job
# compute_nodes: list of names of nodes in the pool
# nreplicas: number of replicas, 0 ... nreplicas-1
Transport.__init__(self) #WFF - 2/18/15
self.logger = logging.getLogger("async_re.ssh_transport") #WFF - 3/2/15
# names of compute nodes (slots)
self.compute_nodes = compute_nodes #changed on 12/1/14
self.nprocs = len(self.compute_nodes)
#self.openmm_platform = None
# node status = None if idle
# Otherwise a structure containing:
# replica number being executed
# process id
# process name
# ...
self.node_status = [ None for k in range(self.nprocs)]
#self.openmm_platform = None
# contains the nodeid of the node running a replica
# None = no information about where the replica is running
self.replica_to_job = [ None for k in replicas ]
# implements a queue of jobs from which to draw the next job
# to launch
self.jobqueue = Queue.Queue()
示例2: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self, **kwargs):
"""
:param host:
:param port:
:param timeout:
:param connect:
:return:
"""
port = get_kwarg('port', kwargs, 7147)
timeout = get_kwarg('timeout', kwargs, 10)
Transport.__init__(self, **kwargs)
# Create instance of self.logger
try:
self.logger = kwargs['logger']
except KeyError:
self.logger = logging.getLogger(__name__)
new_connection_msg = '*** NEW CONNECTION MADE TO {} ***'.format(self.host)
self.logger.info(new_connection_msg)
katcp.CallbackClient.__init__(
self, self.host, port, tb_limit=20,
timeout=timeout, logger=self.logger, auto_reconnect=True)
self.system_info = {}
self.unhandled_inform_handler = None
self._timeout = timeout
self.connect()
self.logger.info('%s: port(%s) created and connected.' % (self.host, port))
示例3: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self, debug=False, verbose=False):
self.client.login()
if verbose:
self.log.basicConfig(level=self.log.INFO)
if debug:
self.log.basicConfig(level=self.log.DEBUG)
Transport.__init__(self, self.client, self.log)
NetworkServices.__init__(self, self.client, self.log)
ControlServices.__init__(self, self.client, self.log)
示例4: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self, jobname, keywords, nreplicas, files_to_stage):
# jobname: identifies current asyncRE job
# files_to_stage: permanent files to stage into BOINC download directory (main struct file, datafiles, etc.)
Transport.__init__(self)
self.logger = logging.getLogger("async_re.boinc_transport")
self.jobname = jobname
# variables required for boinc-based transport
if keywords.get('BOINC_PROJECTDIR') is None:
self._exit("BOINC transport requires a BOINC_PROJECTDIR")
self.project_dir = keywords.get('BOINC_PROJECTDIR')
if not os.path.isdir(self.project_dir):
self.logger.critical("Unable to located BOINC project directory: %s",
self.project_dir)
sys.exit(1)
#sets up a mapping between replicas running and work unit ids
self.replica_to_wuid = [ None for k in range(nreplicas)]
#sets up lookup table for replica done status
self.replica_status = dict()
#set connection with mysql boinc server database
if keywords.get('BOINC_DATABASE') is None:
self.logger.critical("BOINC transport requires a BOINC_DATABASE")
sys.exit(1)
if keywords.get('BOINC_DATABASE_USER') is None:
self.logger.critical("BOINC transport requires a BOINC_DATABASE_USER")
sys.exit(1)
if keywords.get('BOINC_DATABASE_PASSWORD') is None:
self.logger.critical("BOINC transport requires a BOINC_DATABASE_PASSWORD")
sys.exit(1)
self.db_name = keywords.get('BOINC_DATABASE')
self.db_user = keywords.get('BOINC_DATABASE_USER')
self.db_pwd = keywords.get('BOINC_DATABASE_PASSWORD')
# stage files
if files_to_stage is not None:
for file in files_to_stage:
filepath = os.getcwd() + "/" + file
self._stage_file(filepath,file)
示例5: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self, **kwargs):
"""
Initialized Tapcp FPGA object
:param host: IP Address of the targeted Board
:return: none
"""
try:
import tftpy
global TFTPY
TFTPY = tftpy
except ImportError:
raise ImportError('You need to install tftpy to use TapcpTransport')
Transport.__init__(self, **kwargs)
set_log_level(logging.ERROR)
self.t = tftpy.TftpClient(kwargs['host'], 69)
try:
self.logger = kwargs['logger']
except KeyError:
self.logger = logging.getLogger(__name__)
new_connection_msg = '*** NEW CONNECTION MADE TO {} ***'.format(self.host)
self.logger.info(new_connection_msg)
self.timeout = kwargs.get('timeout', 3)
示例6: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self, mode, applications, own_ip):
Transport.__init__(self, mode, applications, own_ip)
self.connection = Connection
self.name = 'UDP'
self.socktype = SOCK_DGRAM
self.server = Udpserver
示例7: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self, auto_gen=False):
Transport.__init__(self)
self.comm = MCUComm()
self.wrote = ""
self.ans_buff = ""
self.auto_gen = auto_gen
示例8: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self):
Transport.__init__(self)
self.sock = None
self.srv_addr = None
示例9: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self, mode, applications, own_ip):
Transport.__init__(self, mode, applications, own_ip)
self.connection = Tcpconnection
self.name = 'TCP'
self.socktype = SOCK_STREAM
self.server = Tcpserver
示例10: __init__
# 需要導入模塊: from transport import Transport [as 別名]
# 或者: from transport.Transport import __init__ [as 別名]
def __init__(self):
Transport.__init__(self)
self.port = None
self.baudrate = None