Utilities

FileCopier

When called with the mode='FileCopier' argument, Flow.get can return a FileCopier instance. This is simply a utility class that exposes a copy method, enabling the user to copy files around without knowing any internal details about where Bionic stores them.

FileCopier API

class bionic.util.FileCopier(src_file_path)[source]

A wrapper for a Path object, exposing a copy method that will copy the underlying file to a local or cloud destination

Parameters

src_file_path (Path) – A path to a file.

copy(destination)[source]

Copies file that FileCopier represents to destination

This supports both local and GCS destinations. For the former, we follow cp’s conventions and for the latter we follow gsutil cp’s conventions. For example, trying to copy a file locally to a non-existent directory will fail.

Parameters

destination (Path or str) – Where to copy the underlying file