Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom pw proxy args support #249

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions src/xpk/core/pathways.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def get_pathways_proxy_args(args) -> str:
yaml = """- --server_port=29000
- --resource_manager_address={rm_address}
- --gcs_scratch_location={args.pathways_gcs_location}"""
if args.additional_pw_proxy_args:
yaml += args.additional_pw_proxy_args.replace(' ', '\n' + ' '*14 +'- ')

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would appreciate some guidance for this line, hopefully there's some way to ensure relative alignment between lines. Without this alignment fix the yaml would not be parsed correctly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe:

Suggested change
additional_pw_proxy_string = ''
if args.additional_pw_proxy_args:
additional_pw_proxy_string = #construct your string here
yaml = """
...
- {intendation_string}{additional_pw_proxy_string}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't get why there are 14 spaces needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indentation is what defines structure in a yaml, so the flag I'm appending needs to follow whichever indentation the current line has. What I was looking for is some way to avoid the magic 14, which might become a different number if the peripheral indentation changes for whatever reason. I'll follow your suggested pattern for clarity though.

if args.use_pathways:
return yaml.format(args=args, rm_address=get_rm_address(args))
Expand Down
10 changes: 10 additions & 0 deletions src/xpk/parser/workload.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@ def set_workload_parsers(workload_parser):
required=False,
)

workload_pathways_workload_arguments.add_argument(
'--additional_pw_proxy_args',
type=str,
default='',
help=(
'Additional arguments to pass to the proxy server.'
),
required=False,
)

add_shared_workload_create_required_arguments([
workload_create_parser_required_arguments,
workload_create_pathways_parser_required_arguments,
Expand Down
Loading