Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/for_pandas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Please refer to :func:`~gokart.task.TaskOnKart.load`.
Fail on empty DataFrame
-----------------------

When the :attr:`~gokart.task.TaskOnKart.fail_on_empty_dump` parameter is true, the :func:`~gokart.task.TaskOnKart.dump()` method raises :class:`~gokart.task.EmptyDumpError` on trying to dump empty ``pandas.DataFrame``.
When the :attr:`~gokart.task.TaskOnKart.fail_on_empty_dump` parameter is true, the :func:`~gokart.task.TaskOnKart.dump()` method raises :class:`~gokart.errors.EmptyDumpError` on trying to dump empty ``pandas.DataFrame``.


.. code:: python
Expand Down
8 changes: 5 additions & 3 deletions gokart/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ def __exit__(self, exception_type, exception_value, traceback):


class GokartBuildError(Exception):
def __init__(self, messsage, raised_exceptions: dict[str, list[Exception]]):
super().__init__(messsage)
"""Raised when ``gokart.build`` failed. This exception contains raised exceptions in the task execution."""

def __init__(self, message, raised_exceptions: dict[str, list[Exception]]):
super().__init__(message)
self.raised_exceptions = raised_exceptions


class HasLockedTaskException(Exception):
pass
"""Raised when the task failed to acquire the lock in the task execution."""


class TaskLockExceptionRaisedFlag:
Expand Down
1 change: 1 addition & 0 deletions gokart/conflict_prevention_lock/task_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TaskLockParams(NamedTuple):

class TaskLockException(Exception):
pass
"""Raised when the task failed to acquire the lock in the task execution. Only used internally."""


class RedisClient:
Expand Down
10 changes: 10 additions & 0 deletions gokart/errors/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from gokart.build import GokartBuildError, HasLockedTaskException
from gokart.pandas_type_config import PandasTypeError
from gokart.task import EmptyDumpError

__all__ = [
'GokartBuildError',
'HasLockedTaskException',
'PandasTypeError',
'EmptyDumpError',
]
2 changes: 1 addition & 1 deletion gokart/pandas_type_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class PandasTypeError(Exception):
pass
"""Raised when the type of the pandas DataFrame column is not as expected."""


class PandasTypeConfig(luigi.Config):
Expand Down
17 changes: 14 additions & 3 deletions gokart/slack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
from gokart.slack.event_aggregator import EventAggregator # noqa:F401
from gokart.slack.slack_api import SlackAPI # noqa:F401
from gokart.slack.slack_config import SlackConfig # noqa:F401
from gokart.slack.event_aggregator import EventAggregator
from gokart.slack.slack_api import SlackAPI
from gokart.slack.slack_config import SlackConfig

from .slack_api import ChannelListNotLoadedError, ChannelNotFoundError, FileNotUploadedError

__all__ = [
'ChannelListNotLoadedError',
'ChannelNotFoundError',
'FileNotUploadedError',
'EventAggregator',
'SlackAPI',
'SlackConfig',
]
2 changes: 1 addition & 1 deletion gokart/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

# NOTE: inherited from AssertionError for backward compatibility (Formerly, Gokart raises that exception when a task dumps an empty DataFrame).
class EmptyDumpError(AssertionError):
"""Attempted to dump an empty DataFrame even though it is prohibited (fail_on_empty_dump is set to True)."""
"""Raised when the task attempts to dump an empty DataFrame even though it is prohibited (``fail_on_empty_dump`` is set to True)"""


class TaskOnKart(luigi.Task, Generic[T]):
Expand Down