Example #1
0
    def makeup(self):
        if self.current_project_def == None:
            tkinter_messagebox.showwarning('', 'No project selected.')
            return
        if self.current_stage_def == None:
            tkinter_messagebox.showwarning('', 'No stage selected.')
            return

        top = self.winfo_toplevel()
        old_cursor = top['cursor']
        try:
            top['cursor'] = 'watch'
            top.update_idletasks()
            project.dosubmit(self.current_project_def,
                             self.current_stage_def,
                             makeup=True,
                             recur=self.current_stage_def.recur)
            top['cursor'] = old_cursor
        except:
            top['cursor'] = old_cursor
            e = sys.exc_info()
            traceback.print_tb(e[2])
            tkinter_messagebox.showerror('', e[1])
        BatchStatus.update_jobs()
        self.project_view.update_status()
Example #2
0
    def recover( self, statusCode, istage, run, subrun ):
        current_status = statusCode + istage
        error_status   = current_status + 1000
                             
        # Report starting
        # self.info()
        self._data = str( self._data )

        # Main command
        stage = self._digit_to_name[istage]

        # Get project and stage object.
        try:
            probj, stobj = project.get_pubs_stage(self._xml_file, '', stage, run, subrun, self._version)
        except:
            self.error('Exception raied by project.get_pubs_stage:')
            e = sys.exc_info()
            for item in e:
                self.error(item)
            for line in traceback.format_tb(e[2]):
                self.error(line)
            return current_status

        # Submit job.
        jobid=''
        try:
            jobid = project.dosubmit(probj, stobj)
        except:
            self.error('Exception raied by project.dosubmit:')
            e = sys.exc_info()
            for item in e:
                self.error(item)
            for line in traceback.format_tb(e[2]):
                self.error(line)
            return current_status
        self.info( 'Resubmit jobs: xml: %s, stage: %s' %( self._xml_file, stage ) )

        # Tentatively do so; need to change!!!
        if not jobid:
            self.error('Failed to fetch job log id...')
            subject = 'Failed to fetch job log id while submitting project %s stage %s.' % (
                probj.name, stobj.name)
            text = subject
            text += '\n'
            text += 'Status code is set to %d!\n\n' % error_status
            pub_smtp(receiver = self._experts,
                     subject = subject,
                     text = text)
            return error_status

        # Now grab the parent job id and submit time
        if self._data == None or self._data == "None" or len(self._data) == 0:
            self._data = '%s+%f' % (jobid, time.time())
        else:
            self._data += ':%s+%f' % (jobid, time.time())

        statusCode = istage + self.kSUBMITTED
        self.info( "Resubmitted jobs, job id: %s, status: %d" % ( self._data, statusCode ) )

        # Pretend I'm doing something
        time.sleep(5)

        # Here we may need some checks
        return statusCode
Example #3
0
    def recover(self, statusCode, istage, run, subrun):
        current_status = statusCode + istage
        error_status = current_status + 1000

        # Report starting
        # self.info()
        self._data = str(self._data)

        # Main command
        stage = self._digit_to_name[istage]

        # Get project and stage object.
        try:
            probj, stobj = project.get_pubs_stage(self._xml_file, '', stage,
                                                  run, subrun, self._version)
        except:
            self.error('Exception raied by project.get_pubs_stage:')
            e = sys.exc_info()
            for item in e:
                self.error(item)
            for line in traceback.format_tb(e[2]):
                self.error(line)
            return current_status

        # Submit job.
        jobid = ''
        try:
            jobid = project.dosubmit(probj, stobj)
        except:
            self.error('Exception raied by project.dosubmit:')
            e = sys.exc_info()
            for item in e:
                self.error(item)
            for line in traceback.format_tb(e[2]):
                self.error(line)
            return current_status
        self.info('Resubmit jobs: xml: %s, stage: %s' %
                  (self._xml_file, stage))

        # Tentatively do so; need to change!!!
        if not jobid:
            self.error('Failed to fetch job log id...')
            subject = 'Failed to fetch job log id while submitting project %s stage %s.' % (
                probj.name, stobj.name)
            text = subject
            text += '\n'
            text += 'Status code is set to %d!\n\n' % error_status
            pub_smtp(receiver=self._experts, subject=subject, text=text)
            return error_status

        # Now grab the parent job id and submit time
        if self._data == None or self._data == "None" or len(self._data) == 0:
            self._data = '%s+%f' % (jobid, time.time())
        else:
            self._data += ':%s+%f' % (jobid, time.time())

        statusCode = istage + self.kSUBMITTED
        self.info("Resubmitted jobs, job id: %s, status: %d" %
                  (self._data, statusCode))

        # Pretend I'm doing something
        time.sleep(5)

        # Here we may need some checks
        return statusCode