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

[hailctl] clarify suggested use of -- and allow it in hailctl batch submit #13447

Merged
merged 3 commits into from Aug 18, 2023

Conversation

danking
Copy link
Collaborator

@danking danking commented Aug 16, 2023

CHANGELOG: Resolves #13446. In all three submit commands (batch, dataproc, and hdinsight), Hail now allows and encourages the use of -- to separate arguments meant for the user script from those meant for hailctl. In hailctl batch submit, option-like arguments, for example "--foo", are now supported before "--" if and only if they do not conflict with a hailctl option.

…ubmit

CHANGELOG: Resolves hail-is#13446. In all three submit commands (batch, dataproc, and hdinsight), Hail now allows and encourages the use of -- to separate arguments meant for the user script from those meant for hailctl. In hailctl batch submit, option-like arguments, for example "--foo", are now supported before "--" if and only if they do not conflict with a hailctl option.
jigold
jigold previously requested changes Aug 16, 2023
Copy link
Collaborator

@jigold jigold left a comment

Choose a reason for hiding this comment

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

I assume you tested this and that's why the ValueErrors were there?


hailctl batch submit --image-name docker.io/image my_script.py -- some-argument --animal dog
'''
raise ValueError((name, image_name, files or [], output, script, [*(arguments or []), *ctx.args]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this raise not supposed to be here?

after the name of the script.
'''
dataproc_submit(name, script, files, pyfiles, properties, gcloud_configuration, dry_run, region, ctx.args)
raise ValueError((name, script, files, pyfiles, properties, gcloud_configuration, dry_run, region, [*(arguments or []), *ctx.args]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove ValueError?

'''
hdinsight_submit(name, storage_account, http_password, script, ctx.args)
raise ValueError((name, storage_account, http_password, script, [*(arguments or []), *ctx.args]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove ValueError.

@danking danking dismissed jigold’s stale review August 16, 2023 23:42

Oops, that was sloppy of me. My bad.

@danking
Copy link
Collaborator Author

danking commented Aug 16, 2023

FWIW, the helps look like this now:

(base) dking@wm28c-761 hail % hailctl batch submit --help    
                                                                                                                                                                                                                                                                                                                              
 Usage: hailctl batch submit [OPTIONS] SCRIPT [ARGUMENTS]...                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                              
 Submit a batch with a single job that runs SCRIPT with the arguments ARGUMENTS.                                                                                                                                                                                                                                              
 If you wish to pass option-like arguments you should use "--". For example:                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                              
 $ hailctl batch submit --image-name docker.io/image my_script.py -- some-argument --animal dog                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                                              
╭─ Arguments ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    script         TEXT            [default: None] [required]                                                                                                                                                                                                                                                             │
│      arguments      [ARGUMENTS]...  You should use -- if you want to pass option-like arguments through. [default: None]                                                                                                                                                                                                   │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --files               TEXT              Files or directories to add to the working directory of the job. [default: None]                                                                                                                                                                                                   │
│ --name                TEXT              The name of the batch.                                                                                                                                                                                                                                                             │
│ --image-name          TEXT              Name of Docker image for the job (default: hailgenetics/hail) [default: None]                                                                                                                                                                                                      │
│ --output      -o      [text|yaml|json]  [default: text]                                                                                                                                                                                                                                                                    │
│ --help                                  Show this message and exit.                                                                                                                                                                                                                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

(base) dking@wm28c-761 hail %                                                                                        
(base) dking@wm28c-761 hail % hailctl hdinsight submit --help                                                        
                                                                                                                                                                                                                                                                                                                              
 Usage: hailctl hdinsight submit [OPTIONS] NAME STORAGE_ACCOUNT HTTP_PASSWORD                                                                                                                                                                                                                                                 
                                 SCRIPT [ARGUMENTS]...                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                              
 Submit a job to an HDInsight cluster configured for Hail.                                                                                                                                                                                                                                                                    
 If you wish to pass option-like arguments you should use "--". For example:                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                              
 $ hailctl hdinsight submit name account password script.py --image-name docker.io/image my_script.py -- some-argument --animal dog                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                              
╭─ Arguments ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    name                 TEXT            [default: None] [required]                                                                                                                                                                                                                                                       │
│ *    storage_account      TEXT            Storage account in which the cluster's container exists. [default: None] [required]                                                                                                                                                                                              │
│ *    http_password        TEXT            Web password for the cluster [default: None] [required]                                                                                                                                                                                                                          │
│ *    script               TEXT            Path to script. [default: None] [required]                                                                                                                                                                                                                                       │
│      arguments            [ARGUMENTS]...  You should use -- if you want to pass option-like arguments through. [default: None]                                                                                                                                                                                             │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                                                                                                                                                                                                                                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

(base) dking@wm28c-761 hail % hailctl dataproc submit --help                                                         
                                                                                                                                                                                                                                                                                                                              
 Usage: hailctl dataproc submit [OPTIONS] NAME SCRIPT [ARGUMENTS]...                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                              
 Submit the Python script at path SCRIPT to a running Dataproc cluster with name NAME.                                                                                                                                                                                                                                        
 You may pass arguments to the script being submitted by listing them after the script; however, if you wish to pass option-like arguments you should use "--". For example:                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                              
 $ hailctl dataproc submit name --image-name docker.io/image my_script.py -- some-argument --animal dog                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                              
╭─ Arguments ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    name           TEXT            [default: None] [required]                                                                                                                                                                                                                                                             │
│ *    script         TEXT            [default: None] [required]                                                                                                                                                                                                                                                             │
│      arguments      [ARGUMENTS]...  You should use -- if you want to pass option-like arguments through. [default: None]                                                                                                                                                                                                   │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --files                                     TEXT  Comma-separated list of files to add to the working directory of the Hail application.                                                                                                                                                                                   │
│ --pyfiles                                   TEXT  Comma-separated list of files (or directories with python files) to add to the PYTHONPATH.                                                                                                                                                                               │
│ --properties            -p                  TEXT  Extra Spark properties to set. [default: None]                                                                                                                                                                                                                           │
│ --gcloud_configuration                      TEXT  Google Cloud configuration to submit job (defaults to currently set configuration). [default: None]                                                                                                                                                                      │
│ --dry-run                   --no-dry-run          Print gcloud dataproc command, but don't run it. [default: no-dry-run]                                                                                                                                                                                                   │
│ --region                                    TEXT  Compute region for the cluster. [default: None]                                                                                                                                                                                                                          │
│ --help                                            Show this message and exit.                                                                                                                                                                                                                                              │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

@danking danking merged commit 83a6c05 into hail-is:main Aug 18, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[batch] Arbitrary pass-through arguments are not supported in hailctl batch submit
2 participants