Example #1
0
 def __init__(self):
     Transport.__init__(self)
     self.sock = None
     self.srv_addr = None
     self.api_name = None
     self.token = None
     self.ids_sensor = {}
Example #2
0
    def __init__(self, **kwargs):
        """

        :param host:
        :param port:
        :param timeout:
        :param connect:
        :return:
        """
        try:
            port = kwargs['port']
        except KeyError:
            port = 7147
        try:
            timeout = kwargs['timeout']
        except KeyError:
            timeout = 10
        katcp.CallbackClient.__init__(self,
                                      kwargs['host'],
                                      port,
                                      tb_limit=20,
                                      timeout=timeout,
                                      logger=LOGGER,
                                      auto_reconnect=True)
        Transport.__init__(self, **kwargs)
        self.system_info = {}
        self.unhandled_inform_handler = None
        self._timeout = timeout
        self.connect()
        LOGGER.info('%s: port(%s) created and connected.' % (self.host, port))
Example #3
0
    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)

        # 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)]

        # 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()
Example #4
0
    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))
    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()
Example #6
0
    def __init__(self, **kwargs):
        """
        Initialized Tapcp FPGA object

        :param host: IP Address of the targeted Board
        """
        try:
            import tftpy
            global TFTPY
            TFTPY = tftpy
            TFTPY.setLogLevel(logging.CRITICAL)
        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.parent = kwargs['parent_fpga']
            self.logger = self.parent.logger
        except KeyError:
            errmsg = 'parent_fpga argument not supplied when creating tapcp device'
            raise RuntimeError(errmsg)

        new_connection_msg = '*** NEW CONNECTION MADE TO {} ***'.format(
            self.host)
        self.logger.info(new_connection_msg)
        self.timeout = kwargs.get('timeout', 3)
        self.server_timeout = 0.1  # Microblaze timeout period. So that if a command fails we can wait for the microblaze to terminate the connection before retrying
        self.retries = kwargs.get(
            'retries', 8
        )  # These are retries of a complete transaction (each of which has it's ofw TFTP retries).
Example #7
0
 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)
Example #8
0
	def __init__(self, sock = None, codec=DefaultCodec):
		"""
			Create a new TCP Transport.  If sock is provided, it is used, otherwise starts with
			an unconnected socket. 
		"""
		Transport.__init__(self, sock=sock, codec=codec)
		self.closed = False
		if not sock:
			self.connected = False
		self.txMessage = TXTracker(codec=self.codec)
		self.rxMessage = RXTracker(codec=self.codec)
Example #9
0
    def __init__(self, **kwargs):
        """
        Initialized Tapcp FPGA object
        :param host: IP Address of the targeted Board
        :return: none
        """
        Transport.__init__(self, **kwargs)

        self.t = tftpy.TftpClient(kwargs['host'], 69)
        self._logger = LOGGER
        self.timeout = kwargs.get('timeout', 3)
Example #10
0
    def __init__(self, **kwargs):
        """
        Make a Dummy Transport

        :param host: IP Address should be 127.0.0.1 for a Dummy
        """
        Transport.__init__(self, **kwargs)
        self._devices = NamedFifo(100)
        self._devices_wishbone = NamedFifo(100)
        LOGGER.info('%s: port(%s) created and connected.' %
                    (self.host, sd.ETHERNET_CONTROL_PORT_ADDRESS))
