def __init__(self,dir=None): """ Load the db when have an instance """ self.__storage = None self.__handle = None self.__dir = utils.getCacheDir()
def __init__(self, dir=None): """ Load the db when have an instance """ self.__storage = None self.__handle = None self.__dir = utils.getCacheDir()
# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import os import random # for testing only import time # for testing only import shelve import dbm import sys import tempfile import fcntl from func import utils DEFAULT_FORKS = 4 DEFAULT_CACHE_DIR = utils.getCacheDir() def __get_storage(dir): """ Return a tempfile we can use for storing data. """ dir = os.path.expanduser(dir) if not os.path.exists(dir): os.makedirs(dir) return tempfile.mkstemp(suffix='', prefix='asynctmp', dir=dir)[1] def __access_buckets(filename,clear,new_key=None,new_value=None): """ Access data in forkbomb cache, potentially clearing or modifying it as required. """
import forkbomb from func.CommonErrors import * from func import utils from certmaster import utils as cm_utils JOB_ID_RUNNING = 0 JOB_ID_FINISHED = 1 JOB_ID_LOST_IN_SPACE = 2 JOB_ID_PARTIAL = 3 JOB_ID_REMOTE_ERROR = 4 # how long to retain old job records in the job id database RETAIN_INTERVAL = 60 * 60 # where to store the internal job id database CACHE_DIR = utils.getCacheDir() def __update_status(jobid, status, results, clear=False): return __access_status(jobid=jobid, status=status, results=results, write=True) def __get_status(jobid): return __access_status(jobid=jobid, write=False) def purge_old_jobs(): return __access_status(purge=True) def clear_db(): return __access_status(clear=True) def __purge_old_jobs(storage): """
import forkbomb from func.CommonErrors import * from func import utils from certmaster import utils as cm_utils JOB_ID_RUNNING = 0 JOB_ID_FINISHED = 1 JOB_ID_LOST_IN_SPACE = 2 JOB_ID_PARTIAL = 3 JOB_ID_REMOTE_ERROR = 4 # how long to retain old job records in the job id database RETAIN_INTERVAL = 60 * 60 # where to store the internal job id database CACHE_DIR = utils.getCacheDir() def __update_status(jobid, status, results, clear=False): return __access_status(jobid=jobid, status=status, results=results, write=True) def __get_status(jobid): return __access_status(jobid=jobid, write=False) def purge_old_jobs(): return __access_status(purge=True)
# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import os import random # for testing only import time # for testing only import shelve import dbm import sys import tempfile import fcntl from func import utils DEFAULT_FORKS = 4 DEFAULT_CACHE_DIR = utils.getCacheDir() def __get_storage(dir): """ Return a tempfile we can use for storing data. """ dir = os.path.expanduser(dir) if not os.path.exists(dir): os.makedirs(dir) return tempfile.mkstemp(suffix='', prefix='asynctmp', dir=dir)[1] def __access_buckets(filename, clear, new_key=None, new_value=None): """ Access data in forkbomb cache, potentially clearing or