Skip to content

parsedmarc.sink.util ๐Ÿ”—

Console ๐Ÿ”—

Console(
    name: str = "default",
    config: dict[str, Any] | None = None,
)

Bases: Sink

Sink that writes reports to the console as JSON.

New in 9.0.

PARAMETER DESCRIPTION
name

profile name for this instance, ideally should be unqiue to easily idenfity this instance and any log messages it produces

TYPE: str DEFAULT: 'default'

config

config for this instance

TYPE: dict[str, Any] | None DEFAULT: None

state property ๐Ÿ”—

state: AppState

Read only Sink state

shutdown ๐Ÿ”—

shutdown(
    timeout: int | float = 120, force: bool = False
) -> None

Attempt to gracefully shutdown this source.

PARAMETER DESCRIPTION
timeout

Giveup after this many seonds (TODO)

TYPE: int | float DEFAULT: 120

force

If a timeout would occur, instead force shutdown.

TYPE: bool DEFAULT: False

validate_config ๐Ÿ”—

validate_config() -> None

Validate the config of this instance

Child classes can override this method to implement their own logic. It is still recomended to call super().validate_config().

ConsoleConfig ๐Ÿ”—

Bases: BaseConfig

Console Config.

New in 9.0.

Noop ๐Ÿ”—

Noop(
    name: str = "default",
    config: dict[str, Any] | None = None,
)

Bases: Sink

Sink that does nothing.

New in 9.0.

PARAMETER DESCRIPTION
name

profile name for this instance, ideally should be unqiue to easily idenfity this instance and any log messages it produces

TYPE: str DEFAULT: 'default'

config

config for this instance

TYPE: dict[str, Any] | None DEFAULT: None

state property ๐Ÿ”—

state: AppState

Read only Sink state

cleanup ๐Ÿ”—

cleanup() -> None

Perform cleanup on this source.

This method is called as a part of self.shutdown.

Child classes can override this method to implement their own logic. It is still recomended to call super().cleanup().

setup ๐Ÿ”—

setup() -> None

Perform setup actions to ensure this Sink is ready to produce.

Child classes can override this method to implement their own logic.

Child classes should
  • check that self._state == AppState.SHUTDOWN
  • set self._state = AppState.SETTING_UP
  • do their setup actions
  • if an error occurs set self._state = AppState.SETUP_ERROR
  • otherwise set self._state = AppState.RUNNING

shutdown ๐Ÿ”—

shutdown(
    timeout: int | float = 120, force: bool = False
) -> None

Attempt to gracefully shutdown this source.

PARAMETER DESCRIPTION
timeout

Giveup after this many seonds (TODO)

TYPE: int | float DEFAULT: 120

force

If a timeout would occur, instead force shutdown.

TYPE: bool DEFAULT: False

validate_config ๐Ÿ”—

validate_config() -> None

Validate the config of this instance

Child classes can override this method to implement their own logic. It is still recomended to call super().validate_config().