Example #11
0
    def __init__(self, jobname, nreplicas):
        Transport.__init__(self)
        self.logger = logging.getLogger("async_re.condor_transport")

        self.jobname = jobname
        self.user_name = os.environ['USER']

        self.replica_to_jobid = [None for k in range(nreplicas)]

        self.replica_status = dict()

        """ Template for Condor submit description file """
        self.condor_submit_file = """+ProjectName = "TG-MCB150001"
Example #12
0
    def __init__(self, **kwargs):
        """
        Initialized Tapcp FPGA object
        :param host: IP Address of the targeted Board
        :return: none
        """
        Transport.__init__(self, **kwargs)

        self.t = tftpy.TftpClient(kwargs['host'], 69)
        self._logger = LOGGER
        self.timeout = kwargs.get(
            'timeout', 1.2)  # long enough to account for Flash erases
        self.server_timeout = 4  # Microblaze timeout period
        self.retries = kwargs.get('retries', 8)
Example #13
0
    def __init__(self, **kwargs):
        """
        Initialized Tapcp FPGA object
        :param host: IP Address of the targeted Board
        :return: none
        """
        Transport.__init__(self, **kwargs)

        self.t = tftpy.TftpClient(kwargs['host'], 69)
        self._logger = LOGGER
        self.timeout = kwargs.get('timeout',
                                  0.025)  # 1/4 the timeout of the MB
        self.server_timeout = 0.1  # Microblaze timeout period. So that if a command fails we can wait for the microblaze to terminate the connection before retrying
        self.retries = kwargs.get(
            'retries', 8
        )  # These are retries of a complete transaction (each of which has it's ofw TFTP retries).
Example #14
0
    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)
Example #15
0
 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)
     self._logger = LOGGER
     self.timeout = kwargs.get('timeout', 3)
Example #16
0
    def __init__(self,
                 address=None,
                 port=None,
                 localaddr=None,
                 droppercent=0.0,
                 codec=DefaultCodec):
        """
			Create a new multicast transport.
			 addr
				the multicast address to join
			 port
				the port to listen on
			 localaddr
				the address of the local interface to stick to for receiving
			droppercent
				for testing only, transmitter will drop x% (0-1.0) of packets at network layer
		"""

        Transport.__init__(self, codec=codec)
        self.addr = address
        self.port = port
        self.localaddr = localaddr
        self.droppercent = droppercent
        self.create_socket(socket.AF_INET, socket.SOCK_DGRAM)

        self.socket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 1)
        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        if (hasattr(socket, "SO_REUSEPORT")):
            self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
        self.socket.bind((address, port))
        self.socket.setsockopt(
            socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP,
            socket.inet_aton(address) + socket.inet_aton(localaddr))
        # Set the multicast interface in case we are using external tunnels or the machine
        # for some reason has a default route we do not like.
        # Alefiya: does this resolve the large number of drops?
        #self.socket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.inet_aton(localaddr))

        self.finished = dict()
        self.neighbors = dict()
        self.idcounter = 0
        self.boottime = int(time.time())
        self.txMessage = TXTracker()  # blank tracker, forces dequeing of next
Example #17
0
    def __init__(self, **kwargs):
        """

        :param host:
        :param port:
        :param timeout:
        :param connect:
        """
        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__)

        try:
            self.parent = kwargs['parent_fpga']
            self.logger = self.parent.logger
        except KeyError:
            errmsg = 'parent_fpga argument not supplied when creating katcp device'
            raise RuntimeError(errmsg)

        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))
    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)
Example #19
0
    def __init__(self, **kwargs):
        """
        
        :param host: 
        """
        self.logger = logging.getLogger(__name__)
        Transport.__init__(self, **kwargs)

        self.memory_devices = None
        self.prog_info = {
            'last_uploaded': '',
            'last_programmed': '',
            'system_name': ''
        }

        pc_ip = '0.0.0.0'
        fpga_ip = get_kwarg('host', kwargs, '10.0.10.3')
        udp_port = get_kwarg('port', kwargs, 10000)
        timeout = get_kwarg('timeout', kwargs, 1)
        self.fpga_idx = [0, 1]  # Indexes for the 2 FPGAs on the iTPM
        self.itpm = rmpNetwork(pc_ip, fpga_ip, udp_port, timeout)
Example #20
0
    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)
    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)
        katcp.CallbackClient.__init__(self,
                                      self.host,
                                      port,
                                      tb_limit=20,
                                      timeout=timeout,
                                      logger=LOGGER,
                                      auto_reconnect=True)
        self.system_info = {}
        self.unhandled_inform_handler = None
        self._timeout = timeout
        self.connect()
        LOGGER.info('%s: port(%s) created and connected.' % (self.host, port))
Example #22
0
 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
Example #23
0
 def __init__(self, auto_gen=False):
     Transport.__init__(self)
     self.comm = MCUComm()
     self.wrote = ""
     self.ans_buff = ""
     self.auto_gen = auto_gen
 def __init__(self):
     Transport.__init__(self)
     self.port = None
     self.baudrate = None
Example #25
0
 def __init__(self):
     Transport.__init__(self)
     self.port = None
     self.baudrate = None
 def __init__(self):
     Transport.__init__(self)
     self.sock = None
     self.srv_addr = None
Example #27
0
 def __init__(self):
     Transport.__init__(self)
     self.sock = None
     self.srv_addr = None
 def __init__(self, auto_gen=False):
     Transport.__init__(self)
     self.comm = MCUComm()
     self.wrote = ""
     self.ans_buff = ""
     self.auto_gen = auto_gen
Example #29
0
 def __init__(self, address=None, port=None):
     Transport.__init__(self)
     self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
     self.set_reuse_addr()
     self.bind((address, port))
     self.listen(5)
Example #30
0
 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
Example #31
0
 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