Skip to content

Commit

Permalink
Remove transfer options from make config file (#361)
Browse files Browse the repository at this point in the history
* Remove transfer-related configs from configs and take as transfer function arguments or just don't make customisable anymore.

* Fix logging tests.

* Apply changes to TUI and TUI tests.

* Fix persisent settings tests.

* Fix docstrings.

* Update docs to better explain transfer behaviour.

* Fix missing docstring.

* Update datashuttle/datashuttle.py docstring

Co-authored-by: Niko Sirmpilatze <[email protected]>

* Update datashuttle/datashuttle.py docstring change

Co-authored-by: Niko Sirmpilatze <[email protected]>

* Fix nonsensical docstring.

* Fix typo in transfer top-level-folder docstrings.

* Rename 'local file' to 'target file' where appropriate.

---------

Co-authored-by: Niko Sirmpilatze <[email protected]>
  • Loading branch information
JoeZiminski and niksirbi authored Apr 10, 2024
1 parent 971d15d commit 2db15cb
Show file tree
Hide file tree
Showing 19 changed files with 425 additions and 307 deletions.
12 changes: 1 addition & 11 deletions datashuttle/configs/canonical_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ def get_canonical_configs() -> dict:
"connection_method": Literal["ssh", "local_filesystem"],
"central_host_id": Optional[str],
"central_host_username": Optional[str],
"overwrite_existing_files": bool,
"transfer_verbosity": Literal["v", "vv"],
"show_transfer_progress": bool,
}

return canonical_configs
Expand Down Expand Up @@ -126,14 +123,6 @@ def check_dict_values_raise_on_fail(config_dict: Configs) -> None:
ConfigError,
)

# Transfer settings
if config_dict["transfer_verbosity"] not in ["v", "vv"]:
utils.log_and_raise_error(
"'transfer_verbosity' must be either "
"'v' or 'vv'. Config not updated.",
ConfigError,
)

# Initialise the local project folder
utils.print_message_to_user(
f"Making project folder at: {config_dict['local_path']}"
Expand Down Expand Up @@ -293,6 +282,7 @@ def get_tui_config_defaults() -> Dict:
"custom_transfer": "rawdata",
},
"bypass_validation": False,
"overwrite_existing_files": False,
}
}
return settings
Expand Down
16 changes: 12 additions & 4 deletions datashuttle/configs/config_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,19 @@ def get_rclone_config_name(

return f"central_{self.project_name}_{connection_method}"

def make_rclone_transfer_options(self, dry_run: bool) -> Dict:
def make_rclone_transfer_options(
self, overwrite_existing_files: bool, dry_run: bool
) -> Dict:
"""
This function originally collected the relevant arguments
from configs. Now, all are passed via function arguments
However, now we fix the previously configurable arguments
`show_transfer_progress` and `dry_run` here.
"""
return {
"overwrite_existing_files": self["overwrite_existing_files"],
"transfer_verbosity": self["transfer_verbosity"],
"show_transfer_progress": self["show_transfer_progress"],
"overwrite_existing_files": overwrite_existing_files,
"show_transfer_progress": True,
"transfer_verbosity": "vv",
"dry_run": dry_run,
}

Expand Down
Loading

0 comments on commit 2db15cb

Please sign in to comment.