コード例 #1
0
def send(name):
    swap = SWAP.load(name)
    ce.Config.load(swap.config.online_name)
    logger.info('Sending reductions to caesar')
    Online.send(swap)

    logger.debug('Done sending reductions to caesar')
    code.interact(local={**globals(), **locals()})
コード例 #2
0
def run(name):
    swap = SWAP.load(name)
    ce.Config.load(swap.config.online_name)

    Online.receive(swap)
    swap.save()
    ce.Config.instance().save()
    logger.debug('Saved swap status')
    logger.info('Sending reductions to caesar')
    Online.send(swap)

    logger.debug('Done sending reductions to caesar')
    code.interact(local={**globals(), **locals()})
コード例 #3
0
def run_continuous(name):
    swap = SWAP.load(name)
    ce.Config.load(swap.config.online_name)

    try:
        logger.info('Starting SWAP (%s) in continuous online mode...' % name)
        while True:
            _, haveItems = Online.receive(swap)
            if haveItems:
                swap.save()
                ce.Config.instance().save()
                logger.debug('Saved swap status')

                logger.info('Sending reductions to caesar')
                Online.send(swap)
                logger.debug('Done sending reductions to caesar')
    except KeyboardInterrupt as e:
        logger.debug('Received KeyboardInterrupt {}'.format(e))
        logger.debug('Terminating SWAP instance ({}).'.format(name))
        return