Skip to content

Local

liblaf.cherries.plugins.local

Classes:

  • Local –

    Copy the entrypoint, logs, and artifacts into .cherries/runs/.

Attributes:

logger module-attribute

logger: Logger = logging.getLogger(__name__)

Local

Bases: Plugin


              flowchart TD
              liblaf.cherries.plugins.local.Local[Local]
              liblaf.cherries.core.plugin._plugin.Plugin[Plugin]

                              liblaf.cherries.core.plugin._plugin.Plugin --> liblaf.cherries.plugins.local.Local
                


              click liblaf.cherries.plugins.local.Local href "" "liblaf.cherries.plugins.local.Local"
              click liblaf.cherries.core.plugin._plugin.Plugin href "" "liblaf.cherries.core.plugin._plugin.Plugin"
            

Copy the entrypoint, logs, and artifacts into .cherries/runs/.

Attributes:

Parameters:

  • name (PluginName, default: <dynamic> ) –
  • run (Run) –

Methods:

  • log_asset –

    Copy path under the snapshot's assets/ directory.

  • start –

    Configure local logging and copy the entrypoint.

folder cached property

folder: Path

Snapshot directory for this run.

log_file property

log_file: Path

Log file inside the local snapshot.

name class-attribute instance-attribute

name: PluginName = attrs.field(
    default=attrs.Factory(_default_name, takes_self=True),
    kw_only=True,
)

run class-attribute instance-attribute

run: Run = attrs.field(repr=False)

log_asset

log_asset(
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None

Copy path under the snapshot's assets/ directory.

Source code in src/liblaf/cherries/plugins/local.py
@core.impl
def log_asset(
    self,
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None:
    """Copy `path` under the snapshot's `assets/` directory."""
    del metadata, report
    if path.is_relative_to(self.run.working_dir):
        target: Path = self.folder / path.relative_to(self.run.working_dir)
    else:
        target: Path = self.folder / "assets" / path.name
    self._copy(path, target)

start

start() -> None

Configure local logging and copy the entrypoint.

Source code in src/liblaf/cherries/plugins/local.py
@core.impl(after=("Logging",))
def start(self) -> None:
    """Configure local logging and copy the entrypoint."""
    self._config_logging()
    self._copy(self.run.entrypoint, self.folder / "src" / self.run.entrypoint.name)