Exemple #1
0
    def evaluate(self):
        if not self.constructed: return
        self.evaluated = False
        self.bStart.setEnabled(False)
        # self.fileChange()

        # Check parameters:
        # Frame range:
        if self.fields['framestart'].value() > self.fields['frameend'].value():
            self.fields['frameend'].setValue(self.fields['framestart'].value())
        tasksnum = (1.0 + self.fields['frameend'].value() -
                    self.fields['framestart'].value()) / (
                        1.0 * self.fields['frameby'].value() *
                        self.fields['framespt'].value())
        if tasksnum > 10000.0:
            if QtGui.QMessageBox.warning(
                    self, 'Warning', 'Number of tasks > 10000',
                    QtGui.QMessageBox.Yes
                    | QtGui.QMessageBox.Abort) != QtGui.QMessageBox.Yes:
                return
        if tasksnum > 100000.0:
            if QtGui.QMessageBox.warning(
                    self, 'Warning', 'Number of tasks > 100000',
                    QtGui.QMessageBox.Yes
                    | QtGui.QMessageBox.Abort) != QtGui.QMessageBox.Yes:
                return
        if tasksnum > 1000000.0:
            self.teCmd.setText(
                'The number of tasks over one million. Call you system administrator, supervisor or TD.'
            )
            return
        # Check wdir:
        if self.fields['scenewdir'].isChecked():
            self.fields['wdir'].setEnabled(False)
        else:
            self.fields['wdir'].setEnabled(True)
        # Set job name:
        if self.fields['jobnamescene'].isChecked():
            self.fields['jobname'].setText(
                os.path.basename(str(self.fields['scenefile'].text())))
            self.fields['jobname'].setEnabled(False)
        else:
            self.fields['jobname'].setEnabled(True)

        # Check scene:
        scene = str(self.fields['scenefile'].text())
        if len(scene) == 0: return
        name, ext = os.path.splitext(scene)
        if ext in ScenesSequences:
            scene = afcommon.patternFromFile(scene)
        elif not os.path.isfile(scene):
            self.teCmd.setText('Scene file does not exist.')
            return
        scene = os.path.normpath(scene)
        scene = os.path.abspath(scene)
        self.fields['scenefile'].setText(scene)

        # Check working directory:
        if self.fields['scenewdir'].isChecked():
            self.fields['wdir'].setText(
                os.path.dirname(str(self.fields['scenefile'].text())))
        if not os.path.isdir(self.fields['wdir'].text()):
            self.teCmd.setText('Working directory does not exist.')
            return
        self.fields['wdir'].setText(
            os.path.abspath(str(self.fields['wdir'].text())))

        # Check job name:
        if str(self.fields['jobname'].text()) == '':
            self.teCmd.setText('Job name is empty.')
            return

        # Get File Type Override
        servType = getComboBoxString(self.fields['servicetype'])

        # Construct command:
        cmd = os.environ['AF_ROOT']
        cmd = os.path.join(cmd, 'python')
        cmd = os.path.join(cmd, 'afjob.py')
        cmd = '"%s" "%s"' % (os.getenv('CGRU_PYTHONEXE', 'python'), cmd)
        cmd += ' "%s"' % self.fields['scenefile'].text()
        cmd += ' %d' % self.fields['framestart'].value()
        cmd += ' %d' % self.fields['frameend'].value()
        cmd += ' -by %d' % self.fields['frameby'].value()
        cmd += ' -fpt %d' % self.fields['framespt'].value()
        if not str(self.fields['node'].text()) == '':
            cmd += ' -node "%s"' % self.fields['node'].text()
        if not str(self.fields['take'].text()) == '':
            cmd += ' -take "%s"' % self.fields['take'].text()
        if not str(self.fields['outimages'].text()) == '':
            cmd += ' -output "%s"' % self.fields['outimages'].text()
        if not str(self.fields['preview'].text()) == '':
            cmd += ' -images "%s"' % self.fields['preview'].text()
        if not str(self.fields['extrargs'].text()) == '':
            cmd += ' -extrargs "%s"' % self.fields['extrargs'].text()
        if len(servType) and servType != 'none':
            cmd += ' -type "%s"' % servType
        if str(self.fields['os'].text()) == '': cmd += ' -os any'
        else: cmd += ' -os "%s"' % self.fields['os'].text()
        cmd += ' -pwd "%s"' % self.fields['wdir'].text()
        if self.fields['capacity'].value() > 0:
            cmd += ' -capacity %d' % self.fields['capacity'].value()
        if self.fields['maxruntasks'].value() > 0:
            cmd += ' -maxruntasks %d' % self.fields['maxruntasks'].value()
        if self.fields['priority'].value() > -1:
            cmd += ' -priority %d' % self.fields['priority'].value()
        if not str(self.fields['dependmask'].text()) == '':
            cmd += ' -depmask "%s"' % self.fields['dependmask'].text()
        if not str(self.fields['dependglobal'].text()) == '':
            cmd += ' -depglbl "%s"' % self.fields['dependglobal'].text()
        if not str(self.fields['hostsmask'].text()) == '':
            cmd += ' -hostsmask "%s"' % self.fields['hostsmask'].text()
        if not str(self.fields['hostsexclude'].text()) == '':
            cmd += ' -hostsexcl "%s"' % self.fields['hostsexclude'].text()
        if self.fields['paused'].isChecked(): cmd += ' -pause'
        cmd += ' -name "%s"' % self.fields['jobname'].text()
        if not str(self.fields['exec'].text()) == '':
            cmd += ' -exec "%s"' % self.fields['exec'].text()

        # Evaluated:
        self.teCmd.setText(cmd)
        self.evaluated = True
        self.bStart.setEnabled(True)
        print('Evaluated')
