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

[PM-1889] Escape command line args passed to Job #2002

Open
mayani opened this issue Dec 14, 2024 · 5 comments
Open

[PM-1889] Escape command line args passed to Job #2002

mayani opened this issue Dec 14, 2024 · 5 comments
Assignees
Labels
affects-5.0.2 affects-master Current Trunk Version fix-5.1.0 major Major loss of function. Pegasus Planner Main Client for Pegasus sync-from-jira Synced from Jira

Comments

@mayani
Copy link
Member

mayani commented Dec 14, 2024

Currently, when we invoke job.add_args("1 2") it is written to the YAML file as below, but the same is written to the .sh file as 1 2 instead of '1 2'.

- type: job
  name: ls
  arguments:
  - 1 2
  - 3 4
pegasus-kickstart  -n ls -N ID0000001 -o listing.txt -R condorpool  -s listing.txt=listing.txt -L .. /bin/ls 1 2 3 4

When writing the arguments into the .sh file, they should be shell escaped.

Reporter: @mayani
Watchers:
@papajim
@mayani
@vahi

@mayani
Copy link
Member Author

mayani commented Dec 14, 2024

Author: @vahi

the planner when parsing the abstract workflow, it has to deserialize to a string
arg string: '1 2' '3 4'

we have users who encode quoted arguments in the arg strings . what are the ramifications there?

@mayani
Copy link
Member Author

mayani commented Dec 14, 2024

Author: @papajim

In python you can have an arg of type list.
example:
parser.add_argument("--my_list", metavar="INT", type=int, nargs='+')

in this example you can invoke the python code as:
python3 my_code --my_list 1 2 --> my_list = [1, 2]
but the following will fail
python3 my_code --my_list '1 2' since it expects integers

@mayani
Copy link
Member Author

mayani commented Dec 14, 2024

Author: @mayani

@papajim That means 1 2 and 2 separate args and should show up as. The Python lib assigning them to one variable doesn't make it one arg ie 12
args:

  • 1
  • 2
    and not
  • 1 2

@mayani
Copy link
Member Author

mayani commented Dec 14, 2024

Author: @vahi

also if arg is *txt , then quoting it as '*txt' will disable expansion in bash!

@mayani
Copy link
Member Author

mayani commented Dec 14, 2024

Author: @vahi

we need to update the python api documentation to give examples on how the user needs to handle it themselves.

@mayani mayani added sync-from-jira Synced from Jira Pegasus Planner Main Client for Pegasus affects-master Current Trunk Version labels Dec 14, 2024
@mayani mayani changed the title PM-1889 [PM-1889] Escape command line args passed to Job Dec 14, 2024
@mayani mayani added the major Major loss of function. label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.0.2 affects-master Current Trunk Version fix-5.1.0 major Major loss of function. Pegasus Planner Main Client for Pegasus sync-from-jira Synced from Jira
Projects
None yet
Development

No branches or pull requests

2 participants