kfp_toolbox.components module#

kfp_toolbox.components.timestamp(format: str = '%Y%m%d%H%M%S', prefix: str = None, suffix: str = None, postfix: str = None, separator: str = '-', tz_offset: int = '0')#

Generate a time string in a specified format.

It adds a prefix or suffix to the time string generated from the format, along with a separator. tz_offset can be specified to represent a time zone other than UTC.

This function is used as a component. Since caching is disabled by default, it is executed each time at the current time unless caching is enabled in the pipeline.

Parameters:
  • format (str, optional) – Time format string. Strings that cannot be interpreted as a format string are output as is. Defaults to “%Y%m%d%H%M%S”.

  • prefix (Optional[str], optional) – A prefix string to be prepended to the format string. Defaults to None.

  • suffix (Optional[str], optional) – A suffix string to be added after the format string. Defaults to None.

  • postfix (Optional[str], optional) – DEPRECATED: Use suffix instead. A postfix string to be added after the format string. Defaults to None.

  • separator (str, optional) – Separator to be added between the format string, prefix and suffix. Defaults to “-“.

  • tz_offset (int, optional) – Time zone offset specified in hours. Defaults to 0.

Returns:

The current time string represented by a format string. A prefix and suffix string separated by a separator is appended.

Return type:

str

Deprecated since version 0.5.0: postfix argument is deprecated. Use suffix instead.