Skip to content

Commit

Permalink
fix: Resolve menu.py not found error when running `pip install deadli…
Browse files Browse the repository at this point in the history
…ne-cloud-for-nuke -t <folder>`

Signed-off-by: Cherie-Chen <[email protected]>
  • Loading branch information
Cherie-Chen committed Jul 24, 2024
1 parent 08b2b27 commit efaea44
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 44 deletions.
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ WARNING: This workflow installs additional Python packages into your Nuke's pyth
2. Switch to your Nuke directory, like `cd "C:\Program Files\Nuke15.0v2"`.
3. Run `.\python -m pip install -e C:\Users\<username>\deadline-clients\deadline-cloud` to install the AWS Deadline Cloud Client Library in edit mode.
4. Run `.\python -m pip install -e C:\Users\<username>\deadline-clients\deadline-cloud-for-nuke` to install the Nuke Submitter in edit mode.
5. Run `set NUKE_PATH=C:\Users\<username>\deadline-clients\deadline-cloud-for-nuke\src` to put the `menu.py` file in the path Nuke searches for menu extensions.
5. Run `set NUKE_PATH=C:\Users\<username>\deadline-clients\deadline-cloud-for-nuke\src\deadline\nuke_submitter` to put the `menu.py` file in the path Nuke searches for menu extensions.
6. Run `set DEADLINE_ENABLE_DEVELOPER_OPTIONS=true` to enable the job bundle debugging support. This enables a menu item you can use to run the tests from the `job_bundle_output_tests` directory.
7. Run `.\Nuke<version>.exe` to run Nuke. The Nuke submitter should be available in the AWS Deadline menu.

Expand Down
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ AWS Deadline Cloud for Nuke is a python package that allows users to create [AWS
[openjd-adaptor-runtime]: https://github.com/OpenJobDescription/openjd-adaptor-runtime-for-python
[openjd-adaptor-runtime-lifecycle]: https://github.com/OpenJobDescription/openjd-adaptor-runtime-for-python/blob/release/README.md#adaptor-lifecycle

## Compatibility
## Submitter

This package provides a Nuke plugin that creates jobs for AWS Deadline Cloud using the [AWS Deadline Cloud client library][deadline-cloud-client]. Based on the loaded comp it determines the files required, allows the user to specify render options, and builds an [OpenJD template][openjd] that defines the workflow.

### Compatibility

This library requires:

1. Nuke 15,
1. Python 3.9 or higher; and
1. Linux, Windows, or a macOS operating system.

## Submitter

This package provides a Nuke plugin that creates jobs for AWS Deadline Cloud using the [AWS Deadline Cloud client library][deadline-cloud-client]. Based on the loaded comp it determines the files required, allows the user to specify render options, and builds an [OpenJD template][openjd] that defines the workflow.

## Adaptor

The Nuke Adaptor implements the [OpenJD][openjd-adaptor-runtime] interface that allows render workloads to launch Nuke and feed it commands. This gives the following benefits:
Expand All @@ -33,6 +33,14 @@ The Nuke Adaptor implements the [OpenJD][openjd-adaptor-runtime] interface that

Jobs created by the submitter use this adaptor by default.

### Compatibility

This library requires:

1. Nuke 15,
1. Python 3.9 or higher; and
1. Linux operating system.

### Getting Started

The adaptor can be installed by the standard python packaging mechanisms:
Expand Down
2 changes: 1 addition & 1 deletion install_builder/deadline-cloud-for-nuke.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<onPackingFilterList>
<fileNameFilter pattern="*/deadline/nuke_submitter/*" logic="matches" patternType="glob"/>
<fileNameFilter pattern="*/deadline/nuke_util/*" logic="matches" patternType="glob"/>
<fileNameFilter pattern="*/menu.py" logic="matches" patternType="glob"/>
<fileNameFilter pattern="*/deadline/nuke_submitter/menu.py" logic="matches" patternType="glob"/>
</onPackingFilterList>
</distributionDirectory>
</distributionFileList>
Expand Down
42 changes: 42 additions & 0 deletions src/deadline/nuke_submitter/menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

"""
DO NOT CHANGE THIS FILE's NAME
Nuke loads this "init.py" or "menu.py" when looking in its plugin folder.
You can inform nuke to look in additional locations by setting via the
NUKE_PATH environment variable.
"""

import sys
import traceback
import nuke
import os

from deadline.nuke_submitter import (
show_nuke_render_submitter_noargs,
run_render_submitter_job_bundle_output_test,
)


def add_deadline_menu() -> None:
try:
menu_bar = nuke.menu("Nuke")
aws_deadline_menu = menu_bar.addMenu("&AWS Deadline")
aws_deadline_menu.addCommand(
"Submit to Deadline Cloud", show_nuke_render_submitter_noargs, ""
)
# Set the environment variable DEADLINE_ENABLE_DEVELOPER_OPTIONS to "true" to get this menu.
if os.environ.get("DEADLINE_ENABLE_DEVELOPER_OPTIONS", "").upper() == "TRUE":
aws_deadline_menu.addCommand(
"Run Nuke Submitter Job Bundle Output Tests...",
run_render_submitter_job_bundle_output_test,
"",
)
except BaseException:
print("Failed to load deadline.nuke_submitter. Reason:", file=sys.stderr)
print(traceback.format_exc(), file=sys.stderr)


add_deadline_menu()
37 changes: 0 additions & 37 deletions src/menu.py

This file was deleted.

32 changes: 32 additions & 0 deletions test/unit/deadline_submitter_for_nuke/test_menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
import nuke
from unittest.mock import ANY
from deadline.nuke_submitter.menu import add_deadline_menu


def test_add_deadline_menu_env_var_true() -> None:
# GIVEN
os.environ["DEADLINE_ENABLE_DEVELOPER_OPTIONS"] = "true"

# WHEN
add_deadline_menu()

# THEN
nuke.menu("Nuke").addMenu.assert_called_with("&AWS Deadline")
nuke.menu("Nuke").addMenu("&AWS Deadline").addCommand.assert_called_with(
"Run Nuke Submitter Job Bundle Output Tests...", ANY, ANY
)


def test_add_deadline_menu_env_var_false() -> None:
# GIVEN
os.environ["DEADLINE_ENABLE_DEVELOPER_OPTIONS"] = "false"

# WHEN
add_deadline_menu()

# THEN
nuke.menu("Nuke").addMenu.assert_called_with("&AWS Deadline")
nuke.menu("Nuke").addMenu("&AWS Deadline").addCommand.assert_called_with(
"Submit to Deadline Cloud", ANY, ANY
)

0 comments on commit efaea44

Please sign in to comment.