def loadCC3DFile(fileName, forceSingleRun=False): from FileLock import FileLock fLock = FileLock(file_name=fileName, timeout=10, delay=0.05) fLock.acquire() import CompuCellSetup import CC3DSimulationDataHandler as CC3DSimulationDataHandler cc3dSimulationDataHandler = CC3DSimulationDataHandler.CC3DSimulationDataHandler(None) cc3dSimulationDataHandler.readCC3DFileFormat(fileName) print cc3dSimulationDataHandler.cc3dSimulationData if forceSingleRun: # forces loadCC3D to behave as if it was running plane simulation without addons such as e.g. parameter scan prepareSingleRun(cc3dSimulationDataHandler) else: if cc3dSimulationDataHandler.cc3dSimulationData.parameterScanResource: preparationSuccessful = prepareParameterScan(cc3dSimulationDataHandler) if not preparationSuccessful: # raise AssertionError('Parameter Scan Complete') raise AssertionError('Parameter Scan ERRORCODE=' + str( ParameterScanEnums.SCAN_FINISHED_OR_DIRECTORY_ISSUE) + ': Parameter Scan Complete') else: prepareSingleRun(cc3dSimulationDataHandler) fLock.release() return cc3dSimulationDataHandler
def loadCC3DFile(fileName, forceSingleRun=False): from FileLock import FileLock fLock = FileLock(file_name=fileName, timeout=10, delay=0.05) fLock.acquire() import CompuCellSetup import CC3DSimulationDataHandler as CC3DSimulationDataHandler cc3dSimulationDataHandler = CC3DSimulationDataHandler.CC3DSimulationDataHandler( None) cc3dSimulationDataHandler.readCC3DFileFormat(fileName) print cc3dSimulationDataHandler.cc3dSimulationData if forceSingleRun: # forces loadCC3D to behave as if it was running plane simulation without addons such as e.g. parameter scan prepareSingleRun(cc3dSimulationDataHandler) else: if cc3dSimulationDataHandler.cc3dSimulationData.parameterScanResource: preparationSuccessful = prepareParameterScan( cc3dSimulationDataHandler) if not preparationSuccessful: # raise AssertionError('Parameter Scan Complete') raise AssertionError( 'Parameter Scan ERRORCODE=' + str(ParameterScanEnums.SCAN_FINISHED_OR_DIRECTORY_ISSUE) + ': Parameter Scan Complete') else: prepareSingleRun(cc3dSimulationDataHandler) fLock.release() return cc3dSimulationDataHandler
def gatherdata(): logger.debug('gatherdata started') lock = FileLock('lock') result = [] if lock.acquire(): if gatherdatafromContestSite(hackerearth, HackerEarth_DB): result.append(True) else: result.append(False) if gatherdatafromContestSite(codechef, CodeChef_DB): result.append(True) else: result.append(False) lastf = LastFetch.objects.all() if (len(lastf) == 0): LastFetch(update_date=timezone.now()).save() else: lastf[0].update_date = timezone.now() lastf[0].save() lock.release() else: lock.poll() return result
def gatherdata(): logger.debug('gatherdata started') lock=FileLock('lock') result = [] if lock.acquire(): if gatherdatafromContestSite(hackerearth,HackerEarth_DB): result.append(True) else: result.append(False) if gatherdatafromContestSite(codechef,CodeChef_DB): result.append(True) else: result.append(False) lastf = LastFetch.objects.all() if(len(lastf)==0): LastFetch(update_date=timezone.now()).save() else: lastf[0].update_date=timezone.now() lastf[0].save() lock.release() else: lock.poll() return result