Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.54.1 (2026-01-21)
## 0.54.1 (2026-01-22)


### Features
Expand Down
170 changes: 104 additions & 66 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,35 @@
This documentation provides guidance on developer workflows for working with the code in this repository.

Table of Contents:
* [Development Environment Setup](#development-environment-setup)
* [The Development Loop](#the-development-loop)
* [Documentation](#documentation)
* [Code Organization](#code-organization)
* [Testing](#testing)
* [Writing tests](#writing-tests)
* [Unit tests](#unit-tests)
* [Integration tests](#integration-tests)
* [Squish GUI Submitter tests](#squish-tests)
* [Changelog Guidelines](#changelog-guidelines)
* [Things to Know](#things-to-know)
* [Public contracts](#public-contracts)
* [Library Dependencies](#dependencies)
* [Qt and Calling AWS APIs](#qt-and-calling-aws-including-aws-deadline-cloud-apis)
- [Development documentation](#development-documentation)
- [Development Environment Setup](#development-environment-setup)
- [The Development Loop](#the-development-loop)
- [Documentation](#documentation)
- [Code Organization](#code-organization)
- [Testing](#testing)
- [Writing Tests](#writing-tests)
- [Unit Tests](#unit-tests)
- [Running Unit Tests](#running-unit-tests)
- [Running Docker-based Unit Tests](#running-docker-based-unit-tests)
- [Integration Tests](#integration-tests)
- [Running Integration Tests](#running-integration-tests)
- [Squish GUI Submitter Tests](#squish-gui-submitter-tests)
- [Running Squish GUI Submitter Tests](#running-squish-gui-submitter-tests)
- [Changelog Guidelines](#changelog-guidelines)
- [Things to Know](#things-to-know)
- [Public Contracts](#public-contracts)
- [Private Modules](#private-modules)
- [Public Modules](#public-modules)
- [On `import os as _os`](#on-import-os-as-_os)
- [Library Dependencies](#library-dependencies)
- [Why is a new dependency needed?](#why-is-a-new-dependency-needed)
- [Quality of the dependency](#quality-of-the-dependency)
- [Version Pinning](#version-pinning)
- [Licensing](#licensing)
- [Qt and Calling AWS (including AWS Deadline Cloud) APIs](#qt-and-calling-aws-including-aws-deadline-cloud-apis)
- [Pattern 1: Simple Async Operations (Recommended)](#pattern-1-simple-async-operations-recommended)
- [Pattern 2: Long-Running Operations with Progress](#pattern-2-long-running-operations-with-progress)
- [Profiling in Deadline Cloud](#profiling-in-deadline-cloud)

## Development Environment Setup

Expand Down Expand Up @@ -378,66 +393,89 @@ for a signal from the application.
If interacting with the GUI can start multiple background threads, you should also track which
is the latest, so the code only applies the result of the newest operation.

See `deadline_config_dialog.py` for some examples that do all of the above. Here's some
code that was edited to show how it fits together:
See `deadline_config_dialog.py` for some examples that do all of the above.

### Pattern 1: Simple Async Operations (Recommended)

For simple fetch-and-display operations, use `AsyncTaskRunner`:

```python
from deadline.client.ui.controllers import AsyncTaskRunner

class MyCustomWidget(QWidget):
# Signals for the widget to receive from the thread
background_exception = Signal(str, BaseException)
update = Signal(int, BackgroundResult)

def __init__(self, ...):
# Save information about the thread
self.__refresh_thread = None
self.__refresh_id = 0

# Use the CancelationFlag object to decouple the cancelation value
# from the window lifetime.
self.canceled = CancelationFlag()
self.destroyed.connect(self.canceled.set_canceled)

# Connect the Signals to handler functions that run on the main thread
self.update.connect(self.handle_update)
self.background_exception.connect(self.handle_background_exception)

def handle_background_exception(self, e: BaseException):
# Handle the error
QMessageBox.warning(...)

def handle_update(self, refresh_id: int, result: BackgroundResult):
# Apply the refresh if it's still for the latest call
if refresh_id == self.__refresh_id:
# Do something with result
self.result_widget.set_message(result)
def __init__(self, ...):
self._runner = AsyncTaskRunner(self)
self._runner.task_error.connect(self._on_error, Qt.QueuedConnection)

def start_the_refresh(self):
# This function starts the thread to run in the background

# Update the GUI state to reflect the update
self.result_widget.set_refreshing_status(True)

self.__refresh_id += 1
self.__refresh_thread = threading.Thread(
target=self._refresh_thread_function,
name=f"AWS Deadline Cloud Refresh Thread",
args=(self.__refresh_id,),
self._runner.run(
operation_key="my_refresh",
fn=self._fetch_data,
on_success=self._handle_result,
on_error=self._handle_error,
)
self.__refresh_thread.start()

def _refresh_thread_function(self, refresh_id: int):
# This function is for the background thread
try:
# Call the slow operations
result = boto3_client.potentially_expensive_api(...)
# Only emit the result if it isn't canceled
if not self.canceled:
self.update.emit(refresh_id, result)
except BaseException as e:
# Use multiple signals for different meanings, such as handling errors.
if not self.canceled:
self.background_exception.emit(f"Background thread error", e)

def _fetch_data(self):
# This runs in background thread
return boto3_client.potentially_expensive_api(...)

def _handle_result(self, result):
self.result_widget.set_refreshing_status(False)
self.result_widget.set_message(result)

def _handle_error(self, error):
self.result_widget.set_refreshing_status(False)
QMessageBox.warning(self, "Error", str(error))
```

### Pattern 2: Long-Running Operations with Progress

For complex operations with progress callbacks, use a `QThread` subclass:

```python
from qtpy.QtCore import QThread, Signal, Qt

class MyWorker(QThread):
progress = Signal(int, str) # percent, message
succeeded = Signal(object)
failed = Signal(BaseException)

def __init__(self, parent=None):
super().__init__(parent)
self._canceled = False

def cancel(self):
self._canceled = True

def run(self):
try:
for i, item in enumerate(items):
if self._canceled:
return
self.progress.emit(i * 100 // len(items), f"Processing {item}")
process(item)
self.succeeded.emit(result)
except Exception as e:
if not self._canceled:
self.failed.emit(e)


class MyCustomWidget(QWidget):
def __init__(self, ...):
self._worker = MyWorker(self)
self._worker.progress.connect(self._on_progress, Qt.QueuedConnection)
self._worker.succeeded.connect(self._on_success, Qt.QueuedConnection)
self._worker.failed.connect(self._on_error, Qt.QueuedConnection)

def start_the_operation(self):
self._worker.start()

def closeEvent(self, event):
if self._worker.isRunning():
self._worker.cancel()
self._worker.wait()
super().closeEvent(event)
```

# Profiling in Deadline Cloud
Expand Down
2 changes: 1 addition & 1 deletion requirements-integ-testing.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
deadline-cloud-test-fixtures == 0.18.8 # Pinning due to a regression in 0.18.9
deadline-cloud-test-fixtures ~= 0.18.10
# MCP (Model Context Protocol) library for MCP server integration tests
mcp >= 1.13.0
pytest-asyncio == 1.*
3 changes: 3 additions & 0 deletions requirements-testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ pytest-cov == 7.*; python_version > '3.8'
pytest-cov == 5.*; python_version <= '3.8'
pytest-timeout == 2.*
pytest-xdist == 3.*
pytest-qt == 4.*
# GUI testing dependencies
PySide6-essentials >= 6.6,< 6.11
freezegun == 1.*
types-pyyaml == 6.*
twine == 4.*; python_version == '3.7'
Expand Down
33 changes: 17 additions & 16 deletions scripts/attributions/approved_text/Darwin/THIRD_PARTY_LICENSES
Original file line number Diff line number Diff line change
Expand Up @@ -502,26 +502,27 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

jmespath

MIT License

Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, dis-
tribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the fol-
lowing conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

packaging

Expand Down
33 changes: 17 additions & 16 deletions scripts/attributions/approved_text/Linux/THIRD_PARTY_LICENSES
Original file line number Diff line number Diff line change
Expand Up @@ -502,26 +502,27 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

jmespath

MIT License

Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, dis-
tribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the fol-
lowing conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

packaging

Expand Down
33 changes: 17 additions & 16 deletions scripts/attributions/approved_text/Windows/THIRD_PARTY_LICENSES
Original file line number Diff line number Diff line change
Expand Up @@ -532,26 +532,27 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

jmespath

MIT License

Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, dis-
tribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the fol-
lowing conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

packaging

Expand Down
2 changes: 1 addition & 1 deletion scripts/attributions/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"spdx": _BSD_3_CLAUSE,
},
"jmespath": {
"license_sha256": "66b313cce80ed0623fc7db3f24863a0c80fd83eb341a46b57864158ae74faa56",
"license_sha256": "6eefacfa4d71b82d08408c751470ac8d9854538da2142cb27be0287fb13d0ab9",
"spdx": _MIT,
},
"packaging": {
Expand Down
17 changes: 17 additions & 0 deletions src/deadline/client/ui/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ class CancelationFlag:
function of the class. With this object, you can bind it
to the cancelation flag's set_canceled method instead.

.. deprecated::
This class is deprecated and will be removed in a future release.
Use Qt's native threading mechanisms instead:
- For simple async operations, use `AsyncTaskRunner` from
`deadline.client.ui.controllers`
- For complex operations with progress callbacks, use a
`QThread` subclass with signals

Example usage:

class MyWidget(QWidget):
Expand All @@ -251,6 +259,15 @@ def _my_thread_function(self):
"""

def __init__(self):
import warnings

warnings.warn(
"CancelationFlag is deprecated and will be removed in a future release. "
"Use AsyncTaskRunner from deadline.client.ui.controllers for simple async operations, "
"or a QThread subclass with signals for complex operations with progress callbacks.",
DeprecationWarning,
stacklevel=2,
)
self.canceled = False

def set_canceled(self):
Expand Down
Loading
Loading