nk2dl

Documentation for nk2dl (aka Nuke to Deadline).

View the Project on GitHub artandmath/nk2dl

Installation

System Requirements

1. Download

nk2dl can be downloaded from source or from a point release.

Download from source

From the shell:

git clone https://github.com/artandmath/nk2dl.git
cd nk2dl

Download from release

From the shell:

cd /path/to/nk2dl-0.1.x-alpha

2. Install dependencies

Create the virtual environment will also install the dependencies:

python setup_environment.py

The setup script will ask for a Nuke location. The Nuke location contains the python interpreter that will be used in the virtual environment.

Nuke installation path not set.
Default path: C:\Program Files\Nuke15.2v1
Enter Nuke installation path (press Enter to use default):

The setup script may ask for the Deadline repository location if it cannot automatically find the repository. The script will copy the Deadline API from the repository to the virtual environment.

Deadline repository root not found automatically.
Default path: C:\DeadlineRepository10
Enter Deadline repository root path (press Enter to use default):

3. Verify

Set the virtual environment (only powershell tested thus far).

# Windows
./.venv/Scripts/Activate-nk2dl.ps1

# Linux/MacOSX
source ./.venv/Scripts/activate

A success message will output to the terminal:

Activating NK2DL development environment...
Setting up NK2DL environment variables...
Environment activated and ready!

Open a python interpreter from the terminal. The python interpreter should indicate that the Foundry’s Nuke version of python is in use.

> python
Python 3.10.10 (remotes/origin/foundry/v3.10.10:693bcebd65, Feb  7 2024, 11:52:25) [MSC v.1935 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

If the python interpreter is not the version by the Foundry, launch Nuke in terminal mode, which is essentially the same as launching the Nuke python interpreter.

# Windows:
& 'C:\Program Files\Nuke15.1v1\Nuke15.1.exe' --t

Import the nk2dl module. A copyright message for nk2dl will display and Nuke will load.

>>> import nk2dl
 
Nuke to Deadline (nk2dl) v0.1.0
Copyright (c) 2025 Daniel Harkness. All Rights Reserved.

4. Install for a single user or multiple users in Nuke

If nk2dl will be used in the Nuke application, then Nuke will need to be able find nk2dl and its dependencies during the application launch process.

Install for single user (.nuke method)

~/.nuke/
 ├─ Deadline/
 ├─ nk2dl/
 ├─ yaml/
 ├─ init.py
 ├─ menu.py
 │
etc

Install for multiple users (init.py method)

# Use nuke.pluginAddPath()
nuke.pluginAddPath('/path/to/parent/folder/containing/nk2dl')

# Or append/insert to sys.path
import sys
sys.path.insert(0, '/path/to/parent/folder/containing/nk2dl')

5. Install the Deadline Plugin for Nuke 15.2+ (optional)

6. Install Deadline Web Service (optional)

I feel the need, the need for speed!

For best performance, an instance of a Deadline Web Service is recommended. Instructions on setting up a Deadline Web Service can be found via the Deadline documentation:

After setting up an instance of Deadline Web Service, configure and test the connection to the Deadline Web Service.

Configuration

[!IMPORTANT] Configuration is recommended, but not required.

nk2dl uses a YAML configuration system with multiple levels of precedence (~/.nk2dl/config.yaml has the highest precedence):

  1. Default configuration hard coded into the system.
  2. Facility level configuraton via config.yaml in the nk2dl module.
  3. Project/facility level configuration via $NK2DL_CONFIG.
  4. Project/facility level configuration via environment variables ($NK2DL_*)
  5. User configuration (~/.nuke/nk2dl/config.yaml)

In the case of a single user install in the user’s .nuke folder, level 2 and level 5 may be the same file. If using $NK2DL_* environment variables or the NK2DL_CONFIG that points to a config, file remove the config.yaml from the nk2dl folder in the .nuke firectory to avoid this file taking precedence over the environemnt variables.

Setting the config

Alternatively:

Example configuration:

deadline:
  use_web_service: True
  host: deadline-web-server
  port: 8081
  ssl: False
  commandline_on_fail: True

logging:
  level: DEBUG
  file: null
  format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"

submission:
  pool: nuke
  group: none
  priority: 50
  chunk_size: 10
  department: comp
  batch_name_template: "{scriptname}"
  job_name_template: "{batch} / {write} / {file}"
  extra_info_templates:
    - "Write: {write}"
    - "Order: {render_order}"
    - "Frames: {range}"
    - "Output: {file}"
    # - "GSVs: {gsvs}"

Script Copy functions

Direct parameter usage example

submit_nuke_script(
    "/path/to/script.nk",
    copy_script=True,
    copy_script_path="{outdir}/farm/{nkstem}_{YYYY}-{MM}-{DD}.nk"
)

# For multiple copies, provide lists:
submit_nuke_script(
    "/path/to/script.nk",
    copy_script=True,
    copy_script_path=[
        "{outdir}/.farm/{scriptname}", 
        "{nkdir}/archive/{nkstem}_{YYYY}-{MM}-{DD}.nk"
    ]
)

Script copy config example - one copy of submitted nukescript

submission:
  # Full path template including directory and filename
  # Available tokens: {nkdir}, {nkstem}, {output}, {YYYY}, etc.
  script_copy_path: '{outdir}/.farm/{nkstem}.nk'  

Available tokens for script_copy_path

Script copy config example - many copies of submitted nukescript

submission:
  script_copy0_path: '{outdir}/.farm/{nukescript}'
  script_copy1_path: '{nkdir}/archive/{basename}_{YYYY}-{MM}-{DD}_{hh}-{mm}-{ss}.nk'
  #script_copy2_path: etc

Usage example

cd /path/to/downloaded/nk2dl-repository/
./.venv/Scripts/Activate-nk2dl.ps1
python /path/to/tests/test_nk2dl.py