How to use the pysces.kraken.KrakenNET.SimpleClient function in pysces

To help you get started, we’ve selected a few pysces examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PySCeS / pysces / pysces / kraken / KrakenNET.py View on Github external
def scan(self):
        self.feedback = []
        self.servers_ready = []
        self.servers_busy = []
        self.servers_dead = []

        for server in self.servers:
            try:
                print('Tentacle scanner is trying server:', server)
                client = SimpleClient(server, STATUS_PORT, BLOCK_SIZE)
                client.timeout = 5
                client.send(['STATUS'])
                print('Response:', client.response)
                self.feedback.append((client.server,client.response[0]))
            except Exception as ex:
                print(ex)
                self.feedback.append((client.server,'FAILED'))
        self.feedback_history.append(self.feedback)

        ##  print self.feedback, '\n'

        for sv in self.feedback:
            if sv[1] == 'FAILED':
                self.servers_dead.append(sv[0])
            elif sv[1] == 'READY':
                self.servers_ready.append(sv[0])
github PySCeS / pysces / pysces / kraken / Kraken.py View on Github external
def sendCmdListToOne(self, command_list, server):
        assert type(command_list) == list or type(command_list) == tuple, '\n* Input must be a list or tuple'
        assert server in self.kc_available_server_list, '\n* Server %s not in active server list' % server
        clnt = SimpleClient(server, self.kc_pysces_port, self.kc_block_size)
        clnt.send(command_list)
        self.kc_tentacle_response[server] = clnt.response
        ##  print self.kc_tentacle_response
github PySCeS / pysces / pysces / kraken / Kraken.py View on Github external
def killTentacles(self):
        GO = True
        while GO:
            inp = input('\nYou have initiated tentacle shutdown ... are you sure? (y/n): ')
            if inp in ['y','Y','yes']:
                GO = False
                for server in self.kc_available_server_list:
                    SimpleClient(server, self.kc_status_port, self.kc_block_size).send(['KILL'])
                    SimpleClient(server, self.kc_pysces_port, self.kc_block_size).send(['KILL'])
                print('Warning: all servers deleted for this host')
                self.kc_available_server_list = []
            elif inp in ['n','N','no']:
                GO = False
            else:
                print('\nPlease enter y for yes or n for no')
github PySCeS / pysces / pysces / kraken / Kraken.py View on Github external
def ResetServersToReady(self):
        for server in self.kc_available_server_list:
            SimpleClient(server, self.kc_status_port, self.kc_block_size).send(['P_RESET_STATUS'])
github PySCeS / pysces / pysces / kraken / Kraken.py View on Github external
def killTentacles(self):
        GO = True
        while GO:
            inp = input('\nYou have initiated tentacle shutdown ... are you sure? (y/n): ')
            if inp in ['y','Y','yes']:
                GO = False
                for server in self.kc_available_server_list:
                    SimpleClient(server, self.kc_status_port, self.kc_block_size).send(['KILL'])
                    SimpleClient(server, self.kc_pysces_port, self.kc_block_size).send(['KILL'])
                print('Warning: all servers deleted for this host')
                self.kc_available_server_list = []
            elif inp in ['n','N','no']:
                GO = False
            else:
                print('\nPlease enter y for yes or n for no')