Skip to content

Commit

Permalink
fix: airbyte sources more resilient: ignore printed non airbyte messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul MARCOMBES committed Sep 7, 2023
1 parent 43c98d0 commit dcaffc2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__pycache__/
airbyte_serverless.egg-info/
dist/
dist/
TODO.md
5 changes: 3 additions & 2 deletions airbyte_serverless/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ def _run(self, action, state=None):
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
for line in iter(process.stdout.readline, b""):
content = line.decode().strip()
if not content:
try:
message = json.loads(content)
except:
continue
message = json.loads(content)
if message.get('trace', {}).get('error'):
raise AirbyteSourceException(json.dumps(message['trace']['error']))
yield message
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import setuptools


VERSION = '0.3'
VERSION = '0.6'


with open('README.md', 'r', encoding='utf-8') as fh:
Expand Down

0 comments on commit dcaffc2

Please sign in to comment.