Exemplo n.º 1
0
def startDrag(dragSource, dropActions, objects):
    mimeData = QtCore.QMimeData()
    mimeData.setText("\n".join(["%s" % job.data.name for job in objects]))

    mimeDataAdd(mimeData,
                "application/x-job-names",
                [object.data.name for object in objects if isJob(object)])

    mimeDataAdd(mimeData,
                "application/x-job-ids",
                [opencue.id(object) for object in objects if isJob(object)])

    mimeDataAdd(mimeData,
                "application/x-group-names",
                [object.data.name for object in objects if isGroup(object)])

    mimeDataAdd(mimeData,
                "application/x-group-ids",
                [opencue.id(object) for object in objects if isGroup(object)])

    mimeDataAdd(mimeData,
                "application/x-host-names",
                [object.data.name for object in objects if isHost(object)])

    mimeDataAdd(mimeData,
                "application/x-host-ids",
                [opencue.id(object) for object in objects if isHost(object)])

    drag = QtGui.QDrag(dragSource)
    drag.setMimeData(mimeData)
    drag.exec_(QtCore.Qt.MoveAction)
Exemplo n.º 2
0
 def __populate_menu(self):
     self.__menu.clear()
     for group in self.__show.getGroups():
         if opencue.id(group) in self.__actions:
             self.__menu.addAction(self.__actions[opencue.id(group)])
         else:
             action = QtWidgets.QAction(self)
             action.setText(group.data.name)
             action.setCheckable(True)
             self.__actions[opencue.id(group)] = action
             self.__menu.addAction(action)
Exemplo n.º 3
0
    def __setJob(self, job = None):
        if cuegui.Utils.isJob(job) and self.__job and opencue.id(job) == opencue.id(self.__job):
            return

        new_job = cuegui.Utils.findJob(job)
        if new_job:
            self.__job = new_job
            self.setWindowTitle("%s" % new_job.data.name)
            self.raise_()

            self.__monitorFrames.setJob(new_job)
            self.__monitorLayers.setJob(new_job)
        elif not job and self.__job:
            self.__unmonitor(self.__job)
Exemplo n.º 4
0
    def testIdOnEntityList(self, getStubMock):
        del getStubMock
        arbitraryIds = ['foo', 'bar']
        jobs = [Job(job_pb2.Job(id=arbitraryIds[0])), Job(job_pb2.Job(id=arbitraryIds[1]))]

        ids = opencue.id(jobs)

        self.assertEqual(len(jobs), len(ids))
        for i in range(0, len(jobs)):
            self.assertEqual(arbitraryIds[i], ids[i])
Exemplo n.º 5
0
 def dropAllDepends(job, layer=None, frame=None):
     if frame:
         logger.debug("dropping all depends on: %s/%04d-%s" % (job, layer, frame))
         depend_er_frame = opencue.api.findFrame(job, layer, frame)
         for depend in depend_er_frame.getWhatThisDependsOn():
             depend.proxy.satisfy()
     elif layer:
         logger.debug("dropping all depends on: %s/%s" % (job, layer))
         depend_er_layer = opencue.api.findLayer(job, layer)
         for depend in depend_er_layer.getWhatThisDependsOn():
             depend.proxy.satisfy()
     else:
         logger.debug("dropping all depends on: %s" % job)
         depend_er_job = opencue.api.findJob(job)
         for depend in depend_er_job.getWhatThisDependsOn():
             logger.debug("dropping depend %s %s" % (depend.data.type, opencue.id(depend)))
             depend.proxy.satisfy()
Exemplo n.º 6
0
def displayDepend(depend):
    print "-"
    print "Unique ID: %s" % opencue.id(depend)
    print "Type: %s" % depend.data.type
    print "Internal: %s" % depend.data.target
    print "Active: %s" % depend.data.active
    print "AnyFrame: %s" % depend.data.any_frame

    print "Depending Job: %s" % depend.data.depend_er_job
    if depend.data.depend_er_layer:
        print "Depending Layer: %s" % depend.data.depend_er_layer
    if depend.data.depend_er_frame:
        print "Depending Frame: %s" % depend.data.depend_er_frame
    if depend.data.depend_on_job != depend.data.depend_er_job:
        print "Depend On Job: %s" % depend.data.depend_on_job
    if depend.data.depend_on_layer:
        print "Depend On Layer: %s" % depend.data.depend_on_layer
    if depend.data.depend_on_frame:
        print "Depending Frame: %s" % depend.data.depend_on_frame
