'Some sanity checks that all runners\' queue_job() methods are likely to want to do'

def prepare_job(self, job_wrapper, include_metadata=False, include_work_dir_outputs=True, modify_command_for_container=True):

    job_id = job_wrapper.get_id_tag()
    job_state = job_wrapper.get_state()
    job_wrapper.is_ready = False
    job_wrapper.runner_command_line = None
    if (job_state == model.Job.states.DELETED):
        log.debug(('(%s)    Job    deleted    by    user    before    it    entered    the    %s    queue' % (job_id, self.runner_name)))
        if (self.app.config.cleanup_job in ('always', 'onsuccess')):
            job_wrapper.cleanup()
        return False
    elif (job_state != model.Job.states.QUEUED):
        log.info(('(%s)    Job    is    in    state    %s,    skipping    execution' % (job_id, job_state)))
        return False
    try:
        job_wrapper.prepare()
        job_wrapper.runner_command_line = self.build_command_line(job_wrapper, include_metadata=include_metadata, include_work_dir_outputs=include_work_dir_outputs, modify_command_for_container=modify_command_for_container)
    except Exception as e:
        log.exception(('(%s)    Failure    preparing    job' % job_id))
        job_wrapper.fail((e.message if hasattr(e, 'message') else 'Job    preparation    failed'), exception=True)
        return False
    if (not job_wrapper.runner_command_line):
        job_wrapper.finish('', '')
        return False
    return True
