Skip to content

Commit

Permalink
fix: Resolve menu.py not found error when running pip install deadlin…
Browse files Browse the repository at this point in the history
…e-cloud-for-nuke -t <folder> (#165)

* fix: Resolve menu.py not found error when running `pip install deadline-cloud-for-nuke -t <folder>`

Signed-off-by: Cherie-Chen <[email protected]>
Signed-off-by: Haejung Choi <[email protected]>

---------

Signed-off-by: Cherie-Chen <[email protected]>
Signed-off-by: Haejung Choi <[email protected]>
Co-authored-by: Cherie-Chen <[email protected]>
Co-authored-by: Haejung Choi <[email protected]>
  • Loading branch information
3 people authored Sep 10, 2024
1 parent a0704a3 commit 82b7eb2
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 40 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
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,28 @@ This library requires:

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.

### Getting Started

To install the submitter manually, you can use pip.

```sh
$ pip install deadline-cloud-for-nuke -t target-directory
```

For Windows,
```sh
$ set NUKE_PATH=%NUKE_PATH%;<target-directory>/deadline/nuke_submitter
```

For Linux and MacOS:
```sh
$ export NUKE_PATH=${NUKE_PATH}:<target-directory>/deadline/nuke_submitter
```

After installation and within the same terminal, run `Nuke<version>` executable. The Nuke submitter should now be available in the AWS Deadline menu.

NOTE: If you want the submitter available outside of this shell, consider using `NUKE_PATH` as an environment variable rather than a shell variable.

## 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 Down
3 changes: 1 addition & 2 deletions install_builder/deadline-cloud-for-nuke.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<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"/>
</onPackingFilterList>
</distributionDirectory>
</distributionFileList>
Expand Down Expand Up @@ -77,7 +76,7 @@
<fnAddPathEnvironmentVariable>
<progressText>Setting NUKE_PATH</progressText>
<name>NUKE_PATH</name>
<value>${nuke_installdir}</value>
<value>${nuke_installdir}/deadline/nuke_submitter</value>
<scope>${installscope}</scope>
<insertAt>end</insertAt>
</fnAddPathEnvironmentVariable>
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 Exception:
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 82b7eb2

Please sign in to comment.