Changeset 5c6002a in sasview


Ignore:
Timestamp:
Apr 7, 2017 5:49:55 AM (7 years ago)
Author:
Tim Snow <tim.snow@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
d6353fb
Parents:
f2cc00b
Message:

Logic sorted

We now check for a) quick submissions b) whether something is already
running and if it is chuck any intermediate stages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rf2cc00b r5c6002a  
    250250 
    251251        # And a home for the thread submission times 
    252         self.lastTimeFitSubmitted = None 
     252        self.lastTimeFitSubmitted = 0.00 
    253253 
    254254    def set_index_model(self, index): 
     
    17071707        currentTime = time() 
    17081708 
    1709         # # So, if a whole pile of jobs are submitted in quick succession,  
    1710         # # let's say in less than 0.1 sec, we'll filter them out, assuming something is running! 
    1711  
    1712         if ((self._manager.calc_1D is not None) and self._manager.calc_1D.isrunning()) or ((self._manager.calc_2D is not None) and self._manager.calc_2D.isrunning()): 
    1713             if currentTime > (self.lastTimeFitSubmitted + 0.1): 
    1714                 # Assuming that things have been 'sensibly' submitted, but there's another 
    1715                 # job going, dump the currently queued job and just execute the job requested last 
    1716                 if self.threadedDrawQueue.empty() == True: 
    1717                     self.threadedDrawQueue.put([update_chisqr, source]) 
    1718                     print 'here' 
    1719                 else: 
    1720                     while self.threadedDrawQueue.empty() != True: 
    1721                         self.threadedDrawQueue.get() 
    1722                         self.threadedDrawQueue.task_done() 
    1723  
    1724                     self.threadedDrawQueue.put([update_chisqr, source]) 
    1725                     print 'rejected' 
    1726          
     1709        # When loading we slam a number of fits through here 
     1710        # let's filter these out to start with 
     1711        if currentTime > (self.lastTimeFitSubmitted + 0.1): 
     1712            # Submitting the rest 
     1713            self.threadedDrawQueue.put([update_chisqr, source]) 
     1714            print 'submitted!' 
    17271715        else: 
    1728             self.threadedDrawQueue.put([update_chisqr, source]) 
     1716            pass 
    17291717 
    17301718        self.lastTimeFitSubmitted = currentTime 
     
    17321720    def _threaded_draw_worker(self, threadedDrawQueue): 
    17331721        while True: 
    1734             if ((self._manager.calc_1D is not None) and self._manager.calc_1D.isrunning()) or ((self._manager.calc_2D is not None) and self._manager.calc_2D.isrunning()): 
    1735                 pass 
     1722            # Check if a manager exists and it's running 
     1723            if ((self._manager.calc_1D is not None) and (self._manager.calc_1D.isrunning() == True)) or ((self._manager.calc_2D is not None) and (self._manager.calc_2D.isrunning() == True)): 
     1724                # If a manager is running a calculation  
     1725                # then trim the queue 
     1726                if self.threadedDrawQueue.qsize() > 1: 
     1727                    print '2' 
     1728                    for loopIter in range(threadedDrawQueue.qsize() - 1): 
     1729                        dump = self.threadedDrawQueue.get() 
     1730                        self.threadedDrawQueue.task_done() 
     1731                        print 'bounced' 
     1732                    print 'one element left' 
    17361733            else: 
     1734                # Otherwise, just run 
    17371735                inputVariables = threadedDrawQueue.get() 
    17381736                self._draw_model_after(inputVariables[0], inputVariables[1]) 
    17391737                wx.PostEvent(self._manager.parent, StatusEvent(status="Computation is in progress...", type = "progress")) 
    17401738                threadedDrawQueue.task_done() 
    1741                 print 'added' 
     1739                print 'run'                 
    17421740 
    17431741    def _draw_model_after(self, update_chisqr=True, source='model'): 
Note: See TracChangeset for help on using the changeset viewer.