Exemple #2
0
			cmd += ' -an 1 -s @#@ -e @#@ -inc %d' % by

		if node != '':
			cmd += ' -cam "%s"' % node

		if take != '':
			if scenetype == 'maya_delight':
				cmd += ' -rp "%s"' % take
			else:
				cmd += ' -rl "%s"' % take
		if images != '':
			images = images.split(',')
			if len(images) > 1:
				images = afcommon.patternFromPaths(images[0], images[1])
			else:
				images = afcommon.patternFromFile(images[0])
		if pwd != '':
			cmd += ' -proj "%s"' % os.path.normpath(pwd)
		
		if output != '':
			cmd += ' -rd "%s"' % os.path.normpath(output)

		if scenetype == 'maya_mental':
			cmd += ' -art -v 5'

		if extrargs != '':
			cmd += ' ' + extrargs

		cmd += ' "%s"' % scene

	# XSI:
    def evaluateCmd(self, i_start=False):
        if not self.constructed:
            return

        self.evaluated = False
        self.bStart.setEnabled(False)
        # self.fileChange()

        # Check parameters:
        # Frame range:

        framestart = self.fields['framestart'].value()
        frameend = self.fields['frameend'].value()
        frameby = self.fields['frameby'].value()
        framespt = self.fields['framespt'].value()

        if i_start:

            if framestart > frameend:
                QtWidgets.QMessageBox.critical(
                    self, 'Critical', 'First frame is greater that last.')
                return

            tasksnum = (1.0 + frameend - framestart) / (1.0 * frameby *
                                                        framespt)

            if tasksnum > 10000.0:
                answer = QtWidgets.QMessageBox.warning(
                    self, 'Warning', 'Number of tasks > 10000',
                    QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Abort)
                if answer != QtWidgets.QMessageBox.Yes:
                    return
            if tasksnum > 100000.0:
                answer = QtWidgets.QMessageBox.warning(
                    self, 'Warning', 'Number of tasks > 100000',
                    QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Abort)
                if answer != QtWidgets.QMessageBox.Yes:
                    return
            if tasksnum > 1000000.0:
                self.teCmd.setText(
                    'The number of tasks over one million. Call you system '
                    'administrator, supervisor or TD.')
                return

        # Check wdir:
        if self.fields['scenewdir'].isChecked():
            self.fields['wdir'].setEnabled(False)
        else:
            self.fields['wdir'].setEnabled(True)
        # Set job name:
        if self.fields['jobnamescene'].isChecked():
            self.fields['jobname'].setText(
                os.path.basename(str(self.fields['scenefile'].text())))
            self.fields['jobname'].setEnabled(False)
        else:
            self.fields['jobname'].setEnabled(True)

        # Check scene:
        scene = str(self.fields['scenefile'].text())
        if len(scene) == 0:
            return

        name, ext = os.path.splitext(scene)
        if ext in ScenesSequences:
            scene = afcommon.patternFromFile(scene)
        elif not os.path.isfile(scene):
            self.teCmd.setText('Scene file does not exist.')
            return

        scene = os.path.normpath(scene)
        scene = os.path.abspath(scene)
        self.fields['scenefile'].setText(scene)

        # Check working directory:
        if self.fields['scenewdir'].isChecked():
            self.fields['wdir'].setText(
                os.path.dirname(str(self.fields['scenefile'].text())))

        if not os.path.isdir(self.fields['wdir'].text()):
            self.teCmd.setText('Working directory does not exist.')
            return
        self.fields['wdir'].setText(
            os.path.abspath(str(self.fields['wdir'].text())))

        # Check job name:
        if str(self.fields['jobname'].text()) == '':
            self.teCmd.setText('Job name is empty.')
            return

        # Get File Type Override
        servType = getComboBoxString(self.fields['servicetype'])

        # Construct command:
        cmd = os.environ['AF_ROOT']
        cmd = os.path.join(cmd, 'python')
        cmd = os.path.join(cmd, 'afjob.py')
        cmd = '"%s" "%s"' % (os.getenv('CGRU_PYTHONEXE', 'python'), cmd)
        cmd += ' "%s"' % self.fields['scenefile'].text()
        cmd += ' %d' % self.fields['framestart'].value()
        cmd += ' %d' % self.fields['frameend'].value()
        cmd += ' -by %d' % self.fields['frameby'].value()
        cmd += ' -fpt %d' % self.fields['framespt'].value()
        cmd += ' -seq %d' % self.fields['frameseq'].value()
        if not str(self.fields['node'].text()) == '':
            cmd += ' -node "%s"' % self.fields['node'].text()

        if not str(self.fields['take'].text()) == '':
            cmd += ' -take "%s"' % self.fields['take'].text()

        if not str(self.fields['outimages'].text()) == '':
            cmd += ' -output "%s"' % self.fields['outimages'].text()

        if not str(self.fields['preview'].text()) == '':
            cmd += ' -images "%s"' % self.fields['preview'].text()

        if not str(self.fields['extrargs'].text()) == '':
            cmd += ' -extrargs "%s"' % self.fields['extrargs'].text()

        if len(servType) and servType != 'none':
            cmd += ' -type "%s"' % servType

        if str(self.fields['os'].text()) == '':
            cmd += ' -os any'
        else:
            cmd += ' -os "%s"' % self.fields['os'].text()

        cmd += ' -pwd "%s"' % self.fields['wdir'].text()

        if self.fields['capacity'].value() > 0:
            cmd += ' -capacity %d' % self.fields['capacity'].value()

        if self.fields['maxruntasks'].value() > 0:
            cmd += ' -maxruntasks %d' % self.fields['maxruntasks'].value()

        if self.fields['maxtasksperhost'].value() > 0:
            cmd += ' -maxtasksperhost %d' % self.fields[
                'maxtasksperhost'].value()

        if self.fields['priority'].value() > -1:
            cmd += ' -priority %d' % self.fields['priority'].value()

        if not str(self.fields['dependmask'].text()) == '':
            cmd += ' -depmask "%s"' % self.fields['dependmask'].text()

        if not str(self.fields['dependglobal'].text()) == '':
            cmd += ' -depglbl "%s"' % self.fields['dependglobal'].text()

        if not str(self.fields['hostsmask'].text()) == '':
            cmd += ' -hostsmask "%s"' % self.fields['hostsmask'].text()

        if not str(self.fields['hostsexclude'].text()) == '':
            cmd += ' -hostsexcl "%s"' % self.fields['hostsexclude'].text()

        # Render Pools Additon
        if str(self.cbSelectedPool.currentText() != "Don't use pool."):
            for pool in self.pools:
                if pool["name"] == self.cbSelectedPool.currentText():
                    afanasy_hostnames = []
                    included_hostnames = []
                    excluded_hostnames = []

                    # get afanasy hostnames
                    afModuleCmd = af.Cmd()
                    af_clients = afModuleCmd.renderGetList()
                    for af_client in af_clients:
                        afanasy_hostnames.append(af_client["name"])

                    # get included hostnames
                    clients = pool["clients"]
                    for client in clients:
                        included_hostnames.append(client["hostname"])

                    # compute excluded hosts
                    for af_hostname in afanasy_hostnames:
                        if not af_hostname in included_hostnames:
                            excluded_hostnames.append(af_hostname)

                    # generate host exclude mask
                    regex_mask = ""
                    for excluded_hostname in excluded_hostnames:
                        regex_mask += excluded_hostname + "|"
                    if regex_mask.endswith("|"):
                        regex_mask = regex_mask[:-1]
                    if regex_mask != "":
                        cmd += ' -hostsexcl "%s"' % regex_mask

        if self.fields['paused'].isChecked():
            cmd += ' -pause'

        cmd += ' -name "%s"' % self.fields['jobname'].text()

        if not str(self.fields['exec'].text()) == '':
            cmd += ' -exec "%s"' % self.fields['exec'].text()

        # Evaluated:
        self.teCmd.setText(cmd)
        self.evaluated = True
        self.bStart.setEnabled(True)
        print('Evaluated')
