Skip to content

Commit

Permalink
add columns + rearrange
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentclaes committed May 2, 2022
1 parent ae20c3f commit 675781e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions stepview/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class States:
succeeded_perc: str
failed: str
running: str
aborted: str
timed_out: str
throttled: str


@dataclass
Expand Down Expand Up @@ -54,14 +57,17 @@ def get_difference_in_seconds(self):

def main(aws_profiles: list, period: str):
table = Table()
table.add_column("State Machine", justify="right")
table.add_column("StateMachine", justify="left", overflow="fold")
table.add_column("Profile")
table.add_column("Account")
table.add_column("Region")
table.add_column("Total")
table.add_column("Succeed (%)")
table.add_column("Failed")
table.add_column("Running")
table.add_column("Failed")
table.add_column("Aborted")
table.add_column("TimedOut")
table.add_column("Throttled")
for profile_name in aws_profiles:
sfn_client = boto3.Session(profile_name=profile_name).client("stepfunctions")
cloudwatch_resource = boto3.Session(profile_name=profile_name).resource("cloudwatch")
Expand Down Expand Up @@ -97,8 +103,11 @@ def main(aws_profiles: list, period: str):
region,
f"{states.total_executions:,.0f}",
f"{states.succeeded_perc:,.2f}",
f"{states.failed:,.0f}",
f"{states.running:,.0f}",
f"{states.failed:,.0f}",
f"{states.aborted:,.0f}",
f"{states.timed_out:,.0f}",
f"{states.throttled:,.0f}",
)
else:
logger.info(f"no statemachines found for profile {profile_name}")
Expand Down Expand Up @@ -208,6 +217,9 @@ def get_data_from_cloudwatch(cloudwatch_resource: object, state_machine_arn: str
succeeded_perc=succeeded_perc,
failed=failed,
running=running,
aborted=aborted,
timed_out=timed_out,
throttled=throttled
)

#
Expand Down

0 comments on commit 675781e

Please sign in to comment.