mantik.remote_file_service.unicore_file_service

Attributes

FilePath

logger

Classes

UnicoreFileService

Client that allows transferring files between unicore and

Functions

join(→ FilePath)

Module Contents

mantik.remote_file_service.unicore_file_service.FilePath[source]
class mantik.remote_file_service.unicore_file_service.UnicoreFileService(username: str, password: str, auth_url: str, remote_base_path: str = '/', local_base_path: str = '.')[source]

Bases: mantik.remote_file_service.abstract_file_service.AbstractFileService

Client that allows transferring files between unicore and the local machine.

To specify that a path is remote, start the path with remote: E.g. client.copy_file(“/path/local.file”, “remote:/path/local.file”) This would upload the file from local to unicore.

Permission handling is not supported here, as it’s not implemented by pyunicore. This includes viewing the file mode, and file owner.

abstract change_permissions(target: FilePath, new_permissions: mantik.remote_file_service.abstract_file_service.FileMeta) None[source]

Change metadata (permissions) of a file.

Note: bash chmod

copy_directory(source: FilePath, target: FilePath) mantik.remote_file_service.abstract_file_service.Directory[source]

Copy directory.

Note: bash cp

copy_file(source: FilePath, target: FilePath) mantik.remote_file_service.abstract_file_service.File[source]

Copy file.

Note: bash cp

create_directory(target: FilePath) mantik.remote_file_service.abstract_file_service.Directory[source]

Make a new directory.

Note: bash mkdir

create_file_if_not_exists(target=FilePath) mantik.remote_file_service.abstract_file_service.File[source]

Create (empty) file if not exists.

Note: bash touch

exists(target=FilePath) bool[source]

Return if file exists

classmethod from_env(connection_id: uuid.UUID | None = None) UnicoreFileService[source]

Instantiate with environment variables.

Credentials are either fetched from mantik api or passed in through end vars.

classmethod is_remote(path: FilePath) bool[source]

Return if a path is remote or not

list_directory(target: FilePath) List[mantik.remote_file_service.abstract_file_service.Directory | mantik.remote_file_service.abstract_file_service.File][source]

List content of directory.

Note: bash ls

classmethod localise_path(path: FilePath) FilePath[source]

Localize a remote path

remote_fs[source]
remove_directory(target: FilePath) None[source]

Remove a directory.

Note: bash rm -r

remove_file(target=FilePath) None[source]

Remove file or directory.

Note: bash rm

property user: str[source]

Return current user.

username[source]
mantik.remote_file_service.unicore_file_service.join(path_1: FilePath, path_2: FilePath) FilePath[source]
mantik.remote_file_service.unicore_file_service.logger[source]