Skip to content

Commit

Permalink
fix(cli): correct download-output command displaying resolved UNC path (
Browse files Browse the repository at this point in the history
#337)

* fix(cli): download-output command display resolved download path

Signed-off-by: Godot Bian <13778003+godobyte@users.noreply.github.com>

---------

Signed-off-by: Godot Bian <13778003+godobyte@users.noreply.github.com>
Co-authored-by: Godot Bian <13778003+godobyte@users.noreply.github.com>
  • Loading branch information
godobyte and godobyte committed May 30, 2024
1 parent 631211e commit 6bcd9a2
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/deadline/client/cli/_groups/job_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ def _download_job_output(
_get_summary_of_files_to_download_message(output_paths_by_root, is_json_format)
)
asset_roots = list(output_paths_by_root.keys())
asset_roots_resolved = [f"{str(Path(root).resolve())}" for root in asset_roots]
click.echo(_get_roots_list_message(asset_roots_resolved, is_json_format))
click.echo(_get_roots_list_message(asset_roots, is_json_format))
user_choice = click.prompt(
"> Please enter the index of root directory to edit, y to proceed without changes, or n to cancel the download",
type=click.Choice(
Expand All @@ -348,28 +347,25 @@ def _download_job_output(
new_root = click.prompt(
"> Please enter the new root directory path, or press Enter to keep it unchanged",
type=click.Path(exists=False),
default=asset_roots_resolved[index_to_change],
default=asset_roots[index_to_change],
)
job_output_downloader.set_root_path(
asset_roots[index_to_change], str(Path(new_root).resolve())
asset_roots[index_to_change], str(Path(new_root))
)
output_paths_by_root = job_output_downloader.get_output_paths_by_root()
else:
click.echo(
_get_summary_of_files_to_download_message(output_paths_by_root, is_json_format)
)
asset_roots = list(output_paths_by_root.keys())
asset_roots_resolved = [f"{str(Path(root).resolve())}" for root in asset_roots]
click.echo(_get_roots_list_message(asset_roots_resolved, is_json_format))
click.echo(_get_roots_list_message(asset_roots, is_json_format))
json_string = click.prompt("", prompt_suffix="", type=str)
confirmed_asset_roots = _get_value_from_json_line(
json_string, JSON_MSG_TYPE_PATHCONFIRM, expected_size=len(asset_roots)
)
for index, confirmed_root in enumerate(confirmed_asset_roots):
_assert_valid_path(confirmed_root)
job_output_downloader.set_root_path(
asset_roots[index], str(Path(confirmed_root).resolve())
)
job_output_downloader.set_root_path(asset_roots[index], str(Path(confirmed_root)))
output_paths_by_root = job_output_downloader.get_output_paths_by_root()

# If the conflict resolution option was not specified, auto-accept is false, and
Expand Down Expand Up @@ -645,7 +641,7 @@ def job_download_output(step_id, task_id, output, **args):
except Exception as e:
if is_json_format:
error_one_liner = str(e).replace("\n", ". ")
click.echo(_get_json_line("error", error_one_liner))
click.echo(_get_json_line(JSON_MSG_TYPE_ERROR, error_one_liner))
sys.exit(1)
else:
raise DeadlineOperationError(f"Failed to download output:\n{e}") from e
Expand Down

0 comments on commit 6bcd9a2

Please sign in to comment.