Skip to content

[pycue/cuegui/cuebot] Add Department wrapper and fix TasksDialog (#2399)#2427

Open
ttpss930141011 wants to merge 6 commits into
AcademySoftwareFoundation:masterfrom
ttpss930141011:pycue-department-wrappers
Open

[pycue/cuegui/cuebot] Add Department wrapper and fix TasksDialog (#2399)#2427
ttpss930141011 wants to merge 6 commits into
AcademySoftwareFoundation:masterfrom
ttpss930141011:pycue-department-wrappers

Conversation

@ttpss930141011

@ttpss930141011 ttpss930141011 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Related Issues

Resolves #2399
Originally reported as #1042
Related (not addressed here): #2400

Summarize your change.

CueGUI's TasksDialog is written entirely against the pycue wrapper API, but the Department wrapper it depends on was never implemented — so opening the dialog raised AttributeError on Show.getDepartments() (TasksDialog.py:94). This adds the missing wrapper layer and fixes two related gaps found while wiring it up.

pycue

  • New opencue/wrappers/department.py: Department wrapper following the existing task.py pattern (self.data + self.stub, one method per RPC), covering the DepartmentInterface RPCs that cuebot implements: addTask, addTasks, clearTasks, clearTaskAdjustments, enableTiManaged, disableTiManaged, getTasks, replaceTasks, setManagedCores. DepartmentInterface.Delete is intentionally not wrapped — cuebot has no implementation for it.
  • Show.getDepartment() / Show.getDepartments(), mirroring the existing getGroups().
  • Module-level api.addDepartmentName() / api.removeDepartmentName(), alongside the existing getDepartmentNames().
  • Task.clearAdjustments(), used by the Tasks dialog context menu.

cuegui

  • TaskActions.clearAdjustment called task.clearAdjustment(), which never existed on the wrapper; the unit test mocked the attribute, so the gap was never caught. Both now call the real Task.clearAdjustments().

cuebot / proto

  • The proto declared rpc SetMangedCores (typo) while the servant implements setManagedCores. Because the names differed, the servant never overrode the generated base method and the RPC always returned UNIMPLEMENTED — so the "Minimum Cores" control in TasksDialog would fail even with the wrapper in place. Renamed the RPC to SetManagedCores and added @Override on the servant. The rename is safe: no client could have called the old RPC successfully, and nothing references the old name. VERSION.in is bumped 1.25 → 1.26 as required by ci/check_version_bump.py for proto changes.

Tests: new tests/wrappers/test_department.py, plus getDepartment/getDepartments in test_show.py, clearAdjustments in test_task.py, and getDepartmentNames/addDepartmentName/removeDepartmentName in test_api.py.

Open question for the reviewer: #2400 suggested naming these createDepartment / deleteDepartment. I chose addDepartmentName / removeDepartmentName instead, to match the underlying RPC names and the existing getDepartmentNames(), and because they manage the allowed-name whitelist rather than creating a show's department entity (entities are auto-created when a name is assigned to a group — see department.proto). Happy to rename if the create/delete spelling is preferred.

LLM usage disclosure

Claude (Opus) was used to build up testing environment across cuegui/pycue/cuebot, write the unit tests, and draft this PR description.

Summary by CodeRabbit

  • New Features

    • Added department support across the Python API and wrappers, including viewing departments from a show and managing department-related task settings.
    • Introduced new actions to add or remove department names through the API.
    • Added support for clearing task adjustments from task actions.
  • Bug Fixes

    • Corrected the managed-cores service name and aligned related behavior for department management.
    • Updated task adjustment clearing to use the new plural behavior consistently.
  • Documentation

    • Expanded API documentation to include the department wrapper.

The DepartmentInterface RPC was declared as SetMangedCores while the
cuebot servant implements setManagedCores. The servant method never
overrode the generated base method, so the RPC always returned
UNIMPLEMENTED. Rename the RPC to the correct spelling and mark the
servant method as an override.

The rename is safe: no client could ever call this RPC successfully,
and nothing else references the old name.

Part of AcademySoftwareFoundation#2399.
CueGUI's TasksDialog calls Show.getDepartments() and several methods on
the returned department objects, but pycue never had a Department
wrapper, so the dialog raised AttributeError on open (AcademySoftwareFoundation#1042).

- Add opencue.wrappers.department.Department covering the
  DepartmentInterface RPCs that cuebot implements.
- Add Show.getDepartment() and Show.getDepartments().
- Add api.addDepartmentName() and api.removeDepartmentName() alongside
  the existing getDepartmentNames() so the list of allowed department
  names can be managed from Python.
- Add Task.clearAdjustments(), used by the Tasks dialog context menu.

DepartmentInterface.Delete is intentionally not wrapped because cuebot
does not implement it.

Fixes AcademySoftwareFoundation#2399
TaskActions.clearAdjustment called task.clearAdjustment(), which never
existed on the pycue Task wrapper; the unit test mocked the attribute
so the gap was never caught. Point both at the real
Task.clearAdjustments() method.

Part of AcademySoftwareFoundation#2399.
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7616cead-cf8e-4fd0-bfd8-ad6dd795ae58

📥 Commits

Reviewing files that changed from the base of the PR and between fc79cef and 4d07462.

📒 Files selected for processing (1)
  • cuegui/cuegui/MenuActions.py

📝 Walkthrough

Walkthrough

This PR adds a Department wrapper class to pycue with gRPC-backed methods for task management, Track-It control, and managed-core configuration. It adds Show.getDepartment/getDepartments, api.addDepartmentName/removeDepartmentName, and Task.clearAdjustments, fixes a proto RPC typo, and updates cuegui's call to the plural method name, plus corresponding tests and docs.

Changes

Department API wrappers and related fixes

Layer / File(s) Summary
Proto typo fix and Cuebot alignment
proto/src/department.proto, cuebot/src/main/java/com/imageworks/spcue/servant/ManageDepartment.java
Renames RPC SetMangedCores to SetManagedCores and adds @Override to the matching Java handler.
New Department wrapper class and docs
pycue/opencue/wrappers/department.py, api_docs/modules/opencue.wrappers.rst
Adds Department class with gRPC methods for task CRUD, Track-It toggling, managed cores, and id/name accessors; registers the module in Sphinx docs.
Task.clearAdjustments and cuegui call-site fix
pycue/opencue/wrappers/task.py, cuegui/cuegui/MenuActions.py
Adds Task.clearAdjustments() RPC wrapper and updates TaskActions.clearAdjustment to call the plural method name.
api.py and Show wiring
pycue/opencue/api.py, pycue/opencue/wrappers/show.py
Registers Department wrapper, adds addDepartmentName/removeDepartmentName API functions, and adds Show.getDepartment/getDepartments methods.
Tests
pycue/tests/test_api.py, pycue/tests/wrappers/test_department.py, pycue/tests/wrappers/test_show.py, pycue/tests/wrappers/test_task.py, cuegui/tests/test_menu_actions.py
Adds/updates tests covering new department functions, wrapper methods, show department retrieval, task clearAdjustments, and the cuegui plural method call.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CueGUI
  participant Show
  participant Department
  participant CuebotStub

  CueGUI->>Show: getDepartments()
  Show->>CuebotStub: GetDepartments(request, timeout)
  CuebotStub-->>Show: departments list
  Show-->>CueGUI: [Department(dept), ...]

  CueGUI->>Department: setManagedCores(managedCores)
  Department->>CuebotStub: SetManagedCores(request, timeout)
  CuebotStub-->>Department: response
Loading

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding the Department wrapper and related CueGUI fixes.
Linked Issues check ✅ Passed The PR implements the requested Show.getDepartments wrapper and the missing AddDepartmentName/RemoveDepartmentName API wrappers for #2399.
Out of Scope Changes check ✅ Passed The remaining changes support the same Department/TasksDialog fix and proto naming correction, with no clear unrelated scope introduced.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ttpss930141011 ttpss930141011 changed the title TBD [pycue/cuegui/cuebot] Add Department wrapper and fix TasksDialog (#2399) Jun 15, 2026
@ramonfigueiredo

Copy link
Copy Markdown
Collaborator

Thanks for your contribution, @ttpss930141011

We will review your PR soon.

@ttpss930141011 ttpss930141011 marked this pull request as ready for review June 15, 2026 20:33

@DiegoTavares DiegoTavares left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution

@DiegoTavares

Copy link
Copy Markdown
Collaborator

This change should be merged next week after I find some time to test it out in our environment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cuegui/pycue] Show.getDepartments() wrapper missing — TasksDialog unusable, Department admin RPCs unreachable from Python

3 participants