st2client/st2client/commands/action.py
def format_execution_status(instance):
    """
    Augment instance "status" attribute with number of seconds which have elapsed for all the
    executions which are in running state and execution total run time for all the executions
    which have finished.
    """
    start_timestamp = getattr(instance, 'start_timestamp', None)
    end_timestamp = getattr(instance, 'end_timestamp', None)

    if instance.status == LIVEACTION_STATUS_RUNNING and start_timestamp:
        start_timestamp = instance.start_timestamp
        start_timestamp = parse_isotime(start_timestamp)
        start_timestamp = calendar.timegm(start_timestamp.timetuple())
        now = int(time.time())
        elapsed_seconds = (now - start_timestamp)
        instance.status = '%s (%ss elapsed)' % (instance.status, elapsed_seconds)
    elif instance.status in LIVEACTION_COMPLETED_STATES and start_timestamp and end_timestamp:
        start_timestamp = parse_isotime(start_timestamp)
        start_timestamp = calendar.timegm(start_timestamp.timetuple())
        end_timestamp = parse_isotime(end_timestamp)
        end_timestamp = calendar.timegm(end_timestamp.timetuple())

        elapsed_seconds = (end_timestamp - start_timestamp)
        instance.status = '%s (%ss elapsed)' % (instance.status, elapsed_seconds)

    return instance

    Augment instance "status" attribute with number of seconds which have elapsed for all the
    executions which are in running state and execution total run time for all the executions
    which have finished.
    
Augment instance "status" attribute with number of seconds which have elapsed for all the
executions which are in running state and execution total run time for all the executions
which have finished.
Augment instance " status " attribute with number of seconds which have elapsed for all the executions which are in running state and execution total run time for all the executions which have finished .
def format_execution_status(instance):
    start_timestamp = getattr(instance, 'start_timestamp', None)
    end_timestamp = getattr(instance, 'end_timestamp', None)
    if instance.status == LIVEACTION_STATUS_RUNNING and start_timestamp:
        start_timestamp = instance.start_timestamp
        start_timestamp = parse_isotime(start_timestamp)
        start_timestamp = calendar.timegm(start_timestamp.timetuple())
        now = int(time.time())
        elapsed_seconds = (now - start_timestamp)
        instance.status = '%s (%ss elapsed)' % (instance.status, elapsed_seconds)
    elif instance.status in LIVEACTION_COMPLETED_STATES and start_timestamp and end_timestamp:
        start_timestamp = parse_isotime(start_timestamp)
        start_timestamp = calendar.timegm(start_timestamp.timetuple())
        end_timestamp = parse_isotime(end_timestamp)
        end_timestamp = calendar.timegm(end_timestamp.timetuple())
        elapsed_seconds = (end_timestamp - start_timestamp)
        instance.status = '%s (%ss elapsed)' % (instance.status, elapsed_seconds)
    return instance
def format_execution_status ( instance ) : start_timestamp = getattr ( instance , 'start_timestamp' , None ) end_timestamp = getattr ( instance , 'end_timestamp' , None ) if instance . status == LIVEACTION_STATUS_RUNNING and start_timestamp : start_timestamp = instance . start_timestamp start_timestamp = parse_isotime ( start_timestamp ) start_timestamp = calendar . timegm ( start_timestamp . timetuple ( ) ) now = int ( time . time ( ) ) elapsed_seconds = ( now - start_timestamp ) instance . status = '%s (%ss elapsed)' % ( instance . status , elapsed_seconds ) elif instance . status in LIVEACTION_COMPLETED_STATES and start_timestamp and end_timestamp : start_timestamp = parse_isotime ( start_timestamp ) start_timestamp = calendar . timegm ( start_timestamp . timetuple ( ) ) end_timestamp = parse_isotime ( end_timestamp ) end_timestamp = calendar . timegm ( end_timestamp . timetuple ( ) ) elapsed_seconds = ( end_timestamp - start_timestamp ) instance . status = '%s (%ss elapsed)' % ( instance . status , elapsed_seconds ) return instance
Augment instance "status" attribute with number of seconds which have elapsed for all the
executions which are in running state and execution total run time for all the executions
which have finished.
Augment instance " status " attribute with number of seconds which have elapsed for all the executions which are in running state and execution total run time for all the executions which have finished .
"""
    Augment instance "status" attribute with number of seconds which have elapsed for all the
    executions which are in running state and execution total run time for all the executions
    which have finished.
    """
instance