Пример #1
0
    def runPreprocess(self, job):
        success = True

        # for each preprocessor
        for pre in job.preprocessors:
            # print the name
            io.printIndented("running preprocessor '{}'...".format(pre.name),
                             1)

            # if we are a reference, get what we are referencing to
            jobName = job.name
            if pre.isReference:
                jobName = pre.job
                pre = getPreprocessorReference(self.config, pre.job, pre.name)

            # see if it has already ran
            if self.shouldPreprocess(jobName, pre.name, pre.runThisRound):
                # we need to run, first gather arguments
                students = self.corpus.students
                assignments = getJobFromConfig(self.config,
                                               jobName).assignments
                args = pre.args
                helpers = self.corpus

                # try to import the correct module
                try:
                    module = importlib.import_module('preprocessors.' +
                                                     pre.name)

                    # run it
                    print ""
                    success = module.run(students, assignments, args, helpers)

                    # update progress
                    self.progress.updatePreprogress(job.name, pre.name,
                                                    success)
                    pre.runThisRound = success
                except:
                    printError(
                        "module '{}' not found or encountered an error.\n".
                        format(pre.name))
                    success = False

                if success:
                    io.printIndented('complete!\n', 1)
                else:
                    # fail out
                    break
            else:
                # don't need to run
                io.printRaw(' already done!\n')

        # return true iff all were sucessful
        return success
Пример #2
0
	def runPreprocess(self, job):
		success = True

		# for each preprocessor
		for pre in job.preprocessors:
			# print the name
			io.printIndented("running preprocessor '{}'...".format(pre.name), 1)

			# if we are a reference, get what we are referencing to
			jobName = job.name
			if pre.isReference:
				jobName = pre.job
				pre = getPreprocessorReference(self.config, pre.job, pre.name)

			# see if it has already ran
			if self.shouldPreprocess(jobName, pre.name, pre.runThisRound):
				# we need to run, first gather arguments
				students = self.corpus.students
				assignments = getJobFromConfig(self.config, jobName).assignments
				args = pre.args
				helpers = self.corpus

				# try to import the correct module
				try:
					module = importlib.import_module('preprocessors.' + pre.name)

					# run it
					print ""
					success = module.run(students, assignments, args, helpers)

					# update progress
					self.progress.updatePreprogress(job.name, pre.name, success)
					pre.runThisRound = success
				except:
					printError("module '{}' not found or encountered an error.\n".format(pre.name))
					success = False

				if success:
					io.printIndented('complete!\n', 1)
				else:
					# fail out
					break
			else:
				# don't need to run
				io.printRaw(' already done!\n')

		# return true iff all were sucessful
		return success
Пример #3
0
    def runPostprocess(self, job):
        success = True

        # for each preprocessor
        for post in job.postprocessors:
            # print the name
            io.printIndented("running postprocessor '{}'...".format(post.name),
                             1)

            # see if it has already ran
            if self.shouldPostprocess(job.name, post.name):
                # we need to run, first gather arguments
                students = self.corpus.students
                assignments = job.assignments
                args = post.args
                helpers = self.corpus

                # try to import the correct module
                try:
                    module = importlib.import_module('postprocessors.' +
                                                     post.name)

                    # run it
                    print ""
                    success = module.run(students, assignments, args, helpers)

                    # update progress
                    self.progress.updatePostprogress(job.name, post.name,
                                                     success)
                except:
                    printError(
                        "module '{}' not found or encountered an error.\n".
                        format(post.name))
                    success = False

                if success:
                    io.printIndented('complete!\n', 1)
                else:
                    # fail out
                    break
            else:
                # don't need to run
                io.printRaw(' already done!\n')

        # return true iff all were sucessful
        return success
Пример #4
0
	def runPostprocess(self, job):
		success = True

		# for each preprocessor
		for post in job.postprocessors:
			# print the name
			io.printIndented("running postprocessor '{}'...".format(post.name), 1)

			# see if it has already ran
			if self.shouldPostprocess(job.name, post.name):
				# we need to run, first gather arguments
				students = self.corpus.students
				assignments = job.assignments
				args = post.args
				helpers = self.corpus

				# try to import the correct module
				try:
					module = importlib.import_module('postprocessors.' + post.name)

					# run it
					print ""
					success = module.run(students, assignments, args, helpers)

					# update progress
					self.progress.updatePostprogress(job.name, post.name, success)
				except:
					printError("module '{}' not found or encountered an error.\n".format(post.name))
					success = False

				if success:
					io.printIndented('complete!\n', 1)
				else:
					# fail out
					break
			else:
				# don't need to run
				io.printRaw(' already done!\n')

		# return true iff all were sucessful
		return success
Пример #5
0
	def clean(self, cleanall):
		corpus = self.corpus
		students = corpus.students
		config = self.config

		io.printRaw("Cleaning up corpus... ")

		# clean the preprocessor
		for job in config.jobs:
			for assignment in job.assignments:
				name = assignment.name

				# clean up the preprocessor
				for student in students:
					corpus.cleanPreprocessed(student, name)

				# clean the processor and postprocessor
				if cleanall == True:
					corpus.cleanProcessed(name)
					corpus.cleanPostprocessed(name)

		print "done!\n"
Пример #6
0
    def clean(self, cleanall):
        corpus = self.corpus
        students = corpus.students
        config = self.config

        io.printRaw("Cleaning up corpus... ")

        # clean the preprocessor
        for job in config.jobs:
            for assignment in job.assignments:
                name = assignment.name

                # clean up the preprocessor
                for student in students:
                    corpus.cleanPreprocessed(student, name)

                # clean the processor and postprocessor
                if cleanall == True:
                    corpus.cleanProcessed(name)
                    corpus.cleanPostprocessed(name)

        print "done!\n"