Skip to content

feat: add submission hooks support for job bundles#986

Draft
rickrams wants to merge 1 commit intoaws-deadline:mainlinefrom
rickrams:feat/submission-hooks
Draft

feat: add submission hooks support for job bundles#986
rickrams wants to merge 1 commit intoaws-deadline:mainlinefrom
rickrams:feat/submission-hooks

Conversation

@rickrams
Copy link
Contributor

Add configurable pre-submission and post-submission hooks that execute during job submission workflow. Hooks are defined in hooks.yaml or hooks.json in the job bundle directory.

Features:

  • Pre-submission hooks run before hashing/uploading and can modify payload
  • Post-submission hooks run after job creation (non-blocking on failure)
  • Hooks receive metadata via stdin JSON and DEADLINE_* environment variables
  • Asset references from hooks are merged with existing references
  • Configurable timeout per hook (default 60s)
  • Works with both CLI (deadline bundle submit) and GUI (deadline bundle gui-submit)

Documentation:

  • Added docs/submission-hooks.md with full usage guide and examples
  • Updated README.md with submission hooks section

Testing:

  • Added 45 unit tests covering models, validation, merging, and execution

What was the problem/requirement? (What/Why)

Being able to execute code before and after job submission. Use cases like setting variables based on the environment or doing introspection for assets for job attachment.

What was the solution? (How)

A new job bundle file called "hooks" that species a command and arguments (similar to how open job description templates do)

What is the impact of this change?

How was this change tested?

I manually tested both CLI and gui submit with a custom script that inspect vrscene files and finds and adds additional job attaachments.

See DEVELOPMENT.md for information on running tests.

  • Have you run the unit tests? Yes
  • Have you run the integration tests? Yes
  • Have you made changes to the download or asset_sync modules? If so, then it is highly recommended
    that you ensure that the docker-based unit tests pass.

Was this change documented?

  • Are relevant docstrings in the code base updated? Yes
  • Has the README.md been updated? YEs

Does this PR introduce new dependencies? No

This library is designed to be integrated into third-party applications that have bespoke and customized deployment environments. Adding dependencies will increase the chance of library version conflicts and incompatabilities. Please evaluate the addition of new dependencies. See the Dependencies section of DEVELOPMENT.md for more details.

  • This PR adds one or more new dependency Python packages. I acknowledge I have reviewed the considerations for adding dependencies in DEVELOPMENT.md.
  • This PR does not add any new dependencies.

Is this a breaking change? No

A breaking change is one that modifies a public contract in a way that is not backwards compatible. See the
Public Contracts section
of the DEVELOPMENT.md for more information on the public contracts.

If so, then please describe the changes that users of this package must make to update their scripts, or Python applications.

Does this change impact security? Potentially. It executes scripts that could be malicous or potentially misused or hijacked.

  • Does the change need to be threat modeled? For example, does it create or modify files/directories that must only be readable by the process owner?
    • If so, then please label this pull request with the "security" label. We'll work with you to analyze the threats.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions github-actions bot added the waiting-on-maintainers Waiting on the maintainers to review. label Jan 31, 2026
origin_dir = f.read().strip()
if _os.path.isdir(origin_dir):
return origin_dir
except Exception:

Check notice

Code scanning / CodeQL

Empty except Note

'except' clause does nothing but pass and there is no explanatory comment.
@rickrams rickrams force-pushed the feat/submission-hooks branch 2 times, most recently from 8955f32 to 175d566 Compare January 31, 2026 22:42
@rickrams rickrams force-pushed the feat/submission-hooks branch 3 times, most recently from c3b1d1b to a5622db Compare February 3, 2026 19:21
Adds support for pre-submission and post-submission hooks via hooks.yaml/hooks.json
in job bundles. Hooks can validate configurations, discover assets, modify parameters,
and integrate with external systems.

- Pre-submission hooks run before hashing/uploading and can modify the submission
- Post-submission hooks run after job creation for notifications/integrations
- Security: hooks disabled by default (settings.allow_hooks), confirmation prompt
- Works with both CLI and GUI submission workflows

Signed-off-by: rickrams <rickrams@users.noreply.github.com>
@rickrams rickrams force-pushed the feat/submission-hooks branch from a5622db to 6325d37 Compare February 4, 2026 02:22
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2026

@rickrams
Copy link
Contributor Author

rickrams commented Feb 4, 2026

Updated to allow for two independent hook sources, each with its own security setting:

Hook Sources

  1. Bundle Hooks - hooks.yaml in job bundles
  • Controlled by settings.allow_bundle_hooks (default: false)
  • For workflows where hooks are bundled with job templates
  1. Environment Hooks - DEADLINE_HOOKS_DIR environment variable
  • Controlled by settings.allow_environment_hooks (default: false)
  • For studios that want to enforce hooks across all submissions without modifying job bundles or submitter code

Security Model

Both sources are disabled by default (opt-in). When enabled, users see a confirmation prompt showing exactly which commands will run before execution (unless auto_accept=true).

Studio Deployment Example

# IT configures workstations once
deadline config set settings.allow_environment_hooks true

# Per-application launcher scripts set the hooks location
# blender_launcher.sh
export DEADLINE_HOOKS_DIR=/studio/pipeline/hooks/blender
exec blender "$@"

# maya_launcher.sh  
export DEADLINE_HOOKS_DIR=/studio/pipeline/hooks/maya
exec maya "$@"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-on-maintainers Waiting on the maintainers to review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants