def _get_machine_info(parallel, sys_config, dirs, config):
    """Get machine resource information from the job scheduler via either the command line or the queue.
    """
    if parallel.get("queue") and parallel.get("scheduler"):
        # dictionary as switch statement; can add new scheduler implementation functions as (lowercase) keys
        sched_info_dict = {
                            "slurm": _slurm_info,
                            "torque": _torque_info,
                            "sge": _sge_info
                          }
        if parallel["scheduler"].lower() in sched_info_dict:
            try:
                return sched_info_dict[parallel["scheduler"].lower()](parallel.get("queue", ""))
            except:
                # If something goes wrong, just hit the queue
                logger.exception("Couldn't get machine information from resource query function for queue "
                                 "'{0}' on scheduler \"{1}\"; "
                                 "submitting job to queue".format(parallel.get("queue", ""), parallel["scheduler"]))
        else:
            logger.info("Resource query function not implemented for scheduler \"{0}\"; "
                         "submitting job to queue".format(parallel["scheduler"]))
    from bcbio.distributed import prun
    with prun.start(parallel, [[sys_config]], config, dirs) as run_parallel:
        return run_parallel("machine_info", [[sys_config]])
Get machine resource information from the job scheduler via either the command line or the queue.