Skip to content

Commit

Permalink
refactor: Capture only cause Exception and not when cancelling
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Sep 25, 2023
1 parent 1001043 commit fcb7bfb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions posthog/temporal/workflows/bigquery_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ async def run(self, inputs: BigQueryBatchExportInputs):

except exceptions.ActivityError as e:
if isinstance(e.cause, exceptions.CancelledError):
logger.exception("BigQuery BatchExport was cancelled.", exc_info=e)
logger.error("BigQuery BatchExport was cancelled.")
update_inputs.status = "Cancelled"
else:
logger.exception("BigQuery BatchExport failed.", exc_info=e)
logger.exception("BigQuery BatchExport failed.", exc_info=e.cause)
update_inputs.status = "Failed"

update_inputs.latest_error = str(e.cause)
Expand Down
4 changes: 2 additions & 2 deletions posthog/temporal/workflows/postgres_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ async def run(self, inputs: PostgresBatchExportInputs):

except exceptions.ActivityError as e:
if isinstance(e.cause, exceptions.CancelledError):
logger.exception("Postgres BatchExport was cancelled.", exc_info=e)
logger.error("Postgres BatchExport was cancelled.")
update_inputs.status = "Cancelled"
else:
logger.exception("Postgres BatchExport failed.", exc_info=e)
logger.exception("Postgres BatchExport failed.", exc_info=e.cause)
update_inputs.status = "Failed"

update_inputs.latest_error = str(e.cause)
Expand Down
4 changes: 2 additions & 2 deletions posthog/temporal/workflows/s3_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ async def run(self, inputs: S3BatchExportInputs):

except exceptions.ActivityError as e:
if isinstance(e.cause, exceptions.CancelledError):
logger.exception("S3 BatchExport was cancelled.", exc_info=e)
logger.error("S3 BatchExport was cancelled.")
update_inputs.status = "Cancelled"
else:
logger.exception("S3 BatchExport failed.", exc_info=e)
logger.exception("S3 BatchExport failed.", exc_info=e.cause)
update_inputs.status = "Failed"

update_inputs.latest_error = str(e.cause)
Expand Down
4 changes: 2 additions & 2 deletions posthog/temporal/workflows/snowflake_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@ async def run(self, inputs: SnowflakeBatchExportInputs):

except exceptions.ActivityError as e:
if isinstance(e.cause, exceptions.CancelledError):
logger.exception("Snowflake BatchExport was cancelled.", exc_info=e)
logger.error("Snowflake BatchExport was cancelled.")
update_inputs.status = "Cancelled"
else:
logger.exception("Snowflake BatchExport failed.", exc_info=e)
logger.exception("Snowflake BatchExport failed.", exc_info=e.cause)
update_inputs.status = "Failed"

update_inputs.latest_error = str(e.cause)
Expand Down

0 comments on commit fcb7bfb

Please sign in to comment.