Skip to content

Commit ecb183e

Browse files
committed
Return JSON to stdout from CLI
1 parent 60780ad commit ecb183e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

beam/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ def run_datatractor():
214214
try:
215215
ret = func(**vars(args))
216216
if ret is not None and len(ret) > 0:
217+
try:
218+
ret = json.dumps(ret)
219+
except json.JSONDecodeError:
220+
pass
217221
print(ret)
218222
except RuntimeError as e:
219223
print(e)
@@ -507,7 +511,7 @@ def fetch_registered_extractors(
507511
)
508512
elif len(extractors) > 0:
509513
logger.info("Discovered the following extractors: %s.", extractors)
510-
return extractors
514+
return {"id": input_type, "registered_extractors": extractors}
511515

512516

513517
class ExtractorPlan:

0 commit comments

Comments
 (0)