def restart_celery():
    for proc in psutil.process_iter():
        if (proc.username() != getpass.getuser()):
            continue
        if (proc.name() != 'celery'):
            continue
        if (not proc.children()):
            continue
        celery_proc = proc
        celery_proc.terminate()
        break
    cmd = 'celery worker -A ideabox_backend -l INFO'
    psutil.Popen(shlex.split(cmd), stdout=PIPE)
def restart_celery():
    for proc in psutil.process_iter():
        if (proc.username() != getpass.getuser()):
            continue
        if (proc.name() != 'celery'):
            continue
        if (not proc.children()):
            continue
        celery_proc = proc
        celery_proc.terminate()
        break
    cmd = 'celery worker -A ideabox_backend -l INFO'
    psutil.Popen(shlex.split(cmd), stdout=PIPE)