submit_parser=cmdparser.add_parser('submit',aliases=['sub'],help='Submits jobs to the SGE queue or to the local job scheduler and logs them in a database.')
submit_parser.add_argument('-q','--queue',metavar='QNAME',dest='qname',default='all.q',help='the name of the SGE queue to submit the job to')
submit_parser.add_argument('-m','--memory',help='Sets both the h_vmem and the mem_free parameters when submitting the job to the specified value, e.g. 8G to set the memory requirements to 8 gigabytes')
submit_parser.add_argument('-n','--name',dest='name',help='Sets the jobname')
submit_parser.add_argument('-n','--name',dest='name',help='Gives the job a name')
submit_parser.add_argument('-x','--dependencies',type=int,default=[],metavar='ID',nargs='*',help='Set job dependencies to the list of job identifiers separated by spaces')
submit_parser.add_argument('-k','--stop-on-failure',action='store_true',help='Stop depending jobs when this job finished with an error.')
submit_parser.add_argument('-l','--log-dir',metavar='DIR',help='Sets the log directory. By default, "logs" is selected for the SGE. If the jobs are executed locally, by default the result is written to console.')
report_parser=cmdparser.add_parser('report',aliases=['rep','r'],help='Iterates through the result and error log files and prints out the logs.')
report_parser.add_argument('-e','--errors-only',action='store_true',help='Only report the error logs (by default, both logs are reported).')
report_parser.add_argument('-o','--output-only',action='store_true',help='Only report the output logs (by default, both logs are reported).')
report_parser.add_argument('-u','--unfinished-also',action='store_true',help='Report also the unfinished jobs.')
report_parser.add_argument('-u','--unfinished-also',action='store_true',help='Report also the unfinished jobs; use this option also to check error files for jobs with success status.')
report_parser.add_argument('-j','--job-ids',metavar='ID',nargs='*',type=int,help='Report only the jobs with the given ids (by default, all finished jobs are reported)')
report_parser.add_argument('-a','--array-ids',metavar='ID',nargs='*',type=int,help='Report only the jobs with the given array ids. If specified, a single job-id must be given as well.')
delete_parser.add_argument('-a','--array-ids',metavar='ID',nargs='*',type=int,help='Delete only the jobs with the given array ids. If specified, a single job-id must be given as well. Note that the whole job including all array jobs will be removed from the SGE queue.')
delete_parser.add_argument('-r','--keep-logs',action='store_true',help='If set, the log files will NOT be removed.')
delete_parser.add_argument('-R','--keep-log-dir',action='store_true',help='When removing the logs, keep the log directory.')
delete_parser.add_argument('-s','--status',nargs='+',choices=Status,default=Status,help='Delete only jobs that have the given stati; by default all jobs are deleted.')
delete_parser.add_argument('-s','--status',nargs='+',choices=Status,default=Status,help='Delete only jobs that have the given statuses; by default all jobs are deleted.')