Skip to content

Commit

Permalink
Catch Dask client shutdown error (#869)
Browse files Browse the repository at this point in the history
A component in my pipeline failed due to an error during the 
client shutdown. While this is not ideal, it should not make
the component fail.

I'm just wondering if we should fix it one level up and wrap the
`component.teardown()` method in the `try ... exctept ...` block
instead.
  • Loading branch information
RobbeSneyders authored Feb 21, 2024
1 parent a172ab3 commit 5a4a64c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/fondant/component/component.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module defines interfaces which components should implement to be executed by fondant."""
import logging
import os
import typing as t
from abc import abstractmethod
Expand Down Expand Up @@ -57,7 +58,12 @@ def setup(self) -> t.Any:
return Client(cluster)

def teardown(self, client: t.Any) -> None:
return client.shutdown()
try:
client.shutdown()
except Exception:
msg = "Caught error while shutting down Client. Exiting anyway."
logging.exception(msg)
pass


class DaskLoadComponent(DaskComponent):
Expand Down

0 comments on commit 5a4a64c

Please sign in to comment.