Skip to content

Commit dd67131

Browse files
Frame dropDepends now drops all depend types (#976)
* Frame dropDepends now drops all depend types MenuActions calling frame.dropDepends only drops FRAME_ON_FRAME dependencies, DependDoJdbc query only checks "pk_frame_depend_er" returns empty list if none found. This does not drop any other types of dependencies. Users create complicated dependency types like FRAME_ON_JOB, FRAME_ON_LAYER etc. that don't always have FRAME_ON_FRAME, so this function would fail to drop the dependencies and caused the frame to be "stuck" in Depend state because all depend types need to be satisfied before the frame is allowed to run. Changed loop to getWhatThisDependsOn() and drop them one by one, allowing the frame to go in "Waiting" and ready to run. (cherry picked from commit 9741efe5f21e524e5c0353115da644698a971488) * Cuegui dropDepends unittest uses depends The changes to dropDepends broke the MenuActions unittest, because the fn now calls `getWhatThisDependsOn`, which threw a `'Mock' object is not iterable` error. Needed to add depend object for it to pass. * Change dropDepends unittests for github Cuegui MenuActions_tests.py's test_dropDepends unittest no longer applies since the fn no longer calls the pycue's dropDepends with a target parameter. This is a bug fix to dropDepends and now the fn iterates over each dependency and calls "depend.satisfy" instead to remove since the pycue'sdropDepends only applys to "one" depend target, so it will not remove different multiple different dependency types linked to the one frame. Hence, this caused the Cuegui unittest to fail on the Github PR. Opting to put the dropDepends test in pycue (which didn't have one) and remove the test in Cuegui, since Cuegui already has a test coverage for depend.satisfy.
1 parent cc265b4 commit dd67131

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

cuegui/cuegui/MenuActions.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1117,8 +1117,12 @@ def dropDepends(self, rpcObjects=None):
11171117
"Drop dependencies on selected frames?\n"
11181118
"(Drops all of the frame's dependencies)",
11191119
names):
1120+
# Remove all dependency types
1121+
# - get what frame depends on and remove each one
11201122
for frame in frames:
1121-
frame.dropDepends(opencue.api.depend_pb2.ANY_TARGET)
1123+
dependencies = frame.getWhatThisDependsOn()
1124+
for d in dependencies:
1125+
d.satisfy()
11221126
self._update()
11231127

11241128
dependWizard_info = ["Dependency &Wizard...", None, "configure"]

cuegui/tests/MenuActions_tests.py

-11
Original file line numberDiff line numberDiff line change
@@ -971,17 +971,6 @@ def test_markAsWaiting(self, yesNoMock):
971971

972972
self.job.markAsWaiting.assert_called_with(name=[frame_name])
973973

974-
@mock.patch('opencue.search.FrameSearch')
975-
@mock.patch('cuegui.Utils.questionBoxYesNo', return_value=True)
976-
def test_dropDepends(self, yesNoMock, frameSearchMock):
977-
frame_name = 'arbitrary-frame-name'
978-
frame = opencue.wrappers.frame.Frame(opencue.compiled_proto.job_pb2.Frame(name=frame_name))
979-
frame.dropDepends = mock.Mock()
980-
981-
self.frame_actions.dropDepends(rpcObjects=[frame])
982-
983-
frame.dropDepends.assert_called_with(opencue.api.depend_pb2.ANY_TARGET)
984-
985974
@mock.patch('cuegui.DependWizard.DependWizard')
986975
def test_dependWizard(self, dependWizardMock):
987976
frames = [opencue.wrappers.frame.Frame()]

pycue/tests/wrappers/frame_test.py

+13
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,19 @@ def testMarkAsWaiting(self, getStubMock):
185185
stubMock.MarkAsWaiting.assert_called_with(
186186
job_pb2.FrameMarkAsWaitingRequest(frame=frame.data), timeout=mock.ANY)
187187

188+
def testDropDepends(self, getStubMock):
189+
stubMock = mock.Mock()
190+
stubMock.DropDepends.return_value = job_pb2.FrameDropDependsResponse()
191+
getStubMock.return_value = stubMock
192+
193+
target = depend_pb2.ANY_TARGET
194+
frame = opencue.wrappers.frame.Frame(job_pb2.Frame(name='arbitrary-frame-name'))
195+
frame.dropDepends(target)
196+
197+
stubMock.DropDepends.assert_called_with(
198+
job_pb2.FrameDropDependsRequest(frame=frame.data, target=target),
199+
timeout=mock.ANY)
200+
188201
def testRunTimeZero(self, getStubMock):
189202
zeroFrame = opencue.wrappers.frame.Frame(
190203
job_pb2.Frame(name=TEST_FRAME_NAME, start_time=0, stop_time=1000))

0 commit comments

Comments
 (0)