flytekit.core.data_persistence.FileAccessProvider#

class flytekit.core.data_persistence.FileAccessProvider(local_sandbox_dir, raw_output_prefix, data_config=None)[source]#

This is the class that is available through the FlyteContext and can be used for persisting data to the remote durable store.

Parameters

Methods

download(remote_path, local_path)[source]#

Downloads from remote to local

Parameters
  • remote_path (str) –

  • local_path (str) –

download_directory(remote_path, local_path)[source]#

Downloads directory from given remote to local path

Parameters
  • remote_path (str) –

  • local_path (str) –

exists(path)[source]#
Parameters

path (str) –

Return type

bool

get(from_path, to_path, recursive=False)[source]#
Parameters
  • from_path (str) –

  • to_path (str) –

  • recursive (bool) –

get_data(remote_path, local_path, is_multipart=False)[source]#
Parameters
  • remote_path (str) –

  • local_path (str) –

  • is_multipart (bool) –

get_filesystem(protocol=None, anonymous=False, **kwargs)[source]#
Parameters
Return type

Optional[fsspec.spec.AbstractFileSystem]

get_filesystem_for_path(path='', anonymous=False, **kwargs)[source]#
Parameters
  • path (str) –

  • anonymous (bool) –

Return type

fsspec.spec.AbstractFileSystem

get_random_local_directory()[source]#
Return type

str

get_random_local_path(file_path_or_file_name=None)[source]#

Use file_path_or_file_name, when you want a random directory, but want to preserve the leaf file name

Parameters

file_path_or_file_name (Optional[str]) –

Return type

str

get_random_remote_directory()[source]#
get_random_remote_path(file_path_or_file_name=None)[source]#

Constructs a randomized path on the configured raw_output_prefix (persistence layer). the random bit is a UUID and allows for disambiguating paths within the same directory.

Use file_path_or_file_name, when you want a random directory, but want to preserve the leaf file name

Parameters

file_path_or_file_name (Optional[str]) –

Return type

str

static is_remote(path)[source]#

Deprecated. Let’s find a replacement

Parameters

path (Union[str, os.PathLike]) –

Return type

bool

put(from_path, to_path, recursive=False, **kwargs)[source]#
Parameters
  • from_path (str) –

  • to_path (str) –

  • recursive (bool) –

put_data(local_path, remote_path, is_multipart=False, **kwargs)[source]#

The implication here is that we’re always going to put data to the remote location, so we .remote to ensure we don’t use the true local proxy if the remote path is a file://

Parameters
static recursive_paths(f, t)[source]#
Parameters
Return type

Tuple[str, str]

sep(file_system)[source]#
Parameters

file_system (Optional[fsspec.spec.AbstractFileSystem]) –

Return type

str

static strip_file_header(path, trim_trailing_sep=False)[source]#

Drops file:// if it exists from the file

Parameters
  • path (str) –

  • trim_trailing_sep (bool) –

Return type

str

upload(file_path, to_path)[source]#
Parameters
  • file_path (Text) –

  • to_path (Text) –

upload_directory(local_path, remote_path)[source]#
Parameters
  • local_path (Text) –

  • remote_path (Text) –

Attributes

data_config#
local_access#
local_sandbox_dir#

This is a context based temp dir.

raw_output_prefix#