Пример #1
0
def qconf_dump(arguments):
    from pandaharvester.harvesterscripts import queue_config_tool
    to_print = not arguments.json
    try:
        if arguments.id_list:
            res_list = [
                vars(
                    queue_config_tool.dump_queue_with_config_id(
                        configID, to_print)) for configID in arguments.id_list
            ]
            resObj = {obj.get('queueName'): obj for obj in res_list}
        elif arguments.all:
            res_list = queue_config_tool.dump_all_active_queues(to_print)
            if res_list is None or to_print:
                resObj = {}
            else:
                resObj = {
                    vars(qm).get('queueName', ''): vars(qm)
                    for qm in res_list
                }
        else:
            resObj = {
                queue:
                vars(queue_config_tool.dump_active_queue(queue, to_print))
                for queue in arguments.queue_list
            }
    except TypeError as e:
        if str(e) == 'vars() argument must have __dict__ attribute':
            resObj = {}
        else:
            raise
    if arguments.json:
        json_print(resObj)
Пример #2
0
def qconf_dump(arguments):
    from pandaharvester.harvesterscripts import queue_config_tool
    to_print = not arguments.json
    try:
        if arguments.id_list:
            res_list = [ vars(queue_config_tool.dump_queue_with_config_id(configID, to_print))
                        for configID in arguments.id_list ]
            resObj = { obj.get('queueName'): obj for obj in res_list }
        elif arguments.all:
            res_list = queue_config_tool.dump_all_active_queues(to_print)
            if res_list is None or to_print:
                resObj = {}
            else:
                resObj = { vars(qm).get('queueName', ''): vars(qm) for qm in res_list }
        else:
            resObj = { queue: vars(queue_config_tool.dump_active_queue(queue, to_print))
                        for queue in arguments.queue_list }
    except TypeError as e:
        if str(e) == 'vars() argument must have __dict__ attribute':
            resObj = {}
        else:
            raise
    if arguments.json:
        json_print(resObj)