def handle_connect(self, msg): logging.debug('Client handle_connect(msg_id=\'%s\')' % msg['header']['msg_id']) if self.state == 'allocated': self.state = 'connected' reply = create_msg('ok', msg['header']['msg_id'], self.id) self.push.send_json(reply)
def handle_disconnect(self, msg): logging.debug('Client handle_disconnect(msg_id=\'%s\')' % msg['header']['msg_id']) if self.state == 'connected': self.state = 'allocated' body = {'err_info': 'This is only a test'} reply = create_msg('disconnect', msg['header']['msg_id'], self.id, body) self.push.send_json(reply)
def handle_alloc(self, msg): logging.debug('Client handle_alloc(msg_id=\'%s\')' % msg['header']['msg_id']) body = {'drp': {'connect_info': {'infiniband': '123.456.789'}}} reply = create_msg('alloc', msg['header']['msg_id'], self.id, body) self.push.send_json(reply) self.state = 'allocated'
def handle_disable(self, msg): logging.debug('Client handle_disable(msg_id=\'%s\')' % msg['header']['msg_id']) if self.state == 'running': self.state = 'paused' reply = create_msg('ok', msg['header']['msg_id'], self.id) self.push.send_json(reply)
def handle_rollcall(self, msg): logging.debug('Client handle_rollcall(msg_id=\'%s\')' % msg['header']['msg_id']) # time.sleep(1.5) body = {'drp': {'proc_info': { 'alias': self.alias, 'host': self.hostname, 'pid': self.pid}}} reply = create_msg('rollcall', msg['header']['msg_id'], self.id, body=body) self.push.send_json(reply)
def fileReport_msg(path): dt = datetime.now(timezone.utc) dts = dt.strftime("%Y-%m-%dT%H:%M:%SZ") body = { 'path': path, 'create_timestamp': dts, 'modify_timestamp': dts, 'size': 0 } return create_msg('fileReport', body=body)
def handle_endrun(self, msg): logging.debug('Client handle_endrun(msg_id=\'%s\')' % msg['header']['msg_id']) if True: reply = create_msg('ok', msg['header']['msg_id'], self.id) self.push.send_json(reply)