Skip to content

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

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

[pycue/cuegui/cuebot] Add Department wrapper and fix TasksDialog (#2399)#2427
ttpss930141011 wants to merge 5 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

Release Notes v1.26

  • New Features

    • Added department management capabilities, including adding/removing departments, managing department tasks, and configuring managed cores allocation per department.
  • Bug Fixes

    • Corrected RPC method naming inconsistency in department interface.
    • Fixed task adjustment clearing in the UI to use the correct API method.
  • Documentation

    • Updated API documentation for the new department module.

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: 5c9280b8-dbd0-4c06-84fe-46ee7255ade8

📥 Commits

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

📒 Files selected for processing (14)
  • VERSION.in
  • api_docs/modules/opencue.wrappers.rst
  • cuebot/src/main/java/com/imageworks/spcue/servant/ManageDepartment.java
  • cuegui/cuegui/MenuActions.py
  • cuegui/tests/test_menu_actions.py
  • proto/src/department.proto
  • pycue/opencue/api.py
  • pycue/opencue/wrappers/department.py
  • pycue/opencue/wrappers/show.py
  • pycue/opencue/wrappers/task.py
  • pycue/tests/test_api.py
  • pycue/tests/wrappers/test_department.py
  • pycue/tests/wrappers/test_show.py
  • pycue/tests/wrappers/test_task.py

📝 Walkthrough

Walkthrough

Adds a new Department Python wrapper class with full gRPC-backed methods for task management, Track-It toggling, and managed-core configuration. Extends Show with getDepartment/getDepartments, adds Task.clearAdjustments, fixes a proto typo (SetMangedCoresSetManagedCores), and aligns cuegui to call the corrected plural method. Bumps version to 1.26.

Changes

Department API wrappers and related fixes

Layer / File(s) Summary
Proto typo fix and Cuebot @Override alignment
proto/src/department.proto, cuebot/src/main/java/.../ManageDepartment.java
Renames the misspelled SetMangedCores RPC to SetManagedCores in the proto service definition and adds @Override to the corresponding Java handler method.
New Department wrapper class and API docs
pycue/opencue/wrappers/department.py, api_docs/modules/opencue.wrappers.rst
Introduces the Department class with gRPC-backed methods for task CRUD (addTask, addTasks, getTasks, replaceTasks, clearTasks, clearTaskAdjustments), Track-It toggle (enableTiManaged, disableTiManaged), managed-core config (setManagedCores), and id()/name() accessors. Sphinx docs entry added.
Task.clearAdjustments and cuegui call-site fix
pycue/opencue/wrappers/task.py, cuegui/cuegui/MenuActions.py
Adds Task.clearAdjustments() calling the ClearAdjustments gRPC stub. Updates TaskActions.clearAdjustment in cuegui to call the new plural method instead of the former singular clearAdjustment.
api.py department functions and Show.getDepartment wiring
pycue/opencue/api.py, pycue/opencue/wrappers/show.py
Registers Department in the __wrappers registry, adds top-level addDepartmentName and removeDepartmentName API functions, and extends Show with getDepartment and getDepartments methods returning Department wrapper instances.
Tests and version bump
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, VERSION.in
Adds DepartmentTests in test_api.py, a full test_department.py suite covering all wrapper methods, department tests in test_show.py, testClearAdjustments in test_task.py, updated plural mock assertion in test_menu_actions.py, and bumps the version to 1.26.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • #2399 — This PR directly implements the missing Show.getDepartments() and Show.getDepartment() wrappers that caused AttributeError in TasksDialog, and also adds the missing AddDepartmentName/RemoveDepartmentName wrappers noted in that issue.
  • #2400 — This PR adds the addDepartmentName and removeDepartmentName API functions and the full Department wrapper class that are prerequisites for the user-facing "add department" flow described in that feature request.

Suggested reviewers

  • lithorus
  • ramonfigueiredo

🐇 A hop through the code, a fix and a name,
SetManagedCores — spelled right, no more shame!
A Department wrapper springs fresh from the ground,
With tasks and TI-managed all properly found.
clearAdjustments plural, the cuegui now knows,
Version 1.26 — off the rabbit goes! 🎉

🚥 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 accurately summarizes the main changes: adding Department wrapper and fixing TasksDialog bug, directly matching the PR's primary objectives.
Linked Issues check ✅ Passed All coding requirements from issue #2399 are met: Department wrapper, Show.getDepartment(s) methods, api-level add/removeDepartmentName functions, and Task.clearAdjustments method are all implemented with comprehensive tests.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #2399 objectives. The proto typo fix (SetMangedCores→SetManagedCores), version bump, @Override annotation, and cuegui fix are all necessary to enable Department functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@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