Setting up a development environment on Windows

Set up your development environment on Windows

This is a guide to setting up a development environment on Windows that lets you run the entire OpenCue system, including Cuebot, CueGUI, and RQD. After you complete the setup, you can make changes to any part of the development environment.

Before you begin

First, clone the OpenCue git repository to your machine. You also need to download and install three core dependencies:

It’s also useful to install an IDEs. JetBrains has free community versions of the following options:

Database setup

After installing PostgreSQL you need to create a database and user for OpenCue (specifically Cuebot) to use.

To do this you can either use the pgAdmin GUI, which is included with PostgreSQL on Windows, or the command-line PostgreSQL client.

Using the command-line

To set up the database using the command-line:

  1. Download the schema-*.sql and demo-*.sql files from the the releases page.

  2. Open Powershell, then run psql:

    # Change the following path depending on what version of PostgreSQL you have:
    $psql = 'C:\Program Files\PostgreSQL\12\bin\psql.exe'
    & $psql -U postgres
    
  3. Enter the password you set during PostgreSQL installation.

  4. Next, enter the following psql commands to set up the user and database:

create user opencue with password 'INSERT PASSWORD HERE';
create database opencue;
\connect opencue
alter default privileges in schema public grant all privileges on tables to opencue;
\include schema-*.sql # actual filename changes depending on version
set search_path = public;
\include demo_data-*.sql # actual filename changes depending on version
\quit

Using the pgAdmin GUI

To set up the database using the pgAdmin GUI:

  1. To start pgAdmin, open pgAdmin from the Start menu.

    This adds an icon to the system tray.

  2. Right-click the pgAdmin icon and click New pgAdmin window…, which will open in your browser.

  3. Sign in with your PostgreSQL admin user credentials that you selected during the PostgreSQL installation.

  4. To create a user, from the tree-view on the left, right-click Login/Group Roles and select Create→Login/Group Role….

  5. Name the user opencue and choose a secure password, then click Save.

  6. To create a database, from the tree-view on the left, right-click Databases and select Create > Database….

  7. Name the database opencue, then click Save.

    Next you need to populate the database.

  8. To populate the database, as described in the instructions on the Setting up the Database page to populate the database, you can:

    1. Download the latest schema-*.sql from the releases page.

    2. In pgAdmin right-click the opencue database, and select Query Tool….

    3. In the Query Editor click 📂 (Open File icon) and open the .sql file you downloaded.

    4. Click ▶ (Execute icon) to populate the database.

    You also need the demo data to run the full environment locally.

  9. To insert demo data, download the latest demo_data-*.sql from the releases page and run it against the opencue database as described in the previous step.

  10. To grant permissions, in pgAdmin, right-click on the opencue database and select Grant Wizard.

  11. Use the select-all box to select all items, then select Next.

  12. Add the opencue user and select ALL privileges, then select Next again, and then click Finish.

Configure PyCue for local CueBot server

You need to change the default servers for the opencue Python library, so that it can find your local Cuebot server.

Open pycue/opencue/default.yaml, and edit the end of the file to look like the following:

cuebot.facility_default: local
cuebot.facility:
  local:
  - localhost:8443

Generate gRPC .proto files

