docs(cli): add scripted submit/wait/download workflow to CLI help#1264
docs(cli): add scripted submit/wait/download workflow to CLI help#1264andychoquette wants to merge 4 commits into
Conversation
Improves the `deadline` CLI help so an AI agent (or a human scripting the CLI) can discover the end-to-end job workflow without trial and error: - Top-level overview + `bundle`/`job` group help now show the submit -> wait -> download-output sequence with copy-pasteable, non-interactive (--yes) examples. - `job wait` is documented as the recommended completion signal (blocks; exit 0 = success) instead of polling `job get`. - `bundle submit` explains job-attachment storage-profile prompts and how to suppress them (--known-asset-path / --yes); `job download-output` documents --ignore-storage-profiles for same-machine submit+download. - `queue paramdefs` is called out as the way to discover queue environments (e.g. Conda), since there is no dedicated list subcommand. Additive (existing help preserved). Generated and A/B-proven by an eval harness: against a real Blender render task at k=5, the revised help cut the agent's median cost ~11% (fewer exploratory commands / turns) with success held at 100%. Signed-off-by: Andy Choquette <78888816+andychoquette@users.noreply.github.com>
|
What about adding |
|
yeah, i think thats reasonable. I'll make the update. Will also adjust the evals system prompt to make explicit that new flags are allowed if they meaningfully improve agent performance. |
eb43889
| # Imported lazily to avoid a circular import with job_group. | ||
| from .job_group import _download_job_output | ||
|
|
||
| _download_job_output( |
There was a problem hiding this comment.
--download-on-success calls _download_job_output, which only skips the interactive "confirm root paths" prompt when settings.auto_accept is true (see job_group.py if not auto_accept: _prompt_to_confirm_roots(...)). That config value is only set to true when --yes is passed to this command. So deadline bundle submit ./bundle --download-on-success (without --yes) will submit, wait, then block on an interactive prompt during the download — defeating the "one command for scripts/agents" purpose this feature is built for.
Consider either forcing auto-accept for the implied download here, or documenting in the --download-on-success help that --yes is required for a fully non-interactive run.
Collapses the common submit -> wait -> download-output sequence into a single `deadline bundle submit` invocation, so scripts and agents don't have to chain three commands and thread the job id between them: - --wait: after submit, block until the job reaches a terminal state (reusing api.wait_for_job_completion, the same path `deadline job wait` uses) and exit non-zero if it does not succeed. - --download-on-success: implies --wait; on SUCCEEDED, download the job's output (reusing job_group._download_job_output, the same path `deadline job download-output` uses). Both are additive and default off -- existing behavior is unchanged. They no-op when there is no real job (e.g. --save-debug-snapshot yields no job id). Adds unit tests covering the non-success exit and the download-on-success path. Signed-off-by: Andy Choquette <78888816+andychoquette@users.noreply.github.com>
eb43889 to
83e050e
Compare
| farm_id = config_file.get_setting("defaults.farm_id", config=config) | ||
| queue_id = config_file.get_setting("defaults.queue_id", config=config) | ||
| click.echo(f"Waiting for job {job_id} to complete...") | ||
| result = api.wait_for_job_completion( |
There was a problem hiding this comment.
The new --wait / --download-on-success block runs inside the submission try, so failures that happen after the job is already created get reported as submission failures. For example, if _download_job_output raises a ClientError (it calls deadline.get_job, S3 ops, etc.), it lands in the except ClientError handler below and is re-raised as "Failed to submit the job bundle to AWS Deadline Cloud" — even though the job submitted fine and is running. Likewise the generic except Exception records this as an "on_submit" telemetry error.
For a scripted workflow this is misleading: a non-zero exit + "submission failed" message could prompt a caller to resubmit and create a duplicate job. Consider moving the wait/download after the try/except/finally (once submission has definitively succeeded), or wrapping it in its own try/except with a distinct error message.
crowecawcaw
left a comment
There was a problem hiding this comment.
Follow up idea: make the failure case excellent for agents as well. Today when iterating on a job, you need to submit, wait, then get logs. Getting the logs is not totally obvious since there are multiple sessions, statuses, etc. If a job fails, the most important info probably are the task statuses and the last 50 lines or so of the last task that failed. It'd be cool if an agent had all the info it needed after submitting a job that fails to fix the issue and submit again, without a second command.
| Scripted workflow (no prompts): | ||
| deadline bundle submit ./bundle --yes | ||
| deadline job wait --job-id <id> | ||
| deadline job download-output --job-id <id> --yes |
There was a problem hiding this comment.
Nit: let's recommend the new flags!
| \b | ||
| For scripted workflows, prefer `wait` over polling `get`: | ||
| deadline job wait --job-id <id> # blocks, exit 0 = success | ||
| deadline job download-output --job-id <id> --yes | ||
|
|
There was a problem hiding this comment.
Feels like this string is too specific for the higher leveljob command. Maybe put some example commands that include wait in here.
| \b | ||
| Pass --yes to skip confirmation prompts (useful when scripting). | ||
| Pass --ignore-storage-profiles when submitting and downloading on the | ||
| same machine to skip storage profile path mapping. |
There was a problem hiding this comment.
Aren't these flags documented when you call --help already?
| \b | ||
| Available subcommands: | ||
| list List queues in the farm | ||
| get Get details of a queue (incl. job attachment settings) | ||
| paramdefs List parameters from queue environments (e.g. conda) | ||
| export-credentials Export temporary queue role credentials | ||
| sync-output Incrementally download output for all jobs in queue | ||
|
|
||
| \b | ||
| Note: There is no subcommand for listing queue environments directly. | ||
| Use `deadline queue paramdefs` to see what parameters (and therefore | ||
| which queue environments such as Conda) are configured on a queue. | ||
|
|
There was a problem hiding this comment.
Don't think this is necessary. The current help text looks like:
$ deadline queue --help
Usage: deadline queue [OPTIONS] COMMAND [ARGS]...
Manage Deadline Cloud queues. View queue details, list available queues,
export queue credentials for scripting, inspect queue parameter definitions,
or sync job output for all jobs in a queue.
Learn more about queues (https://docs.aws.amazon.com/deadline-cloud/latest/userguide/queues.html)
Options:
-h, --help Show this message and exit.
Commands:
export-credentials Export queue credentials in a format compatible...
get Get the details of a Deadline Cloud queue in the farm.
list Lists the available Deadline Cloud queues in the farm.
paramdefs Lists the parameter definitions for a Deadline...
sync-output Downloads any new job attachment output for all...| Scripted end-to-end example (no interactive prompts): | ||
| deadline bundle submit ./bundle --yes | ||
| deadline job wait --job-id job-abc123 | ||
| deadline job download-output --job-id job-abc123 --yes |
There was a problem hiding this comment.
Replace with our new command
Improves the
deadlineCLI help so an AI agent (or a human scripting the CLI) can discover the end-to-end job workflow without trial and error:bundle/jobgroup help now show the submit -> wait -> download-output sequence with copy-pasteable, non-interactive (--yes) examples.job waitis documented as the recommended completion signal (blocks; exit 0 = success) instead of pollingjob get.bundle submitexplains job-attachment storage-profile prompts and how to suppress them (--known-asset-path / --yes);job download-outputdocuments --ignore-storage-profiles for same-machine submit+download.queue paramdefsis called out as the way to discover queue environments (e.g. Conda), since there is no dedicated list subcommand.Additive (existing help preserved). Generated and A/B-proven by an eval harness: against a real Blender render task at k=5, the revised help cut the agent's median cost ~11% (fewer exploratory commands / turns) with success held at 100%.
Fixes: N/A (no linked issue)
What was the problem/requirement? (What/Why)
The
deadlineCLI--helpis the primary interface for both humans scripting the CLI and, increasingly, AI agents driving it. The end-to-end job workflow — author a bundle, submit, wait for completion, download output — was not discoverable from the help text:job waitwasn't surfaced as the completion signal (so callers polledjob getin a loop), the job-attachment storage-profile prompt (which cancels submission for paths outside the storage profile) was unexplained, and there was no pointer thatqueue paramdefsis how you inspect a queue's environments (e.g. Conda). Agents burned extra commands and turns rediscovering this each time.What was the solution? (How)
Clarify the affected command/group
--helptext and docstrings. Changes are additive — existing help, examples, and doc links are preserved; new content adds the workflow sequence, concrete non-interactive examples, and the specific gotchas above. Scope: help strings only in_main.pyand_groups/{bundle,job,queue}_group.py. Every added claim was verified against the CLI's own implementation (exit codes, option existence,settings.known_asset_paths, queue subcommands,job getoutput fields) — no invented flags or behavior.What is the impact of this change?
Clearer, self-describing CLI help — fewer commands and less trial-and-error for anyone (human or agent) running an end-to-end job. No functional, argument, or behavioral change.
How was this change tested?
\bblocks intact, no formatting regressions) viaCliRunner().invoke(cmd, ["--help"])for the affected commands.job wait,--ignore-storage-profileson submit/download, the fivequeuesubcommands,job getoutput fields, thesettings.known_asset_pathsconfig key).help=strings and command docstrings — no code paths, arguments, types, or defaults were modified.Was this change documented?
Does this PR introduce new dependencies?
Is this a breaking change?
No. Only
--help/docstring text changed; no public contract is affected.Does this change impact security?
No. No files/directories, permissions, or trust boundaries are created or modified.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.