Exemple #4
0
            cmd += ' -an 1 -s @#@ -e @#@ -inc %d' % by

        if node != '':
            cmd += ' -cam "%s"' % node

        if take != '':
            if scenetype == 'maya_delight':
                cmd += ' -rp "%s"' % take
            else:
                cmd += ' -rl "%s"' % take
        if images != '':
            images = images.split(',')
            if len(images) > 1:
                images = afcommon.patternFromPaths(images[0], images[1])
            else:
                images = afcommon.patternFromFile(images[0])

        if proj:
            cmd += ' -proj "%s"' % os.path.normpath(proj)
        # else:
        #     if pwd != '':
        #         cmd += ' -proj "%s"' % os.path.normpath(pwd)
        #     else:
        #         cmd += ' -proj "%s"' % os.path.normpath(os.path.dirname(scene))

        if output != '':
            cmd += ' -rd "%s"' % os.path.normpath(output)

        if scenetype == 'maya_mental':
            cmd += ' -art -v 5'
Exemple #5
0
	def evaluate(self):
		if not self.constructed:
			return

		self.evaluated = False
		self.bStart.setEnabled(False)
		# self.fileChange()

		# Check parameters:
		# Frame range:
		if self.fields['framestart'].value() > self.fields['frameend'].value():
			self.fields['frameend'].setValue(self.fields['framestart'].value())

		framestart = self.fields['framestart'].value()
		frameend = self.fields['frameend'].value()
		frameby = self.fields['frameby'].value()
		framespt = self.fields['framespt'].value()

		tasksnum = (1.0 + frameend - framestart) / (1.0 * frameby * framespt)

		if tasksnum > 10000.0:
			answer = QtGui.QMessageBox.warning(
				self,
				'Warning',
				'Number of tasks > 10000',
				QtGui.QMessageBox.Yes | QtGui.QMessageBox.Abort
			)
			if answer != QtGui.QMessageBox.Yes:
				return

		if tasksnum > 100000.0:
			answer = QtGui.QMessageBox.warning(
				self,
				'Warning',
				'Number of tasks > 100000',
				QtGui.QMessageBox.Yes | QtGui.QMessageBox.Abort
			)
			if answer != QtGui.QMessageBox.Yes:
				return
		if tasksnum > 1000000.0:
			self.teCmd.setText(
				'The number of tasks over one million. Call you system '
				'administrator, supervisor or TD.'
			)
			return
		# Check wdir:
		if self.fields['scenewdir'].isChecked():
			self.fields['wdir'].setEnabled(False)
		else:
			self.fields['wdir'].setEnabled(True)
		# Set job name:
		if self.fields['jobnamescene'].isChecked():
			self.fields['jobname'].setText(
				os.path.basename(str(self.fields['scenefile'].text()))
			)
			self.fields['jobname'].setEnabled(False)
		else:
			self.fields['jobname'].setEnabled(True)

		# Check scene:
		scene = str(self.fields['scenefile'].text())
		if len(scene) == 0:
			return

		name, ext = os.path.splitext(scene)
		if ext in ScenesSequences:
			scene = afcommon.patternFromFile(scene)
		elif not os.path.isfile(scene):
			self.teCmd.setText('Scene file does not exist.')
			return

		scene = os.path.normpath(scene)
		scene = os.path.abspath(scene)
		self.fields['scenefile'].setText(scene)

		# Check working directory:
		if self.fields['scenewdir'].isChecked():
			self.fields['wdir'].setText(
				os.path.dirname(str(self.fields['scenefile'].text()))
			)

		if not os.path.isdir(self.fields['wdir'].text()):
			self.teCmd.setText('Working directory does not exist.')
			return
		self.fields['wdir'].setText(
			os.path.abspath(str(self.fields['wdir'].text()))
		)

		# Check job name:
		if str(self.fields['jobname'].text()) == '':
			self.teCmd.setText('Job name is empty.')
			return

		# Get File Type Override
		servType = getComboBoxString(self.fields['servicetype'])

		# Construct command:
		cmd = os.environ['AF_ROOT']
		cmd = os.path.join(cmd, 'python')
		cmd = os.path.join(cmd, 'afjob.py')
		cmd = '"%s" "%s"' % (os.getenv('CGRU_PYTHONEXE', 'python'), cmd)
		cmd += ' "%s"' % self.fields['scenefile'].text()
		cmd += ' %d' % self.fields['framestart'].value()
		cmd += ' %d' % self.fields['frameend'].value()
		cmd += ' -by %d' % self.fields['frameby'].value()
		cmd += ' -fpt %d' % self.fields['framespt'].value()
		cmd += ' -seq %d' % self.fields['frameseq'].value()
		if not str(self.fields['node'].text()) == '':
			cmd += ' -node "%s"' % self.fields['node'].text()

		if not str(self.fields['take'].text()) == '':
			cmd += ' -take "%s"' % self.fields['take'].text()

		if not str(self.fields['outimages'].text()) == '':
			cmd += ' -output "%s"' % self.fields['outimages'].text()

		if not str(self.fields['preview'].text()) == '':
			cmd += ' -images "%s"' % self.fields['preview'].text()

		if not str(self.fields['extrargs'].text()) == '':
			cmd += ' -extrargs "%s"' % self.fields['extrargs'].text()

		if len(servType) and servType != 'none':
			cmd += ' -type "%s"' % servType

		if str(self.fields['os'].text()) == '':
			cmd += ' -os any'
		else:
			cmd += ' -os "%s"' % self.fields['os'].text()

		cmd += ' -pwd "%s"' % self.fields['wdir'].text()

		if self.fields['capacity'].value() > 0:
			cmd += ' -capacity %d' % self.fields['capacity'].value()

		if self.fields['maxruntasks'].value() > 0:
			cmd += ' -maxruntasks %d' % self.fields['maxruntasks'].value()

		if self.fields['priority'].value() > -1:
			cmd += ' -priority %d' % self.fields['priority'].value()

		if not str(self.fields['dependmask'].text()) == '':
			cmd += ' -depmask "%s"' % self.fields['dependmask'].text()

		if not str(self.fields['dependglobal'].text()) == '':
			cmd += ' -depglbl "%s"' % self.fields['dependglobal'].text()

		if not str(self.fields['hostsmask'].text()) == '':
			cmd += ' -hostsmask "%s"' % self.fields['hostsmask'].text()

		if not str(self.fields['hostsexclude'].text()) == '':
			cmd += ' -hostsexcl "%s"' % self.fields['hostsexclude'].text()

		if self.fields['paused'].isChecked():
			cmd += ' -pause'

		cmd += ' -name "%s"' % self.fields['jobname'].text()

		if not str(self.fields['exec'].text()) == '':
			cmd += ' -exec "%s"' % self.fields['exec'].text()

		# Evaluated:
		self.teCmd.setText(cmd)
		self.evaluated = True
		self.bStart.setEnabled(True)
		print('Evaluated')