Skip to content

Commit b88ae4c

Browse files
author
Tom Reitz
committed
add comment to structure output
1 parent d4a61dd commit b88ae4c

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

lightbeam/lightbeam.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ def __init__(self, config_file, logger=None, selector="*", exclude="", keep_keys
133133
def replace_linebreaks(self, m):
134134
return re.sub(r"\s+", '', m.group(0))
135135

136-
def write_structured_output(self):
136+
def write_structured_output(self, command):
137137
### Create structured output results_file if necessary
138138
self.end_timestamp = datetime.now()
139139
self.metadata.update({
140+
"command": command,
140141
"completed_at": self.end_timestamp.isoformat(timespec='microseconds'),
141142
"runtime_sec": (self.end_timestamp - self.start_timestamp).total_seconds(),
142143
"total_records_processed": sum(item['records_processed'] for item in self.metadata["resources"].values()),

lightbeam/send.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def send(self):
3636
self.lightbeam.log_status_reasons()
3737

3838
# write structured output (if needed)
39-
self.lightbeam.write_structured_output()
39+
self.lightbeam.write_structured_output("send")
4040

4141
if self.lightbeam.metadata["total_records_processed"] == self.lightbeam.metadata["total_records_skipped"]:
4242
self.logger.info("all payloads skipped")

lightbeam/validate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def validate(self):
6868
asyncio.run(self.validate_endpoint(endpoint))
6969

7070
# write structured output (if needed)
71-
self.lightbeam.write_structured_output()
71+
self.lightbeam.write_structured_output("validate")
7272

7373
if self.lightbeam.metadata["total_records_processed"] == self.lightbeam.metadata["total_records_failed"]:
7474
self.logger.info("all payloads failed")

0 commit comments

Comments
 (0)