@path_required<EOL><INDENT>def dump_file(self, value, relativePath,<EOL>description=None,<EOL>dump=None, pull=None,<EOL>replace=False, raiseError=True, ntrials=<NUM_LIT:3>):<DEDENT>
<EOL>assert isinstance(raiseError, bool), "<STR_LIT>"<EOL>assert isinstance(replace, bool), "<STR_LIT>"<EOL>assert isinstance(ntrials, int), "<STR_LIT>"<EOL>assert ntrials><NUM_LIT:0>, "<STR_LIT>"<EOL>if description is None:<EOL><INDENT>description = '<STR_LIT>'<EOL><DEDENT>assert isinstance(description, basestring), "<STR_LIT>"<EOL>if pull is None and dump is not None:<EOL><INDENT>if dump.startswith('<STR_LIT>') or dump.startswith('<STR_LIT>') or dump.startswith('<STR_LIT>') or dump =='<STR_LIT>':<EOL><INDENT>pull = dump<EOL><DEDENT><DEDENT>dump = get_dump_method(dump, protocol=self._DEFAULT_PICKLE_PROTOCOL)<EOL>pull = get_pull_method(pull)<EOL>relativePath = self.to_repo_relative_path(path=relativePath, split=False)<EOL>savePath     = os.path.join(self.__path,relativePath)<EOL>fPath, fName = os.path.split(savePath)<EOL>success, reason = self.is_name_allowed(savePath)<EOL>if not success:<EOL><INDENT>assert not raiseError, reason<EOL>return False, reason<EOL><DEDENT>try:<EOL><INDENT>success, reason = self.add_directory(fPath, raiseError=False, ntrials=ntrials)<EOL><DEDENT>except Exception as err:<EOL><INDENT>reason  = "<STR_LIT>"%(str(err))<EOL>success = False<EOL><DEDENT>if not success:<EOL><INDENT>assert not raiseError, reason<EOL>return False, reason<EOL><DEDENT>LR =  Locker(filePath=None, lockPass=str(uuid.uuid1()), lockPath=os.path.join(self.__path, self.__repoLock))<EOL>acquired, code = LR.acquire_lock()<EOL>if not acquired:<EOL><INDENT>m = "<STR_LIT>"%(code,)<EOL>assert raiseError, Exception(m)<EOL>return False,m<EOL><DEDENT>LF =  Locker(filePath=None, lockPass=str(uuid.uuid1()), lockPath=os.path.join(fPath,self.__fileLock%fName))<EOL>acquired, code = LF.acquire_lock()<EOL>if not acquired:<EOL><INDENT>LR.release_lock()<EOL>error = "<STR_LIT>"%(code,relativePath)<EOL>assert not raiseError, error<EOL>return False, error<EOL><DEDENT>for _trial in range(ntrials):<EOL><INDENT>try:<EOL><INDENT>repo = self.__load_repository_pickle_file(os.path.join(self.__path, self.__repoFile))<EOL>self.__repo['<STR_LIT>'] = repo['<STR_LIT>']<EOL><DEDENT>except Exception as err:<EOL><INDENT>error = str(err)<EOL>if self.DEBUG_PRINT_FAILED_TRIALS: print("<STR_LIT>"%(_trial, inspect.stack()[<NUM_LIT:1>][<NUM_LIT:3>], str(error)))<EOL><DEDENT>else:<EOL><INDENT>error = None<EOL>break<EOL><DEDENT><DEDENT>if error is not None:<EOL><INDENT>LR.release_lock()<EOL>LF.release_lock()<EOL>assert not raiseError, Exception(error)<EOL>return False, error<EOL><DEDENT>for _trial in range(ntrials):<EOL><INDENT>error = None<EOL>try:<EOL><INDENT>isRepoFile, fileOnDisk, infoOnDisk, classOnDisk = self.is_repository_file(relativePath)<EOL>if isRepoFile:<EOL><INDENT>assert replace, "<STR_LIT>"<EOL><DEDENT>fileInfoPath = os.path.join(self.__path,os.path.dirname(relativePath),self.__fileInfo%fName)<EOL>if isRepoFile and fileOnDisk:<EOL><INDENT>with open(fileInfoPath, '<STR_LIT:rb>') as fd:<EOL><INDENT>info = pickle.load(fd)<EOL><DEDENT>assert info['<STR_LIT>'] == self.__repo['<STR_LIT>'], "<STR_LIT>"<EOL>info['<STR_LIT>'] = time.time()<EOL><DEDENT>else:<EOL><INDENT>info = {'<STR_LIT>':self.__repo['<STR_LIT>']}<EOL>info['<STR_LIT>'] = info['<STR_LIT>'] = time.time()<EOL><DEDENT>info['<STR_LIT>'] = dump<EOL>info['<STR_LIT>'] = pull<EOL>info['<STR_LIT:description>'] = description<EOL>if not isRepoFile:<EOL><INDENT>dirList = self.__get_repository_directory(fPath)<EOL><DEDENT>my_exec( dump.replace("<STR_LIT>", str(savePath)), locals=locals(), globals=globals(), description='<STR_LIT>'  )<EOL>with open(fileInfoPath, '<STR_LIT:wb>') as fd:<EOL><INDENT>pickle.dump( info,fd, protocol=self._DEFAULT_PICKLE_PROTOCOL)<EOL>fd.flush()<EOL>os.fsync(fd.fileno())<EOL><DEDENT>fileClassPath = os.path.join(self.__path,os.path.dirname(relativePath),self.__fileClass%fName)<EOL>with open(fileClassPath, '<STR_LIT:wb>') as fd:<EOL><INDENT>if value is None:<EOL><INDENT>klass = None<EOL><DEDENT>else:<EOL><INDENT>klass = value.__class__<EOL><DEDENT>pickle.dump(klass , fd, protocol=self._DEFAULT_PICKLE_PROTOCOL )<EOL>fd.flush()<EOL>os.fsync(fd.fileno())<EOL><DEDENT>if not isRepoFile:<EOL><INDENT>dirList.append(fName)<EOL><DEDENT><DEDENT>except Exception as err:<EOL><INDENT>error = "<STR_LIT>"%(str(err),)<EOL>try:<EOL><INDENT>if '<STR_LIT>' in dump:<EOL><INDENT>mi = get_pickling_errors(value)<EOL>if mi is not None:<EOL><INDENT>error += '<STR_LIT>'%str(mi)<EOL><DEDENT><DEDENT><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>if self.DEBUG_PRINT_FAILED_TRIALS: print("<STR_LIT>"%(_trial, inspect.stack()[<NUM_LIT:1>][<NUM_LIT:3>], str(error)))<EOL><DEDENT>else:<EOL><INDENT>error = None<EOL>break<EOL><DEDENT><DEDENT>if error is None:<EOL><INDENT>_, error = self.__save_repository_pickle_file(lockFirst=False, raiseError=False)<EOL><DEDENT>LR.release_lock()<EOL>LF.release_lock()<EOL>assert not raiseError or error is None, "<STR_LIT>"%(relativePath, ntrials, error,)<EOL>return success, error<EOL>
Dump a file using its value to the system and creates its
attribute in the Repository with utc timestamp.

