# Path: memsql_loader/util/command.py
# class Command(object):
#     def __init__(self, options):
#         self.options = options
#         self.ensure_bootstrapped()
#         self.run()
# 
#     @staticmethod
#     def configure(parser, subparsers):
#         raise NotImplemented('Every command needs a static configure(...) method')
# 
#     def ensure_bootstrapped(self):
#         if not bootstrap.check_bootstrapped():
#             bootstrap.bootstrap()
# 
#     def run():
#         raise NotImplemented('Every command needs a run method, otherwise not much is going to happen')
# 
# Path: memsql_loader/util/log.py
# def setup(log_path=None, stdout_enabled=True):
# def update_verbosity(debug=False, extra_verbose=False):
#     def __call__(self, parser, namespace, value, option_string=None):
#     def __call__(self, parser, namespace, value, option_string=None):
#     def __call__(self, parser, namespace, value, option_string=None):
# def configure(parser):
# def get_logger(name, level=None):
#     def format(self, record):
#     def __init__(self, name, level=logging.DEBUG):
# class _SetDebug(argparse.Action):
# class _SetStdout(argparse.Action):
# class _SetLogPath(argparse.Action):
# class Formatter(logging.Formatter):
# class Logger(logging.Logger):
# 
# Path: memsql_loader/util/super_json.py
# def simplejson_datetime_serializer(obj):
# def _set_defaults(kwargs):
# def dumps(data, **kwargs):
# def loads(data, **kwargs):
# def safe_loads(data, default, **kwargs):
# def pformat(d):
# 
# Path: memsql_loader/api/exceptions.py
# class ApiException(Exception):
# class DBConnectionIssue(ApiException):
# class DBError(ApiException):
#     def __str__(self):
#     def __init__(self, *args):
#     def __str__(self):
# 
# Path: memsql_loader/api/task.py
# class Task(Api):
#     validate = V.Schema({
#         V.Required('task_id'): int
#     })
# 
#     def _execute(self, params):
#         generated_sql, query_params = self._generate_sql(params)
# 
#         task_row = self._db_get('''
#             SELECT *, %(state_projection)s AS state
#             FROM tasks
#             WHERE
#                 %(task_id_predicate)s
#             LIMIT 1
#         ''' % generated_sql, **query_params)
# 
#         if not task_row:
#             raise exceptions.ApiException('No task found with id `%s`' % params['task_id'])
# 
#         return shared.task_load_row(task_row)
# 
#     def _generate_sql(self, params):
#         query_params = shared.TaskState.projection_params()
#         return { k: v or '' for k, v in {
#             'task_id_predicate': self._task_id_predicate(params, query_params),
#             'state_projection': shared.TaskState.PROJECTION,
#         }.iteritems() }, query_params
# 
#     def _task_id_predicate(self, params, query_params):
#         query_params['task_id_predicate'] = params['task_id']
#         return 'tasks.id = :task_id_predicate'


import sys
from clark.super_enum import SuperEnum
from memsql_loader.util.command import Command
from memsql_loader.util import log, super_json as json
from memsql_loader.api import exceptions
from memsql_loader.api.task import Task as TaskApi




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')

# Path: memsql_loader/util/command.py
# class Command(object):
#     def __init__(self, options):
#         self.options = options
#         self.ensure_bootstrapped()
#         self.run()
# 
#     @staticmethod
#     def configure(parser, subparsers):
#         raise NotImplemented('Every command needs a static configure(...) method')
# 
#     def ensure_bootstrapped(self):
#         if not bootstrap.check_bootstrapped():
#             bootstrap.bootstrap()
# 
#     def run():
#         raise NotImplemented('Every command needs a run method, otherwise not much is going to happen')
# 
# Path: memsql_loader/util/log.py
# def setup(log_path=None, stdout_enabled=True):
# def update_verbosity(debug=False, extra_verbose=False):
#     def __call__(self, parser, namespace, value, option_string=None):
#     def __call__(self, parser, namespace, value, option_string=None):
#     def __call__(self, parser, namespace, value, option_string=None):
# def configure(parser):
# def get_logger(name, level=None):
#     def format(self, record):
#     def __init__(self, name, level=logging.DEBUG):
# class _SetDebug(argparse.Action):
# class _SetStdout(argparse.Action):
# class _SetLogPath(argparse.Action):
# class Formatter(logging.Formatter):
# class Logger(logging.Logger):
# 
# Path: memsql_loader/util/super_json.py
# def simplejson_datetime_serializer(obj):
# def _set_defaults(kwargs):
# def dumps(data, **kwargs):
# def loads(data, **kwargs):
# def safe_loads(data, default, **kwargs):
# def pformat(d):
# 
# Path: memsql_loader/api/exceptions.py
# class ApiException(Exception):
# class DBConnectionIssue(ApiException):
# class DBError(ApiException):
#     def __str__(self):
#     def __init__(self, *args):
#     def __str__(self):
# 
# Path: memsql_loader/api/task.py
# class Task(Api):
#     validate = V.Schema({
#         V.Required('task_id'): int
#     })
# 
#     def _execute(self, params):
#         generated_sql, query_params = self._generate_sql(params)
# 
#         task_row = self._db_get('''
#             SELECT *, %(state_projection)s AS state
#             FROM tasks
#             WHERE
#                 %(task_id_predicate)s
#             LIMIT 1
#         ''' % generated_sql, **query_params)
# 
#         if not task_row:
#             raise exceptions.ApiException('No task found with id `%s`' % params['task_id'])
# 
#         return shared.task_load_row(task_row)
# 
#     def _generate_sql(self, params):
#         query_params = shared.TaskState.projection_params()
#         return { k: v or '' for k, v in {
#             'task_id_predicate': self._task_id_predicate(params, query_params),
#             'state_projection': shared.TaskState.PROJECTION,
#         }.iteritems() }, query_params
# 
#     def _task_id_predicate(self, params, query_params):
#         query_params['task_id_predicate'] = params['task_id']
#         return 'tasks.id = :task_id_predicate'


# Path: memsql_loader/cli/task.py
import sys
from clark.super_enum import SuperEnum
from memsql_loader.util.command import Command
from memsql_loader.util import log, super_json as json
from memsql_loader.api import exceptions
from memsql_loader.api.task import Task as TaskApi





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()