# Path: jobs/sge_jobs.py
# class DbJob(db.UserDb):
#     def __init__(self):
#     def get_job_table(self, state_filter, limit = 50, offset = 0,
#                       cmd_filter = None):
#     def get_accounting_table(self, limit = 50, offset = 0, job_ids = None):
#     def pending_request(self, limit = 16, offset = 0):
#     def _add_request(self, jobname, run_cmd, args, max_vmem, cpu_bound, force):
#     def add_request(self, jobname, run_cmd, args,  max_vmem,
#                     cpu_bound = True, force = False):
#     def exec_request(self, r):
#     def run_batch(self, nr_running, limit = 16):
#     def _exec_check(self, request):
#     def check_running(self):
#     def search_accounting(self, jobs, last_time_day = 2):
#     def update_accounting(self):
# def quote_arg(arg):
# def job_cmdline_arg(request, cmd):
# def sge_cmdline_arg(request):


import sys
import os
from jobs import sge_jobs
        'args' : [
            os.path.expanduser('~/phe/ocr/ocr_djvu.py'),
            '-lang:' + lang,
            '' + filename
            ],
        'max_vmem' : 2048,
        }

    db_obj = sge_jobs.DbJob()

    print job_req

    db_obj.add_request(**job_req)

def prepare_ocr_request(lang, filename):
    print "preparing", lang, filename
    if not os.path.exists(filename):
        print >> sys.stderr, "file:", filename, "doesn't exist"
        exit(1)
    add_ocr_request(lang, filename)

if __name__ == "__main__":
    filenames = []
    lang = None
    for arg in sys.argv[1:]:
        if arg.startswith('-lang:'):
            lang = arg[len('-lang:'):]
        else:
            filenames.append(arg)


# Path: jobs/sge_jobs.py
# class DbJob(db.UserDb):
#     def __init__(self):
#     def get_job_table(self, state_filter, limit = 50, offset = 0,
#                       cmd_filter = None):
#     def get_accounting_table(self, limit = 50, offset = 0, job_ids = None):
#     def pending_request(self, limit = 16, offset = 0):
#     def _add_request(self, jobname, run_cmd, args, max_vmem, cpu_bound, force):
#     def add_request(self, jobname, run_cmd, args,  max_vmem,
#                     cpu_bound = True, force = False):
#     def exec_request(self, r):
#     def run_batch(self, nr_running, limit = 16):
#     def _exec_check(self, request):
#     def check_running(self):
#     def search_accounting(self, jobs, last_time_day = 2):
#     def update_accounting(self):
# def quote_arg(arg):
# def job_cmdline_arg(request, cmd):
# def sge_cmdline_arg(request):


# Path: ocr/queue_ocr.py
import sys
import os
from jobs import sge_jobs

        'args' : [
            os.path.expanduser('~/phe/ocr/ocr_djvu.py'),
            '-lang:' + lang,
            '' + filename
            ],
        'max_vmem' : 2048,
        }

    db_obj = sge_jobs.DbJob()

    print job_req

    db_obj.add_request(**job_req)

def prepare_ocr_request(lang, filename):
    print "preparing", lang, filename
    if not os.path.exists(filename):
        print >> sys.stderr, "file:", filename, "doesn't exist"
        exit(1)
    add_ocr_request(lang, filename)

if __name__ == "__main__":
    filenames = []
    lang = None
    for arg in sys.argv[1:]:
        if arg.startswith('-lang:'):
            lang = arg[len('-lang:'):]
        else:
            filenames.append(arg)


    if not lang: