Skip to content

Commit

Permalink
adding datetime to results objects to help with reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonnfaherty committed Aug 5, 2022
1 parent 01b077d commit 74851af
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[tool.poetry]
name = "aws-service-catalog-puppet"
version = "0.184.0"
version = "0.185.0"
description = "Making it easier to deploy ServiceCatalog products"
classifiers = ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Natural Language :: English"]
homepage = "https://service-catalog-tools-workshop.com/"
Expand Down
1 change: 0 additions & 1 deletion servicecatalog_puppet/commands/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ def validate(f):
for tag in account.get("overwrite", {}).get("tags", []):
tags_defined_by_accounts[tag] = True


for collection_type in constants.ALL_SECTION_NAMES:
collection_to_check = manifest.get(collection_type, {})
for collection_name, collection_item in collection_to_check.items():
Expand Down
20 changes: 16 additions & 4 deletions servicecatalog_puppet/workflow/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,23 @@ def run_tasks(
config.get_puppet_role_arn(current_account_id),
f"{current_account_id}-{config.get_puppet_role_name()}",
) as events:
batches = [entries[i * constants.EVENTBRIDGE_MAX_EVENTS_PER_CALL:(i + 1) * constants.EVENTBRIDGE_MAX_EVENTS_PER_CALL] for i in range((len(entries) + constants.EVENTBRIDGE_MAX_EVENTS_PER_CALL - 1) // constants.EVENTBRIDGE_MAX_EVENTS_PER_CALL)]
for batch in batches:
events.put_events(
Entries=batch
batches = [
entries[
i
* constants.EVENTBRIDGE_MAX_EVENTS_PER_CALL : (i + 1)
* constants.EVENTBRIDGE_MAX_EVENTS_PER_CALL
]
for i in range(
(
len(entries)
+ constants.EVENTBRIDGE_MAX_EVENTS_PER_CALL
- 1
)
// constants.EVENTBRIDGE_MAX_EVENTS_PER_CALL
)
]
for batch in batches:
events.put_events(Entries=batch)
time.sleep(1)
logging.info(f"Finished sending {len(entries)} events to eventbridge")

Expand Down
2 changes: 2 additions & 0 deletions servicecatalog_puppet/workflow/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import traceback
from pathlib import Path
from datetime import datetime

import luigi
import psutil
Expand Down Expand Up @@ -296,6 +297,7 @@ def record_event(event_type, task, extra_event_data=None):
"task_type": task_type,
"task_params": task_params,
"params_for_results": task.params_for_results_display(),
"datetime": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
}
if extra_event_data is not None:
event.update(extra_event_data)
Expand Down

0 comments on commit 74851af

Please sign in to comment.