beancmd/migrate.py
def migrate_job(tube, job, use_on_dest=False):
        """migrate a single job from source_client to dest_client"""
        if use_on_dest:
            if args.destination_tube:
                dest_client.use(args.destination_tube)
            else:
                dest_client.use(tube)
        job_stats = source_client.stats_job(job.job_id)
        if job_stats['state'] == 'delayed':
            delay = job_stats['time-left']
        else:
            delay = 0
        if args.log is not None:
            args.log.write(json.dumps({
                'tube': tube,
                'job_data': base64.b64encode(job.job_data).decode('ascii'),
                'pri': job_stats['pri'],
                'ttr': job_stats['ttr'],
                'delay': delay
            }) + '\n')
        dest_client.put_job(job.job_data, pri=job_stats['pri'], ttr=job_stats['ttr'], delay=delay)
        source_client.delete_job(job.job_id)
migrate a single job from source_client to dest_client
migrate a single job from source_client to dest_client
migrate a single job from source_client to dest_client
def migrate_job(tube, job, use_on_dest=False):
        if use_on_dest:
            if args.destination_tube:
                dest_client.use(args.destination_tube)
            else:
                dest_client.use(tube)
        job_stats = source_client.stats_job(job.job_id)
        if job_stats['state'] == 'delayed':
            delay = job_stats['time-left']
        else:
            delay = 0
        if args.log is not None:
            args.log.write(json.dumps({
                'tube': tube,
                'job_data': base64.b64encode(job.job_data).decode('ascii'),
                'pri': job_stats['pri'],
                'ttr': job_stats['ttr'],
                'delay': delay
            }) + '\n')
        dest_client.put_job(job.job_data, pri=job_stats['pri'], ttr=job_stats['ttr'], delay=delay)
        source_client.delete_job(job.job_id)
def migrate_job ( tube , job , use_on_dest = False ) : if use_on_dest : if args . destination_tube : dest_client . use ( args . destination_tube ) else : dest_client . use ( tube ) job_stats = source_client . stats_job ( job . job_id ) if job_stats [ 'state' ] == 'delayed' : delay = job_stats [ 'time-left' ] else : delay = 0 if args . log is not None : args . log . write ( json . dumps ( { 'tube' : tube , 'job_data' : base64 . b64encode ( job . job_data ) . decode ( 'ascii' ) , 'pri' : job_stats [ 'pri' ] , 'ttr' : job_stats [ 'ttr' ] , 'delay' : delay } ) + '\n' ) dest_client . put_job ( job . job_data , pri = job_stats [ 'pri' ] , ttr = job_stats [ 'ttr' ] , delay = delay ) source_client . delete_job ( job . job_id )
migrate a single job from source_client to dest_client
migrate a single job from source_client to dest_client
"""migrate a single job from source_client to dest_client"""
tube
job
use_on_dest