StackStorm / st2

StackStorm (aka "IFTTT for Ops") is event-driven automation for auto-remediation, incident responses, troubleshooting, deployments, and more for DevOps and SREs. Includes rules engine, workflow, 160 integration packs with 6000+ actions (see https://exchange.stackstorm.org) and ChatOps. Installer at https://docs.stackstorm.com/install/index.html
https://stackstorm.com/
Apache License 2.0
6.07k stars 749 forks source link

print elapsed time in user friendly format instead of seconds on cli #4944

Open Sheshagiri opened 4 years ago

Sheshagiri commented 4 years ago

This is not a bug but just a small user experience improvement.

When we get the status of execution using the st2 cli time is mentioned in seconds it would be nice to print time in a user-friendly format.

image

ex: running (339s elapsed), could be: running (5m39s elapsed)

I'll try to make a pr with the changes if its okay.

arm4b commented 4 years ago

Yeah, makes better sense for CLI representation.

winem commented 4 years ago

Hi,

the PR implements the requested change with a small deviation. The elapsed time will look like this: (0:01:12 hours elapsed) or (1 day, 2:03:23 hours elapsed) instead of (1m12s elapsed). The reason is that this is the default presentation of datetime.timedelta.

Please let me know if this is not convenient enough and you prefer the requested format. In that case I add a few lines code to change the format.

Sheshagiri commented 4 years ago

@winem thanks a lot for the pr. This is definitely better than just the number of seconds, that said while we are at this I think it would be a nice idea to having it something like 5d6h7m8s.

winem commented 4 years ago

Hi @Sheshagiri, I updated the PR and the elapsed time will be presented as requested. Guess it's the right thing to do when we're talking about a more user friendly format and my priority on "less code" was not the right one in this case. :)

shree-crypto commented 2 weeks ago

is this open ? i am new to opensource and would like this to be my first contribution if its possible !!!