예제 #1
0
class Task(Command):
    @staticmethod
    def configure(parser, subparsers):
        subparser = subparsers.add_parser(
            'task', help='Show information about a single task')
        subparser.set_defaults(command=Task)

        subparser.add_argument('task_id',
                               type=int,
                               help='The ID of the task to lookup')

    def run(self):
        self.logger = log.get_logger('Task')
        self.task_api = TaskApi()

        try:
            result = self.task_api.query({'task_id': self.options.task_id})
        except exceptions.ApiException as e:
            print e.message
            sys.exit(1)

        result = {
            k: str(v) if isinstance(v, SuperEnum.Element) else v
            for k, v in result.items()
        }
        print json.dumps(result, sort_keys=True, indent=4 * ' ')
예제 #2
0
class Task(Command):
    @staticmethod
    def configure(parser, subparsers):
        subparser = subparsers.add_parser('task', help='Show information about a single task')
        subparser.set_defaults(command=Task)

        subparser.add_argument('task_id', type=int,
            help='The ID of the task to lookup')

    def run(self):
        self.logger = log.get_logger('Task')
        self.task_api = TaskApi()

        try:
            result = self.task_api.query({ 'task_id': self.options.task_id })
        except exceptions.ApiException as e:
            print e.message
            sys.exit(1)

        result = { k: str(v) if isinstance(v, SuperEnum.Element) else v for k, v in result.items() }
        print json.dumps(result, sort_keys=True, indent=4 * ' ')