Exemplo n.º 7
0
    def __init__(self, layers, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        self.__layers = [
            opencue.api.getLayer(opencue.id(layer)) for layer in layers
        ]

        self.setWindowTitle("Layer Properties")

        multiSelect = len(self.__layers) > 1

        self.mem_max_gb = float(self._cfg().get('max_memory', 80.0))
        self.mem_min_gb = 0.25
        self.mem_max_kb = int(self.mem_max_gb * 1024 * 1024)
        self.mem_min_kb = int(self.mem_min_gb * 1024 * 1024)

        self.gpu_max_kb = 2 * 1024 * 1024
        self.gpu_min_kb = 0
        self.gpu_tick_kb = 256 * 1024
        self.gpu_max_gb = 2.0
        self.gpu_min_gb = 0.0
        self.gpu_tick_gb = .25

        self.__group = QtWidgets.QGroupBox("Resource Options", self)

        # Memory
        self.__mem = SlideSpinner(self)
        self.__mem.slider.setMinimumWidth(200)
        self.__mem.slider.setRange(self.mem_min_kb, self.mem_max_kb)
        self.__mem.slider.setTickInterval(self.mem_min_kb)
        self.__mem.slider.setSingleStep(self.mem_min_kb)
        self.__mem.spinner.setSuffix(" GB")
        self.__mem.spinner.setRange(self.mem_min_gb, self.mem_max_gb)

        # Cores
        self.__core = QtWidgets.QDoubleSpinBox(self)
        self.__core.setDecimals(1)
        self.__core.setRange(0, int(self._cfg().get('max_cores', 16)))
        self.__core.setSingleStep(1)

        # Max cores
        self.__max_cores = QtWidgets.QSpinBox(self)
        self.__max_cores.setRange(0, int(self._cfg().get('max_cores', 16)))
        self.__max_cores.setSingleStep(1)

        # Disable this for everything except commander.
        # pylint: disable=no-member
        if QtGui.qApp.applicationName() != "CueCommander":
            self.__core.setDisabled(True)
        # pylint: enable=no-member

        # Threads
        self.__thread = QtWidgets.QCheckBox(self)
        self.__thread.setChecked(self.getThreading())

        # Timeout
        self.__timeout = QtWidgets.QSpinBox(self)
        self.__timeout.setRange(0, 4320)
        self.__timeout.setSingleStep(1)
        self.__timeout.setSuffix(" minutes")
        self.__timeout.setSpecialValueText("No timeout")

        # Timeout LLU
        self.__timeout_llu = QtWidgets.QSpinBox(self)
        self.__timeout_llu.setRange(0, 4320)
        self.__timeout_llu.setSingleStep(1)
        self.__timeout_llu.setSuffix(" minutes")
        self.__timeout_llu.setSpecialValueText("No timeout")

        # Memory Optimizer
        self.__mem_opt = QtWidgets.QCheckBox()
        self.__mem_opt.setChecked(self.getMemoryOptSetting())

        # Tags
        self.__tags = LayerTagsWidget(self.__layers, self)

        # Limits
        self.__limits = LayerLimitsWidget(self.__layers, self)

        ## GPU Memory
        self.__gpu = SlideSpinner(self)
        self.__gpu.slider.setMinimumWidth(200)
        self.__gpu.slider.setRange(self.gpu_min_kb,
                                   self.gpu_max_kb // self.gpu_tick_kb)
        self.__gpu.slider.setTickInterval(1)
        self.__gpu.slider.setSingleStep(1)
        self.__gpu.slider.setPageStep(1)
        self.__gpu.spinner.setSuffix(' GB')
        self.__gpu.spinner.setRange(self.gpu_min_gb, self.gpu_max_gb)
        self.__gpu.spinner.setSingleStep(self.gpu_tick_gb)

        # Our dialog buttons.
        self.__buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Save
            | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)

        # Setup signals
        self.__mem.slider.valueChanged.connect(self.__translateToMemSpinbox)
        self.__mem.spinner.valueChanged.connect(self.__translateToMemSlider)
        self.__gpu.slider.valueChanged.connect(self.__translateToGpuSpinbox)
        self.__gpu.spinner.valueChanged.connect(self.__translateToGpuSlider)
        self.__buttons.accepted.connect(self.verify)
        self.__buttons.rejected.connect(self.reject)

        # Set actual values once signals are setup
        self.__mem.slider.setValue(self.getMaxMemory())
        self.__gpu.slider.setValue(self.getMaxGpu())
        self.__core.setValue(self.getMinCores())
        self.__max_cores.setValue(self.getMaxCores())
        self.__timeout.setValue(self.getTimeout())
        self.__timeout_llu.setValue(self.getTimeoutLLU())

        QtWidgets.QVBoxLayout(self)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(
            EnableableItem(
                LayerPropertiesItem("Minimum Memory:", self.__mem, False),
                multiSelect))
        layout.addWidget(
            EnableableItem(
                LayerPropertiesItem("Memory Optimizer:", self.__mem_opt, True),
                multiSelect))
        layout.addWidget(
            EnableableItem(
                LayerPropertiesItem("Min Threads:", self.__core, False),
                multiSelect))
        layout.addWidget(
            EnableableItem(
                LayerPropertiesItem("Max Threads:", self.__max_cores, False),
                multiSelect))
        layout.addWidget(
            EnableableItem(
                LayerPropertiesItem("Multi-Threadable:", self.__thread, True),
                multiSelect))
        layout.addWidget(
            EnableableItem(
                LayerPropertiesItem("Minimum Gpu Memory:", self.__gpu, False),
                multiSelect))
        layout.addWidget(
            EnableableItem(
                LayerPropertiesItem("Timeout:", self.__timeout, False),
                multiSelect))
        layout.addWidget(
            EnableableItem(
                LayerPropertiesItem("Timeout LLU:", self.__timeout_llu, False),
                multiSelect))
        layout.addStretch()
        self.__group.setLayout(layout)

        self.layout().addWidget(EnableableItem(self.__tags, multiSelect))
        self.layout().addWidget(EnableableItem(self.__limits, multiSelect))
        self.layout().addWidget(self.__group)
        self.layout().addWidget(self.__buttons)
Exemplo n.º 8
0
    def testIdOnEntity(self, getStubMock):
        del getStubMock
        arbitraryId = 'foo'
        job = Job(job_pb2.Job(id=arbitraryId))

        self.assertEqual(arbitraryId, opencue.id(job))
Exemplo n.º 9
0
 def testGetLayer(self):
     layer1 = opencue.api.findLayer(TEST_JOB_NAME, TEST_LAYER_NAME)
     layer2 = opencue.api.getLayer(opencue.id(layer1))
Exemplo n.º 10
0
 def testGetJob(self):
     job1 = opencue.api.findJob(TEST_JOB_NAME)
     job2 = opencue.api.getJob(opencue.id(job1))
Exemplo n.º 11
0
 def testGetHost(self):
     h = opencue.api.findHost(TEST_HOST_NAME)
     self.assertEquals(h.name(), TEST_HOST_NAME)
     h2 = opencue.api.getHost(opencue.id(h))
     self.assertEquals(h.name(), h2.name())
Exemplo n.º 12
0
 def testGetSubscription(self):
     sub1 = opencue.api.findSubscription(TEST_SUB_NAME)
     sub2 = opencue.api.getSubscription(opencue.id(sub1))
     self.assertEqual(opencue.id(sub1), opencue.id(sub2))
Exemplo n.º 13
0
 def testGetFrame(self):
     frame1 = opencue.api.findFrame(TEST_JOB_NAME, TEST_LAYER_NAME, 1)
     frame2 = opencue.api.getFrame(opencue.id(frame1))
     self.assertEqual(frame1.number(), frame2.number())
Exemplo n.º 14
0
    def testIdOnEntity(self):
        arbitraryId = 'foo'
        job = Job(job_pb2.Job(id=arbitraryId))

        self.assertEquals(arbitraryId, opencue.id(job))