Exemple #1
0
def format_instance_status(instance):
    """Formats the instance status field"""
    status_text = format_state(instance['status'])
    if 'reason_string' in instance:
        parenthetical_text = ' (%s)' % colors.reason(instance['reason_string'])
    elif 'progress' in instance and instance['progress'] > 0:
        parenthetical_text = ' (%s%%)' % instance['progress']
    else:
        parenthetical_text = ''

    return '%s%s' % (status_text, parenthetical_text)
Exemple #2
0
def submit_failed_message(cluster_name, reason):
    """Generates a failed submission message with the given cluster name and reason"""
    return 'Job submission %s on %s:\n%s' % (
        colors.failed('failed'), cluster_name, colors.reason(reason))