luigi.contrib.hdfs.abstract_client module

Module containing abstract class about hdfs clients.

class luigi.contrib.hdfs.abstract_client.HdfsFileSystem[source]

Bases: FileSystem

This client uses Apache 2.x syntax for file system commands, which also matched CDH4.

rename(path, dest)[source]

Rename or move a file.

In hdfs land, “mv” is often called rename. So we add an alias for move() called rename(). This is also to keep backward compatibility since move() became standardized in luigi’s filesystem interface.

rename_dont_move(path, dest)[source]

Override this method with an implementation that uses rename2, which is a rename operation that never moves.

rename2 - (lines 483-523)

abstract remove(path, recursive=True, skip_trash=False)[source]

Remove file or directory at location path

  • path (str) – a path within the FileSystem to remove.

  • recursive (bool) – if the path is a directory, recursively remove the directory and all of its descendants. Defaults to True.

abstract chmod(path, permissions, recursive=False)[source]
abstract chown(path, owner, group, recursive=False)[source]
abstract count(path)[source]

Count contents in a directory

abstract copy(path, destination)[source]

Copy a file or a directory with contents. Currently, LocalFileSystem and MockFileSystem support only single file copying but S3Client copies either a file or a directory as required.

abstract put(local_path, destination)[source]
abstract get(path, local_destination)[source]
abstract mkdir(path, parents=True, raise_if_exists=False)[source]

Create directory at location path

Creates the directory at path and implicitly create parent directories if they do not already exist.

  • path (str) – a path within the FileSystem to create as a directory.

  • parents (bool) – Create parent directories when necessary. When parents=False and the parent directory doesn’t exist, raise

  • raise_if_exists (bool) – raise if the folder already exists.

abstract listdir(path, ignore_directories=False, ignore_files=False, include_size=False, include_type=False, include_time=False, recursive=False)[source]

Return a list of files rooted in path.

This returns an iterable of the files rooted at path. This is intended to be a recursive listing.


path (str) – a path within the FileSystem to list.

Note: This method is optional, not all FileSystem subclasses implements it.

abstract touchz(path)[source]