Generating the .proto gRPC protocol files for RQD and the PyCue library is currently a manual process. To generate the .proto files:

  1. Open Powershell and install the required gRPC tools:

    pip install grpcio-tools
    
  2. Change directory to the proto folder.

  3. Run the following commands (from proto/README.md):

    python -m grpc_tools.protoc --proto_path=. --python_out=../rqd/rqd/compiled_proto --grpc_python_out=../rqd/rqd/compiled_proto (ls *.proto).Name
    python -m grpc_tools.protoc --proto_path=. --python_out=../pycue/opencue/compiled_proto --grpc_python_out=../pycue/opencue/compiled_proto (ls *.proto).Name
    

    The .proto files also need some post-processing to make them compatible with Python 3. The easiest way to do this is to install and run the 2to3 package.

  4. Run the following commands to install the 2to3 package and complete the post-processing:

    pip install 2to3
    2to3 -wn (ls ../rqd/rqd/compiled_proto/*_pb2*)
    2to3 -wn (ls ../pycue/opencue/compiled_proto/*_pb2*)
    

Running Cuebot

Cuebot is the core component of OpenCue, written in Java.

To build and run it with IntelliJ IDEA:

  1. Open IntelliJ IDEA and choose Open, select the cuebot folder in the git repository.

    The IDE downloads and sets up Gradle, if required, which can take some time.

  2. Browse to the src/main/java/com.imageworks/spcue/CuebotApplication file.

  3. Click Edit ‘CubotApplicat….main()'….

  4. Update the Program arguments as follows and replace the value for <PASSWORD> where indicated:

    --datasource.cue-data-source.jdbc-url=jdbc:postgresql://localhost/opencue --datasource.cue-data-source.username=opencue --datasource.cue-data-source.password=<PASSWORD>
    
  5. Click OK.

  6. Click Run > Run ‘CuebotApplication’.

  7. Verify that the output window doesn’t show any errors.

    If it does, double-check that you have set up the database correctly, including permissions, and have set the Program arguments correctly.

Running CueSubmit

CueSubmit lets you submit jobs to OpenCue, written in Python.

To set up CueSubmit and run it with PyCharm:

  1. Open PyCharm and choose Open, select the cuesubmit folder in the git repository.

  2. For the project interpreter, if you are working on other Python projects, we recommend seting up a virtual environment. Alternatively, you can leave the project interpreter set to the default Python interpreter.

  3. PyCharm should prompt you to install ‘Package requirements’. If not, open the setup.py and the banner should appear.

  4. Select Install Requirements and wait for the packages to be installed.

    PySide2 can take some time to install.

  5. You need to add additional content roots to find the opencue and outline libraries. Under File > Settings, find Project: cuesubmit/Project Structure, then click ➕ (plus icon) next to Add Content Root and add the pycue folder.

  6. Repeat the previous step for the pyoutline folder.

  7. Select OK to exit.

  8. Right-click cuesubmit/__main__.py and click Run.

Running CueGUI

CueGUI lets you monitor the status of jobs and rendering hosts. It is written in Python.

To set up CueGUI and run it with PyCharm:

  1. Open PyCharm and click Open.

  2. Select the cuegui folder in the git repository.

  3. For the project interpreter, if you are working on other Python projects, we recommend seting up a virtual environment. Alternatively, you can leave the project interpreter set to the default Python interpreter.

  4. PyCharm should prompt you to install ‘Package requirements’. If not, open the setup.py and the banner should appear.

  5. Select Install Requirements and wait for the packages to be installed.

    PySide2 can take some time to install.

  6. You need to add additional content roots to find the opencue library. Under File > Settings, find Project: cuegui/Project Structure, then click the ➕ (plus icon) next to Add Content Root and add the pycue folder.

  7. Select OK to exit.

  8. Right-click cuegui/__main__.py and click Run.

Running RQD

RQD is the OpenCue rendering host agent. It is written in Python.

To get set up and run it with PyCharm:

  1. Open PyCharm and choose Open, select the rqd folder in the git repository.

  2. For the project interpreter, if you are working on other Python projects, we recommend seting up a virtual environment. Alternatively, you can leave the project interpreter set to the default Python interpreter.

  3. PyCharm should prompt you to install ‘Package requirements’. If not, open the setup.py and the banner should appear.

  4. Select Install Requirements and wait for the packages to be installed.

  5. Right-click rqd/__main__.py and click Run.

Verify your installation

After you are running CueBot, CueGUI, and RQD simultaneously, you should be able to see the RQD host in CueGUI:

  1. From the Views/Plugins menu, click Cuecommander > Monitor Hosts.

  2. In the Monitor Hosts section, check the Auto-refresh box as illustrated by the following screenshot:

    A screenshot of CueGUI showing host

    Next, check that you can run a job by using CueSubmit.

  3. Switch to CueSubmit and fill out Job, Shot, and Layer Name fields as you like.

  4. Set the Command to ping opencue.io.

  5. Set Frame Spec to 1.

  6. Click Submit:

    A screenshot of CueSubmit with correct values

  7. Switch back to CueGUI and verify that the job completes successfully:

    A screenshot of CueGUI with completed job

This verifies that your end-to-end installation is working.