Exemplo n.º 1
0
    def resolve(self):
        """Standard i/o prompt for resolution of an individual query"""
        if armi.MPI_RANK != 0:
            return

        if self.condition():
            try:
                if self.isCorrective():
                    try:
                        make_correction = runLog.prompt(
                            "INSPECTOR: " + self.statement,
                            self.question,
                            "YES_NO",
                            "NO_DEFAULT",
                            "CANCEL",
                        )
                        if make_correction:
                            self.correction()
                            self._corrected = True
                        else:
                            self._passed = True
                    except exceptions.RunLogPromptCancel:
                        raise exceptions.InputInspectionDiscontinued()
                else:
                    try:
                        continue_submission = runLog.prompt(
                            "INSPECTOR: " + self.statement,
                            "Continue?",
                            "YES_NO",
                            "NO_DEFAULT",
                            "CANCEL",
                        )
                        if not continue_submission:
                            raise exceptions.InputInspectionDiscontinued()
                    except exceptions.RunLogPromptCancel:
                        raise exceptions.InputInspectionDiscontinued()

            except exceptions.RunLogPromptUnresolvable:
                self.autoResolved = False
                self._passed = True
Exemplo n.º 2
0
 def _checkInvalidSettings(self):
     if not self.invalidSettings:
         return
     try:
         invalidNames = "\n\t".join(self.invalidSettings)
         proceed = runLog.prompt(
             "Found {} invalid settings in {}.\n\n {} \n\t".format(
                 len(self.invalidSettings), self.inputPath, invalidNames
             ),
             "Invalid settings will be ignored. Continue running the case?",
             "YES_NO",
         )
     except exceptions.RunLogPromptUnresolvable:
         # proceed with invalid settings (they'll be ignored).
         proceed = True
     if not proceed:
         raise exceptions.InvalidSettingsStopProcess(self)
     else:
         runLog.warning("Ignoring invalid settings: {}".format(invalidNames))