Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions gpustack_runtime/deployer/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,16 @@ def _create_containers(
create_options["working_dir"] = c.execution.working_dir
create_options["entrypoint"] = c.execution.command
create_options["command"] = c.execution.args
run_as_user = c.execution.run_as_user or workload.run_as_user
run_as_group = c.execution.run_as_group or workload.run_as_group
run_as_user = (
c.execution.run_as_user
if c.execution.run_as_user is not None
else workload.run_as_user
)
run_as_group = (
c.execution.run_as_group
if c.execution.run_as_group is not None
else workload.run_as_group
)
Comment on lines +913 to +922

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While the logic is correct, these assignments can be written more concisely using single-line ternary operators. This improves readability by reducing the number of lines.

                run_as_user = c.execution.run_as_user if c.execution.run_as_user is not None else workload.run_as_user
                run_as_group = c.execution.run_as_group if c.execution.run_as_group is not None else workload.run_as_group

if run_as_user is not None:
create_options["user"] = run_as_user
if run_as_group is not None:
Expand Down
12 changes: 10 additions & 2 deletions gpustack_runtime/deployer/podman.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,16 @@ def _create_containers(
create_options["working_dir"] = c.execution.working_dir
create_options["entrypoint"] = c.execution.command
create_options["command"] = c.execution.args
run_as_user = c.execution.run_as_user or workload.run_as_user
run_as_group = c.execution.run_as_group or workload.run_as_group
run_as_user = (
c.execution.run_as_user
if c.execution.run_as_user is not None
else workload.run_as_user
)
run_as_group = (
c.execution.run_as_group
if c.execution.run_as_group is not None
else workload.run_as_group
)
Comment on lines +914 to +923

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the change in docker.py, these assignments can be made more concise. Using single-line ternary operators would improve readability here.

                run_as_user = c.execution.run_as_user if c.execution.run_as_user is not None else workload.run_as_user
                run_as_group = c.execution.run_as_group if c.execution.run_as_group is not None else workload.run_as_group

if run_as_user is not None:
create_options["user"] = run_as_user
if run_as_group is not None:
Expand Down
Loading