:Parameters:
    #. value (object): The value of a file to dump and add to the
       repository. It is any python object or file.
    #. relativePath (str): The relative to the repository path to where
       to dump the file.
    #. description (None, string): Any description about the file.
    #. dump (None, string): The dumping method.
       If None it will be set automatically to pickle and therefore the
       object must be pickleable. If a string is given, it can be a
       keyword ('json','pickle','dill') or a string compileable code to
       dump the data. The string code must include all the necessary
       imports and a '$FILE_PATH' that replaces the absolute file path
       when the dumping will be performed.\n
       e.g. "import numpy as np; np.savetxt(fname='$FILE_PATH', X=value, fmt='%.6e')"
    #. pull (None, string): The pulling method. If None it will be set
       automatically to pickle and therefore the object must be
       pickleable. If a string is given, it can be a keyword
       ('json','pickle','dill') or a string compileable code to pull
       the data. The string code must include all the necessary imports,
       a '$FILE_PATH' that replaces the absolute file path when the
       dumping will be performed and finally a PULLED_DATA variable.\n
       e.g "import numpy as np; PULLED_DATA=np.loadtxt(fname='$FILE_PATH')"
    #. replace (boolean): Whether to replace any existing file.
    #. raiseError (boolean): Whether to raise encountered error instead
       of returning failure.
    #. ntrials (int): After aquiring all locks, ntrials is the maximum
       number of trials allowed before failing.
       In rare cases, when multiple processes
       are accessing the same repository components, different processes
       can alter repository components between successive lock releases
       of some other process. Bigger number of trials lowers the
       likelyhood of failure due to multiple processes same time
       alteration.

:Returns:
    #. success (boolean): Whether renaming the directory was successful.
    #. message (None, string): Some explanatory message or error reason
       why directory was not dumped.