generates a reql cursor for plugin_name
    with status ready
    and prepares to sort by StartTime
    :param plugin_name:
    :param location:
    :param port:
    :return:

def _jobs_cursor(plugin_name, location=None, port=None, custom=None):
    """
    generates a reql cursor for plugin_name
    with status ready
    and prepares to sort by StartTime
    :param plugin_name:
    :param location:
    :param port:
    :return:
    """
    cur = RBJ.get_all(READY, index=STATUS_FIELD)
    cur_filter = (r.row[TARGET_FIELD][PLUGIN_NAME_KEY] == plugin_name)
    cur_filter = cur_filter & \
                 (~r.row.has_fields(EXPIRE_FIELD) |
                  r.row[EXPIRE_FIELD].ge(time()))
    if location:
        cur_filter = cur_filter & \
                     (r.row[TARGET_FIELD][LOCATION_FIELD] == location)
    if port:
        cur_filter = cur_filter & \
                     (r.row[TARGET_FIELD][PORT_FIELD] == port)
    if custom:
        cur_filter = cur_filter & custom
    return cur.filter(cur_filter).order_by(START_FIELD)