Skip to content

taps.run.config

RunConfig

Bases: Config

Run configuration.

Attributes:

  • log_file_level (Union[int, str]) –

    Logging level for the log file.

  • log_file_name (Optional[str]) –

    Logging file name. If None, only logging to stdout is used.

  • log_level (Union[int, str]) –

    Logging level for stdout.

  • run_dir (Union[int, str]) –

    Runtime directory.

add_argument_group() classmethod

add_argument_group(
    parser: ArgumentParser,
    *,
    argv: Sequence[str] | None = None,
    required: bool = True
) -> None

Add model fields as arguments of an argument group on the parser.

Parameters:

  • parser (ArgumentParser) –

    Parser to add a new argument group to.

  • argv (Sequence[str] | None, default: None ) –

    Optional sequence of string arguments.

  • required (bool, default: True ) –

    Mark arguments without defaults as required.

Source code in taps/config.py
@classmethod
def add_argument_group(
    cls,
    parser: argparse.ArgumentParser,
    *,
    argv: Sequence[str] | None = None,
    required: bool = True,
) -> None:
    """Add model fields as arguments of an argument group on the parser.

    Args:
        parser: Parser to add a new argument group to.
        argv: Optional sequence of string arguments.
        required: Mark arguments without defaults as required.
    """
    group = parser.add_argument_group(cls.__name__)
    for field_name, field_info in cls.model_fields.items():
        arg_name = field_name.replace('_', '-').lower()
        group.add_argument(
            f'--{arg_name}',
            dest=field_name,
            # type=field_info.annotation,
            default=field_info.get_default(),
            required=field_info.is_required() and required,
            help=field_info.description,
        )

BenchmarkConfig

Bases: Config

Application benchmark configuration.

Attributes:

  • name (str) –

    Name of the application to execute.

  • timestamp (datetime) –

    Start time of the application.

  • executor_name (str) –

    Name of the executor.

  • app (SerializeAsAny[AppConfig]) –

    Application config.

  • executor (SerializeAsAny[ExecutorConfig]) –

    Executor config.

  • filter (SerializeAsAny[FilterConfig]) –

    Filter config.

  • run (SerializeAsAny[RunConfig]) –

    Run config.

  • transformer (SerializeAsAny[DataTransformerConfig]) –

    Transformer config.

add_argument_group() classmethod

add_argument_group(
    parser: ArgumentParser,
    *,
    argv: Sequence[str] | None = None,
    required: bool = True
) -> None

Add model fields as arguments of an argument group on the parser.

Parameters:

  • parser (ArgumentParser) –

    Parser to add a new argument group to.

  • argv (Sequence[str] | None, default: None ) –

    Optional sequence of string arguments.

  • required (bool, default: True ) –

    Mark arguments without defaults as required.

Source code in taps/config.py
@classmethod
def add_argument_group(
    cls,
    parser: argparse.ArgumentParser,
    *,
    argv: Sequence[str] | None = None,
    required: bool = True,
) -> None:
    """Add model fields as arguments of an argument group on the parser.

    Args:
        parser: Parser to add a new argument group to.
        argv: Optional sequence of string arguments.
        required: Mark arguments without defaults as required.
    """
    group = parser.add_argument_group(cls.__name__)
    for field_name, field_info in cls.model_fields.items():
        arg_name = field_name.replace('_', '-').lower()
        group.add_argument(
            f'--{arg_name}',
            dest=field_name,
            # type=field_info.annotation,
            default=field_info.get_default(),
            required=field_info.is_required() and required,
            help=field_info.description,
        )

get_run_dir()

get_run_dir() -> Path

Create and return the path to the run directory.

Source code in taps/run/config.py
def get_run_dir(self) -> pathlib.Path:
    """Create and return the path to the run directory."""
    timestamp = self.timestamp.strftime('%Y-%m-%d-%H-%M-%S')
    run_dir = pathlib.Path(
        self.run.run_dir_format.format(
            executor=self.executor_name,
            name=self.name,
            timestamp=timestamp,
        ),
    )
    run_dir.mkdir(parents=True, exist_ok=True)
    return run_dir