예제 #1
0
파일: stress.py 프로젝트: AthinaB/synnefo
def join_and_leave(proj_id, user, repeat, prefix=""):
    user_id = user.id
    if prefix:
        prefix += ' '

    for i in range(repeat):
        try:
            now = datetime.datetime.now()
            logger.info('%s%s: user %s joining project %s'
                        % (prefix, now, user_id, proj_id))
            membership = join(proj_id, user)
        except ProjectError as e:
            logger.info(e.message)
            continue
        except Exception as e:
            logger.exception(e)
            continue
        try:
            now = datetime.datetime.now()
            logger.info('%s%s: user %s leaving project %s'
                        % (prefix, now, user_id, proj_id))
            leave(membership.id, user)
        except ProjectError as e:
            logger.info(e.message)
        except Exception as e:
            logger.exception(e)
예제 #2
0
def join_and_leave(proj_id, user, repeat, prefix=""):
    user_id = user.id
    if prefix:
        prefix += ' '

    for i in range(repeat):
        try:
            now = datetime.datetime.now()
            logger.info('%s%s: user %s joining project %s' %
                        (prefix, now, user_id, proj_id))
            membership = join(proj_id, user)
        except ProjectError as e:
            logger.info(e.message)
            continue
        except Exception as e:
            logger.exception(e)
            continue
        try:
            now = datetime.datetime.now()
            logger.info('%s%s: user %s leaving project %s' %
                        (prefix, now, user_id, proj_id))
            leave(membership.id, user)
        except ProjectError as e:
            logger.info(e.message)
        except Exception as e:
            logger.exception(e)
예제 #3
0
def join_and_leave(proj_id, user_id, repeat, prefix=""):
    if prefix:
        prefix += ' '

    for i in range(repeat):
        try:
            now = datetime.datetime.now()
            logger.info('%s%s: user %s joining project %s' %
                        (prefix, now, user_id, proj_id))
            join(proj_id, user_id)
        except PermissionDenied as e:
            logger.info('Membership already exists')
        except Exception as e:
            logger.exception(e)

        try:
            now = datetime.datetime.now()
            logger.info('%s%s: user %s leaving project %s' %
                        (prefix, now, user_id, proj_id))
            leave(proj_id, user_id)
        except IOError as e:
            logger.info('No such membership')
        except Exception as e:
            logger.exception(e)
예제 #4
0
파일: stress.py 프로젝트: cstavr/synnefo
def join_and_leave(proj_id, user_id, repeat, prefix=""):
    if prefix:
        prefix += ' '

    for i in range(repeat):
        try:
            now = datetime.datetime.now()
            logger.info('%s%s: user %s joining project %s'
                        % (prefix, now, user_id, proj_id))
            join(proj_id, user_id)
        except PermissionDenied as e:
            logger.info('Membership already exists')
        except Exception as e:
            logger.exception(e)

        try:
            now = datetime.datetime.now()
            logger.info('%s%s: user %s leaving project %s'
                        % (prefix, now, user_id, proj_id))
            leave(proj_id, user_id)
        except IOError as e:
            logger.info('No such membership')
        except Exception as e:
            logger.exception(e)