Beispiel #1
0
def _show_schedule(job_id, json_flag=False):
    """
    :param job_id: Id of the job
    :type job_id: str
    :returns: process return code
    :rtype: int
    """

    try:
        client = metronome.create_client()
        json_schedule = client.get_schedules(job_id)
    except DCOSHTTPException as e:
        if e.response.status_code == 404:
            raise DCOSException("Job ID: '{}' does NOT exist.".format(job_id))
        else:
            raise DCOSException(e)
    except DCOSException as e:
        raise DCOSException(e)

    if json_flag:
        emitter.publish(json_schedule)
    else:
        table = tables.schedule_table(json_schedule)
        output = six.text_type(table)
        if output:
            emitter.publish(output)

    return 0
Beispiel #2
0
def _show_schedule(job_id, json_flag=False):
    """
    :param job_id: Id of the job
    :type job_id: str
    :returns: process return code
    :rtype: int
    """

    response = None
    url = "{}/{}/schedules".format(_get_api_url('v1/jobs'), job_id)
    try:
        response = _do_request(url, 'GET')
    except DCOSException as e:
        raise DCOSException(e)

    json_schedule = _read_http_response_body(response)
    if json_flag:
        emitter.publish(json_schedule)
    else:
        table = tables.schedule_table(json_schedule)
        output = six.text_type(table)
        if output:
            emitter.publish(output)

    return 0
Beispiel #3
0
def _show_schedule(job_id, json_flag=False):
    """
    :param job_id: Id of the job
    :type job_id: str
    :returns: process return code
    :rtype: int
    """

    response = None
    url = "{}/{}/schedules".format(_get_api_url('v1/jobs'), job_id)
    try:
        response = _do_request(url, 'GET')
    except DCOSHTTPException as e:
        if e.response.status_code == 404:
            raise DCOSException("Job ID: '{}' does NOT exist.".format(job_id))
        else:
            raise DCOSException(e)
    except DCOSException as e:
        raise DCOSException(e)

    json_schedule = _read_http_response_body(response)
    if json_flag:
        emitter.publish(json_schedule)
    else:
        table = tables.schedule_table(json_schedule)
        output = six.text_type(table)
        if output:
            emitter.publish(output)

    return 0
Beispiel #4
0
def _show_schedule(job_id, json_flag=False):
    """
    :param job_id: Id of the job
    :type job_id: str
    :returns: process return code
    :rtype: int
    """

    try:
        client = metronome.create_client()
        json_schedule = client.get_schedules(job_id)
    except DCOSHTTPException as e:
        if e.response.status_code == 404:
            raise DCOSException("Job ID: '{}' does NOT exist.".format(job_id))
        else:
            raise DCOSException(e)
    except DCOSException as e:
        raise DCOSException(e)

    if json_flag:
        emitter.publish(json_schedule)
    else:
        table = tables.schedule_table(json_schedule)
        output = six.text_type(table)
        if output:
            emitter.publish(output)

    return 0